Skip to content

Commit b2fb357

Browse files
authored
Merge branch 'dev' into krivard/covid_hosp-older_than
2 parents eecc6b8 + 08de322 commit b2fb357

File tree

115 files changed

+4127
-5038
lines changed

Some content is hidden

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

115 files changed

+4127
-5038
lines changed

.bumpversion.cfg

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

.git-blame-ignore-revs

-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
# style(black): format cdc acquisition
22
980b0b7e80c7923b79e14fee620645e680785703
3-
# style(black): format covidcast_nowcast acquisition
4-
9e6ff16f599e8feec34a08dd1bddbc5eae347b55
53
# style(black): format ecdc acquisition
64
d1141d904da4e62992b97c92d5caebd8fadffd42
75
# style(black): format flusurv acquisition

.github/workflows/ci.yaml

+2-2
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ jobs:
7575
7676
- name: Start delphi_web_epidata
7777
run: |
78-
docker run --rm -d -p 10080:80 --env "MODULE_NAME=delphi.epidata.server.main" --env "SQLALCHEMY_DATABASE_URI=mysql+mysqldb://user:pass@delphi_database_epidata:3306/epidata" --env "FLASK_SECRET=abc" --env "FLASK_PREFIX=/epidata" --env "REDIS_HOST=delphi_redis" --env "REDIS_PASSWORD=1234" --env "API_KEY_REGISTER_WEBHOOK_TOKEN=abc" --env "API_KEY_ADMIN_PASSWORD=test_admin_password" --network delphi-net --name delphi_web_epidata delphi_web_epidata
78+
docker run --rm -d -p 10080:80 --env "MODULE_NAME=delphi.epidata.server.main" --env "SQLALCHEMY_DATABASE_URI=mysql+mysqldb://user:pass@delphi_database_epidata:3306/epidata" --env "FLASK_SECRET=abc" --env "FLASK_PREFIX=/epidata" --env "REDIS_HOST=delphi_redis" --env "REDIS_PASSWORD=1234" --env "API_KEY_REGISTER_WEBHOOK_TOKEN=abc" --env "API_KEY_ADMIN_PASSWORD=test_admin_password" --env "TESTING_MODE=True" --network delphi-net --name delphi_web_epidata delphi_web_epidata
7979
docker ps
8080
8181
- name: Run Unit Tests
@@ -101,7 +101,7 @@ jobs:
101101
uses: actions/checkout@v2
102102
- uses: actions/setup-node@v2
103103
with:
104-
node-version: '14.x'
104+
node-version: '16.x'
105105
- name: Cache Node.js modules
106106
uses: actions/cache@v2
107107
with:

.github/workflows/create-release.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ jobs:
3939
base: main
4040
title: Release Delphi Epidata ${{ steps.version.outputs.next_tag }}
4141
labels: chore
42-
reviewers: krivard
43-
assignees: krivard
42+
reviewers: melange396
43+
assignees: melange396
4444
body: |
4545
Releasing Delphi Epidata ${{ steps.version.outputs.next_tag }}.

.github/workflows/dependabot-assignments.yml

