Skip to content

Commit a6cc058

Browse files
committed
1. Merge branch 'dev' into leonlu2/error_on_geo_values.
2 parents d024995 + 4e64d16 commit a6cc058

39 files changed

+1308
-530
lines changed

.bumpversion.cfg

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
[bumpversion]
2-
current_version = 0.4.5
2+
current_version = 0.4.6
33
commit = False
44
tag = False
55

Lines changed: 80 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,80 @@
1+
name: Performance testing
2+
3+
# Run when a PR comment is created (issues and PRs are considered the same entity in the GitHub API)
4+
on:
5+
issue_comment:
6+
types: [created]
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+
# Make sure 1. this is a PR, not an issue 2. it contains "/run performance test" anywhere in the body
16+
if: github.event.issue.pull_request && contains(github.event.comment.body, '/run performance test')
17+
runs-on: ubuntu-latest
18+
steps:
19+
- name: Set up WireGuard
20+
uses: egor-tensin/[email protected]
21+
with:
22+
endpoint: '${{ secrets.WG_PERF_ENDPOINT }}'
23+
endpoint_public_key: '${{ secrets.WG_PERF_ENDPOINT_PUBLIC_KEY }}'
24+
ips: '${{ secrets.WG_PERF_IPS }}'
25+
allowed_ips: '${{ secrets.WG_PERF_ALLOWED_IPS }}'
26+
private_key: '${{ secrets.WG_PERF_PRIVATE_KEY }}'
27+
- name: Check out repository
28+
uses: actions/checkout@v3
29+
# Previous step checks out default branch, so we check out the pull request's branch
30+
- name: Switch to PR branch
31+
run: |
32+
hub pr checkout ${{ github.event.issue.number }}
33+
env:
34+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
35+
- name: Set up repository # mimics install.sh in the README except that delphi is cloned from the PR rather than main
36+
run: |
37+
cd ..
38+
mkdir -p driver/repos/delphi
39+
cd driver/repos/delphi
40+
git clone https://github.com/cmu-delphi/operations
41+
git clone https://github.com/cmu-delphi/utils
42+
git clone https://github.com/cmu-delphi/flu-contest
43+
git clone https://github.com/cmu-delphi/nowcast
44+
cd ../../
45+
46+
cd ..
47+
cp -R delphi-epidata driver/repos/delphi/delphi-epidata
48+
cd -
49+
50+
ln -s repos/delphi/delphi-epidata/dev/local/Makefile
51+
- name: Build & run epidata
52+
run: |
53+
cd ../driver
54+
sudo make web sql="${{ secrets.DB_CONN_STRING }}"
55+
- name: Build & run Locust
56+
run: |
57+
cd ../driver/repos/delphi/delphi-epidata/tests/performance
58+
docker build -t locust .
59+
docker run --net=host -v $PWD:/mnt/locust -e CSV=/mnt/locust/v4-requests-smaller.csv locust -f /mnt/locust/v4.py --host http://127.0.0.1:10080/ --users 10 --spawn-rate 1 --headless -t 15m
60+
61+
comment-output:
62+
runs-on: ubuntu-latest
63+
if: success() || failure() # but not if skipped
64+
needs: run-perftests
65+
steps:
66+
- name: Comment run results
67+
# URL that links to run results
68+
env:
69+
GITHUB_WORKFLOW_URL: https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}
70+
uses: actions/github-script@v5
71+
with:
72+
github-token: ${{secrets.GITHUB_TOKEN}}
73+
script: |
74+
github.rest.issues.createComment({
75+
issue_number: context.issue.number,
76+
owner: context.repo.owner,
77+
repo: context.repo.repo,
78+
body: '✅ Performance tests complete! Click here to view results: ${{ env.GITHUB_WORKFLOW_URL }}'
79+
})
80+

dev/local/Makefile

