Skip to content

Commit 09a5657

Browse files
committed
Merge remote-tracking branch 'upstream/develop' into develop
2 parents 7719125 + 188c35b commit 09a5657

File tree

23 files changed

+895
-272
lines changed

23 files changed

+895
-272
lines changed

Dockerfile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ WORKDIR /app
44
COPY README.md .
55
COPY setup.cfg .
66
COPY setup.py .
7+
COPY MANIFEST.in .
78
COPY .streamlit .streamlit
89
COPY defaults defaults
910
COPY src src

MANIFEST.in

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
include src/penn_chime/locales/*.yml

Pipfile

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,9 @@ dash = "*"
1616
dash-bootstrap-components = "*"
1717
gunicorn = "*"
1818
PyYAML = "*"
19+
python-i18n = "*"
20+
gspread="*"
21+
oauth2client="*"
1922

2023
[requires]
2124
python_version = "3.7"

Pipfile.lock

Lines changed: 151 additions & 92 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

setup.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,14 +26,16 @@
2626
"gspread",
2727
"gunicorn",
2828
"dash",
29+
"dash_daq",
2930
"dash_bootstrap_components",
3031
"numpy",
3132
"pandas",
3233
"pytest",
3334
"pyyaml",
3435
"streamlit",
3536
"gspread",
36-
"oauth2client"
37+
"oauth2client",
38+
"python-i18n"
3739
],
3840
classifiers=[
3941
"Programming Language :: Python :: 3",

src/chime_dash/app/components/visualizations.py

Lines changed: 31 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
from dash.development.base_component import ComponentMeta
1111
from dash_html_components import H2, Div, A
1212
from dash_core_components import Markdown, Graph
13-
from dash_bootstrap_components import Table, Container
13+
from dash_bootstrap_components import Table, Container, Button
1414

1515
from chime_dash.app.components.base import Component
1616

@@ -50,6 +50,16 @@ def get_html(self) -> List[ComponentMeta]:
5050
target="_blank",
5151
className="btn btn-sm btn-info",
5252
),
53+
Div(
54+
children=Button(
55+
"Lock Zoom",
56+
id="new_admissions_lock_zoom",
57+
color="info",
58+
outline=False,
59+
className="btn btn-sm"
60+
),
61+
style={"display": "inline-block", "padding": 10}
62+
),
5363
Div(
5464
className="row justify-content-center",
5565
children=Div(
@@ -79,6 +89,16 @@ def get_html(self) -> List[ComponentMeta]:
7989
target="_blank",
8090
className="btn btn-sm btn-info",
8191
),
92+
Div(
93+
children=Button(
94+
"Lock Zoom",
95+
id="admitted_patients_lock_zoom",
96+
color="info",
97+
outline=False,
98+
className="btn btn-sm"
99+
),
100+
style={"display": "inline-block", "padding": 10}
101+
),
82102
Div(
83103
className="row justify-content-center",
84104
children=Div(
@@ -108,6 +128,16 @@ def get_html(self) -> List[ComponentMeta]:
108128
target="_blank",
109129
className="btn btn-sm btn-info my-4",
110130
),
131+
Div(
132+
children=Button(
133+
"Lock Zoom",
134+
id="SIR_lock_zoom",
135+
color="info",
136+
outline=False,
137+
className="btn btn-sm"
138+
),
139+
style={"display": "inline-block", "padding": 10}
140+
),
111141
Div(
112142
className="row justify-content-center",
113143
children=Div(

src/chime_dash/app/pages/sidebar.py

Lines changed: 32 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,23 +3,24 @@
33
44
#! _SIDEBAR_ELEMENTS should be considered for moving else where
55
"""
6-
from typing import List
76
from collections import OrderedDict
87
from datetime import date, datetime
8+
from typing import List
99

1010
from dash.development.base_component import ComponentMeta
11-
from dash_html_components import Nav, Div
1211
from dash_core_components import Store
12+
from dash_html_components import Nav, Div
1313

1414
from chime_dash.app.components.base import Page
15+
from chime_dash.app.services.callbacks import SidebarCallbacks
1516
from chime_dash.app.utils import ReadOnlyDict
1617
from chime_dash.app.utils.templates import (
1718
create_switch_input,
1819
create_number_input,
1920
create_date_input,
2021
create_header,
22+
create_line_break,
2123
)
22-
from chime_dash.app.services.callbacks import SidebarCallbacks
2324

2425
FLOAT_INPUT_MIN = 0.001
2526
FLOAT_INPUT_STEP = "any"
@@ -37,13 +38,21 @@
3738
},
3839
current_hospitalized={"type": "number", "min": 0, "step": 1},
3940
###
41+
line_break_1={"type": "linebreak"},
4042
spread_parameters={"type": "header", "size": "h4"},
43+
spread_parameters_checkbox={"type": "switch", "on": False},
4144
date_first_hospitalized={
4245
"type": "date",
4346
"min_date_allowed": datetime(2019, 10, 1),
44-
"max_date_allowed": datetime(2021, 12, 31),
47+
"max_date_allowed": datetime(2021, 12, 31)
4548
},
4649
doubling_time={"type": "number", "min": FLOAT_INPUT_MIN, "step": FLOAT_INPUT_STEP},
50+
social_distancing_checkbox={"type": "switch", "on": False},
51+
social_distancing_start_date={
52+
"type": "date",
53+
"min_date_allowed": datetime(2019, 10, 1),
54+
"max_date_allowed": datetime(2021, 12, 31),
55+
},
4756
relative_contact_rate={
4857
"type": "number",
4958
"min": 0.0,
@@ -52,6 +61,7 @@
5261
"percent": True,
5362
},
5463
###
64+
line_break_2={"type": "linebreak"},
5565
severity_parameters={"type": "header", "size": "h4"},
5666
hospitalized_rate={
5767
"type": "number",
@@ -79,6 +89,7 @@
7989
icu_los={"type": "number", "min": 0, "step": 1},
8090
ventilated_los={"type": "number", "min": 0, "step": 1},
8191
###
92+
line_break_3={"type": "linebreak"},
8293
display_parameters={"type": "header", "size": "h4"},
8394
n_days={"type": "number", "min": 30, "step": 1},
8495
current_date={
@@ -89,7 +100,7 @@
89100
"date": date.today(),
90101
},
91102
max_y_axis_value={"type": "number", "min": 10, "step": 10, "value": None},
92-
show_tables={"type": "switch", "value": False},
103+
show_tables={"type": "switch", "on": False},
93104
))
94105

95106

@@ -107,13 +118,24 @@ class Sidebar(Page):
107118
input_type_map = ReadOnlyDict(OrderedDict(
108119
(key, value["type"])
109120
for key, value in _SIDEBAR_ELEMENTS.items()
110-
if value["type"] not in ("header",)
121+
if value["type"] not in ("header", "linebreak")
111122
))
123+
112124
input_value_map = ReadOnlyDict(OrderedDict(
113-
(key, {"number": "value", "date": "date"}.get(value, "value"))
125+
(key, {"number": "value", "date": "date", "switch": "on"}.get(value, "value"))
114126
for key, value in input_type_map.items()
115127
))
116128

129+
input_state_map = ReadOnlyDict(OrderedDict(
130+
[
131+
('group_date_first_hospitalized', 'style'),
132+
('group_doubling_time', 'style'),
133+
('group_social_distancing_start_date', 'style'),
134+
('group_relative_contact_rate', 'style'),
135+
]
136+
))
137+
138+
117139
def get_html(self) -> List[ComponentMeta]:
118140
"""Initializes the view
119141
"""
@@ -129,6 +151,8 @@ def get_html(self) -> List[ComponentMeta]:
129151
element = create_date_input(idx, data, self.content, self.defaults)
130152
elif data["type"] == "header":
131153
element = create_header(idx, self.content)
154+
elif data["type"] == "linebreak":
155+
element = create_line_break(idx)
132156
else:
133157
raise ValueError(
134158
"Failed to parse input '{idx}' with data '{data}'".format(
@@ -151,6 +175,7 @@ def get_html(self) -> List[ComponentMeta]:
151175
"top": "56px",
152176
"width": "320px",
153177
"zIndex": 1,
178+
"padding-top": "1rem",
154179
},
155180
)
156181

0 commit comments

Comments
 (0)