Skip to content

Commit 6608147

Browse files
authored
Merge branch 'dev' into #848
2 parents fd2e13f + f51a4a2 commit 6608147

File tree

215 files changed

+9781
-9373
lines changed

Some content is hidden

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

215 files changed

+9781
-9373
lines changed

.bumpversion.cfg

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

.dockerignore

+4-3
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
/delphi-epidata
2-
/.mypy_cache
2+
**/.mypy_cache
33
/.github
44
/docs
5-
__pycache__
6-
/node_modules
5+
**/__pycache__
6+
**/.pytest_cache
7+
**/node_modules

.editorconfig

+22
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
# EditorConfig helps developers define and maintain consistent
2+
# coding styles between different editors and IDEs
3+
# editorconfig.org
4+
5+
root = true
6+
7+
[*]
8+
# We recommend you to keep these unchanged
9+
end_of_line = lf
10+
charset = utf-8
11+
trim_trailing_whitespace = true
12+
insert_final_newline = true
13+
14+
15+
[*.py]
16+
# Change these settings to your own preference
17+
indent_style = space
18+
indent_size = 4
19+
20+
21+
[*.md]
22+
trim_trailing_whitespace = false

.env.example

+3-15
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,6 @@
11
FLASK_DEBUG=True
22
SQLALCHEMY_DATABASE_URI=sqlite:///test.db
33
FLASK_SECRET=abc
4-
SECRET_TWITTER=abc
5-
SECRET_GHT=abc
6-
SECRET_FLUVIEW=abc
7-
SECRET_CDC=abc
8-
SECRET_SENSORS=abc
9-
SECRET_SENSOR_TWTR=abc
10-
SECRET_SENSOR_GFT=abc
11-
SECRET_SENSOR_GHT=abc
12-
SECRET_SENSOR_GHTJ=abc
13-
SECRET_SENSOR_CDC=abc
14-
SECRET_SENSOR_QUID=abc
15-
SECRET_SENSOR_WIKI=abc
16-
SECRET_QUIDEL=abc
17-
SECRET_NOROSTAT=abc
18-
SECRET_AFHSB=abc
4+
#API_KEY_REQUIRED_STARTING_AT=2021-07-30
5+
API_KEY_ADMIN_PASSWORD=abc
6+
API_KEY_REGISTER_WEBHOOK_TOKEN=abc

.git-blame-ignore-revs

+24
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
# style(black): format cdc acquisition
2+
980b0b7e80c7923b79e14fee620645e680785703
3+
# style(black): format covidcast_nowcast acquisition
4+
9e6ff16f599e8feec34a08dd1bddbc5eae347b55
5+
# style(black): format ecdc acquisition
6+
d1141d904da4e62992b97c92d5caebd8fadffd42
7+
# style(black): format flusurv acquisition
8+
08af0f6b7bff85bbc2b193b63b5abf6a16ba03e4
9+
# style(black): format fluview acquisition
10+
0133ef2042c4df8867e91595eb1f64873edb4632
11+
# style(black): format ght acquisition
12+
b8900a0bc846888885310911efd6e26459effa99
13+
# style(black): format kcdc acquisition
14+
a849384c884934b3b7c3c67b68aa6240277d6b6d
15+
# style(black): format nidss acquisition
16+
d04af3c02fda7708a16bec0952b1aa7475acaec7
17+
# style(black): format paho acquisition
18+
7f60fbba572c1b6e5153a9ef216895bdc2f7f5b3
19+
# style(black): format quidel acquisition
20+
b9ceb400d9248c8271e8342275664ac5524e335d
21+
# style(black): format twitter acquisition
22+
07ed83e5768f717ab0f9a62a9209e4e2cffa058d
23+
# style(black): format wiki acquisition
24+
923852eafa86b8f8b182d499489249ba8f815843

.github/workflows/ci.yaml