Lines changed: 24 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@
3636
# pdb=1 Drops you into debug mode upon test failure, if running tests.
3737
# test= Only runs tests in the directories provided here, e.g.
3838
# repos/delphi/delphi-epidata/tests/acquisition/covidcast
39+
# sql= Overrides the default SQL connection string.
3940

4041

4142
# Set optional argument defaults
@@ -49,6 +50,12 @@ ifndef test
4950
test=repos/delphi/delphi-epidata/tests repos/delphi/delphi-epidata/integrations
5051
endif
5152

53+
ifdef sql
54+
sqlalchemy_uri:=$(sql)
55+
else
56+
sqlalchemy_uri:=mysql+mysqldb://user:pass@delphi_database_epidata:3306/epidata
57+
endif
58+
5259
SHELL:=/bin/sh
5360

5461
# Get the Makefile's absolute path: https://stackoverflow.com/a/324782/4784655
@@ -60,6 +67,11 @@ LOG_DB:=delphi_database_epidata_$(NOW).log
6067
WEB_CONTAINER_ID:=$(shell docker ps -q --filter 'name=delphi_web_epidata')
6168
DATABASE_CONTAINER_ID:=$(shell docker ps -q --filter 'name=delphi_database_epidata')
6269

70+
M1=
71+
ifeq ($(shell uname -smp), Darwin arm64 arm)
72+
$(info M1 system detected, changing docker platform to linux/amd64.)
73+
override M1 =--platform linux/amd64
74+
endif
6375

6476
.PHONY=web
6577
web:
@@ -73,12 +85,15 @@ web:
7385

7486
@# Build the web_epidata image
7587
@cd repos/delphi/delphi-epidata;\
76-
docker build -t delphi_web_epidata -f ./devops/Dockerfile .;\
88+
docker build -t delphi_web_epidata\
89+
$(M1) \
90+
-f ./devops/Dockerfile .;\
7791
cd -
7892

7993
@# Run the web server
8094
@docker run --rm -p 127.0.0.1:10080:80 \
81-
--env "SQLALCHEMY_DATABASE_URI=mysql+mysqldb://user:pass@delphi_database_epidata:3306/epidata" \
95+
$(M1) \
96+
--env "SQLALCHEMY_DATABASE_URI=$(sqlalchemy_uri)" \
8297
--env "FLASK_SECRET=abc" --env "FLASK_PREFIX=/epidata" --env "LOG_DEBUG" \
8398
--network delphi-net --name delphi_web_epidata \
8499
delphi_web_epidata >$(LOG_WEB) 2>&1 &
@@ -95,10 +110,12 @@ db:
95110

96111
@# Build the database_epidata image
97112
@docker build -t delphi_database_epidata \
113+
$(M1) \
98114
-f repos/delphi/delphi-epidata/dev/docker/database/epidata/Dockerfile .
99115

100116
@# Run the database
101117
@docker run --rm -p 127.0.0.1:13306:3306 \
118+
$(M1) \
102119
--network delphi-net --name delphi_database_epidata \
103120
--cap-add=sys_nice \
104121
delphi_database_epidata >$(LOG_DB) 2>&1 &
@@ -113,6 +130,7 @@ db:
113130
.PHONY=py
114131
py:
115132
@docker build -t delphi_web_python \
133+
$(M1) \
116134
-f repos/delphi/delphi-epidata/dev/docker/python/Dockerfile .
117135

118136
.PHONY=all
@@ -121,18 +139,20 @@ all: db web py
121139
.PHONY=test
122140
test:
123141
@docker run -i --rm --network delphi-net \
142+
$(M1) \
124143
--mount type=bind,source=$(CWD)repos/delphi/delphi-epidata,target=/usr/src/app/repos/delphi/delphi-epidata,readonly \
125144
--mount type=bind,source=$(CWD)repos/delphi/delphi-epidata/src,target=/usr/src/app/delphi/epidata,readonly \
126-
--env "SQLALCHEMY_DATABASE_URI=mysql+mysqldb://user:pass@delphi_database_epidata:3306/epidata" \
145+
--env "SQLALCHEMY_DATABASE_URI=$(sqlalchemy_uri)" \
127146
--env "FLASK_SECRET=abc" \
128147
delphi_web_python python -m pytest --import-mode importlib $(pdb) $(test) | tee test_output_$(NOW).log
129148