+3-3
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,11 @@ permissions:
77
jobs:
88
dependabot:
99
runs-on: ubuntu-latest
10-
env:
11-
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
10+
env:
11+
GH_TOKEN: ${{ secrets.CMU_DELPHI_AUTOMATION_MACHINE_DEPENDABOT_PAT }}
1212
if: ${{ github.actor == 'dependabot[bot]' }}
1313
steps:
1414
- name: Assign team to PR
1515
run: gh pr edit "$PR_URL" --add-reviewer "cmu-delphi/code-reviewers"
1616
env:
17-
PR_URL: ${{github.event.pull_request.html_url}}
17+
PR_URL: ${{github.event.pull_request.html_url}}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,108 @@
1+
name: One-time performance testing - 8th November 2023
2+
3+
# Run "At every 30th minute on day-of-month 8 in November"
4+
on:
5+
schedule:
6+
- cron: '*/30 * 8 11 *'
7+
8+
# Add some extra perms to comment on a PR
9+
permissions:
10+
pull-requests: write
11+
contents: read
12+
13+
jobs:
14+
run-perftests:
15+
# Run this on Delphi's self-hosted runner
16+
runs-on: self-hosted
17+
outputs:
18+
request_count: ${{ steps.output.outputs.request_count }}
19+
failure_count: ${{ steps.output.outputs.failure_count }}
20+
med_time: ${{ steps.output.outputs.med_time }}
21+
avg_time: ${{ steps.output.outputs.avg_time }}
22+
min_time: ${{ steps.output.outputs.min_time }}
23+
max_time: ${{ steps.output.outputs.max_time }}
24+
requests_per_sec: ${{ steps.output.outputs.requests_per_sec }}
25+
steps:
26+
- name: Set up WireGuard
27+
uses: egor-tensin/[email protected]
28+
with:
29+
endpoint: '${{ secrets.WG_PERF_ENDPOINT }}'
30+
endpoint_public_key: '${{ secrets.WG_PERF_ENDPOINT_PUBLIC_KEY }}'
31+
ips: '${{ secrets.WG_PERF_IPS }}'
32+
allowed_ips: '${{ secrets.WG_PERF_ALLOWED_IPS }}'
33+
private_key: '${{ secrets.WG_PERF_PRIVATE_KEY }}'
34+
- name: Clean files from previous runs
35+
uses: AutoModality/action-clean@v1
36+
- name: Check out repository
37+
uses: actions/checkout@v3
38+
- name: Set up repository # mimics install.sh in the README except that delphi is cloned from the PR rather than main
39+
run: |
40+
cd ..
41+
rm -rf driver
42+
mkdir -p driver/repos/delphi
43+
cd driver/repos/delphi
44+
git clone https://github.com/cmu-delphi/operations
45+
git clone https://github.com/cmu-delphi/utils
46+
git clone https://github.com/cmu-delphi/flu-contest
47+
git clone https://github.com/cmu-delphi/nowcast
48+
cd ../../
49+
50+
cd ..
51+
cp -R delphi-epidata driver/repos/delphi/delphi-epidata
52+
cd -
53+
54+
ln -s repos/delphi/delphi-epidata/dev/local/Makefile
55+
- name: Build & run epidata
56+
run: |
57+
cd ../driver
58+
sudo make web sql="${{ secrets.DB_CONN_STRING }}" rate_limit="999999/second"
59+
sudo make redis
60+
- name: Check out delphi-admin
61+
uses: actions/checkout@v3
62+
with:
63+
repository: cmu-delphi/delphi-admin
64+
token: ${{ secrets.CMU_DELPHI_DEPLOY_MACHINE_PAT }}
65+
path: delphi-admin
66+
- name: Build & run Locust
67+
continue-on-error: true # sometimes ~2-5 queries fail, we shouldn't end the run if that's the case
68+
env:
69+
PERFTEST_API_KEY: ${{secrets.PERFTEST_API_KEY}}
70+
run: |
71+
cd delphi-admin/load-testing/locust
72+
docker build -t locust .
73+
export CSV=v4-requests-small.csv
74+
touch output_stats.csv && chmod 666 output_stats.csv
75+
touch output_stats_history.csv && chmod 666 output_stats_history.csv
76+
touch output_failures.csv && chmod 666 output_failures.csv
77+
touch output_exceptions.csv && chmod 666 output_exceptions.csv
78+
docker run --net=host -v $PWD:/mnt/locust -e CSV="/mnt/locust/${CSV}" locust -f /mnt/locust/v4.py --host http://127.0.0.1:10080/ --users 10 --spawn-rate 1 --headless -i "$(cat ${CSV} | wc -l)" --csv=/mnt/locust/output
79+
- name: Produce output for summary
80+
id: output
81+
uses: jannekem/run-python-script-action@v1
82+
with:
83+
script: |
84+
import os
85+
86+
def write_string(name, value):
87+
with open(os.environ['GITHUB_OUTPUT'], 'a') as fh:
88+
print(f'{name}={value}', file=fh)
89+
90+
def write_float(name, value):
91+
write_string(name, "{:.2f}".format(float(value)))
92+
93+
with open("delphi-admin/load-testing/locust/output_stats.csv", "r", encoding="utf-8", errors="ignore") as scraped:
94+
final_line = scraped.readlines()[-1].split(",")
95+
write_string('request_count', final_line[2])
96+
write_string('failure_count', final_line[3])
97+
write_float('med_time', final_line[4])
98+
write_float('avg_time', final_line[5])
99+
write_float('min_time', final_line[6])
100+
write_float('max_time', final_line[7])
101+
write_float('requests_per_sec', final_line[9])
102+
103+
- name: Archive results as artifacts
104+
uses: actions/upload-artifact@v3
105+
with:
106+
name: locust-output
107+
path: |
108+
delphi-admin/load-testing/locust/output_*.csv

