Skip to content

Make CPR hospital admissions header filter more specific #1544

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

Merged
merged 1 commit into from
Mar 3, 2022
Merged
Changes from all commits
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
23 changes: 10 additions & 13 deletions dsew_community_profile/delphi_dsew_community_profile/pull.py
Original file line number Diff line number Diff line change
Expand Up @@ -252,7 +252,7 @@ def _parse_times_for_sheet(self, sheet):
@staticmethod
def retain_header(header):
"""Ignore irrelevant headers."""
return ((all([
return all([
# include "Total NAATs - [last|previous] 7 days ..."
# include "Total RT-PCR diagnostic tests - [last|previous] 7 days ..."
# include "NAAT positivity rate - [last|previous] 7 days ..."
Expand All @@ -270,17 +270,15 @@ def retain_header(header):
header.find("7 days") > 0,
# exclude "NAAT positivity rate - last 7 days - ages <5"
header.find(" ages") < 0,
]) or all([
]) or (
# include "Confirmed COVID-19 admissions - last 7 days"
header.startswith("Confirmed COVID-19 admissions"),
# exclude "Confirmed COVID-19 admissions - percent change"
header.find("7 days") > 0,
# exclude "Confirmed COVID-19 admissions - last 7 days - ages <18"
# exclude "Confirmed COVID-19 admissions - last 7 days - age unknown"
header.find(" age") < 0,
# exclude "Confirmed COVID-19 admissions per 100 inpatient beds - last 7 days"
header.find(" beds") < 0,
])) or (all([
# exclude "Confirmed COVID-19 admissions per 100k - last 7 days"
header == "Confirmed COVID-19 admissions - last 7 days"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have confirmed through exhaustive checking that this is the only header ever used for the column we want, across all sheets and all dates up to 2022-02-24. A refreshing degree of consistency for this report!

) or all([
# include "People who are fully vaccinated"
# include "People who have received a booster dose since August 13, 2021"
header.startswith("People who"),
Expand All @@ -292,13 +290,12 @@ def retain_header(header):
header.find(" age") < 0,
# exclude "People who are fully vaccinated - 12-17" ...
header.find("-") < 0,

]) or all([
# include "People with full course administered"
header.startswith("People with full course"),
# exclude "People with full course administered as % of adult population"
header.find("%") < 0,
])))
# include "People with full course administered"
header.startswith("People with full course"),
# exclude "People with full course administered as % of adult population"
header.find("%") < 0,
])
def _parse_sheet(self, sheet):
"""Extract data frame for this sheet."""
df = pd.read_excel(
Expand Down