Skip to content

Commit 6dcafa9

Browse files
authored
Merge branch 'main' into backfill/claims_hosp
2 parents 530b687 + 3704566 commit 6dcafa9

File tree

763 files changed

+5443
-266861
lines changed

Some content is hidden

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

763 files changed

+5443
-266861
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.19
2+
current_version = 0.3.28
33
commit = True
44
message = chore: bump covidcast-indicators to {new_version}
55
tag = False

.github/workflows/r-ci.yml renamed to .github/workflows/backfill-corr-ci.yml

Lines changed: 21 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
# See https://github.com/r-lib/actions/tree/master/examples#readme for
77
# additional example workflows available for the R community.
88

9-
name: R facebook survey
9+
name: R backfill corrections
1010

1111
on:
1212
push:
@@ -21,10 +21,10 @@ jobs:
2121
if: github.event.pull_request.draft == false
2222
strategy:
2323
matrix:
24-
r-version: [4.0]
24+
r-version: [4.2.1]
2525
defaults:
2626
run:
27-
working-directory: facebook/delphiFacebook
27+
working-directory: backfill_corrections/delphiBackfillCorrection
2828

2929
steps:
3030
- uses: actions/checkout@v2
@@ -34,7 +34,13 @@ jobs:
3434
r-version: ${{ matrix.r-version }}
3535
- name: Install linux dependencies
3636
run: |
37-
sudo apt-get install libcurl4-openssl-dev
37+
sudo apt-get install \
38+
libcurl4-openssl-dev \
39+
libgdal-dev \
40+
libudunits2-dev \
41+
libglpk-dev \
42+
libharfbuzz-dev \
43+
libfribidi-dev
3844
- name: Get date
3945
id: get-date
4046
run: |
@@ -43,17 +49,25 @@ jobs:
4349
uses: actions/cache@v2
4450
with:
4551
path: ${{ env.R_LIBS_USER }}
46-
key: ${{ runner.os }}-r-facebook-survey-${{ steps.get-date.outputs.date }}
52+
key: ${{ runner.os }}-r-backfillcorr-${{ steps.get-date.outputs.date }}
4753
restore-keys: |
48-
${{ runner.os }}-r-facebook-survey-
54+
${{ runner.os }}-r-backfillcorr-
4955
- name: Install R dependencies
56+
env:
57+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
5058
run: |
5159
if ( !require("remotes") ) {
5260
install.packages("remotes")
5361
}
54-
remotes::update_packages(c("rcmdcheck", "mockr", "remotes"), upgrade="always")
62+
if ( !require("devtools") ) {
63+
install.packages("devtools")
64+
}
65+
remotes::update_packages(c("rcmdcheck", "remotes", "devtools"), upgrade="always")
5566
dependency_list <- remotes::dev_package_deps(dependencies=TRUE)
5667
remotes::update_packages(dependency_list$package, upgrade="always")
68+
69+
devtools::install_github("cmu-delphi/covidcast", ref = "evalcast", subdir = "R-packages/evalcast")
70+
devtools::install_github(repo="ryantibs/quantgen", subdir="quantgen")
5771
shell: Rscript {0}
5872
- name: Check
5973
run: |

.github/workflows/build-container-images.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ jobs:
99
runs-on: ubuntu-latest
1010
strategy:
1111
matrix:
12-
packages: [ facebook ]
12+
packages: [ backfill_corrections ]
1313
steps:
1414
- name: Checkout code
1515
uses: actions/checkout@v2

.github/workflows/create-release.yml

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,13 @@ jobs:
5858
id: indicators
5959
run: |
6060
echo -n "::set-output name=version::"
61-
bump2version --list ${{ github.event.inputs.versionName }} | grep ^new_version | sed -r s,"^.*=",,
61+
bump2version --list ${{ github.event.inputs.versionName }} | grep ^new_version | sed -r s,"^.*=",,
62+
- name: Copy version to indicator directory
63+
run: |
64+
indicator_list=("changehc" "claims_hosp" "doctor_visits" "dsew_community_profile" "google_symptoms" "hhs_hosp" "jhu" "nchs_mortality" "nowcast" "quidel_covidtest" "sir_complainsalot")
65+
for path in ${indicator_list[@]}; do
66+
echo "current_version = ${{ steps.indicators.outputs.version }}" > $path/version.cfg
67+
done
6268
- name: Create pull request into prod
6369
uses: peter-evans/create-pull-request@v3
6470
with:

.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, 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]
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 = ["changehc", "claims_hosp", "facebook", "google_symptoms", "hhs_hosp", "jhu", "nchs_mortality", "quidel", "quidel_covidtest", "safegraph_patterns", "sir_complainsalot", "usafacts", "dsew_community_profile"]
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.5
2+
current_version = 0.3.7
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.5"
18+
__version__ = "0.3.7"