.github/workflows/performance-tests.yml

+8-2
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,8 @@ jobs:
1414
run-perftests:
1515
# Make sure 1. this is a PR, not an issue 2. it contains "/run performance test" anywhere in the body
1616
if: github.event.issue.pull_request && contains(github.event.comment.body, '/run performance test')
17-
runs-on: ubuntu-latest
17+
# Run this on Delphi's self-hosted runner
18+
runs-on: self-hosted
1819
outputs:
1920
request_count: ${{ steps.output.outputs.request_count }}
2021
failure_count: ${{ steps.output.outputs.failure_count }}
@@ -32,6 +33,8 @@ jobs:
3233
ips: '${{ secrets.WG_PERF_IPS }}'
3334
allowed_ips: '${{ secrets.WG_PERF_ALLOWED_IPS }}'
3435
private_key: '${{ secrets.WG_PERF_PRIVATE_KEY }}'
36+
- name: Clean files from previous runs
37+
uses: AutoModality/action-clean@v1
3538
- name: Check out repository
3639
uses: actions/checkout@v3
3740
# Previous step checks out default branch, so we check out the pull request's branch
@@ -43,6 +46,7 @@ jobs:
4346
- name: Set up repository # mimics install.sh in the README except that delphi is cloned from the PR rather than main
4447
run: |
4548
cd ..
49+
rm -rf driver
4650
mkdir -p driver/repos/delphi
4751
cd driver/repos/delphi
4852
git clone https://github.com/cmu-delphi/operations
@@ -59,7 +63,7 @@ jobs:
5963
- name: Build & run epidata
6064
run: |
6165
cd ../driver
62-
sudo make web sql="${{ secrets.DB_CONN_STRING }}"
66+
sudo make web sql="${{ secrets.DB_CONN_STRING }}" rate_limit="999999/second"
6367
sudo make redis
6468
- name: Check out delphi-admin
6569
uses: actions/checkout@v3
@@ -69,6 +73,8 @@ jobs:
6973
path: delphi-admin
7074
- name: Build & run Locust
7175
continue-on-error: true # sometimes ~2-5 queries fail, we shouldn't end the run if that's the case
76+
env:
77+
PERFTEST_API_KEY: ${{secrets.PERFTEST_API_KEY}}
7278
run: |
7379
cd delphi-admin/load-testing/locust
7480
docker build -t locust .

.github/workflows/release-helper.yml

+3-3
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ jobs:
9595
uses: actions/checkout@v2
9696
- uses: actions/setup-node@v2
9797
with:
98-
node-version: '14.x'
98+
node-version: '16.x'
9999
- name: Cache Node.js modules
100100
uses: actions/cache@v2
101101
with:
@@ -147,7 +147,7 @@ jobs:
147147
base: dev
148148
title: "chore: sync main->dev"
149149
labels: chore
150-
reviewers: krivard
151-
assignees: krivard
150+
reviewers: melange396
151+
assignees: melange396
152152
body: |
153153
Syncing Main->Dev.

.github/workflows/update_gdocs_data.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ jobs:
3131
commit-message: 'chore: update docs'
3232
title: Update Google Docs Meta Data
3333
labels: chore
34-
reviewers: krivard
35-
assignees: krivard
34+
reviewers: melange396
35+
assignees: melange396
3636
body: |
3737
Updating Google Docs Meta Data

deploy.json

+4-3
Original file line numberDiff line numberDiff line change
@@ -208,12 +208,13 @@
208208
"add-header-comment": true
209209
},
210210

211-
"// acquisition - covidcast_nowcast",
211+
"// maintenance",
212212
{
213213
"type": "move",
214-
"src": "src/acquisition/covidcast_nowcast/",
215-
"dst": "[[package]]/acquisition/covidcast_nowcast/",
214+
"src": "src/maintenance/",
215+
"dst": "[[package]]/maintenance/",
216216
"match": "^.*\\.(py)$",
217+
"recursive": true,
217218
"add-header-comment": true
218219
},
219220

