|
31 | 31 | from delphi_utils.geomap import GeoMapper |
32 | 32 | from delphi_utils.nancodes import add_default_nancodes |
33 | 33 |
|
34 | | -from .constants import AUXILIARY_COLS, CSV_COLS, GEOS, SECONDARY_GEOS, SECONDARY_SIGNALS, SIGNALS |
35 | | -from .pull import pull_nssp_data, secondary_pull_nssp_data |
| 34 | +from .constants import AUXILIARY_COLS, CSV_COLS, GEOS, SIGNALS |
| 35 | +from .pull import pull_nssp_data |
36 | 36 |
|
37 | 37 |
|
38 | 38 | def add_needed_columns(df, col_names=None): |
@@ -141,52 +141,5 @@ def run_module(params): |
141 | 141 | if len(dates) > 0: |
142 | 142 | run_stats.append((max(dates), len(dates))) |
143 | 143 |
|
144 | | - logger.info("Generating secondary signals") |
145 | | - secondary_df_pull = secondary_pull_nssp_data(socrata_token, backup_dir, custom_run, logger) |
146 | | - for signal in SECONDARY_SIGNALS: |
147 | | - secondary_df_pull_signal = secondary_df_pull[secondary_df_pull["signal"] == signal] |
148 | | - if secondary_df_pull_signal.empty: |
149 | | - logger.warning("No data found for signal", signal=signal) |
150 | | - continue |
151 | | - for geo in SECONDARY_GEOS: |
152 | | - df = secondary_df_pull_signal.copy() |
153 | | - logger.info("Generating signal and exporting to CSV", geo_type=geo, signal=signal) |
154 | | - if geo == "state": |
155 | | - df = df[(df["geo_type"] == "state")] |
156 | | - df["geo_id"] = df["geo_value"].apply( |
157 | | - lambda x: ( |
158 | | - us.states.lookup(x).abbr.lower() |
159 | | - if us.states.lookup(x) |
160 | | - else ("dc" if x == "District of Columbia" else x) |
161 | | - ) |
162 | | - ) |
163 | | - unexpected_state_names = df[df["geo_id"] == df["geo_value"]] |
164 | | - if unexpected_state_names.shape[0] > 0: |
165 | | - logger.error( |
166 | | - "Unexpected state names", |
167 | | - unexpected_state_names=unexpected_state_names["geo_value"].unique(), |
168 | | - ) |
169 | | - raise RuntimeError |
170 | | - elif geo == "nation": |
171 | | - df = df[(df["geo_type"] == "nation")] |
172 | | - df["geo_id"] = "us" |
173 | | - elif geo == "hhs": |
174 | | - df = df[(df["geo_type"] == "hhs")] |
175 | | - df["geo_id"] = df["geo_value"] |
176 | | - # add se, sample_size, and na codes |
177 | | - missing_cols = set(CSV_COLS) - set(df.columns) |
178 | | - df = add_needed_columns(df, col_names=list(missing_cols)) |
179 | | - df_csv = df[CSV_COLS + ["timestamp"]] |
180 | | - # actual export |
181 | | - dates = create_export_csv( |
182 | | - df_csv, |
183 | | - geo_res=geo, |
184 | | - export_dir=export_dir, |
185 | | - sensor=signal, |
186 | | - weekly_dates=True, |
187 | | - ) |
188 | | - if len(dates) > 0: |
189 | | - run_stats.append((max(dates), len(dates))) |
190 | | - |
191 | 144 | ## log this indicator run |
192 | 145 | logging(start_time, run_stats, logger) |
0 commit comments