_delphi_utils_python/delphi_utils/runner.py

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
"""Indicator running utilities."""
22
import argparse as ap
33
import importlib
4+
import os
45
from typing import Any, Callable, Dict, Optional
56
from .archive import ArchiveDiffer, archiver_from_params
67
from .logger import get_structured_logger
@@ -40,6 +41,21 @@ def run_indicator_pipeline(indicator_fn: Callable[[Params], None],
4041
name=indicator_fn.__module__,
4142
filename=params["common"].get("log_filename", None),
4243
log_exceptions=params["common"].get("log_exceptions", True))
44+
45+
#Get version and indicator name for startup
46+
ind_name = indicator_fn.__module__.replace(".run", "")
47+
#Check for version.cfg in indicator directory
48+
if os.path.exists("version.cfg"):
49+
with open("version.cfg") as ver_file:
50+
current_version = "not found"
51+
for line in ver_file:
52+
if "current_version" in line:
53+
current_version = str.strip(line)
54+
current_version = current_version.replace("current_version = ", "")
55+
#Logging - Starting Indicator
56+
logger.info(f"Started {ind_name} with covidcast-indicators version {current_version}")
57+
else: logger.info(f"Started {ind_name} without version.cfg")
58+
4359
indicator_fn(params)
4460
validator = validator_fn(params)
4561
archiver = archiver_fn(params)

_delphi_utils_python/delphi_utils/validator/dynamic.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
import re
66
import pandas as pd
77
import numpy as np
8-
from .errors import ValidationFailure, APIDataFetchError
8+
from .errors import ValidationFailure
99
from .datafetcher import get_geo_signal_combos, threaded_api_calls
1010
from .utils import relative_difference_by_min, TimeWindow, lag_converter
1111

@@ -116,7 +116,7 @@ def validate(self, all_frames, report):
116116
api_df_or_error = all_api_df[(geo_type, signal_type)]
117117

118118
report.increment_total_checks()
119-
if isinstance(api_df_or_error, APIDataFetchError):
119+
if not isinstance(api_df_or_error, pd.DataFrame):
120120
report.add_raised_error(api_df_or_error)
121121
continue
122122

_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/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.5",
29+
version="0.3.7",
3030
description="Shared Utility Functions for Indicators",
3131
long_description=long_description,
3232
long_description_content_type="text/markdown",

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 }}"
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
{
2+
"ref_lag": 60,
3+
"input_dir": "/common/backfill/",
4+
"cache_dir": "./cache",
5+
"testing_window": 1,
6+
"training_days": 270,
7+
"lag_pad":2,
8+
"export_dir": "./receiving",
9+
"geo_levels": ["state", "county"],
10+
"value_types": ["count", "fraction"],
11+
"num_col": "num",
12+
"denom_col": "den",
13+
"post": {
14+
"aws_credentials": {
15+
"aws_access_key_id": "{{ backfillcorr_aws_access_key_id }}",
16+
"aws_secret_access_key": "{{ backfillcorr_aws_secret_access_key }}"
17+
},
18+
"bucket_name": "{{ backfillcorr_aws_bucket_name }}"
19+
},
20+
"gurobi": {
21+
"GRB_LICENSEID": "{{ grb_licenseid }}",
22+
"GRB_WLSACCESSID": "{{ grb_wlsaccessid }}",
23+
"GRB_WLSSECRET": "{{ grb_wlssecret }}"
24+
}
25+
}

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@
1616
"start_date": null,
1717
"end_date": null,
1818
"drop_date": null,
19+
"backfill_dir": "/common/backfill/chng",
20+
"backfill_merge_day": 0,
1921
"n_backfill_days": 60,
2022
"n_waiting_days": 3,
2123
"se": false,

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"common": {
3-
"export_dir": "./common/covidcast/receiving/claims_hosp",
3+
"export_dir": "/common/covidcast/receiving/hospital-admissions/",
44
"log_exceptions": false
55
},
66
"indicator": {
@@ -15,7 +15,7 @@
1515
"write_se": false,
1616
"obfuscated_prefix": "foo_obfuscated",
1717
"parallel": false,
18-
"geos": ["state", "msa", "hrr", "county"],
18+
"geos": ["state", "msa", "hrr", "county", "nation", "hhs"],
1919
"weekday": [true, false],
2020
"ftp_credentials": {
2121
"host": "{{ claims_hosp_ftp_host }}",
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
{
2+
"common": {
3+
"export_dir": "./receiving",
4+
"log_filename": "./doctor-visits.log"
5+
},
6+
"indicator": {
7+
"input_file": "./input/SYNEDI_AGG_OUTPATIENT_18052020_1455CDT.csv.gz",
8+
"drop_date": "",
9+
"n_backfill_days": 70,
10+
"n_waiting_days": 3,
11+
"weekday": [true, false],
12+
"se": false,
13+
"obfuscated_prefix": "wip_XXXXX",
14+
"parallel": false,
15+
"ftp_credentials": {
16+
"host": "{{ doctor_visits_ftp_host }}",
17+
"user": "{{ doctor_visits_ftp_user }}",
18+
"pass": "{{ doctor_visits_ftp_password }}",
19+
"port": 2222
20+
}
21+
},
22+
"validation": {
23+
"common": {
24+
"data_source": "doctor-visits",
25+
"span_length": 14,
26+
"min_expected_lag": {"all": "3"},
27+
"max_expected_lag": {"all": "4"},
28+
"dry_run": true,
29+
"suppressed_errors": [
30+
]
31+
},
32+
"static": {
33+
"minimum_sample_size": 5,
34+
"missing_se_allowed": true,
35+
"missing_sample_size_allowed": true
36+
},
37+
"dynamic": {
38+
"ref_window_size": 7,
39+
"smoothed_signals": [
40+
"smoothed_cli",
41+
"smoothed_adj_cli"
42+
]
43+
}
44+
}
45+
}

0 commit comments

Comments
 (0)