dev/local/Makefile

+10
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@
3737
# test= Only runs tests in the directories provided here, e.g.
3838
# repos/delphi/delphi-epidata/tests/acquisition/covidcast
3939
# sql= Overrides the default SQL connection string.
40+
# rate_limit= Overrides the default rate limit for API requests.
4041

4142

4243
# Set optional argument defaults
@@ -56,6 +57,14 @@ else
5657
sqlalchemy_uri:=mysql+mysqldb://user:pass@delphi_database_epidata:3306/epidata
5758
endif
5859

60+
ifdef rate_limit
61+
# Notation found here: https://flask-limiter.readthedocs.io/en/stable/#rate-limit-string-notation
62+
rate_limit_settings:=--env "RATE_LIMIT=$(rate_limit)"
63+
else
64+
# Default behavior is to set the rate limit to "5/hour" for API key tests via this environment variable
65+
rate_limit_settings:=--env "TESTING_MODE=True"
66+
endif
67+
5968
SHELL:=/bin/sh
6069

6170
# Get the Makefile's absolute path: https://stackoverflow.com/a/324782/4784655
@@ -104,6 +113,7 @@ web:
104113
--env "REDIS_PASSWORD=1234" \
105114
--env "API_KEY_ADMIN_PASSWORD=test_admin_password" \
106115
--env "API_KEY_REGISTER_WEBHOOK_TOKEN=abc" \
116+
$(rate_limit_settings) \
107117
--network delphi-net --name delphi_web_epidata \
108118
delphi_web_epidata >$(LOG_WEB) 2>&1 &
109119

dev/local/setup.cfg

+1-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[metadata]
22
name = Delphi Development
3-
version = 4.1.4
3+
version = 4.1.13
44

55
[options]
66
packages =
@@ -13,7 +13,6 @@ packages =
1313
delphi.epidata.acquisition.covid_hosp.state_daily
1414
delphi.epidata.acquisition.covid_hosp.state_timeseries
1515
delphi.epidata.acquisition.covidcast
16-
delphi.epidata.acquisition.covidcast_nowcast
1716
delphi.epidata.acquisition.ecdc
1817
delphi.epidata.acquisition.flusurv
1918
delphi.epidata.acquisition.fluview

docs/api/covidcast-signals/quidel-inactive.md

+1
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ grand_parent: COVIDcast Main Endpoint
1515
1. TOC
1616
{:toc}
1717

18+
## Accessibility: Delphi-internal only
1819

1920
## COVID-19 Tests
2021
These signals are still active. Documentation is available on the [Quidel page](quidel.md).

docs/api/covidcast-signals/quidel.md

+2
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@ grand_parent: COVIDcast Main Endpoint
1515
1. TOC
1616
{:toc}
1717

18+
## Accessibility: Delphi-internal only
19+
1820
## COVID-19 Tests
1921

2022
* **Earliest issue available:** July 29, 2020

docs/api/covidcast.md

+16
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,16 @@ and lists.
113113
The current set of signals available for each data source is returned by the
114114
[`covidcast_meta`](covidcast_meta.md) endpoint.
115115

116+
#### Alternate Required Parameters
117+
118+
The following parameters help specify multiple source-signal, timetype-timevalue or geotype-geovalue pairs. Use them instead of the usual required parameters.
119+
120+
| Parameter | Replaces | Format | Description | Example |
121+
| --- | --- | --- | --- | --- |
122+
| `signal` | `data_source`, `signal` | `signal={source}:{signal1},{signal2}` | Specify multiple source-signal pairs, grouped by source | `signal=src1:sig1`, `signal=src1:sig1,sig2`, `signal=src1:*`, `signal=src1:sig1;src2:sig3` |
123+
| `time` | `time_type`, `time_values` | `time={timetype}:{timevalue1},{timevalue2}` | Specify multiple timetype-timevalue pairs, grouped by timetype | `time=day:*`, `time=day:20201201`, `time=day:20201201,20201202`, `time=day:20201201-20201204` |
124+
| `geo` | `geo_type`, `geo_value` | `geo={geotype}:{geovalue1},{geovalue2}` | Specify multiple geotype-geovalue pairs, grouped by geotype | `geo=fips:*`, `geo=fips:04019`, `geo=fips:04019,19143`, `geo=fips:04019;msa:40660`, `geo=fips:*;msa:*` |
125+
116126
#### Optional
117127

