Skip to content

Commit 78ecdcb

Browse files
Merge branch 'develop' into implement_streamlit_caching
2 parents b8ed13d + 9d0d319 commit 78ecdcb

File tree

8 files changed

+125
-24
lines changed

8 files changed

+125
-24
lines changed

.github/workflows/gh-pages.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ name: Publish GitBook to GH Pages
33
on:
44
push:
55
branches:
6-
- 'releases/v1'
6+
- 'develop'
77

88

99
jobs:
@@ -25,6 +25,6 @@ jobs:
2525
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
2626
HAB_LICENSE: accept
2727
with:
28-
ref: master
28+
ref: develop
2929
holobranch: gh-pages
3030
commit-to: gh-pages

__init__.py

Whitespace-only changes.

docs/CONTRIBUTING.md

Lines changed: 33 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,44 @@
11
# Contributing
22

3-
When contributing to this repository, please first discuss the change you wish to make via [issue](https://github.com/codeforphilly/chime/issues), [Slack chat](https://codeforphilly.org/chat/covid19-chime-penn), or any other method with the owners of this repository before making a change.
3+
Welcome, grab a cup of coffee, and let's roll our sleeves up! By participating in this project, you agree to abide by our [code of conduct](CODE_OF_CONDUCT.md).
44

5-
Please note we have a [code of conduct](CODE_OF_CONDUCT.md), please follow it in all your interactions with the project.
5+
## What should I work on?
66

7-
## Active Needs
7+
As of March 19, help is especially wanted in these areas:
88

9-
We maintain a list of [issues in the Code for Philly repo](https://github.com/codeforphilly/chime/issues) that encompasses work requested by stakeholders and technologists. Each issue is designed to be small enough for one person to implement.
9+
- **Python wizards** for application development ([#chime-app](https://codeforphilly.org/chat?channel=chime-app))
10+
- Hardening the code
11+
- Making it more flexible
12+
- Unit tests!
13+
- **DevOps heroes** for application hosting ([#chime-ops](https://codeforphilly.org/chat?channel=chime-ops))
14+
- Maintaining Penn's instance
15+
- Ensuring easy redeploys
16+
- **Math and stats friends** for model improvements ([#chime-analysis](https://codeforphilly.org/chat?channel=chime-analysis))
17+
- **Consulting DevOps champs** to help other public agencies set up their own instances ([#chime-help](https://codeforphilly.org/chat?channel=chime-help)
1018

11-
**Developers** If you are new to the project, check out open issues to see if there is any pre-existing work needed that you can handle. We will need to add your git account to the repo to grant write access - contact us on [Slack](https://codeforphilly.org/chat) in the [covid19-chime-penn](https://codeforphilly.org/chat?channel=covid19-chime-penn) channel.
19+
## Before You Begin
1220

13-
## Change Management
21+
- Join the [#covid19-chime-penn](https://codeforphilly.org/chat?channel=covid19-chime-penn) channel, and [request write access](https://codeforphilly.slack.com/archives/CV4NGQYMP/p1584665484368300) to the `CodeforPhilly/chime` Github repository.
22+
- Our highest-priority work is organized in the [Github Project Management board](https://github.com/CodeForPhilly/chime/projects/2). Look for an issue matching your interests & skills in one of the "Ready" columns.
23+
- Assign yourself to the issue and add a comment to briefly describe your plan.
24+
- For new ideas, please first discuss the change(s) you wish to make via [issue](https://github.com/codeforphilly/chime/issues) or appropriate Slack channel (platform/app - #chime-app, devops - #chime-ops, modeling - #chime-analysis).
1425

15-
- Base all work on the latest `master` branch available in [Code for Philly's fork of the `chime` repository](https://github.com/CodeForPhilly/chime).
16-
- Submit your work in the form of a pull request against that same branch.
17-
- Check in on your pull request periodically after you submit it to see if any changes have been requested or any merge conflicts have arisen from other work getting integrated.
18-
- If a merge conflict arises, please rebase your branch against the latest `master` branch and force-push the new branch as early as you can. You may need to do this more than once before your changes get merged. Do your best to keep your branch in a mergeable state until it is finished being reviewed and accepted.
26+
## Making and Submitting Changes
27+
28+
- Base your work on the `develop` branch in [Code for Philly's fork of the `chime` repository](https://github.com/CodeForPhilly/chime).
29+
- Submit a pull request, also against the `develop` branch.
30+
- Check your pull request periodically to see if any changes have been requested or any merge conflicts have arisen.
31+
- If a merge conflict arises, rebase against the latest `develop` branch and force-push the new branch as early as you can. You may need to do this more than once before your changes get merged. Do your best to keep your branch in a mergeable state until it is finished being reviewed and accepted.
32+
33+
## Review & Release
34+
35+
<!-- Currently establishing & clarifying the release process, this is just a skeleton. -->
36+
37+
- Maintainers will review pull requests, asking for changes as needed.
38+
- Once a PR has 1 approval and passes automated tests, maintainers will merge to release branches.
39+
- Exception: Documentation or infrastructure support PRs can be merged directly to master.
40+
- Deploys to production must be signed off on by @beckerfluffle or @cchivers.
1941

2042
## Requesting Functionality
2143

22-
**Stakeholders/Users** Find us on [Slack](https://codeforphilly.org/chat) in the [#covid19-chime-penn](https://codeforphilly.org/chat/covid19-chime-penn) channel to see if your need is already being addressed.
44+
**Stakeholders/Users**: Check the [#covid19-chime-penn](https://codeforphilly.org/chat/covid19-chime-penn) channel on [Slack](https://codeforphilly.org/chat) to see if your need is already being addressed.

docs/README.md

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

33
This book is the living documentation for developers and operators working on [the CHIME project](https://github.com/CodeForPhilly/chime) or running instances of it.
44

5-
It is maintained in the [GitBook format](https://gitbookio.gitbooks.io/docs-toolchain/structure.html) within [the `docs/` directory](https://github.com/CodeForPhilly/chime/tree/master/docs) of the project's main Git repository, and new versions are published automatically upon merge to the `master` branch to: [codeforphilly.github.io/chime](https://codeforphilly.github.io/chime)
5+
It is maintained in the [GitBook format](https://gitbookio.gitbooks.io/docs-toolchain/structure.html) within [the `docs/` directory](https://github.com/CodeForPhilly/chime/tree/develop/docs) of the project's main Git repository, and new versions are published automatically upon merge to the `develop` branch to: [codeforphilly.github.io/chime](https://codeforphilly.github.io/chime)
66

7-
To contribute to this book, please [open a pull request against the master branch of github.com/CodeForPhilly/chime](https://github.com/CodeForPhilly/chime/compare/master).
7+
To contribute to this book, please [open a pull request against the develop branch of github.com/CodeForPhilly/chime](https://github.com/CodeForPhilly/chime/compare/develop).

docs/SUMMARY.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
- [Data Analysis](contributing/data-analysis.md)
1010
- [Operations Support](contributing/operations-support.md)
1111
- Operations
12+
- [Release Process](./operations/release-process.md)
1213
- [The `chime-live` Cluster](./operations/chime-live-cluster.md)
1314
- [Deploy to Heroku](./operations/heroku.md)
1415
- [Deploy to Your Own Cluster](./operations/byok8s.md)

docs/operations/chime-live-cluster.md

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -32,18 +32,17 @@
3232

3333
## Deploying a New CHIME Version
3434

35-
1. Merge new version into `master` branch
36-
2. Create a new release tag in the format `v1.2.3`, incrementing semantically
37-
3. Wait for the `Docker` GitHub Actions workflow to complete
38-
4. Verify the new version shows up at the top as "Latest version" here: https://github.com/CodeForPhilly/chime/packages/155340
39-
5. Run:
35+
1. [MaCreateke a new release](release-process.md)
36+
2. Wait for the `Docker` GitHub Actions workflow to complete
37+
3. Verify the new version shows up at the top as "Latest version" here: https://github.com/CodeForPhilly/chime/packages/155340
38+
4. Run:
4039

4140
```bash
4241
VERSION=1.2.3
4342
kubectl set image --record deployment/chime chime="docker.pkg.github.com/codeforphilly/chime/penn-chime:${VERSION}"
4443
```
4544

46-
6. Watch rollout status:
45+
5. Watch rollout status:
4746

4847
```bash
4948
kubectl rollout status deployment.v1.apps/chime
@@ -68,5 +67,5 @@ kubectl apply -f k8s/infra/ingress-nginx.yaml
6867
Or the entire directory:
6968

7069
```bash
71-
kubectl diff -Rf k8s/
70+
kubectl apply -Rf k8s/
7271
```

docs/operations/release-process.md

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
# Operations: Release Process
2+
3+
1. Merge pull requests into `develop`
4+
2. Chose a new version number by incrementing the previous release according to [semver](https://semver.org/)
5+
- Do not bump the MAJOR version unless the team is ready to create a new `releases/v#` branch
6+
3. Open a pull request to merge `develop` into `releases/v1`
7+
- **Title**: `Release: CHIME v1.#.#`
8+
- **Description**: Generate with this command:
9+
10+
```bash
11+
git fetch origin
12+
git log \
13+
--first-parent \
14+
--reverse \
15+
--pretty=format:"- %s" \
16+
"origin/releases/v1..origin/develop"
17+
```
18+
19+
4. Get release pull request approved by [`@cjbayesian`](https://github.com/cjbayesian) or [`@mdbecker`](https://github.com/mdbecker)
20+
5. Merge the pull request
21+
6. [Create a new release against `releases/v1`](https://github.com/CodeForPhilly/chime/releases/new?target=releases/v1)
22+
- **Tag version:** `v1.#.#`
23+
- **Release Title:** `CHIME v1.#.#`
24+
- **Description:** Copy release notes from pull request
25+
7. [Deploy to the `chime-live` cluster](chime-live-cluster.md)

test_app.py

Lines changed: 56 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,12 @@
11
import pytest
2+
import pandas as pd
23

3-
from penn_chime.models import sir
4-
from penn_chime.presentation import display_header
4+
from app import (S_default, known_infections, known_cases, current_hosp, doubling_time, relative_contact_rate,
5+
hosp_rate, icu_rate, vent_rate, hosp_los, icu_los, vent_los, market_share, S, initial_infections,
6+
detection_prob, hospitalization_rates, I, R, beta, gamma, n_days, beta_decay,
7+
projection_admits, alt)
8+
from penn_chime.models import sir, sim_sir
9+
from penn_chime.presentation import display_header, new_admissions_chart
510

611

712
# set up
@@ -75,3 +80,52 @@ def test_sir():
7580
0.20297029702970298,
7681
0.0049504950495049506,
7782
), "This contrived example should work"
83+
84+
85+
def test_sim_sir():
86+
"""
87+
Rounding to move fast past decimal place issues
88+
"""
89+
s, i, r = sim_sir(S, I, R, beta, gamma, n_days, beta_decay=beta_decay)
90+
assert round(s[0], 0) == 4119405
91+
assert round(s[-1], 2) == 3421436.31
92+
assert round(i[0], 2) == 533.33
93+
assert round(i[-1], 2) == 418157.62
94+
assert round(r[0], 0) == 0
95+
assert round(r[-1], 2) == 280344.40
96+
97+
98+
def test_initial_conditions():
99+
"""
100+
Note: For the rates (ie hosp_rate) - just change the value, leave the "100" alone.
101+
Easier to change whole numbers than decimals.
102+
"""
103+
assert current_hosp == known_cases
104+
assert doubling_time == 6
105+
assert relative_contact_rate == 0
106+
assert hosp_rate == 5 / 100
107+
assert icu_rate == 2 / 100
108+
assert vent_rate == 1 / 100
109+
assert hosp_los == 7
110+
assert icu_los == 9
111+
assert vent_los == 10
112+
assert market_share == 15 / 100
113+
assert S == S_default
114+
assert initial_infections == known_infections
115+
116+
117+
def test_derived_variables():
118+
assert hospitalization_rates == (hosp_rate, icu_rate, vent_rate)
119+
assert detection_prob == initial_infections / (current_hosp / market_share / hosp_rate)
120+
121+
122+
def test_new_admissions_chart():
123+
chart = new_admissions_chart(alt, projection_admits, n_days - 10)
124+
assert type(chart) == alt.Chart
125+
assert chart.data.iloc[1].Hospitalized < 1
126+
assert round(chart.data.iloc[49].ICU, 0) == 43
127+
with pytest.raises(TypeError):
128+
new_admissions_chart()
129+
130+
empty_chart = new_admissions_chart(alt, pd.DataFrame(), -1)
131+
assert empty_chart.data.empty

0 commit comments

Comments
 (0)