Skip to content

Commit 67c2226

Browse files
authored
Merge pull request #982 from cmu-delphi/release/delphi-epidata-0.4.0
Release Delphi Epidata 0.4.0
2 parents 7b8cace + 2ca7c63 commit 67c2226

File tree

133 files changed

+2587
-2877
lines changed

Some content is hidden

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

133 files changed

+2587
-2877
lines changed

.bumpversion.cfg

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
[bumpversion]
2-
current_version = 0.3.21
2+
current_version = 0.4.0
33
commit = False
44
tag = False
55

.github/workflows/ci.yaml

+2-1
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ jobs:
6262
- name: Start services
6363
run: |
6464
docker network create --driver bridge delphi-net
65-
docker run --rm -d -p 13306:3306 --network delphi-net --name delphi_database_epidata delphi_database_epidata
65+
docker run --rm -d -p 13306:3306 --network delphi-net --name delphi_database_epidata --cap-add=sys_nice delphi_database_epidata
6666
docker run --rm -d -p 10080:80 --env "SQLALCHEMY_DATABASE_URI=mysql+mysqldb://user:pass@delphi_database_epidata:3306/epidata" --env "FLASK_SECRET=abc" --env "FLASK_PREFIX=/epidata" --network delphi-net --name delphi_web_epidata delphi_web_epidata
6767
docker ps
6868
@@ -109,6 +109,7 @@ jobs:
109109
needs: build
110110
# only on main and dev branch
111111
if: github.ref == 'refs/heads/main' || github.ref == 'refs/heads/dev'
112+
112113
runs-on: ubuntu-latest
113114
steps:
114115
- name: Check out code

.gitignore

+3
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
11
__pycache__/
2+
*.pyc
3+
*~
4+
\#*#
25
.DS_Store
36
/.vscode
47
/delphi-epidata
+20-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,14 @@
1-
# start with the `delphi_database` image
2-
FROM delphi_database
1+
# start with a standard percona mysql image
2+
FROM percona:ps-8
3+
4+
# percona exits with the mysql user but we need root for additional setup
5+
USER root
6+
7+
# use delphi's timezome
8+
RUN ln -s -f /usr/share/zoneinfo/America/New_York /etc/localtime
9+
10+
# specify a development-only password for the database user "root"
11+
ENV MYSQL_ROOT_PASSWORD pass
312

413
# create the `epidata` database
514
ENV MYSQL_DATABASE epidata
@@ -8,8 +17,17 @@ ENV MYSQL_DATABASE epidata
817
ENV MYSQL_USER user
918
ENV MYSQL_PASSWORD pass
1019