+14-6
Original file line numberDiff line numberDiff line change
@@ -53,24 +53,31 @@ jobs:
5353
run: |
5454
docker build -t delphi_database_epidata -f ./repos/delphi/delphi-epidata/dev/docker/database/epidata/Dockerfile .
5555
docker build -t delphi_web_python -f repos/delphi/delphi-epidata/dev/docker/python/Dockerfile .
56+
sudo docker build -t delphi_redis -f repos/delphi/delphi-epidata/dev/docker/redis/Dockerfile .
5657
cd ./repos/delphi/delphi-epidata
5758
docker build -t delphi_web_epidata -f ./devops/Dockerfile .
5859
cd ../../../
5960
6061
# MODULE_NAME specifies the location of the `app` variable, the actual WSGI application object to run.
6162
# see https://github.com/tiangolo/meinheld-gunicorn-docker#module_name
62-
- name: Start services
63+
- name: Start database and Redis services
6364
run: |
6465
docker network create --driver bridge delphi-net
6566
docker run --rm -d -p 13306:3306 --network delphi-net --name delphi_database_epidata --cap-add=sys_nice delphi_database_epidata
66-
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" --network delphi-net --name delphi_web_epidata delphi_web_epidata
67-
docker ps
67+
docker run --rm -d -p 6379:6379 --network delphi-net --env "REDIS_PASSWORD=1234" --name delphi_redis delphi_redis
68+
6869
6970
- run: |
7071
wget https://raw.githubusercontent.com/eficode/wait-for/master/wait-for
7172
chmod +x wait-for
7273
./wait-for localhost:13306 -- echo 'ready'
7374
sleep 10s
75+
76+
- name: Start delphi_web_epidata
77+
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" --env "TESTING_MODE=True" --network delphi-net --name delphi_web_epidata delphi_web_epidata
79+
docker ps
80+
7481
- name: Run Unit Tests
7582
run: |
7683
docker run --rm --network delphi-net --env "SQLALCHEMY_DATABASE_URI=mysql+mysqldb://user:pass@delphi_database_epidata:3306/epidata" --env "FLASK_SECRET=abc" delphi_web_python python -m pytest --import-mode importlib repos/delphi/delphi-epidata/tests
@@ -81,7 +88,7 @@ jobs:
8188
8289
- name: Clean Up
8390
run: |
84-
docker stop delphi_database_epidata delphi_web_epidata
91+
docker stop delphi_database_epidata delphi_web_epidata delphi_redis
8592
docker network remove delphi-net
8693
8794
build_js_client:
@@ -94,7 +101,7 @@ jobs:
94101
uses: actions/checkout@v2
95102
- uses: actions/setup-node@v2
96103
with:
97-
node-version: '14.x'
104+
node-version: '16.x'
98105
- name: Cache Node.js modules
99106
uses: actions/cache@v2
100107
with:
@@ -108,7 +115,8 @@ jobs:
108115
image:
109116
needs: build
110117
# only on main and dev branch
111-
if: github.ref == 'refs/heads/main' || github.ref == 'refs/heads/dev'
118+
# TODO: #1112 Remove `|| github.ref == 'refs/heads/api-keys'` after transition to production status.
119+
if: github.ref == 'refs/heads/main' || github.ref == 'refs/heads/dev' || github.ref == 'refs/heads/api-keys'
112120

113121
runs-on: ubuntu-latest
114122
steps:

.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 }}.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
name: Dependabot auto-assign reviewer
2+
on: pull_request
3+
4+
permissions:
5+
pull-requests: write
6+
7+
jobs:
8+
dependabot:
9+
runs-on: ubuntu-latest
10+
env:
11+
GH_TOKEN: ${{ secrets.CMU_DELPHI_AUTOMATION_MACHINE_DEPENDABOT_PAT }}
12+
if: ${{ github.actor == 'dependabot[bot]' }}
13+
steps:
14+
- name: Assign team to PR
15+
run: gh pr edit "$PR_URL" --add-reviewer "cmu-delphi/code-reviewers"
16+
env:
17+
PR_URL: ${{github.event.pull_request.html_url}}

.github/workflows/performance-tests.yml

