Skip to content

Commit 8cc5443

Browse files
Merge pull request #3 from BrianThomasRoss/dash-app
Push to remote devel
2 parents e5dfa31 + a1a38c9 commit 8cc5443

Some content is hidden

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

50 files changed

+225
-11324
lines changed

src/chime_dash/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ This directory should provide the interface for a dash app.
55
E.g., it contains the actual app which pieces together individual parts which could potentially live on their own.
66
This makes it easier to modularize and reuse parts.
77

8-
![Current interface](interface.png)
8+
![Current interface](docs/assets/interface.png)
99

1010
## Todo
1111
Plots & callbacks

src/chime_dash/layout/__init__.py renamed to src/chime_dash/app/components/__init__.py

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
"""Combines all components
22
3-
The `sidbar` component cobines all the inputs while other components potentially
3+
The `sidebar` component combines all the inputs while other components potentially
44
have callbacks.
55
66
To add or remove components, adjust the `setup`.
@@ -14,13 +14,14 @@
1414

1515
from penn_chime.defaults import Constants
1616

17-
from chime_dash.layout import sidebar
18-
from chime_dash.layout import header
19-
from chime_dash.layout import intro
20-
from chime_dash.layout import additions
21-
from chime_dash.layout import visualizations
22-
from chime_dash.layout import definitions
23-
from chime_dash.layout import footer
17+
from chime_dash.app.components import sidebar
18+
from chime_dash.app.components import header
19+
from chime_dash.app.components import intro
20+
from chime_dash.app.components import additions
21+
from chime_dash.app.components import visualizations
22+
from chime_dash.app.components import definitions
23+
from chime_dash.app.components import footer
24+
from chime_dash.app.components import navbar
2425

2526

2627
EXTERNAL_STYLESHEETS = [

src/chime_dash/layout/additions.py renamed to src/chime_dash/app/components/additions.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@
1313
from penn_chime.utils import add_date_column
1414
from penn_chime.parameters import Parameters
1515

16-
from chime_dash.utils import read_localization_yaml, df_to_html_table
17-
from chime_dash.plotting import plot_dataframe
16+
from chime_dash.app.utils.templates import read_localization_yaml, df_to_html_table
17+
from chime_dash.app.services.plotting import plot_dataframe
1818

1919

2020
LOCALIZATION_FILE = "additions.yml"

src/chime_dash/app/components/menu.py

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
"""Initializes dropdown menu
2+
"""
3+
import dash_bootstrap_components as dbc
4+
5+
6+
def setup ():
7+
menu = dbc.DropdownMenu(
8+
children=[
9+
dbc.DropdownMenuItem(
10+
"Penn Medicine",
11+
header=True),
12+
dbc.DropdownMenuItem(
13+
"Predictive Healthcare",
14+
href='http://predictivehealthcare.pennmedicine.org/',
15+
external_link=True
16+
),
17+
dbc.DropdownMenuItem(
18+
"Contact Us",
19+
href='http://predictivehealthcare.pennmedicine.org/contact/',
20+
external_link=True
21+
),
22+
dbc.DropdownMenuItem(
23+
"User Docs",
24+
href="https://code-for-philly.gitbook.io/chime/",
25+
external_link=True
26+
),
27+
dbc.DropdownMenuItem(
28+
"GitHub",
29+
href="https://github.com/CodeForPhilly/chime",
30+
external_link=True
31+
),
32+
dbc.DropdownMenuItem(
33+
"Slack",
34+
href="https://codeforphilly.org/chat?channel=covid19-chime-penn"
35+
)
36+
],
37+
in_navbar=True,
38+
label="Learn More",
39+
color="light"
40+
)
41+
return menu
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
"""Navigation bar view
2+
"""
3+
from typing import List
4+
from chime_dash.app.static import header
5+
from chime_dash.app.components import menu
6+
7+
import dash_html_components as html
8+
import dash_bootstrap_components as dbc
9+
from dash.development.base_component import ComponentMeta
10+
11+
12+
def setup (language: str) -> List[ComponentMeta]:
13+
"""Initialize the navigation bar
14+
"""
15+
nav = dbc.Navbar(
16+
dbc.Container(
17+
[
18+
html.A(
19+
dbc.Row(
20+
children=[
21+
dbc.Col(header.setup(language)),
22+
dbc.Col(
23+
dbc.NavbarBrand(
24+
children='Penn Medicine CHIME',
25+
href='/')
26+
)
27+
],
28+
align="center",
29+
no_gutters=True,
30+
),
31+
href='https://www.pennmedicine.org/'),
32+
menu.setup()
33+
]
34+
))
35+
return nav

src/chime_dash/layout/sidebar.py renamed to src/chime_dash/app/components/sidebar.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
from penn_chime.defaults import RateLos, Constants
1111
from penn_chime.parameters import Parameters
1212

13-
from chime_dash.utils import read_localization_yaml
13+
from chime_dash.app.utils.templates import read_localization_yaml
1414

1515
LOCALIZATION_FILE = "sidebar.yml"
1616

src/chime_dash/layout/visualizations.py renamed to src/chime_dash/app/components/visualizations.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@
1313
from penn_chime.parameters import Parameters
1414

1515

16-
from chime_dash.utils import read_localization_yaml, df_to_html_table
17-
from chime_dash.plotting import plot_dataframe
16+
from chime_dash.app.utils.templates import read_localization_yaml, df_to_html_table
17+
from chime_dash.app.services.plotting import plot_dataframe
1818

1919
LOCALIZATION_FILE = "visualizations.yml"
2020

src/chime_dash/app/pages/index.py

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
"""pages/index
2+
Homepage
3+
"""
4+
from typing import List
5+
6+
import dash_html_components as html
7+
import dash_bootstrap_components as dbc
8+
from dash.development.base_component import ComponentMeta
9+
10+
from chime_dash.app.components import navbar
11+
from chime_dash.app.static.homepage import introducing_chime, latest_updates
12+
13+
14+
def render (language: str) -> List[ComponentMeta]:
15+
"""Initializes page
16+
"""
17+
layout = html.Div(
18+
[
19+
dbc.Row(navbar.setup(language)),
20+
dbc.Col(
21+
children=introducing_chime('en')
22+
),
23+
dbc.Col(
24+
children=latest_updates('en')
25+
)
26+
]
27+
)
28+
return layout

0 commit comments

Comments
 (0)