Skip to content

Commit 2748d2b

Browse files
authored
Merge pull request #1770 from cmu-delphi/release/indicators_v0.3.29_utils_v0.3.8
Release covidcast-indicators 0.3.29
2 parents e61b4fb + 99c7459 commit 2748d2b

File tree

118 files changed

+527
-4469
lines changed

Some content is hidden

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

118 files changed

+527
-4469
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.3.28
2+
current_version = 0.3.29
33
commit = True
44
message = chore: bump covidcast-indicators to {new_version}
55
tag = False

.github/workflows/python-ci.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ jobs:
1616
if: github.event.pull_request.draft == false
1717
strategy:
1818
matrix:
19-
packages: [_delphi_utils_python, changehc, claims_hosp, combo_cases_and_deaths, doctor_visits, dsew_community_profile, google_symptoms, hhs_hosp, hhs_facilities, jhu, nchs_mortality, nowcast, quidel, quidel_covidtest, safegraph_patterns, sir_complainsalot, usafacts]
19+
packages: [_delphi_utils_python, changehc, claims_hosp, doctor_visits, dsew_community_profile, google_symptoms, hhs_hosp, hhs_facilities, jhu, nchs_mortality, nowcast, quidel, quidel_covidtest, safegraph_patterns, sir_complainsalot]
2020
defaults:
2121
run:
2222
working-directory: ${{ matrix.packages }}

Jenkinsfile

Lines changed: 23 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,26 +9,43 @@
99
- Keep in sync with '.github/workflows/python-ci.yml'.
1010
- TODO: #527 Get this list automatically from python-ci.yml at runtime.
1111
*/
12-
def indicator_list = ["backfill_corrections", "changehc", "claims_hosp", "google_symptoms", "hhs_hosp", "jhu", "nchs_mortality", "quidel", "quidel_covidtest", "safegraph_patterns", "sir_complainsalot", "usafacts", "dsew_community_profile", "doctor_visits"]
13-
def build_package = [:]
12+
13+
def indicator_list = ["backfill_corrections", "changehc", "claims_hosp", "google_symptoms", "hhs_hosp", "jhu", "nchs_mortality", "quidel", "quidel_covidtest", "safegraph_patterns", "sir_complainsalot", "dsew_community_profile", "doctor_visits"]
14+
def build_package_main = [:]
15+
def build_package_prod = [:]
1416
def deploy_staging = [:]
1517
def deploy_production = [:]
1618