+4-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 }}
@@ -60,6 +61,7 @@ jobs:
6061
run: |
6162
cd ../driver
6263
sudo make web sql="${{ secrets.DB_CONN_STRING }}"
64+
sudo make redis
6365
- name: Check out delphi-admin
6466
uses: actions/checkout@v3
6567
with:
@@ -71,7 +73,7 @@ jobs:
7173
run: |
7274
cd delphi-admin/load-testing/locust
7375
docker build -t locust .
74-
export CSV=v4-requests-as_of.csv
76+
export CSV=v4-requests-small.csv
7577
touch output_stats.csv && chmod 666 output_stats.csv
7678
touch output_stats_history.csv && chmod 666 output_stats_history.csv
7779
touch output_failures.csv && chmod 666 output_failures.csv

.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

+10-18
Original file line numberDiff line numberDiff line change
@@ -138,15 +138,6 @@
138138
"add-header-comment": true
139139
},
140140

141-
"// acquisition - norostat",
142-
{
143-
"type": "move",
144-
"src": "src/acquisition/norostat/",
145-
"dst": "[[package]]/acquisition/norostat/",
146-
"match": "^.*\\.(py)$",
147-
"add-header-comment": true
148-
},
149-
150141
"// acquisition - paho",
151142
{
152143
"type": "move",
@@ -174,15 +165,6 @@
174165
"add-header-comment": true
175166
},
176167

177-
"// acquisition - afhsb",
178-
{
179-
"type": "move",
180-
"src": "src/acquisition/afhsb/",
181-
"dst": "[[package]]/acquisition/afhsb/",
182-
"match": "^.*\\.(py)$",
183-
"add-header-comment": true
184-
},
185-
186168
"// acquisition - covidcast",
187169
{
188170
"type": "move",
@@ -235,6 +217,16 @@
235217
"add-header-comment": true
236218
},
237219

