Skip to content

Commit f713e39

Browse files
authored
Merge pull request #1056 from cmu-delphi/release/delphi-epidata-0.4.4
Release Delphi Epidata 0.4.4
2 parents 9280f04 + c5777c6 commit f713e39

Some content is hidden

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

70 files changed

+360
-324
lines changed

.bumpversion.cfg

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

@@ -14,3 +14,5 @@ tag = False
1414
[bumpversion:file:src/client/packaging/pypi/setup.py]
1515

1616
[bumpversion:file:src/client/packaging/pypi/delphi_epidata/__init__.py]
17+
18+
[bumpversion:file:dev/local/setup.cfg]

.github/workflows/ci.yaml

-2
Original file line numberDiff line numberDiff line change
@@ -51,8 +51,6 @@ jobs:
5151

5252
- name: Build docker images
5353
run: |
54-
docker build -t delphi_database -f repos/delphi/operations/dev/docker/database/Dockerfile .
55-
docker build -t delphi_python -f repos/delphi/operations/dev/docker/python/Dockerfile .
5654
docker build -t delphi_database_epidata -f ./repos/delphi/delphi-epidata/dev/docker/database/epidata/Dockerfile .
5755
docker build -t delphi_web_python -f repos/delphi/delphi-epidata/dev/docker/python/Dockerfile .
5856
cd ./repos/delphi/delphi-epidata

dev/docker/database/epidata/Dockerfile

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ ENV MYSQL_ROOT_PASSWORD pass
1313
# create the `epidata` database
1414
ENV MYSQL_DATABASE epidata
1515

16-
# create the `epi` user account with a development-only password
16+
# create the `user` account with a development-only password
1717
ENV MYSQL_USER user
1818
ENV MYSQL_PASSWORD pass
1919

dev/docker/database/epidata/README.md

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
# `delphi_database_epidata`
22

3-
This image extends Delphi's database by:
3+
This image extends a Percona database by:
44

5-
- adding the `epi` user account
6-
- adding the `epidata` database
7-
- creating empty tables in `epidata`
5+
- adding the `user` account
6+
- adding the `epidata` & other appropriate databases
7+
- creating empty tables in those databases
88

99
To start a container from this image, run:
1010

dev/docker/python/Dockerfile

+10-3
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,11 @@
1-
# start with the `delphi_python` image
2-
FROM delphi_python
1+
FROM python:3.8-buster
32

4-
RUN pip install --no-cache-dir -r repos/delphi/delphi-epidata/requirements.txt -r repos/delphi/delphi-epidata/requirements.dev.txt
3+
WORKDIR /usr/src/app
4+
5+
COPY repos repos
6+
COPY repos/delphi/delphi-epidata/dev/docker/python/setup.sh .
7+
8+
RUN ln -s -f /usr/share/zoneinfo/America/New_York /etc/localtime && \
9+
chmod -R o+r repos/ && \
10+
bash setup.sh && \
11+
pip install --no-cache-dir -r repos/delphi/delphi-epidata/requirements.api.txt -r repos/delphi/delphi-epidata/requirements.dev.txt

dev/docker/python/setup.sh

+27
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
# This script sets up the correct directory structure within the `delphi_img`
2+
# docker image.
3+
4+
# Some notes on package structure:
5+
# - Python package names can't contain hyphens, so hyphens in repo names are
6+
# replaced with underscores in the package hierarchy. (An exception is the
7+
# repo `delphi-epidata`, which is renamed to simply `epidata`.)
8+
# - Repos are organized such that the main code for the package is inside of
9+
# a `src/` directory. When deployed, `src/` is elided. (An exception is the
10+
# legacy `undef-analysis` repo, which has sources at the top-level.)
11+
12+
# bail if anything fails
13+
set -e
14+
15+
# create python package `undefx`
16+
mkdir undefx
17+
mv repos/undefx/py3tester/src undefx/py3tester
18+
mv repos/undefx/undef-analysis undefx/undef_analysis
19+
20+
# create python package `delphi`
21+
mkdir delphi
22+
mv repos/delphi/operations/src delphi/operations
23+
mv repos/delphi/utils/src delphi/utils
24+
mv repos/delphi/github-deploy-repo/src delphi/github_deploy_repo
25+
mv repos/delphi/delphi-epidata/src delphi/epidata
26+
mv repos/delphi/flu-contest/src delphi/flu_contest
27+
mv repos/delphi/nowcast/src delphi/nowcast

dev/local/Makefile