1719
pipeline {
1820
agent any
1921
stages {
20-
stage('Build and Package') {
22+
stage('Build and Package main') {
2123
when {
2224
branch "main";
2325
}
2426
steps {
2527
script {
2628
indicator_list.each { indicator ->
27-
build_package[indicator] = {
28-
sh "jenkins/build-and-package.sh ${indicator}"
29+
build_package_main[indicator] = {
30+
sh "jenkins/build-and-package.sh ${indicator} main"
31+
}
32+
}
33+
parallel build_package_main
34+
}
35+
}
36+
}
37+
stage('Build and Package prod') {
38+
when {
39+
branch "prod";
40+
}
41+
steps {
42+
script {
43+
indicator_list.each { indicator ->
44+
build_package_prod[indicator] = {
45+
sh "jenkins/build-and-package.sh ${indicator} prod"
2946
}
3047
}
31-
parallel build_package
48+
parallel build_package_prod
3249
}
3350
}
3451
}

_delphi_utils_python/.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.3.7
2+
current_version = 0.3.8
33
commit = True
44
message = chore: bump delphi_utils to {new_version}
55
tag = False

_delphi_utils_python/delphi_utils/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,4 +15,4 @@
1515
from .nancodes import Nans
1616
from .weekday import Weekday
1717

18-
__version__ = "0.3.7"
18+
__version__ = "0.3.8"

_delphi_utils_python/delphi_utils/validator/params.json.template

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"validation": {
33
"global": {
4-
"data_source": "usa-facts",
4+
"data_source": "jhu-csse",
55
"end_date": "2020-09-08",
66
"span_length": 3,
77
"suppressed_errors": [

_delphi_utils_python/delphi_utils/validator/static.py

Lines changed: 27 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -90,28 +90,34 @@ def check_missing_date_files(self, daily_filenames, report):
9090
Returns:
9191
- None
9292
"""
93-
# Create set of all dates seen in CSV names.
94-
unique_dates = {datetime.strptime(
95-
daily_filename[0][0:8], '%Y%m%d').date() for daily_filename in daily_filenames}
96-
97-
# Diff expected and observed dates.
98-
expected_dates = self.params.time_window.date_seq
99-
100-
if len(self.params.max_expected_lag) == 0:
101-
max_expected_lag_overall = 10
102-
else:
103-
max_expected_lag_overall = max(self.params.max_expected_lag.values())
104-
105-
# Only check for date if it should definitely be present,
106-
# i.e if it is more than max_expected_lag since the checking date
107-
expected_dates = [date for date in expected_dates if
108-
((datetime.today().date() - date).days) > max_expected_lag_overall]
109-
check_dateholes = list(set(expected_dates).difference(unique_dates))
110-
check_dateholes.sort()
111-
112-
if check_dateholes:
93+
# Check to see if there are any files in the export directory
94+
# Validator will throw an error if the directory is empty, which can be suppressed
95+
if len(daily_filenames) == 0:
11396
report.add_raised_error(
114-
ValidationFailure("check_missing_date_files",
97+
ValidationFailure("check_empty_filelist",
98+
message="No files found in export directory"))
99+
# Check for missing date only happens when files are found
100+
else:
101+
# Create set of all dates seen in CSV names.
102+
unique_dates = {datetime.strptime(
103+
daily_filename[0][0:8], '%Y%m%d').date() for daily_filename in daily_filenames}
104+
# Diff expected and observed dates.
105+
expected_dates = self.params.time_window.date_seq
106+
if len(self.params.max_expected_lag) == 0:
107+
max_expected_lag_overall = 10
108+
else:
109+
max_expected_lag_overall = max(self.params.max_expected_lag.values())
110+
111+
# Only check for date if it should definitely be present,
112+
# i.e if it is more than max_expected_lag since the checking date
113+
expected_dates = [date for date in expected_dates if
114+
((datetime.today().date() - date).days) > max_expected_lag_overall]
115+
check_dateholes = list(set(expected_dates).difference(unique_dates))
116+
check_dateholes.sort()
117+
118+
if check_dateholes:
119+
report.add_raised_error(
120+
ValidationFailure("check_missing_date_files",
115121
message="Missing dates are observed; if these dates are already "
116122
"in the API they would not be updated"))
117123

_delphi_utils_python/delphi_utils/validator/validate.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,10 @@ def validate(self):
5858
frames_list = load_all_files(self.export_dir, self.time_window.start_date,
5959
self.time_window.end_date)
6060
self.static_validation.validate(frames_list, report)
61-
all_frames = aggregate_frames(frames_list)
61+
# Check if frames_list is empty before calling aggregate_frames
62+
if len(frames_list) == 0:
63+
all_frames = []
64+
else:
65+
all_frames = aggregate_frames(frames_list)
6266
self.dynamic_validation.validate(all_frames, report)
6367
return report

_delphi_utils_python/setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626

2727
setup(
2828
name="delphi_utils",
29-
version="0.3.7",
29+
version="0.3.8",
3030
description="Shared Utility Functions for Indicators",
3131
long_description=long_description,
3232
long_description_content_type="text/markdown",

_delphi_utils_python/tests/validator/test_static.py

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,9 +27,29 @@ def test_empty_filelist(self):
2727
filenames = list()
2828
validator.check_missing_date_files(filenames, report)
2929

30+
assert len(report.raised_errors) == 1
31+
assert report.raised_errors[0].check_name == "check_empty_filelist"
32+
33+
def test_missing_date_files(self):
34+
params = {
35+
"common": {
36+
"data_source": "",
37+
"span_length": 5,
38+
"end_date": "2020-09-05",
39+
"max_expected_lag": {"all": "1"}
40+
}
41+
}
42+
validator = StaticValidator(params)
43+
report = ValidationReport([])
44+
filenames = [("20200901_county_signal_signal.csv", "match_obj"),
45+
("20200903_county_signal_signal.csv", "match_obj"),
46+
("20200904_county_signal_signal.csv", "match_obj"),
47+
("20200905_county_signal_signal.csv", "match_obj")]
48+
validator.check_missing_date_files(filenames, report)
3049
assert len(report.raised_errors) == 1
3150
assert report.raised_errors[0].check_name == "check_missing_date_files"
3251

52+
3353
def test_same_day(self):
3454
params = {
3555
"common": {

ansible/ansible-deploy-staging.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
tasks:
77
- name: Copy and unarchive the package into the indicators runtime host directory.
88
unarchive:
9-
src: "{{ jenkins_artifact_dir }}/{{ package }}"
9+
src: "{{ jenkins_artifact_dir }}/{{ package_staging }}"
1010
dest: "{{ indicators_runtime_dir }}"
1111
owner: "{{ runtime_user }}"
1212
group: "{{ runtime_user }}"

ansible/ansible-deploy.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
tasks:
77
- name: Copy and unarchive the package into the indicators runtime host directory.
88
unarchive:
9-
src: "{{ jenkins_artifact_dir }}/{{ package }}"
9+
src: "{{ jenkins_artifact_dir }}/{{ package_production }}"
1010
dest: "{{ indicators_runtime_dir }}"
1111
owner: "{{ runtime_user }}"
1212
group: "{{ runtime_user }}"

ansible/templates/claims_hosp-params-prod.json.j2

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@
88
"start_date": "2020-02-01",
99
"end_date": null,
1010
"drop_date": null,
11+
"backfill_dir": "/common/backfill/claims_hosp",
12+
"backfill_merge_day": 0,
1113
"n_backfill_days": 70,
1214
"n_waiting_days": 3,
1315
"write_se": false,

ansible/templates/covid_act_now-params-prod.json.j2

Lines changed: 0 additions & 51 deletions
This file was deleted.

ansible/templates/sir_complainsalot-params-prod.json.j2

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -28,11 +28,6 @@
2828
"sum_anosmia_ageusia_smoothed_search"
2929
]
3030
},
31-
"usa-facts": {
32-
"max_age": 5,
33-
"maintainers": ["U01AP8GSWG3","U01069KCRS7"],
34-
"retired-signals": ["confirmed_7dav_cumulative_num", "confirmed_7dav_cumulative_prop", "deaths_7dav_cumulative_num", "deaths_7dav_cumulative_prop"]
35-
},
3631
"jhu-csse": {
3732
"max_age": 2,
3833
"maintainers": ["U01AP8GSWG3","U01069KCRS7"],

ansible/templates/usafacts-params-prod.json.j2

Lines changed: 0 additions & 55 deletions
This file was deleted.

ansible/vars.yaml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,8 @@ runtime_user: "indicators"
66
jenkins_user: "jenkins"
77
jenkins_artifact_dir: "/var/lib/jenkins/artifacts"
88
indicators_runtime_dir: "/home/{{ runtime_user }}/runtime"
9-
package: "{{ indicator }}.tar.gz" # {{ indicator }} is passed in from the Jenkins shell script wrapper.
9+
package_staging: "main_{{ indicator }}.tar.gz" # {{ indicator }} is passed in from the Jenkins shell script wrapper.
10+
package_production: "prod_{{ indicator }}.tar.gz" # {{ indicator }} is passed in from the Jenkins shell script wrapper.
1011
python_version: "3.8.2"
1112
pyenv_python_path: "/home/{{ runtime_user }}/.pyenv/versions/{{ python_version }}/bin/python"
1213

0 commit comments

Comments
 (0)