220+
"// maintenance",
221+
{
222+
"type": "move",
223+
"src": "src/maintenance/",
224+
"dst": "[[package]]/maintenance/",
225+
"match": "^.*\\.(py)$",
226+
"recursive": true,
227+
"add-header-comment": true
228+
},
229+
238230
"// move flask tests out of the way",
239231
{
240232
"type": "move",

dev/docker/python/Dockerfile

+2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
FROM python:3.8-buster
22

3+
RUN apt-get update && apt-get install -y r-base && Rscript -e "install.packages(c('httr','xml2'))"
4+
35
WORKDIR /usr/src/app
46

57
COPY repos repos

dev/docker/redis/Dockerfile

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
FROM redis
2+
3+
ENV REDIS_PASSWORD=$REDIS_PASSWORD
4+
5+
CMD ["sh", "-c", "exec redis-server --requirepass \"$REDIS_PASSWORD\""]

dev/local/Makefile

+36-1
Original file line numberDiff line numberDiff line change
@@ -64,8 +64,10 @@ CWD:=$(dir $(abspath $(lastword $(MAKEFILE_LIST))))
6464
NOW:=$(shell date "+%Y-%m-%d")
6565
LOG_WEB:=delphi_web_epidata_$(NOW).log
6666
LOG_DB:=delphi_database_epidata_$(NOW).log
67+
LOG_REDIS:=delphi_redis_instance_$(NOW).log
6768
WEB_CONTAINER_ID:=$(shell docker ps -q --filter 'name=delphi_web_epidata')
6869
DATABASE_CONTAINER_ID:=$(shell docker ps -q --filter 'name=delphi_database_epidata')
70+
REDIS_CONTAINER_ID:=$(shell docker ps -q --filter 'name=delphi_redis')
6971

7072
M1=
7173
ifeq ($(shell uname -smp), Darwin arm64 arm)
@@ -98,6 +100,11 @@ web:
98100
--env "MODULE_NAME=delphi.epidata.server.main" \
99101
--env "SQLALCHEMY_DATABASE_URI=$(sqlalchemy_uri)" \
100102
--env "FLASK_SECRET=abc" --env "FLASK_PREFIX=/epidata" --env "LOG_DEBUG" \
103+
--env "REDIS_HOST=delphi_redis" \
104+
--env "REDIS_PASSWORD=1234" \
105+
--env "API_KEY_ADMIN_PASSWORD=test_admin_password" \
106+
--env "API_KEY_REGISTER_WEBHOOK_TOKEN=abc" \
107+
--env "TESTING_MODE=True" \
101108
--network delphi-net --name delphi_web_epidata \
102109
delphi_web_epidata >$(LOG_WEB) 2>&1 &
103110

@@ -136,8 +143,25 @@ py:
136143
$(M1) \
137144
-f repos/delphi/delphi-epidata/dev/docker/python/Dockerfile .
138145

146+
.PHONY=redis
147+
redis:
148+
@# Stop container if running
149+
@if [ $(REDIS_CONTAINER_ID) ]; then\
150+
docker stop $(REDIS_CONTAINER_ID);\
151+
fi
152+
153+
@docker build -t delphi_redis \
154+
$(M1) \
155+
-f repos/delphi/delphi-epidata/dev/docker/redis/Dockerfile .
156+
157+
@docker run --rm -d -p 127.0.0.1:6379:6379 \
158+
$(M1) \
159+
--network delphi-net \
160+
--env "REDIS_PASSWORD=1234" \
161+
--name delphi_redis delphi_redis >$(LOG_REDIS) 2>&1 &
162+
139163
.PHONY=all
140-
all: db web py
164+
all: db web py redis
141165

142166
.PHONY=test
143167
test:
@@ -149,6 +173,17 @@ test:
149173
--env "FLASK_SECRET=abc" \
150174
delphi_web_python python -m pytest --import-mode importlib $(pdb) $(test) | tee test_output_$(NOW).log
151175

176+
.PHONY=r-test
177+
r-test:
178+
@docker run -i --rm --network delphi-net \
179+
$(M1) \
180+
--mount type=bind,source=$(CWD)repos/delphi/delphi-epidata,target=/usr/src/app/repos/delphi/delphi-epidata,readonly \
181+
--mount type=bind,source=$(CWD)repos/delphi/delphi-epidata/src,target=/usr/src/app/delphi/epidata,readonly \
182+
--env "SQLALCHEMY_DATABASE_URI=$(sqlalchemy_uri)" \
183+
--env "FLASK_SECRET=abc" \
184+
delphi_web_python Rscript repos/delphi/delphi-epidata/integrations/client/test_delphi_epidata.R | tee r-test_output_$(NOW).log
185+
186+
152187
.PHONY=bash
153188
bash:
154189
@docker run -it --rm --network delphi-net \

dev/local/setup.cfg

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,11 @@
11
[metadata]
22
name = Delphi Development
3-
version = 0.4.9
3+
version = 4.1.10
44

55
[options]
66
packages =
77
delphi.epidata
88
delphi.epidata.acquisition
9-
delphi.epidata.acquisition.afhsb
109
delphi.epidata.acquisition.cdcp
1110
delphi.epidata.acquisition.covid_hosp
1211
delphi.epidata.acquisition.covid_hosp.common
@@ -21,13 +20,14 @@ packages =
2120
delphi.epidata.acquisition.ght
2221
delphi.epidata.acquisition.kcdc
2322
delphi.epidata.acquisition.nidss
24-
delphi.epidata.acquisition.norostat
2523
delphi.epidata.acquisition.paho
2624
delphi.epidata.acquisition.quidel
2725
delphi.epidata.acquisition.twtr
2826
delphi.epidata.acquisition.wiki
2927
delphi.epidata.client
3028
delphi.epidata.server
29+
delphi.epidata.server.admin
30+
delphi.epidata.server.admin.templates
3131
delphi.epidata.server.covidcast_issues_migration
3232
delphi.epidata.server.endpoints
3333
delphi.epidata.server.endpoints.covidcast_utils

0 commit comments

Comments
 (0)