Skip to content

Commit c339e31

Browse files
authored
Merge pull request #585 from cmu-delphi/main
1.11 hotfixes
2 parents 071aa2b + be549a5 commit c339e31

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

87 files changed

+7015
-1314
lines changed

.github/workflows/python-ci.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ jobs:
1616
if: github.event.pull_request.draft == false
1717
strategy:
1818
matrix:
19-
packages: [_delphi_utils_python, cdc_covidnet, claims_hosp, combo_cases_and_deaths, google_symptoms, jhu, nchs_mortality, quidel, quidel_covidtest, safegraph, safegraph_patterns, usafacts]
19+
packages: [_delphi_utils_python, cdc_covidnet, changehc, claims_hosp, combo_cases_and_deaths, google_symptoms, jhu, nchs_mortality, quidel, quidel_covidtest, safegraph, safegraph_patterns, usafacts]
2020
defaults:
2121
run:
2222
working-directory: ${{ matrix.packages }}
@@ -34,7 +34,7 @@ jobs:
3434
run: |
3535
make install
3636
- name: Lint
37-
if: ${{ matrix.packages != 'claims_hosp' && matrix.packages != 'quidel'}}
37+
if: ${{ matrix.packages != 'claims_hosp' }}
3838
run: |
3939
make lint
4040
- name: Test

_delphi_utils_python/delphi_utils/export.py

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,8 @@ def create_export_csv(
1414
sensor: str,
1515
metric: Optional[str] = None,
1616
start_date: Optional[datetime] = None,
17-
end_date: Optional[datetime] = None
17+
end_date: Optional[datetime] = None,
18+
remove_null_samples: Optional[bool] = False
1819
):
1920
"""Export data in the format expected by the Delphi API.
2021
@@ -34,6 +35,8 @@ def create_export_csv(
3435
Earliest date to export or None if no minimum date restrictions should be applied.
3536
end_date: Optional[datetime]
3637
Latest date to export or None if no maximum date restrictions should be applied.
38+
remove_null_samples: Optional[bool]
39+
Whether to remove entries whose sample sizes are null.
3740
"""
3841
df = df.copy()
3942

@@ -54,6 +57,7 @@ def create_export_csv(
5457
else:
5558
export_filename = f"{date.strftime('%Y%m%d')}_{geo_res}_{metric}_{sensor}.csv"
5659
export_file = join(export_dir, export_filename)
57-
df[df["timestamp"] == date][["geo_id", "val", "se", "sample_size",]].to_csv(
58-
export_file, index=False, na_rep="NA"
59-
)
60+
export_df = df[df["timestamp"] == date][["geo_id", "val", "se", "sample_size",]]
61+
if remove_null_samples:
62+
export_df = export_df[export_df["sample_size"].notnull()]
63+
export_df.to_csv(export_file, index=False, na_rep="NA")

0 commit comments

Comments
 (0)