Skip to content

Commit 57431dc

Browse files
committed
Merge branch 'develop' of github.com:CodeForPhilly/chime into phil-census-forecast
2 parents 89375ab + b0fa0e6 commit 57431dc

File tree

10 files changed

+129
-77
lines changed

10 files changed

+129
-77
lines changed

.github/workflows/dockerpublish.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ jobs:
9292
echo "::set-env name=VERSION::$VERSION"
9393
9494
# Update image version in application manifest
95-
sed -Ei "s,(- image: docker.pkg.github.com)(.*),\1/${{ github.repository }}/$IMAGE_NAME:$VERSION," k8s/app.yaml
95+
sed -Ei "s,(- image: docker.pkg.github.com)(.*),\1/${GITHUB_REPOSITORY,,}/$IMAGE_NAME:$VERSION," k8s/app.yaml
9696
9797
# Show updated manifest file
9898
cat k8s/app.yaml

.github/workflows/pythonapp.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,4 +44,6 @@ jobs:
4444
uses: cypress-io/[email protected]
4545
with:
4646
working-directory: e2e
47+
wait-on: 'http://localhost:8000'
48+
wait-on-timeout: 300
4749

e2e/cypress/integration/tests/actions.spec.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,8 @@ context('Actions', () => {
1010

1111
// This gets the "first" input from the sidebar. From clicking step up,
1212
// the Regional Population should increase from default 4119405 to 4219405.
13-
cy.get('input.st-al').eq(1)
14-
.should('has.value', '4119406')
13+
// Updated to 3600000
14+
cy.get('input.st-al').eq(0)
15+
.should('has.value', '3600000')
1516
})
1617
});

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
"""Setup file for chime
22
"""
3-
__version__ = "0.2.0"
3+
__version__ = "1.1.0"
44
__author__ = "Predictive Healthcare @ Penn Medicine"
55

66
from os import path

src/app.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -34,14 +34,14 @@
3434
display_header(st, m, p)
3535

3636
if st.checkbox("Show more info about this tool"):
37-
notes = "The total size of the susceptible population will be the entire catchment area for Penn Medicine entities (HUP, PAH, PMC, CCH)"
37+
notes = "The total size of the susceptible population will be the entire catchment area for our hospitals."
3838
display_more_info(st=st, model=m, parameters=p, defaults=DEFAULTS, notes=notes)
3939

4040
st.subheader("New Admissions")
41-
st.markdown("Projected number of **daily** COVID-19 admissions at Penn hospitals")
41+
st.markdown("Projected number of **daily** COVID-19 admissions. \n\n _NOTE: Now including estimates of prior admissions for comparison._")
4242
admits_chart = build_admits_chart(alt=alt, admits_df=m.admits_df, max_y_axis=p.max_y_axis)
4343
st.altair_chart(admits_chart, use_container_width=True)
44-
st.markdown(build_descriptions(chart=admits_chart, labels=p.labels))
44+
st.markdown(build_descriptions(chart=admits_chart, labels=p.labels, suffix=" Admissions"))
4545
display_download_link(
4646
st,
4747
filename=f"{p.current_date}_projected_admits.csv",
@@ -60,7 +60,7 @@
6060

6161

6262
st.subheader("Admitted Patients (Census)")
63-
st.markdown("Projected **census** of COVID-19 patients, accounting for arrivals and discharges at Penn hospitals")
63+
st.markdown("Projected **census** of COVID-19 patients, accounting for arrivals and discharges \n\n _NOTE: Now including estimates of prior census for comparison._")
6464
census_chart = build_census_chart(alt=alt, census_df=m.census_df, max_y_axis=p.max_y_axis)
6565
st.altair_chart(census_chart, use_container_width=True)
6666
st.markdown(build_descriptions(chart=census_chart, labels=p.labels, suffix=" Census"))

src/penn_chime/constants.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,5 +14,5 @@
1414

1515
EPSILON = 1.0e-7
1616

17-
FLOAT_INPUT_MIN = 0.001
18-
FLOAT_INPUT_STEP = FLOAT_INPUT_MIN
17+
FLOAT_INPUT_MIN = 0.0001
18+
FLOAT_INPUT_STEP = 0.1

src/penn_chime/models.py

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -91,9 +91,7 @@ def __init__(self, p: Parameters):
9191

9292
self.beta_t = get_beta(intrinsic_growth_rate, self.gamma, self.susceptible, p.relative_contact_rate)
9393
self.run_projection(p)
94-
self.infected = self.raw_df['infected'].values[i_day]
95-
self.susceptible = self.raw_df['susceptible'].values[i_day]
96-
self.recovered = self.raw_df['recovered'].values[i_day]
94+
9795
self.r_t = self.beta_t / gamma * susceptible
9896
self.r_naught = self.beta / gamma * susceptible
9997
logger.info('Set i_day = %s', i_day)
@@ -144,6 +142,10 @@ def __init__(self, p: Parameters):
144142
logger.info('len(np.arange(-i_day, n_days+1)): %s', len(np.arange(-self.i_day, p.n_days+1)))
145143
logger.info('len(raw_df): %s', len(self.raw_df))
146144

145+
self.infected = self.raw_df['infected'].values[self.i_day]
146+
self.susceptible = self.raw_df['susceptible'].values[self.i_day]
147+
self.recovered = self.raw_df['recovered'].values[self.i_day]
148+
147149
self.r_t = self.beta_t / gamma * susceptible
148150
self.r_naught = self.beta / gamma * susceptible
149151

@@ -180,7 +182,10 @@ def get_loss(self) -> float:
180182

181183

182184
def get_argmin_ds(census_df: pd.DataFrame, current_hospitalized: float) -> float:
183-
losses_df = (census_df.hospitalized - current_hospitalized) ** 2.0
185+
# By design, this forbids choosing a day after the peak
186+
# If that's a problem, see #381
187+
peak_day = census_df.hospitalized.argmax()
188+
losses_df = (census_df.hospitalized[:peak_day] - current_hospitalized) ** 2.0
184189
return losses_df.argmin()
185190

186191

src/penn_chime/parameters.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ def __init__(
5959
infectious_days: int = 14,
6060
market_share: float = 1.0,
6161
max_y_axis: Optional[int] = None,
62-
n_days: int = 60,
62+
n_days: int = 100,
6363
population: Optional[int] = None,
6464
recovered: int = 0,
6565
region: Optional[Regions] = None,

0 commit comments

Comments
 (0)