+1-13
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,6 @@
77
#
88
# Checks for the delphi-net bridge and creates if it doesn't exist.
99
#
10-
# Creates all prereq images (delphi_database, delphi_python) only if they don't
11-
# exist. If you need to rebuild a prereq, you're probably doing something
12-
# complicated, and can figure out the rebuild command on your own.
13-
#
1410
#
1511
# Commands:
1612
#
@@ -78,7 +74,7 @@ web:
7874
@# Build the web_epidata image
7975
@cd repos/delphi/delphi-epidata;\
8076
docker build -t delphi_web_epidata -f ./devops/Dockerfile .;\
81-
cd ../../../
77+
cd -
8278

8379
@# Run the web server
8480
@docker run --rm -p 127.0.0.1:10080:80 \
@@ -97,10 +93,6 @@ db:
9793
@# Setup virtual network if it doesn't exist
9894
@docker network ls | grep delphi-net || docker network create --driver bridge delphi-net
9995

100-
@# Only build prereqs if we need them
101-
@docker images delphi_database | grep delphi || \
102-
docker build -t delphi_database -f repos/delphi/operations/dev/docker/database/Dockerfile .
103-
10496
@# Build the database_epidata image
10597
@docker build -t delphi_database_epidata \
10698
-f repos/delphi/delphi-epidata/dev/docker/database/epidata/Dockerfile .
@@ -120,10 +112,6 @@ db:
120112

121113
.PHONY=py
122114
py:
123-
@# Build the python image
124-
@docker build -t delphi_python \
125-
-f repos/delphi/operations/dev/docker/python/Dockerfile .
126-
127115
@docker build -t delphi_web_python \
128116
-f repos/delphi/delphi-epidata/dev/docker/python/Dockerfile .
129117

dev/local/setup.cfg

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

55
[options]
66
packages =

devops/Dockerfile

+12-12
Original file line numberDiff line numberDiff line change
@@ -5,25 +5,25 @@ RUN npm ci && npm run build
55

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

