Skip to content

first draft of splitting NWSS signals #1946

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 18 commits into from
Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
formatting and date_start -> date_end
  • Loading branch information
dsweber2 authored and dshemetov committed Jun 5, 2024
commit 2c96adc4c34b737fd8a218e51cc009cd229ec33c
8 changes: 4 additions & 4 deletions nwss_wastewater/delphi_nwss/pull.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ def sig_digit_round(value, n_digits):
sign_mask = value < 0
value[sign_mask] *= -1
exponent = np.ceil(np.log10(value))
result = 10**exponent * np.round(value * 10 ** (-exponent), n_digits)
result = 10 ** exponent * np.round(value * 10 ** (-exponent), n_digits)
result[sign_mask] *= -1
result[zero_mask] = in_value[zero_mask]
return result
Expand Down Expand Up @@ -68,7 +68,7 @@ def reformat(df, df_metric):
"""
# drop unused columns from df_metric
df_metric_core = df_metric.loc[
:, ["key_plot_id", "date_start", "population_served", *METRIC_SIGNALS]
:, ["key_plot_id", "date_end", "population_served", *METRIC_SIGNALS]
]
# get matching keys
df_metric_core = df_metric_core.rename(columns={"date_end": "timestamp"})
Expand Down Expand Up @@ -148,8 +148,8 @@ def pull_nwss_data(token: str):

# Pull data from Socrata API
client = Socrata("data.cdc.gov", token)
results_concentration = client.get("g653-rqe2", limit=10**10)
results_metric = client.get("2ew6-ywp6", limit=10**10)
results_concentration = client.get("g653-rqe2", limit=10 ** 10)
results_metric = client.get("2ew6-ywp6", limit=10 ** 10)
df_metric = pd.DataFrame.from_records(results_metric)
df_concentration = pd.DataFrame.from_records(results_concentration)
df_concentration = df_concentration.rename(columns={"date": "timestamp"})
Expand Down