Skip to content

Commit f5df311

Browse files
authored
Merge pull request #1709 from cmu-delphi/release/indicators_v0.3.25_utils_v0.3.6
Release covidcast-indicators 0.3.25
2 parents 0bcc06b + 7e744ce commit f5df311

File tree

662 files changed

+3442
-264315
lines changed

Some content is hidden

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

662 files changed

+3442
-264315
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.24
2+
current_version = 0.3.25
33
commit = True
44
message = chore: bump covidcast-indicators to {new_version}
55
tag = False

.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: [ ]
1313
steps:
1414
- name: Checkout code
1515
uses: actions/checkout@v2

.github/workflows/r-ci.yml

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

Jenkinsfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
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", "doctor_visits"]
12+
def indicator_list = ["changehc", "claims_hosp", "google_symptoms", "hhs_hosp", "jhu", "nchs_mortality", "quidel", "quidel_covidtest", "safegraph_patterns", "sir_complainsalot", "usafacts", "dsew_community_profile", "doctor_visits"]
1313
def build_package = [:]
1414
def deploy_staging = [:]
1515
def deploy_production = [:]

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

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

backfill_corrections/Makefile

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
SHELL:=/bin/bash
2+
3+
TODAY:=$(shell date -u +"%Y-%m-%d")
4+
CURR_TIME:=$(shell date -u +"%Hh%Mm%Ss")
5+
LOG_FILE:=$(TODAY)_$(CURR_TIME).log
6+
7+
default:
8+
@echo No default implemented yet
9+
10+
install: dev
11+
12+
dev: delphiBackfillCorrection_1.0.tar.gz
13+
R CMD INSTALL delphiBackfillCorrection_1.0.tar.gz
14+
15+
lib:
16+
R -e 'roxygen2::roxygenise("delphiBackfillCorrection")'
17+
18+
run-R:
19+
time Rscript run.R 2>&1 | tee $(LOG_FILE)
20+
grep "backfill correction completed successfully" $(LOG_FILE)
21+
grep "scheduled core" $(LOG_FILE) ; \
22+
[ "$$?" -eq 1 ]
23+
24+
coverage:
25+
Rscript -e 'covr::package_coverage("delphiBackfillCorrection")'
26+
27+
# best we can do
28+
lint: coverage
29+
30+
test: delphiBackfillCorrection_1.0.tar.gz
31+
R CMD check --test-dir=unit-tests $<
32+
33+
delphiBackfillCorrection_1.0.tar.gz: $(wildcard delphiBackfillCorrection/R/*.R)
34+
R CMD build delphiBackfillCorrection

backfill_corrections/README.md

Lines changed: 120 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,120 @@
1+
# Backfill Correction
2+
3+
## Running the Pipeline
4+
5+
The indicator is run by installing the package `delphiBackfillCorrection` and
6+
running the script "run.R". To install the package, run the following code
7+
from this directory:
8+
9+
```
10+
make install
11+
```
12+
13+
All of the user-changable parameters are stored in `params.json`. A basic
14+
template is included as `params.json.template`. Default values are provided
15+
for most parameters; `input_dir` is the only requied parameter.
16+
17+
To execute the module and produce the output datasets (by default, in
18+
`receiving`), run the following:
19+
20+
```
21+
Rscript run.R
22+
```
23+
24+
Default values are provided for most parameters; `input_dir`,
25+
`test_start_date`, and `test_end_date` must be provided as command line
26+
arguments.
27+
28+
## Building and testing the code
29+
30+
The documentation for the package is written using the **roxygen2** package. To
31+
(re)-create this documentation for the package, run the following from the package
32+
directory:
33+
34+
```
35+
make lib
36+
```
37+
38+
Testing the package is done with the built-in R package checks (which include
39+
both static and dynamic checks), as well as unit tests written with
40+
**testthat**. To run all of these, use the following from within this
41+
directory:
42+
43+
```
44+
make test
45+
```
46+
47+
None of the tests should fail and notes and warnings should be manually
48+
checked for issues. To see the code coverage from the tests and example run
49+
the following:
50+
51+
```
52+
make coverage
53+
```
54+
55+
There should be good coverage of all the core functions in the package.
56+
57+
### Writing tests
58+
59+
Because the package tests involve reading and writing files, we must be
60+
careful with working directories to ensure the tests are portable.
61+
62+
For reading and writing to files contained in the `unit-tests/testthat/` directory,
63+
use the `testthat::test_path` function. It works much like `file.path` but
64+
automatically provides paths relative to `unit-tests/testthat/`, so e.g.
65+
`test_path("input")` becomes `unit-tests/testthat/input/` or whatever relative path
66+
is needed to get there.
67+
68+
`params.json` files contain paths, so `unit-tests/testthat/helper-relativize.R`
69+
contains `relativize_params`, which takes a `params` list and applies
70+
`test_path` to all of its path components. This object can then be passed to
71+
anything that needs it to read or write files.
72+
73+
### Testing during development
74+
75+
Repeatedly building the package and running the full check suite is tedious if
76+
you are working on fixing a failing test. A faster workflow is this:
77+
78+
1. Set your R working directory to `delphiBackfillCorrection/unit-tests/testthat`.
79+
2. Run `testthat::test_dir('.')`
80+
81+
This will test the live code without having to rebuild the package.
82+
83+
## Outline of the Indicator
84+
85+
TODO
86+
87+
### Data requirements
88+
89+
Required columns with fixed column names:
90+
91+
- geo_value: strings or floating numbers to indicate the location
92+
- time_value: reference date
93+
- lag: the number of days between issue date and the reference date
94+
- issue_date: issue date/report, required if lag is not available
95+
96+
Required columns without fixed column names (column names must be specified in [TODO]):
97+
98+
- num_col: the column for the number of reported counts of the numerator. e.g.
99+
the number of COVID claims counts according to insurance data.
100+
- denom_col: the column for the number of reported counts of the denominator.
101+
e.g. the number of total claims counts according to insurance data. Required
102+
if correcting ratios.
103+
104+
## Output Files
105+
106+
The pipeline produces two output types:
107+
108+
1. Predictions
109+
110+
| geo_value | time_value |lag | value | predicted_tauX | ... | wis |
111+
|--- | --- | --- | --- |--- |--- |--- |
112+
| pa | 2022-01-01 | 1 | 0.1 | 0 | ... | 0.01 |
113+
114+
3. Model objects. In production, models are trained on the last year of
115+
versions (as-of dates) and the last year of reference (report) dates. For
116+
one signal at the state level, a model takes about 30 minutes to train. Due
117+
to resource limitations in production, we only train models once a month
118+
and save the model objects between runs. By default, these are saved to the
119+
`cache` directory name with suffix `.model`.
120+
Binary file not shown.
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
Package: delphiBackfillCorrection
2+
Type: Package
3+
Title: Correct signal outliers
4+
Version: 1.0
5+
Date: 2022-08-24
6+
Author: Jingjing Tang
7+
Maintainer: Jingjing Tang <[email protected]>
8+
Description: Takes auxiliary output from COVIDcast API data pipelines and
9+
adjusts unusual values using a lasso-penalized quantile regression.
10+
Output is used for research and model development.
11+
License: file LICENSE
12+
Depends:
13+
R (>= 3.5.0),
14+
Imports:
15+
dplyr,
16+
readr,
17+
tibble,
18+
stringr,
19+
covidcast,
20+
quantgen,
21+
arrow,
22+
evalcast,
23+
jsonlite,
24+
lubridate,
25+
tidyr,
26+
zoo,
27+
utils,
28+
rlang,
29+
parallel
30+
Suggests:
31+
knitr (>= 1.15),
32+
rmarkdown (>= 1.4),
33+
testthat (>= 1.0.1),
34+
covr (>= 2.2.2)
35+
RoxygenNote: 7.2.0
36+
Encoding: UTF-8

0 commit comments

Comments
 (0)