Skip to content

new data source: covid hospitalization #292

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 17 commits into from
Nov 19, 2020

Conversation

dfarrow0
Copy link
Contributor

Adds a new data source to the API, start to finish.

"COVID-19 Reported Patient Impact and Hospital Capacity by State Timeseries" dataset provided by the US Department of
Health & Human Services via healthdata.gov.

https://healthdata.gov/dataset/covid-19-reported-patient-impact-and-hospital-capacity-state-timeseries

Fixes #288


See individual commits for more details on what happens at each step.

  • add test data and code readme
  • implement network interface
  • implement database interface, including ddl for new tables
  • implement acquisition code
  • add new endpoint covid_hosp to api server
  • add same endpoint to all epidata clients
  • write integration tests for acquisition and serving
  • provide api documentation

repo-wide unit tests: ✔ All 52 tests passed!
repo-wide integration tests: ✔ All 29 tests passed!

- nothing here is deployed in prod or runs in prod
- this will be used by unit and integration tests later on
- including some realistic sample data to fully exercise all the code 
paths
- also includes readme with basic source info and plan for acquisition
- extract out all the parts that make network calls
- this class will be swapped out with a mock in unit and integration 
tests to prevent hitting real external services during testing
- tests included
- extract out all the database interactions
- this will be mocked out in unit tests (but not integration tests, as 
they will interact with a real (local) database)
- implemented as a context manager which ensures graceful cleanup on 
both success and failure
- care is taken to only commit transaction on success
- ddl included (this will require a one-time manual run on the server)
- tests included
- checks for new data
- bails if nothing new, otherwise fetches and stores in database
- tested using mocks for database and network operations, using sample 
data for more realistic testing
- this should be scheduled in automation, suggest 1-2 times per day

`python3 -m delphi.epidata.acquisition.covid_hosp.update`
- after this commit, acquisition can be scheduled in automation
- just another data source, following all the same conventions as before
- wow there are so many columns in this dataset...
- tests to follow shortly, after the api clients are updated
- updates all the client libraries
- coffee recompiled to js using latest version of coffeescript
- tests server-side api behavior, like handling of versioning (issues)
- tests acquisition "pipeline", which uses test data to download and 
store a dataset
- adds new page for the `covid_hosp` endpoint
- adds entry in the parent readme for this new covid-19 data source
Copy link
Contributor

@krivard krivard left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

unfinished review; will hit the other files later

dfarrow0 and others added 3 commits November 18, 2020 15:37
committing suggestion from @krivard

Co-authored-by: Katie Mazaitis <[email protected]>
- use built-in fuzzy comparison instead of taking abs and less than
- these names aren't actually changed
Copy link
Contributor

@krivard krivard left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Needs a new javascript client (otherwise it will fail deployment on prod) but everything else is probably optional

dfarrow0 and others added 3 commits November 19, 2020 10:49
dont hardcode column count

Co-authored-by: Katie Mazaitis <[email protected]>
- line was too long, split up
- converted from es6 to es5 by babel
@dfarrow0
Copy link
Contributor Author

@krivard thanks for the review, should be good to go!

Copy link
Contributor

@krivard krivard left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🎉

@krivard krivard merged commit 8d1f6cd into cmu-delphi:main Nov 19, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

add healthdata.gov signals on hospitalizations
2 participants