20+
# provide DDL which will configure dev environment at container startup
21+
COPY repos/delphi/delphi-epidata/dev/docker/database/epidata/_init.sql /docker-entrypoint-initdb.d/
22+
1123
# provide DDL which will create empty tables at container startup
1224
COPY repos/delphi/delphi-epidata/src/ddl/*.sql /docker-entrypoint-initdb.d/
1325

26+
# provide additional configuration needed for percona
27+
COPY repos/delphi/delphi-epidata/dev/docker/database/mysql.d/*.cnf /etc/my.cnf.d/
28+
1429
# grant access to SQL scripts
1530
RUN chmod o+r /docker-entrypoint-initdb.d/*.sql
31+
32+
# restore mysql user for percona
33+
USER mysql

dev/docker/database/epidata/_init.sql

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
CREATE DATABASE covid;
2+
GRANT ALL ON covid.* TO 'user';

dev/docker/database/mysql.d/my.cnf

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
[mysqld]
2+
default_authentication_plugin=mysql_native_password

dev/local/Makefile

+13-9
Original file line numberDiff line numberDiff line change
@@ -10,19 +10,19 @@
1010
# Creates all prereq images (delphi_database, delphi_python) only if they don't
1111
# exist. If you need to rebuild a prereq, you're probably doing something
1212
# complicated, and can figure out the rebuild command on your own.
13-
#
14-
#
13+
#
14+
#
1515
# Commands:
16-
#
16+
#
1717
# web: Stops currently-running delphi_web_epidata instances, if any.
1818
# Rebuilds delphi_web_epidata image.
1919
# Runs image in the background and pipes stdout to a log file.
20-
#
20+
#
2121
# db: Stops currently-running delphi_database_epidata instances, if any.
2222
# Rebuilds delphi_database_epidata image.
2323
# Runs image in the background and pipes stdout to a log file.
2424
# Blocks until database is ready to receive connections.
25-
#
25+
#
2626
# python: Rebuilds delphi_web_python image. You shouldn't need to do this
2727
# often; only if you are installing a new environment, or have
2828
# made changes to delphi-epidata/dev/docker/python/Dockerfile.
@@ -35,7 +35,7 @@
3535
#
3636
# clean: Cleans up dangling Docker images.
3737
#
38-
#
38+
#
3939
# Optional arguments:
4040
# pdb=1 Drops you into debug mode upon test failure, if running tests.
4141
# test= Only runs tests in the directories provided here, e.g.
@@ -94,6 +94,9 @@ db:
9494
docker stop $(DATABASE_CONTAINER_ID);\
9595
fi
9696

97+
@# Setup virtual network if it doesn't exist
98+
@docker network ls | grep delphi-net || docker network create --driver bridge delphi-net
99+
97100
@# Only build prereqs if we need them
98101
@docker images delphi_database | grep delphi || \
99102
docker build -t delphi_database -f repos/delphi/operations/dev/docker/database/Dockerfile .
@@ -105,11 +108,12 @@ db:
105108
@# Run the database
106109
@docker run --rm -p 127.0.0.1:13306:3306 \
107110
--network delphi-net --name delphi_database_epidata \
111+
--cap-add=sys_nice \
108112
delphi_database_epidata >$(LOG_DB) 2>&1 &
109113

110114
@# Block until DB is ready
111115
@while true; do \
112-
sed -n '/Temporary server stopped/,/mysqld: ready for connections/p' $(LOG_DB) | grep "ready for connections" && break; \
116+
sed -n '/mysqld: ready for connections/p' $(LOG_DB) | grep "ready for connections" && break; \
113117
tail -1 $(LOG_DB); \
114118
sleep 1; \
115119
done
@@ -124,10 +128,10 @@ py:
124128
-f repos/delphi/delphi-epidata/dev/docker/python/Dockerfile .
125129

126130
.PHONY=all
127-
all: web db py
131+
all: db web py
128132

129133
.PHONY=test
130-
test:
134+
test:
131135
@docker run -i --rm --network delphi-net \
132136
--mount type=bind,source=$(CWD)repos/delphi/delphi-epidata,target=/usr/src/app/repos/delphi/delphi-epidata,readonly \
133137
--mount type=bind,source=$(CWD)repos/delphi/delphi-epidata/src,target=/usr/src/app/delphi/epidata,readonly \

devops/Dockerfile

+6-3
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,16 @@ WORKDIR /src
33
COPY . /src
44
RUN npm ci && npm run build
55

6-
FROM tiangolo/meinheld-gunicorn:python3.7
6+
FROM tiangolo/meinheld-gunicorn:python3.8
77
LABEL org.opencontainers.image.source=https://github.com/cmu-delphi/delphi-epidata
88
# use delphi's timezome
99
RUN ln -s -f /usr/share/zoneinfo/America/New_York /etc/localtime
1010

11-
COPY requirements.txt /app
12-
RUN pip install --no-cache-dir -r requirements.txt
11+
COPY requirements.txt /app/requirements_also.txt
12+
RUN pip install --no-cache-dir -r /tmp/requirements.txt -r requirements_also.txt
13+
# the file /tmp/requirements.txt is created in the parent docker definition. (see:
14+
# https://github.com/tiangolo/meinheld-gunicorn-docker/blob/master/docker-images/python3.8.dockerfile#L5 )
15+
# this combined requirements installation ensures all version constrants are accounted for.
1316

1417
# disable python stdout buffering
1518
ENV PYTHONUNBUFFERED 1

docs/api/README.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
---
2-
title: Epidata API (Other Diseases)
3-
nav_order: 3
2+
title: Other Endpoints (COVID-19 and Other Diseases)
3+
nav_order: 2
44
has_children: true
55
---
66

docs/api/afhsb.md

+7-7
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
---
22
title: AFHSB
3-
parent: Epidata API (Other Diseases)
3+
parent: Other Endpoints (COVID-19 and Other Diseases)
44
---
55

66
# AFHSB
@@ -36,12 +36,12 @@ See [this documentation](README.md) for details on specifying epiweeks, dates, a
3636

3737
## Response
3838

39-
| Field | Description | Type |
40-
| --- | --- | --- |
41-
| `result` | result code: 1 = success, 2 = too many results, -2 = no results | integer |
42-
| `epidata` | list of results | array of objects |
43-
| ... | ... | ... | <!-- TODO -->
44-
| `message` | `success` or error message | string |
39+
| Field | Description | Type |
40+
|-----------|-----------------------------------------------------------------|------------------|
41+
| `result` | result code: 1 = success, 2 = too many results, -2 = no results | integer |
42+
| `epidata` | list of results | array of objects |
43+
| ... | ... | ... | <!-- TODO -->
44+
| `message` | `success` or error message | string |
4545

4646
# Example URLs
4747

docs/api/cdc.md

+7-7
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
---
22
title: CDC
3-
parent: Epidata API (Other Diseases)
3+
parent: Other Endpoints (COVID-19 and Other Diseases)
44
---
55

66
# CDC
@@ -35,12 +35,12 @@ See [this documentation](README.md) for details on specifying epiweeks, dates, a
3535

3636
## Response
3737

38-
| Field | Description | Type |
39-
| --- | --- | --- |
40-
| `result` | result code: 1 = success, 2 = too many results, -2 = no results | integer |
41-
| `epidata` | list of results | array of objects |
42-
| ... | ... | ... | <!-- TODO -->
43-
| `message` | `success` or error message | string |
38+
| Field | Description | Type |
39+
|-----------|-----------------------------------------------------------------|------------------|
40+
| `result` | result code: 1 = success, 2 = too many results, -2 = no results | integer |
41+
| `epidata` | list of results | array of objects |
42+
| ... | ... | ... | <!-- TODO -->
43+
| `message` | `success` or error message | string |
4444

4545
# Example URLs
4646

docs/api/client_libraries.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
---
22
title: Epidata API Client Libraries
3-
parent: Epidata API (Other Diseases)
3+
parent: Other Endpoints (COVID-19 and Other Diseases)
44
nav_order: 1
55
---
66

docs/api/covid_hosp.md

+8-8
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
---
22
title: COVID-19 Reported Patient Impact and Hospital Capacity by State Timeseries
3-
parent: Epidata API (Other Diseases)
3+
parent: Other Endpoints (COVID-19 and Other Diseases)
44
---
55

66
# COVID-19 Hospitalization by State
@@ -43,16 +43,16 @@ See [this documentation](README.md) for details on specifying locations and date
4343

4444
### Required
4545

46-
| Parameter | Description | Type |
47-
| --- | --- | --- |
48-
| `states` | two-letter state abbreviations | `list` of states |
49-
| `dates` | dates | `list` of dates or date ranges |
46+
| Parameter | Description | Type |
47+
|-----------|--------------------------------|--------------------------------|
48+
| `states` | two-letter state abbreviations | `list` of states |
49+
| `dates` | dates | `list` of dates or date ranges |
5050

5151
### Optional
5252

53-
| Parameter | Description | Type |
54-
| --- | --- | --- |
55-
| `issues` | issues | `list` of "issue" dates or date ranges |
53+
| Parameter | Description | Type |
54+
|-----------|-------------|----------------------------------------|
55+
| `issues` | issues | `list` of "issue" dates or date ranges |
5656

5757
If `issues` is not specified, then the most recent issue is used by default.
5858

docs/api/covid_hosp_facility.md

+7-7
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
---
22
title: COVID-19 Reported Patient Impact and Hospital Capacity by Facility
3-
parent: Epidata API (Other Diseases)
3+
parent: Other Endpoints (COVID-19 and Other Diseases)
44
---
55

66
# COVID-19 Hospitalization by Facility
@@ -38,10 +38,10 @@ See [this documentation](README.md) for details on specifying locations and date
3838

3939
### Required
4040

41-
| Parameter | Description | Type |
42-
| --- | --- | --- |
43-
| `hospital_pks` | facility unique identifiers | `list` of identifiers |
44-
| `collection_weeks` | dates | `list` of dates or date ranges |
41+
| Parameter | Description | Type |
42+
|--------------------|-----------------------------|--------------------------------|
43+
| `hospital_pks` | facility unique identifiers | `list` of identifiers |
44+
| `collection_weeks` | dates | `list` of dates or date ranges |
4545

4646
NOTE: The companion
4747
[`covid_hosp_facility_lookup` endpoint](covid_hosp_facility_lookup.md) can be
@@ -54,8 +54,8 @@ dates) rather than an "epiweek" as in other endpoints.
5454

5555
### Optional
5656

57-
| Parameter | Description | Type |
58-
| --- | --- | --- |
57+
| Parameter | Description | Type |
58+
|---------------------|---------------------|----------------------------------------|
5959
| `publication_dates` | date of publication | `list` of "issue" dates or date ranges |
6060

6161
If `publication_dates` is not specified, then the most recent issue is used by

docs/api/covid_hosp_facility_lookup.md

+8-8
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
---
22
title: COVID-19 Reported Patient Impact and Hospital Capacity - Facility lookup
3-
parent: Epidata API (Other Diseases)
3+
parent: Other Endpoints (COVID-19 and Other Diseases)
44
---
55

66
# COVID-19 Hospitalization: Facility Lookup
@@ -36,13 +36,13 @@ See [this documentation](README.md) for details on specifying locations and date
3636

3737
## Parameters
3838

39-
| Parameter | Description | Type |
40-
| --- | --- | --- |
41-
| `state` | two-letter state abbreviation | string |
42-
| `ccn` | facility CMS Certification Number | string |
43-
| `city` | city name | string |
44-
| `zip` | 5-digit ZIP code | string |
45-
| `fips_code` | 5-digit FIPS county code | string |
39+
| Parameter | Description | Type |
40+
|-------------|-----------------------------------|--------|
41+
| `state` | two-letter state abbreviation | string |
42+
| `ccn` | facility CMS Certification Number | string |
43+
| `city` | city name | string |
44+
| `zip` | 5-digit ZIP code | string |
45+
| `fips_code` | 5-digit FIPS county code | string |
4646

4747
NOTE: Exactly one of the above parameters must be present in requests.
4848
Combinations of parameters (e.g. specifying both `city` and `state`) are not

docs/api/covidcast-signals/_source-template.md

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
title: SOURCE NAME
33
parent: Data Sources and Signals
4-
grand_parent: COVIDcast Epidata API
4+
grand_parent: COVIDcast Main Endpoint
55
---
66

77
# SOURCE NAME
@@ -17,8 +17,8 @@ grand_parent: COVIDcast Epidata API
1717

1818
A brief description of what this source measures.
1919

20-
| Signal | Description |
21-
| --- | --- |
20+
| Signal | Description |
21+
|---------------|----------------------------------------------------------------------------------------------------------|
2222
| `signal_name` | Brief description of the signal, including the units it is measured in and any smoothing that is applied |
2323

2424
## Table of contents

docs/api/covidcast-signals/chng.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
title: Change Healthcare
33
parent: Data Sources and Signals
4-
grand_parent: COVIDcast Epidata API
4+
grand_parent: COVIDcast Main Endpoint
55
---
66

77
# Change Healthcare

docs/api/covidcast-signals/covid-act-now.md

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
title: COVID Act Now
33
parent: Data Sources and Signals
4-
grand_parent: COVIDcast Epidata API
4+
grand_parent: COVIDcast Main Endpoint
55
---
66

77
# COVID Act Now (CAN)
@@ -21,10 +21,10 @@ While CAN provides this data potentially from multiple sources, we only use data
2121
[CDC's COVID-19 Integrated County View](https://covid.cdc.gov/covid-data-tracker/#county-view).
2222

2323

24-
| Signal | Description |
25-
| --- | --- |
24+
| Signal | Description |
25+
|--------------------------------|----------------------------------------------------------------|
2626
| `pcr_specimen_positivity_rate` | Proportion of PCR specimens tested that have a positive result |
27-
| `pcr_specimen_total_tests` | Total number of PCR specimens tested |
27+
| `pcr_specimen_total_tests` | Total number of PCR specimens tested |
2828

2929
## Table of contents
3030
{: .no_toc .text-delta}

docs/api/covidcast-signals/doctor-visits.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
title: Doctor Visits
33
parent: Data Sources and Signals
4-
grand_parent: COVIDcast Epidata API
4+
grand_parent: COVIDcast Main Endpoint
55
---
66

77
# Doctor Visits

0 commit comments

Comments
 (0)