diff --git a/nchs_mortality/delphi_nchs_mortality/pull.py b/nchs_mortality/delphi_nchs_mortality/pull.py index 254a044d4..7abfd4b00 100644 --- a/nchs_mortality/delphi_nchs_mortality/pull.py +++ b/nchs_mortality/delphi_nchs_mortality/pull.py @@ -1,17 +1,17 @@ # -*- coding: utf-8 -*- """Functions for pulling NCHS mortality data API.""" -from typing import Optional import logging +from typing import Optional import numpy as np import pandas as pd +from delphi_utils import create_backup_csv +from delphi_utils.geomap import GeoMapper from sodapy import Socrata -from delphi_utils.geomap import GeoMapper -from delphi_utils import create_backup_csv +from .constants import METRICS, NEWLINE, RENAME -from .constants import METRICS, RENAME, NEWLINE def standardize_columns(df): """Rename columns to comply with a standard set. @@ -29,7 +29,7 @@ def pull_nchs_mortality_data( backup_dir: str, custom_run: bool, logger: Optional[logging.Logger] = None, - test_file: Optional[str] = None + test_file: Optional[str] = None, ): """Pull the latest NCHS Mortality data, and conforms it into a dataset. @@ -73,7 +73,7 @@ def pull_nchs_mortality_data( results = client.get("r8kw-7aab", limit=10**10) df = pd.DataFrame.from_records(results) - create_backup_csv(df, backup_dir, custom_run = custom_run, logger = logger) + create_backup_csv(df, backup_dir, custom_run=custom_run, logger=logger) # drop "By Total" rows df = df[df["group"].transform(str.lower) == "by week"] diff --git a/nchs_mortality/delphi_nchs_mortality/run.py b/nchs_mortality/delphi_nchs_mortality/run.py index f191781aa..4e88e9d61 100644 --- a/nchs_mortality/delphi_nchs_mortality/run.py +++ b/nchs_mortality/delphi_nchs_mortality/run.py @@ -72,8 +72,9 @@ def run_module(params: Dict[str, Any]): daily_arch_diff.update_cache() stats = [] - df_pull = pull_nchs_mortality_data(socrata_token, backup_dir, - custom_run = custom_run, test_file = test_file, logger = logger) + df_pull = pull_nchs_mortality_data( + socrata_token, backup_dir, custom_run=custom_run, test_file=test_file, logger=logger + ) for metric in METRICS: for geo in ["state", "nation"]: if metric == 'percent_of_expected_deaths':