codeforphilly / chime Goto Github PK
View Code? Open in Web Editor NEWCOVID-19 Hospital Impact Model for Epidemics
Home Page: https://codeforphilly.github.io/chime/
License: MIT License
COVID-19 Hospital Impact Model for Epidemics
Home Page: https://codeforphilly.github.io/chime/
License: MIT License
Set master branch up against heroku as a POC for orgs that want to make their own instance and to ensure tool still works on heroku
When I run this command:
flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
I get a bunch of linter errors:
15 E122 continuation line missing indentation or outdented
1 E203 whitespace before ','
1 E225 missing whitespace around operator
5 E261 at least two spaces before inline comment
8 E302 expected 2 blank lines, found 1
3 E303 too many blank lines (2)
6 E305 expected 2 blank lines after class or function definition, found 1
17 E501 line too long (155 > 127 characters)
4 F401 'functools.reduce' imported but unused
107 Q000 Remove bad quotes
1 W391 blank line at end of file
168
The linter doesn't appear to displaying this in the build output right now, so that I consider finding out why it's not failing the build at the same time if possible.
When I adjust the "currently known regional infections" parameter, the charts remain unchanged. Is this intended? If so, could someone explain why changing that number wouldn't affect projections?
To which @cjbayesian replied
It's not a bug but rather a consequence of how we're estimating the actual number of infected individuals. Specifically, we're using the number of hospitalizations and hospitalization rate to compute the number likely infected. We only use the number of confirmed cases in the region to infer the detection rate.
You're not the only one confused about this.
User responds:
Here's the issue: currently known regional infections is all we have, which means that our position on the timeline is <0 (well, its <0 for the model that assumes 1 hospitalization)
Acknowledging that the information value of known regional infections is dangerously unreliable as an input, the issue I'm facing is a way to keep the feature in the tool for its palliative effects without diminishing the predictive validity of the output
My (stats-literate) colleague suggested offering a way to use currently known regional infections as a (really bad) estimate of the true proportion of infected people in the population if it could be combined with estimates of the screening rate
Perhaps people need to check a box to use it that gives a popup warning them "do not use this. Its really bad, you're liable to mislead yourself" so that people fixated on using it can play with it
Copied from my input in the web pages feedback page this morning:
Dear Colleagues,
as a mathematician working at a Fraunhofer institute for digital
medicine in Bremen, Germany,
I take great interest in prognostic model available
http://penn-chime.phl.io/
I like to suggest the following:
[1) .. (suggested to make this open source, obdiously alredy done)]
as changing these value from say 1 to 2 % results in vastly different
predictions and the by now still unknown true values
are likely to be non integer bus small numbers.
For example my current estimate form positive tested case in the 3
Germany's independent city-states (Berlin+Hamburg+Bremen)
for the doubling time for example is 2.2 days, for the whole of Germany
it its 2.9 (considering the official data published by the
Robert-Koch-Institute)
May estimates for these doubling times is based on 7* log(cases from
last publishes day) / cases(7 days before) / log(2).
We are at a time were social distancing was just started, thus these
numbers might be close to the natural spread rate, but they are strongly linked to testing, availability, usage and rules applied to who will be tested.
It is to be hoped strongly, that the doubling times will get well above your probably significantly
too high default value of 6 days due to the measures started a few days ago.
I would think 3 day at most 5 day ought to be the default for the doubling time for your web page.
Looking a longer scale worldwide non china data from Johns Hopking on a log scale I see a factor 100 increase in diagnosed cases in little more than 30 day, related to a doubling tome of about 4.7.
One might also consider entering these two numbers (last days #
positive tested case / #positively tested cased 7 days before or some other
time delay) instead of a not well possible direct guess for the doubling time stated
as integer input in your model.
At a later time instead of # positive tested cases the number of
hospital admission related to COVID 19 at two days a few days apart would probably provide more realistic values, but these are still very few and not well documented publicly in Germany to use the at the current stage.
Best regards
Volker Dicken
Problem: When launching the heroku app without the setup.sh, H11's appear (router backlog) because the app is not being connected on the backend.
Solution: Re add the setup.sh allowing the $PORT to determine the port for the .toml files for streamlit.
What has the ops team built? How does it help the app?
Make documentation for app stakeholders to show what/why we built what we built
Data resides at:
https://raw.githubusercontent.com/CSSEGISandData/COVID-19/master/csse_covid_19_data/csse_covid_19_time_series/time_series_19-covid-Confirmed.csv
Similar to hospital market share, these sliders should accept floating point inputs.
Make sure python code works and isn't broken by changes
Dependent on #59
Not an expert but here's some tips on writing python tests
Edit docs/contributing/data-analysis.md
and then open a PR against CodeForPhilly/chime#master
Add a new GitHub Action workflow that pushes a new container image tagged with :latest
and :${version}
to DockerHub on tag
Following #47, automate updating the instance on our LKE cluster via the same GitHub Action workflow
Generating the observability stack serves the following purposes:
Components to generate:
Technologies and software to consider:
In a hidden-by-default section at the bottom, provide a list containing details of each input parameter and how the default value is estimated. This is in lieu of the ability to add this information as a tooltip in streamlit.
Also, LOS
should display as Length of Stay
for accessibility
@quinn-dougherty added a bool flag to functions that look like def some_chart(*args) -> alt.Chart:
. if logscale
is flagged, do something like .encode(y=alt.Y("col", scale=alt.Scale("log")
... read the docs for specific syntax.
Edit docs/operations/byok8s.md
and then open a PR against CodeForPhilly/chime#master
Use the current date as day 0 and plot projections with x-axis as actual date.
Calculation (extends "more info about this tool"):
We can compute the implicit
From our previous equation for
So, for our
For our first pass at providing an alternative to Heroku, we've spun up a dedicated chime-live
Kubernetes cluster on Linode. Currently it has 3 nodes with 6 CPUs each
To close this issue, add a set of static manifests to this repository for a deployment that takes the current Streamlit-based Chime implementation, runs as many workers as possible on that 3x6 cluster, and includes deploying an in-cluster ingress controller that will load balance between all those workers and serve out of penn-chime.phl.io
Skip any templating or automation at this phase, we'll manually deploy the manifests and manually edit them as needed. After we learn more, we'll create follow-up issues around templating or automation
Done: documentation made in markdown format
Depends on #76 - script breakdown from that documentation implemented in repo
Given that many governments are enacting policies which effectively change R0, it might be useful to support an "intervention" - a sudden change in R0.
Can we implement google analytics on top of streamlit? how can we get visitor data to app?
Does implementing GA tie the repo to one account?
as per discussion in thread pennsignals/chime#58 ,
the granularity of the chart should be daily, not weekly, this detail has to be recovered from the matplotlib version.
Edit docs/contributing/operations-support.md
and then open a PR against CodeForPhilly/chime#master
Related to https://github.com/pennsignals/chime/issues/6
Per this slack message,
i was able to compare the model to the Portugal reality (black datapoints: still not enough data but ok). Im still working on it. What I had to do first was to decouple the code from the web-app integration (it has a few dependencies). maybe the core can transformed into a module ( #chime-app maybe?)
I am going to guess at some desired functionality / API design, please discuss / correct me in the comments:
pip install chime
or something similarfrom chime import sim_sir
and model sir
in code (? Not sure)In addition to the output plots, it would help to have an automatically takeaway in words. For example:
Peak admissions projected in XX days.
ICU admissions projected to surpass XX in YY days.
...
streamlit supports caching... maybe this would be a good idea to speed things up?
Implement the Scripts To Rule Them All interface for developers:
script/server — Brings a fully working environment up at localhost:[port]
script/setup — Run after script/server to initialize local database with seed data
script/update — Run after changing code or switching branches to refresh server
An example of this implementation can be found at CfP's Prevention Point project
@garysieling has a WIP here- will finish testing later: https://github.com/garysieling/chime/tree/feature/36-scripts-to-rule-them-all
how can we break app.py into modules?
Done: app.py modules understood and documented, plan for re-factoring exists
Quinn & Sam - wanna make a braintrust?
Domain lke.penn-chime.phl.io has been pointed to the cluster to enable testing. App manifest will need to be updated to include this testing domain.
Allow developers and product owners to see app activity and usage
Done:
K8 observability implemented on product
Add workflow for python testing in actions
Create a workflow for publishing a multi-page set of docs to GitHub pages
Split this off #60 -
I like this suggestion. I think verifying the models and data aren't broken is most important. However, even after the refactor, there is some coupling of logic and presentation (the framework we are using, Streamlit, makes it pretty hard to fully decouple the two). So, if we want to encode the manual testing procedure, I think that sounds like a puppeteer/selenium thing to me. Or even kasaya which seems like it might be a way to get QA help from non-coders.
Something like Cypress/Selenium can potentially serve three separate purposes:
This was a comment from @luminoso on PR #55 but it is really its own issue...
is there any reason to include N
parameter in def sir(y, beta, gamma, N):
function @ models.py
? Because app.py invokes sim_sir()
and it defaults N
to N = S + R + I
. when sir()
is invoked you just compute always that scale = 1
IMO, N
should be removed from sir()
for three reasons:
Allow users to export dash outputs (graphs and text) as a pdf report.
Implement scancode toolkit on repo to check licenses and stuff
*this makes it easier for open source teams to contribute
Assigned Kris cause he knows how to do this and what it actually is.
The cluster is currently running only 1 ingress controller, which could become a major bottleneck when production traffic is turned on. We need to pick a higher number and scale up to it.
Find the published source and normalize for https://docs.google.com/spreadsheets/d/1P1W6nLPYPoIqKmvKJWq1iUCkTsrPOu7DkOMTmWotJik/edit?usp=sharing
Insert white label mast on a webpage. https://www1.pennmedicine.org/includes_shared/penn-medicine-header.html
With Mast header "Penn Medicine - COVID-19 Hospital Impact Model for Epidemics"
Remove the website title "COVID-19 Hospital Impact Model for Epidemics" since it will appear in the header.
A quick fix can also be to include an image in the top of the sidebar.
It might be valuable to have some external monitoring, e.g. have pingdom notify slack if the site goes down (though perhaps low priority given the attention this already has).
Potential goals, from slack conversation:
Some potential next steps (pulled from slack discussion):
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.