Skip to content

Commit 27e5123

Browse files
committed
Add disposition type
1 parent 842e6b3 commit 27e5123

File tree

5 files changed

+26
-26
lines changed

5 files changed

+26
-26
lines changed

src/penn_chime/cli.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
from pandas import DataFrame
1010

1111
from .constants import CHANGE_DATE
12-
from .parameters import Parameters, RateDays
12+
from .parameters import Parameters, Disposition
1313
from .models import SimSirModel as Model
1414

1515

@@ -129,9 +129,9 @@ def main():
129129
relative_contact_rate=a.relative_contact_rate,
130130
population=a.population,
131131

132-
hospitalized=RateDays(a.hospitalized_rate, a.hospitalized_days),
133-
icu=RateDays(a.icu_rate, a.icu_days),
134-
ventilated=RateDays(a.ventilated_rate, a.ventilated_days),
132+
hospitalized=Disposition(a.hospitalized_rate, a.hospitalized_days),
133+
icu=Disposition(a.icu_rate, a.icu_days),
134+
ventilated=Disposition(a.ventilated_rate, a.ventilated_days),
135135
)
136136

137137
m = Model(p)

src/penn_chime/parameters.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111

1212
# (0.02, 7) is 2%, 7 days
1313
# be sure to multiply by 100 when using as a default to the percent widgets!
14-
RateDays = namedtuple("RateDays", ("rate", "days"))
14+
Disposition = namedtuple("Disposition", ("rate", "days"))
1515

1616

1717
class Regions:
@@ -32,10 +32,10 @@ def __init__(
3232
self,
3333
*,
3434
current_hospitalized: int,
35-
hospitalized: RateDays,
36-
icu: RateDays,
35+
hospitalized: Disposition,
36+
icu: Disposition,
3737
relative_contact_rate: float,
38-
ventilated: RateDays,
38+
ventilated: Disposition,
3939
current_date: date = date.today(),
4040
date_first_hospitalized: Optional[date] = None,
4141
doubling_time: Optional[float] = None,

src/penn_chime/presentation.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
)
1717

1818
from .utils import dataframe_to_base64
19-
from .parameters import Parameters, RateDays
19+
from .parameters import Parameters, Disposition
2020
from .models import SimSirModel as Model
2121

2222
hide_menu_style = """
@@ -285,10 +285,10 @@ def display_sidebar(st, d: Parameters) -> Parameters:
285285

286286
return Parameters(
287287
current_hospitalized=current_hospitalized,
288-
hospitalized=RateDays(hospitalized_rate, hospitalized_days),
289-
icu=RateDays(icu_rate, icu_days),
288+
hospitalized=Disposition(hospitalized_rate, hospitalized_days),
289+
icu=Disposition(icu_rate, icu_days),
290290
relative_contact_rate=relative_contact_rate,
291-
ventilated=RateDays(ventilated_rate, ventilated_days),
291+
ventilated=Disposition(ventilated_rate, ventilated_days),
292292

293293
current_date=current_date,
294294
date_first_hospitalized=date_first_hospitalized,

src/penn_chime/settings.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
from datetime import date
44

5-
from .parameters import Parameters, Regions, RateDays
5+
from .parameters import Parameters, Regions, Disposition
66

77
DEFAULTS = Parameters(
88
region=Regions(
@@ -15,11 +15,11 @@
1515
current_hospitalized=32,
1616
date_first_hospitalized=date(2020,3,7),
1717
doubling_time=4.0,
18-
hospitalized=RateDays(0.025, 7),
19-
icu=RateDays(0.0075, 9),
18+
hospitalized=Disposition(0.025, 7),
19+
icu=Disposition(0.0075, 9),
2020
infectious_days=14,
2121
market_share=0.15,
2222
n_days=60,
2323
relative_contact_rate=0.3,
24-
ventilated=RateDays(0.005, 10),
24+
ventilated=Disposition(0.005, 10),
2525
)

tests/test_app.py

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
)
2323
from src.penn_chime.parameters import (
2424
Parameters,
25-
RateDays,
25+
Disposition,
2626
Regions,
2727
)
2828
from src.penn_chime.presentation import display_header
@@ -45,9 +45,9 @@
4545
n_days=60,
4646
market_share=0.15,
4747
relative_contact_rate=0.3,
48-
hospitalized=RateDays(0.025, 7),
49-
icu=RateDays(0.0075, 9),
50-
ventilated=RateDays(0.005, 10),
48+
hospitalized=Disposition(0.025, 7),
49+
icu=Disposition(0.0075, 9),
50+
ventilated=Disposition(0.005, 10),
5151
)
5252

5353
PARAM = Parameters(
@@ -56,9 +56,9 @@
5656
market_share=0.05,
5757
relative_contact_rate=0.15,
5858
population=500000,
59-
hospitalized=RateDays(0.05, 7),
60-
icu=RateDays(0.02, 9),
61-
ventilated=RateDays(0.01, 10),
59+
hospitalized=Disposition(0.05, 7),
60+
icu=Disposition(0.02, 9),
61+
ventilated=Disposition(0.01, 10),
6262
n_days=60,
6363
)
6464

@@ -68,9 +68,9 @@
6868
market_share=0.05,
6969
relative_contact_rate=0.7,
7070
population=500000,
71-
hospitalized=RateDays(0.05, 7),
72-
icu=RateDays(0.02, 9),
73-
ventilated=RateDays(0.01, 10),
71+
hospitalized=Disposition(0.05, 7),
72+
icu=Disposition(0.02, 9),
73+
ventilated=Disposition(0.01, 10),
7474
n_days=60,
7575
)
7676

0 commit comments

Comments
 (0)