Skip to content

Commit

Permalink
Update base class refactor (#1518)
Browse files Browse the repository at this point in the history
Now that NRI is final I needed to make a small number of updates to my
refactored code.
  • Loading branch information
mattbowen-usds committed Aug 10, 2022
1 parent 2be776a commit c154ab2
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 8 deletions.
8 changes: 4 additions & 4 deletions data/data-pipeline/data_pipeline/etl/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,8 @@ class ExtractTransformLoad:
DATA_PATH: pathlib.Path = APP_ROOT / "data"
TMP_PATH: pathlib.Path = DATA_PATH / "tmp"
CONTENT_CONFIG: pathlib.Path = APP_ROOT / "content" / "config"
DATASET_CONFIG: pathlib.Path = APP_ROOT / "etl" / "score" / "config"
DATASET_CONFIG_PATH: pathlib.Path = APP_ROOT / "etl" / "score" / "config"
DATASET_CONFIG: Optional[dict] = None

# Parameters
GEOID_FIELD_NAME: str = "GEOID10"
Expand Down Expand Up @@ -107,7 +108,7 @@ def yaml_config_load(cls) -> dict:
if cls.NAME is not None:
# check if the class instance has score YAML definitions
datasets_config = load_yaml_dict_from_file(
cls.DATASET_CONFIG / "datasets.yml",
cls.DATASET_CONFIG_PATH / "datasets.yml",
DatasetsConfig,
)

Expand Down Expand Up @@ -137,11 +138,10 @@ def yaml_config_load(cls) -> dict:
]
for field in dataset_config["load_fields"]:
cls.COLUMNS_TO_KEEP.append(field["long_name"])
setattr(cls, field["df_field_name"], field["long_name"])

# set the constants for the class
setattr(cls, field["df_field_name"], field["long_name"])

# return the config dict
return dataset_config

# This is a classmethod so it can be used by `get_data_frame` without
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,3 @@ def transform(self) -> None:
)

self.output_df = output_df

def load(self) -> None:
logger.info("Saving CSV")
super().load()

0 comments on commit c154ab2

Please sign in to comment.