11-
COPY requirements.txt /app/requirements_also.txt
12-
RUN pip install --no-cache-dir -r /tmp/requirements.txt -r requirements_also.txt
9+
COPY ./devops/gunicorn_conf.py /app
10+
COPY ./devops/start_wrapper.sh /
11+
COPY ./src/server/ /app/app/
12+
COPY --from=builder ./src/build/lib/ /app/app/lib/
13+
14+
COPY requirements.api.txt /app/requirements_also.txt
15+
16+
RUN ln -s -f /usr/share/zoneinfo/America/New_York /etc/localtime \
17+
&& rm -rf /app/app/__pycache__ /app/app/*.php \
18+
&& chmod -R o+r /app/app \
19+
&& chmod 755 /start_wrapper.sh \
20+
&& pip install --no-cache-dir -r /tmp/requirements.txt -r requirements_also.txt
1321
# the file /tmp/requirements.txt is created in the parent docker definition. (see:
1422
# https://github.com/tiangolo/meinheld-gunicorn-docker/blob/master/docker-images/python3.8.dockerfile#L5 )
1523
# this combined requirements installation ensures all version constrants are accounted for.
1624

1725
# disable python stdout buffering
1826
ENV PYTHONUNBUFFERED 1
1927

20-
COPY ./devops/gunicorn_conf.py /app
21-
COPY ./devops/start_wrapper.sh /
22-
COPY ./src/server/ /app/app/
23-
COPY --from=builder ./src/build/lib/ /app/app/lib/
24-
RUN rm -rf /app/app/__pycache__ /app/app/*.php \
25-
&& chmod -R o+r /app/app \
26-
&& chmod 755 /start_wrapper.sh
27-
2828
ENTRYPOINT [ "/entrypoint.sh" ]
2929
CMD [ "/start_wrapper.sh" ]

docs/Gemfile.lock

+2-2
Original file line numberDiff line numberDiff line change
@@ -211,7 +211,7 @@ GEM
211211
jekyll-seo-tag (~> 2.1)
212212
minitest (5.14.4)
213213
multipart-post (2.1.1)
214-
nokogiri (1.13.9)
214+
nokogiri (1.13.10)
215215
mini_portile2 (~> 2.8.0)
216216
racc (~> 1.4)
217217
octokit (4.20.0)
@@ -220,7 +220,7 @@ GEM
220220
pathutil (0.16.2)
221221
forwardable-extended (~> 2.6)
222222
public_suffix (4.0.6)
223-
racc (1.6.0)
223+
racc (1.6.1)
224224
rb-fsevent (0.10.4)
225225
rb-inotify (0.10.1)
226226
ffi (~> 1.0)

docs/epidata_development.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -119,8 +119,8 @@ above. The base images are built first, followed by the derived
119119
the Epidata API to the `delphi_web` image.
120120
- The
121121
[`delphi_database_epidata` image](https://github.com/cmu-delphi/delphi-epidata/blob/main/dev/docker/database/epidata/README.md)
122-
adds the `epi` user account, `epidata` database, and relevant tables
123-
(initially empty) to the `delphi_database` image.
122+
adds user accounts, `epidata` & other appropriate databases, and relevant tables
123+
(initially empty) to a Percona database image.
124124

125125
From the root of your workspace, all of the images can be built as follows:
126126

docs/new_endpoint_tutorial.md

-2
Original file line numberDiff line numberDiff line change
@@ -277,8 +277,6 @@ docker build -t delphi_web \
277277
-f repos/delphi/operations/dev/docker/web/Dockerfile .
278278
docker build -t delphi_web_epidata \
279279
-f repos/delphi/delphi-epidata/dev/docker/web/epidata/Dockerfile .
280-
docker build -t delphi_database \
281-
-f repos/delphi/operations/dev/docker/database/Dockerfile .
282280
docker build -t delphi_database_epidata \
283281
-f repos/delphi/delphi-epidata/dev/docker/database/epidata/Dockerfile .
284282

integrations/server/test_covidcast.py

+32
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,18 @@ def _insert_placeholder_set_three(self):
6363
self._insert_rows(rows)
6464
return rows
6565

66+
def _insert_placeholder_set_four(self):
67+
rows = [
68+
self._make_placeholder_row(source='src1', signal=str(i)*5, value=i*1., stderr=i*10., sample_size=i*100.)[0]
69+
for i in [1, 2, 3]
70+
] + [
71+
# signal intended to overlap with the signal above
72+
self._make_placeholder_row(source='src2', signal=str(i-3)*5, value=i*1., stderr=i*10., sample_size=i*100.)[0]
73+
for i in [4, 5, 6]
74+
]
75+
self._insert_rows(rows)
76+
return rows
77+
6678
def test_round_trip(self):
6779
"""Make a simple round-trip with some sample data."""
6880

@@ -225,6 +237,26 @@ def test_location_wildcard(self):
225237
'message': 'success',
226238
})
227239

240+
def test_signal_wildcard(self):
241+
"""Select all signals with a wildcard query."""
242+
243+
# insert placeholder data
244+
rows = self._insert_placeholder_set_four()
245+
expected_signals = [
246+
self.expected_from_row(r) for r in rows[:3]
247+
]
248+
249+
# make the request
250+
response, _ = self.request_based_on_row(rows[0], signals="*")
251+
252+
self.maxDiff = None
253+
# assert that the right data came back
254+
self.assertEqual(response, {
255+
'result': 1,
256+
'epidata': expected_signals,
257+
'message': 'success',
258+
})
259+
228260
def test_geo_value(self):
229261
"""test different variants of geo types: single, *, multi."""
230262

Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
1+
epiweeks==2.1.2
2+
Flask==2.2.2
13
itsdangerous<2.1
24
jinja2==3.0.3
3-
werkzeug==2.2.2
4-
Flask==2.2.2
5-
SQLAlchemy==1.4.40
65
mysqlclient==2.1.1
7-
python-dotenv==0.15.0
6+
newrelic
87
orjson==3.4.7
98
pandas==1.2.3
9+
python-dotenv==0.15.0
1010
scipy==1.6.2
11+
SQLAlchemy==1.4.40
12+
structlog==22.1.0
1113
tenacity==7.0.0
12-
newrelic
13-
epiweeks==2.1.2
1414
typing-extensions
15-
structlog==22.1.0
15+
werkzeug==2.2.2

requirements.dev.txt

+22-5
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,25 @@
1-
invoke>=1.4.1
1+
aiohttp==3.8.3
22
black>=20.8b1
3-
sqlalchemy-stubs>=0.3
3+
bump2version==1.0.1
4+
covidcast==0.1.5
5+
delphi_utils==0.3.6
6+
docker==6.0.1
7+
dropbox==11.36.0
8+
freezegun==1.2.2
9+
invoke>=1.4.1
10+
lxml==4.9.1
11+
matplotlib==3.6.2
412
mypy>=0.790
5-
pytest
13+
mysql-connector==2.2.9
14+
numpy==1.22.4
15+
pycountry==22.3.5
16+
pymysql==1.0.2
17+
pytest==7.2.0
18+
pytest-check==1.3.0
19+
requests==2.28.1
20+
sas7bdat==2.2.3
21+
selenium==4.7.2
22+
sqlalchemy-stubs>=0.3
23+
structlog==22.1.0
624
tenacity==7.0.0
7-
bump2version
8-
requests
25+
xlrd==2.0.1

0 commit comments

Comments
 (0)