refactor(code): Shorten data preparation
This commit is contained in:
parent
b89ab5f5d9
commit
67fa885cdd
1 changed files with 3 additions and 22 deletions
|
@ -27,17 +27,6 @@ import seaborn as sns
|
|||
from tabulate import tabulate
|
||||
import bibtexparser
|
||||
|
||||
from contextlib import contextmanager
|
||||
import logging
|
||||
@contextmanager
|
||||
def all_logging_disabled(highest_level=logging.CRITICAL):
|
||||
previous_level = logging.root.manager.disable
|
||||
logging.disable(highest_level)
|
||||
try:
|
||||
yield
|
||||
finally:
|
||||
logging.disable(previous_level)
|
||||
|
||||
sns.set_style("whitegrid")
|
||||
|
||||
DATA_DIR=Path("./02-data")
|
||||
|
@ -55,23 +44,15 @@ bib_sample = prep_data.bib_library_from_dir(WORKING_DATA)
|
|||
|
||||
# load relevant studies
|
||||
from src import load_data
|
||||
raw_observations_df = load_data.from_yml(PROCESSED_DATA)
|
||||
|
||||
# load zotero-based metadata: citations and uses
|
||||
zot_df = prep_data.bib_metadata_df(bib_sample)
|
||||
|
||||
# Add WB country grouping definitions (income group, world region)
|
||||
df_country_groups = prep_data.country_groups_df(Path(f"{SUPPLEMENTARY_DATA}/wb-country-groupings.xlsx"))
|
||||
|
||||
bib_df = prep_data.observations_with_metadata_df(
|
||||
raw_observations = raw_observations_df,
|
||||
study_metadata = zot_df,
|
||||
country_groups = df_country_groups
|
||||
raw_observations = load_data.from_yml(PROCESSED_DATA),
|
||||
study_metadata = prep_data.bib_metadata_df(bib_sample),
|
||||
country_groups = prep_data.country_groups_df(Path(f"{SUPPLEMENTARY_DATA}/wb-country-groupings.xlsx")),
|
||||
)
|
||||
raw_observations = None
|
||||
zot_df = None
|
||||
df_country_groups = None
|
||||
|
||||
```
|
||||
|
||||
<!-- pagebreak to separate from TOC -->
|
||||
|
|
Loading…
Reference in a new issue