Skip to content

Commit c3002d9

Browse files
authored
Merge branch 'develop' into issue-#421
2 parents 46c1578 + a933752 commit c3002d9

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

+1362
-724
lines changed

Dockerfile.dash

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,11 @@ FROM python:3.7.7-slim-buster
22

33
WORKDIR /code
44

5+
ARG PORT
6+
ENV PORT $PORT
7+
58
COPY requirements.txt requirements.txt
6-
RUN pip install -q -r requirements.txt
9+
RUN pip install -r requirements.txt
710

811
COPY src src
912

docker-compose-dash.yml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
version: '3.1'
2+
3+
services:
4+
app:
5+
build:
6+
context: .
7+
dockerfile: Dockerfile.dash
8+
args:
9+
- PORT=${PORT}
10+
restart: always
11+
ports:
12+
- "${PORT}:8000"

k8s/app.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ spec:
2525
app: chime
2626
spec:
2727
containers:
28-
- image: docker.pkg.github.com/codeforphilly/chime/penn-chime:1.1.1
28+
- image: docker.pkg.github.com/codeforphilly/chime/penn-chime:1.1.2
2929
name: chime
3030
ports:
3131
- containerPort: 8000

script/server-dash

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
#!/usr/bin/env bash
2+
3+
# script/server: Launch the application and any extra required processes
4+
# locally.
5+
6+
set -e
7+
cd "$(dirname "$0")/.."
8+
9+
10+
script/bootstrap
11+
12+
if [ ! -f ".env" ]; then
13+
echo
14+
echo "==> Initializing .env…"
15+
cp .env.example .env
16+
fi
17+
18+
echo
19+
echo "==> Loading .env…"
20+
set -o allexport; source .env; set +o allexport
21+
22+
echo
23+
echo "==> Starting containers with docker-compose…"
24+
docker-compose -f docker-compose-dash.yml up -d --build
25+
26+
echo
27+
echo "==> App is now ready to go!"
28+
echo " *Open http://localhost:${PORT}"
29+
echo

setup.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
"""Setup file for chime
22
"""
3-
__version__ = "1.1.1"
3+
__version__ = "1.1.2"
44
__author__ = "Predictive Healthcare @ Penn Medicine"
55

66
from os import path
@@ -30,7 +30,8 @@
3030
"dash",
3131
"dash_bootstrap_components",
3232
"pyyaml",
33-
"gunicorn"
33+
"gunicorn",
34+
"selenium"
3435
],
3536
classifiers=[
3637
"Programming Language :: Python :: 3",
@@ -44,3 +45,4 @@
4445
keywords=[],
4546
include_package_data=True,
4647
)
48+

src/__init__.py

Whitespace-only changes.

src/assets/favicon.ico

-822 Bytes
Binary file not shown.

src/chime_dash/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
This directory provides the interface for the dash app.
44

5-
![Current interface](docs/assets/interface.png)
5+
![Current interface](docs/interface.png)
66

77
## Tree
88
Structure of the app

src/chime_dash/__init__.py

Lines changed: 50 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,50 @@
1-
x = 1
1+
"""
2+
chime_dash/app
3+
4+
dash instance defined here
5+
"""
6+
7+
from dash import Dash
8+
from typing import TypeVar
9+
from chime_dash.app.config import from_object
10+
from penn_chime.settings import get_defaults
11+
from chime_dash.app.components import Body
12+
from chime_dash.app.utils.callbacks import wrap_callbacks
13+
14+
DashAppInstance = TypeVar('DashAppInstance')
15+
DEFAULTS = get_defaults()
16+
17+
def create_app(context:str='prod')-> DashAppInstance:
18+
"""
19+
create_app initializes the app instance
20+
21+
Args:
22+
context (str, optional): One of either 'prod', 'dev', 'testing.
23+
Defaults to 'prod' where dash.Dash.run_server(debug=False).
24+
Change to 'dev' or 'test' to set debug to true.
25+
26+
Returns:
27+
Env: Config variables based on context argument received
28+
DashAppInstance: Dash instance with appropriate configuration settings
29+
"""
30+
31+
Env = from_object(context)
32+
33+
LANGUAGE = Env.LANG
34+
body = Body(LANGUAGE, DEFAULTS)
35+
36+
37+
App = Dash(
38+
__name__,
39+
external_stylesheets=body.external_stylesheets,
40+
external_scripts=body.external_scripts,
41+
)
42+
43+
App.title = Env.CHIME_TITLE
44+
App.layout = body.html
45+
wrap_callbacks(App)
46+
47+
48+
49+
return Env, App
50+

src/chime_dash/app/__init__.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
"""/app
2+
where the magic happens
3+
"""

0 commit comments

Comments
 (0)