Skip to content

Commit 19527e7

Browse files
authored
Merge pull request #789 from cmu-delphi/CAN-total-tests
CAN PCR Total Tests
2 parents 3bd6ce3 + b79c0a1 commit 19527e7

File tree

3 files changed

+19
-7
lines changed

3 files changed

+19
-7
lines changed

covid_act_now/delphi_covid_act_now/constants.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,4 +11,5 @@
1111

1212
SIGNALS = [
1313
"pcr_specimen_positivity_rate",
14+
"pcr_specimen_total_tests",
1415
]

covid_act_now/delphi_covid_act_now/run.py

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@
55
when the module is run with `python -m delphi_covid_act_now`.
66
"""
77

8+
import numpy as np
9+
810
from delphi_utils import (
911
read_params,
1012
create_export_csv,
@@ -43,14 +45,22 @@ def run_module():
4345
print(f"Processing {geo_res}")
4446
df = geo_map(df_county_testing, geo_res)
4547

46-
# Only 1 signal for now
47-
signal = SIGNALS[0]
48+
# Export 'pcr_specimen_positivity_rate'
49+
exported_csv_dates = create_export_csv(
50+
df,
51+
export_dir=export_dir,
52+
geo_res=geo_res,
53+
sensor=SIGNALS[0])
4854

55+
# Export 'pcr_specimen_total_tests'
56+
df["val"] = df["sample_size"]
57+
df["sample_size"] = np.nan
58+
df["se"] = np.nan
4959
exported_csv_dates = create_export_csv(
5060
df,
5161
export_dir=export_dir,
5262
geo_res=geo_res,
53-
sensor=signal)
63+
sensor=SIGNALS[1])
5464

5565
earliest, latest = min(exported_csv_dates), max(exported_csv_dates)
5666
print(f"Exported dates: {earliest} to {latest}")

covid_act_now/tests/test_run.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,16 +4,17 @@
44
import pandas as pd
55
import pytest
66

7-
from delphi_covid_act_now.constants import GEO_RESOLUTIONS
7+
from delphi_covid_act_now.constants import GEO_RESOLUTIONS, SIGNALS
88

99
class TestRun:
1010
def test_output_files(self, run_as_module):
1111
csv_files = set(listdir("receiving"))
1212
csv_files.discard(".gitignore")
1313

14-
expected_files = {
15-
f"20210101_{geo}_pcr_specimen_positivity_rate.csv"
16-
for geo in GEO_RESOLUTIONS}
14+
expected_files = set()
15+
for signal in SIGNALS:
16+
for geo in GEO_RESOLUTIONS:
17+
expected_files.add(f"20210101_{geo}_{signal}.csv")
1718

1819
# All output files exist
1920
assert csv_files == expected_files

0 commit comments

Comments
 (0)