130149
.PHONY=bash
131150
bash:
132151
@docker run -it --rm --network delphi-net \
152+
$(M1) \
133153
--mount type=bind,source=$(CWD)repos/delphi/delphi-epidata,target=/usr/src/app/repos/delphi/delphi-epidata,readonly \
134154
--mount type=bind,source=$(CWD)repos/delphi/delphi-epidata/src,target=/usr/src/app/delphi/epidata,readonly \
135-
--env "SQLALCHEMY_DATABASE_URI=mysql+mysqldb://user:pass@delphi_database_epidata:3306/epidata" \
155+
--env "SQLALCHEMY_DATABASE_URI=$(sqlalchemy_uri)" \
136156
--env "FLASK_SECRET=abc" \
137157
delphi_web_python bash
138158

dev/local/setup.cfg

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[metadata]
22
name = Delphi Development
3-
version = 0.4.5
3+
version = 0.4.6
44

55
[options]
66
packages =

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

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,16 @@ geographic coverage, limits in its interpretation (symptoms in a survey aren't
6262
always caused by COVID, our healthcare partner only is part of the market, there
6363
may be a demographic bias in respondents, etc.), known inaccuracies, etc.
6464

65+
## Missingness
66+
67+
Describe *all* situations under which a value may not be reported, and what that
68+
means. If the signal ever reports NA, describe what that means and how it is
69+
different from missingness. For example:
70+
71+
When fewer than 100 survey responses are received in a geographic area on a
72+
specific day, no data is reported for that area on that day; an API query for
73+
all reported geographic areas on that day will not include it.
74+
6575
## Lag and Backfill
6676

6777
If this signal is reported with a consistent lag, describe it here.

docs/symptom-survey/end-of-survey.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
title: End of CTIS Data Collection
33
parent: COVID-19 Trends and Impact Survey
4-
nav_order: 10
4+
nav_order: 11
55
---
66

77
# End of CTIS Data Collection

docs/symptom-survey/index.md

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -16,12 +16,6 @@ international version is [conducted by the University of
1616
Maryland](https://covidmap.umd.edu/). Data collection [ceased on June 25,
1717
2022](end-of-survey.md).
1818

19-
The [survey results dashboard](https://delphi.cmu.edu/covidcast/survey-results/)
20-
provides a high-level summary of survey results. Geographically aggregated data
21-
from this survey is publicly available through the [COVIDcast API](../api/covidcast.md)
22-
as the [`fb-survey` data source](../api/covidcast-signals/fb-survey.md). Demographic breakdowns of survey
23-
data are publicly available as [downloadable contingency tables](contingency-tables.md).
24-
2519
The [CTIS Methodology
2620
Report](https://dataforgood.facebook.com/dfg/resources/CTIS-methodology-report)
2721
describes the survey design, data collection process, weighting, and aggregation
@@ -34,6 +28,16 @@ access to the data, see our page on getting [data access](data-access.md).
3428
If you have questions about the survey or getting access to data, contact us at
3529
3630

31+
## Results
32+
33+
The [survey results dashboard](https://delphi.cmu.edu/covidcast/survey-results/)
34+
provides a high-level summary of survey results. Geographically aggregated data
35+
from this survey is publicly available through the [COVIDcast API](../api/covidcast.md)
36+
as the [`fb-survey` data source](../api/covidcast-signals/fb-survey.md). Demographic breakdowns of survey
37+
data are publicly available as [downloadable contingency tables](contingency-tables.md).
38+
39+
CTIS data has been used in [numerous peer-reviewed publications](publications.md).
40+
3741
## Credits
3842

3943
The US COVID-19 Trends and Impact Survey (CTIS) is a project of the [Delphi

0 commit comments

Comments
 (0)