118128
Estimates for a specific `time_value` and `geo_value` are sometimes updated
@@ -209,6 +219,12 @@ The `fields` parameter can be used to limit which fields are included in each re
209219

210220
https://api.delphi.cmu.edu/epidata/covidcast/?data_source=fb-survey&signal=smoothed_cli&time_type=day&geo_type=county&time_values=20200406-20200410&geo_value=06001
211221

222+
or
223+
224+
https://api.delphi.cmu.edu/epidata/covidcast/?signal=fb-survey:smoothed_cli&time=day:20200406-20200410&geo=county:06001
225+
226+
Both of these URLs are equivalent and can be used to get the following result:
227+
212228
```json
213229
{
214230
"result": 1,

docs/api/covidcast_signals.md

-1
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,6 @@ dashboard](https://delphi.cmu.edu/covidcast/):
3636
| Early Indicators | COVID-Like Symptoms | [`fb-survey`](covidcast-signals/fb-survey.md) | `smoothed_wcli` |
3737
| Early Indicators | COVID-Like Symptoms in Community | [`fb-survey`](covidcast-signals/fb-survey.md) | `smoothed_whh_cmnty_cli` |
3838
| Early Indicators | COVID-Related Doctor Visits | [`doctor-visits`](covidcast-signals/doctor-visits.md) | `smoothed_adj_cli` |
39-
| Cases and Testing | COVID Antigen Test Positivity (Quidel) | [`quidel`](covidcast-signals/quidel.md) | `covid_ag_smoothed_pct_positive` |
4039
| Cases and Testing | COVID Cases | [`jhu-csse`](covidcast-signals/jhu-csse.md) | `confirmed_7dav_incidence_prop` |
4140
| Late Indicators | COVID Hospital Admissions | [`hhs`](covidcast-signals/hhs.md) | `confirmed_admissions_covid_1d_prop_7dav` |
4241
| Late Indicators | Deaths | [`jhu-csse`](covidcast-signals/jhu-csse.md) | `deaths_7dav_incidence_prop` |

docs/api/fluview.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ General topics not specific to any particular endpoint are discussed in the
1818
Influenza-like illness (ILI) from U.S. Outpatient Influenza-like Illness Surveillance Network (ILINet).
1919
- Data source: [United States Centers for Disease Control and Prevention](http://gis.cdc.gov/grasp/fluview/fluportaldashboard.html) (CDC)
2020
- Temporal Resolution: Weekly* from 1997w40
21-
- Spatial Resolution: National, [HHS regions](http://www.hhs.gov/iea/regional/), [Census divisions](http://www.census.gov/econ/census/help/geography/regions_and_divisions.html), most States and Territories, and some Cities (full list [here](https://github.com/cmu-delphi/delphi-epidata/blob/main/src/acquisition/fluview/fluview_locations.py))
21+
- Spatial Resolution: National, [HHS regions](https://www.hhs.gov/about/agencies/iea/regional-offices/index.html), [Census divisions](https://www2.census.gov/geo/pdfs/maps-data/maps/reference/us_regdiv.pdf), most States and Territories, and some Cities (full list [here](https://github.com/cmu-delphi/delphi-epidata/blob/main/src/acquisition/fluview/fluview_locations.py))
2222
- Open access
2323

2424
\* Data is usually released on Friday

docs/new_endpoint_tutorial.md

+2-4
Original file line numberDiff line numberDiff line change
@@ -123,11 +123,9 @@ Here's what we add to each client:
123123
def fluview_meta():
124124
"""Fetch FluView metadata."""
125125
# Set up request
126-
params = {
127-
'endpoint': 'fluview_meta',
128-
}
126+
params = {}
129127
# Make the API call
130-
return Epidata._request(params)
128+
return Epidata._request("fluview_meta", params)
131129
```
132130
133131
- [`delphi_epidata.R`](https://github.com/cmu-delphi/delphi-epidata/blob/dev/src/client/delphi_epidata.R)

0 commit comments

Comments
 (0)