Skip to content

Release covidcast-indicators 0.2.20 #1460

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 24 commits into from
Jan 12, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
4327856
add in some older indicators
nmdefries Dec 7, 2021
d50a2a5
add in schooling indicators
nmdefries Dec 7, 2021
4339087
report avoiding contact inds (C7/C7a)
nmdefries Dec 16, 2021
271f702
Merge pull request #1431 from cmu-delphi/add-c7-inds
nmdefries Dec 17, 2021
5f4ce23
Merge branch 'main' into prepare-contingency-historical-backfill
nmdefries Dec 18, 2021
626e55e
split_options returns NA if all input is NA
nmdefries Jan 3, 2022
e82b934
remove na-checking logic
nmdefries Jan 4, 2022
2214a30
make split_options input and output more regular
nmdefries Jan 5, 2022
84bb7ec
read wave as double instead of int
nmdefries Jan 5, 2022
55952c6
use minimal quotes
nmdefries Jan 6, 2022
b47b0ee
switch direction of wave logic for filtering exp treatment var
nmdefries Jan 6, 2022
716f733
Merge pull request #1450 from cmu-delphi/bot/sync-prod-main
krivard Jan 6, 2022
3113d39
[ctis] fix micro monthly script permissions
krivard Jan 10, 2022
6d6c6a5
Patch validator for chng subdivision mapping change
krivard Jan 10, 2022
9be617d
Merge pull request #1455 from cmu-delphi/krivard/ctis-micro
krivard Jan 10, 2022
7c0a91e
Disable fixme lint; these are well-documented
krivard Jan 10, 2022
43c9484
Merge pull request #1446 from cmu-delphi/splitoptions-robust-na
krivard Jan 10, 2022
8b5982f
Merge pull request #1447 from cmu-delphi/codebook-numeric-wave
krivard Jan 10, 2022
d9be7c8
Merge pull request #1397 from cmu-delphi/prepare-contingency-historic…
krivard Jan 10, 2022
c254e5e
Remove covid-act-now from sirCAL, CI, and Jenkins
krivard Jan 10, 2022
27b9ad5
Merge pull request #1459 from cmu-delphi/krivard/no-can
krivard Jan 11, 2022
234c600
Merge pull request #1458 from cmu-delphi/krivard/patch-validator
krivard Jan 12, 2022
e8e7424
chore: bump delphi_utils to 0.2.9
Jan 12, 2022
df7d0b4
chore: bump covidcast-indicators to 0.2.20
Jan 12, 2022
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .bumpversion.cfg
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[bumpversion]
current_version = 0.2.19
current_version = 0.2.20
commit = True
message = chore: bump covidcast-indicators to {new_version}
tag = False
2 changes: 1 addition & 1 deletion .github/workflows/python-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ jobs:
if: github.event.pull_request.draft == false
strategy:
matrix:
packages: [_delphi_utils_python, changehc, claims_hosp, combo_cases_and_deaths, covid_act_now, doctor_visits, google_symptoms, hhs_hosp, hhs_facilities, jhu, nchs_mortality, nowcast, quidel, quidel_covidtest, safegraph_patterns, sir_complainsalot, usafacts]
packages: [_delphi_utils_python, changehc, claims_hosp, combo_cases_and_deaths, doctor_visits, google_symptoms, hhs_hosp, hhs_facilities, jhu, nchs_mortality, nowcast, quidel, quidel_covidtest, safegraph_patterns, sir_complainsalot, usafacts]
defaults:
run:
working-directory: ${{ matrix.packages }}
Expand Down
2 changes: 1 addition & 1 deletion Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
- Keep in sync with '.github/workflows/python-ci.yml'.
- TODO: #527 Get this list automatically from python-ci.yml at runtime.
*/
def indicator_list = ["changehc", "claims_hosp", "covid_act_now", "facebook", "google_symptoms", "hhs_hosp", "jhu", "nchs_mortality", "quidel", "quidel_covidtest", "safegraph_patterns", "sir_complainsalot", "usafacts"]
def indicator_list = ["changehc", "claims_hosp", "facebook", "google_symptoms", "hhs_hosp", "jhu", "nchs_mortality", "quidel", "quidel_covidtest", "safegraph_patterns", "sir_complainsalot", "usafacts"]
def build_package = [:]
def deploy_staging = [:]
def deploy_production = [:]
Expand Down
2 changes: 1 addition & 1 deletion _delphi_utils_python/.bumpversion.cfg
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[bumpversion]
current_version = 0.2.8
current_version = 0.2.9
commit = True
message = chore: bump delphi_utils to {new_version}
tag = False
Expand Down
2 changes: 1 addition & 1 deletion _delphi_utils_python/delphi_utils/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,4 @@
from .nancodes import Nans
from .weekday import Weekday

__version__ = "0.2.8"
__version__ = "0.2.9"
4 changes: 3 additions & 1 deletion _delphi_utils_python/delphi_utils/validator/datafetcher.py
Original file line number Diff line number Diff line change
Expand Up @@ -111,8 +111,10 @@ def get_geo_signal_combos(data_source):
Cross references based on combinations reported available by COVIDcast metadata.
"""
# Maps data_source name with what's in the API, lists used in case of multiple names
# pylint: disable=fixme
# TODO: Extract this mapping from meta response instead of hard-coding
# https://github.com/cmu-delphi/covidcast-indicators/issues/1457
source_signal_mappings = {
'chng': ['chng-cli', 'chng-covid'],
'indicator-combination': ['indicator-combination-cases-deaths'],
'quidel': ['quidel-covid-ag'],
'safegraph': ['safegraph-weekly']
Expand Down
2 changes: 1 addition & 1 deletion _delphi_utils_python/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@

setup(
name="delphi_utils",
version="0.2.8",
version="0.2.9",
description="Shared Utility Functions for Indicators",
long_description=long_description,
long_description_content_type="text/markdown",
Expand Down
3 changes: 3 additions & 0 deletions _delphi_utils_python/tests/validator/test_datafetcher.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,9 @@ def test_make_date_filter(self):
assert not date_filter(FILENAME_REGEX.match("20200620_a_b.csv"))
assert not date_filter(FILENAME_REGEX.match("202006_a_b.csv"))

# pylint: disable=fixme
# TODO: mock out the advanced meta endpoint /covidcast/meta as well
# https://github.com/cmu-delphi/covidcast-indicators/issues/1456
@mock.patch("covidcast.metadata")
def test_get_geo_signal_combos(self, mock_metadata):
"""Test that the geo signal combos are correctly pulled from the covidcast metadata."""
Expand Down
4 changes: 0 additions & 4 deletions ansible/templates/sir_complainsalot-params-prod.json.j2
Original file line number Diff line number Diff line change
Expand Up @@ -102,10 +102,6 @@
"max_age":16,
"maintainers": []
},
"covid-act-now": {
"max_age":9,
"maintainers": []
},
"hhs": {
"max_age":8,
"maintainers": []
Expand Down
14 changes: 11 additions & 3 deletions facebook/delphiFacebook/R/contingency_indicators.R
Original file line number Diff line number Diff line change
Expand Up @@ -73,13 +73,17 @@ get_aggs <- function() {
## Mask wearing and distancing
"pct_wearing_mask_5d", "c_mask_often", compute_binary, jeffreys_binary,
"pct_wearing_mask_7d", "c_mask_often_7d", compute_binary, jeffreys_binary,
"pct_others_masked", "c_others_masked", compute_binary, jeffreys_binary,
"pct_others_masked_public", "c_others_masked_public", compute_binary, jeffreys_binary,
"pct_others_distanced_public", "c_others_distanced_public", compute_binary, jeffreys_binary,

"pct_cli", "hh_p_cli", compute_household_binary, jeffreys_count,
"pct_ili", "hh_p_ili", compute_household_binary, jeffreys_count,
"pct_hh_cmnty_cli", "hh_community_yes", compute_binary, jeffreys_binary,
"pct_nohh_cmnty_cli", "community_yes", compute_binary, jeffreys_binary,
"pct_direct_contact", "c_direct_contact", compute_binary, jeffreys_binary,
"pct_avoid_contact", "c_avoid_contact", compute_binary, jeffreys_binary,
"pct_avoid_contact_7d", "c_avoid_contact_7d", compute_binary, jeffreys_binary,

# symptoms
"pct_symp_fever", "symp_fever", compute_binary, jeffreys_binary,
Expand Down Expand Up @@ -303,8 +307,6 @@ get_aggs <- function() {
"pct_race_treated_fairly_healthcare", "b_race_treated_fairly_healthcare", compute_binary, jeffreys_binary,
"pct_delayed_care_cost", "b_delayed_care_cost", compute_binary, jeffreys_binary,

"pct_worried_catch_covid", "mh_worried_catch_covid", compute_binary, jeffreys_binary,

# topics want to learn about
"pct_want_info_covid_treatment", "i_want_info_covid_treatment", compute_binary, jeffreys_binary,
"pct_want_info_vaccine_access", "i_want_info_vaccine_access", compute_binary, jeffreys_binary,
Expand Down Expand Up @@ -355,6 +357,8 @@ get_aggs <- function() {
"pct_anxious_7d", "mh_anxious_7d", compute_binary, jeffreys_binary,
"pct_depressed_7d", "mh_depressed_7d", compute_binary, jeffreys_binary,
"pct_felt_isolated_7d", "mh_isolated_7d", compute_binary, jeffreys_binary,
# wave 11
"pct_worried_catch_covid", "mh_worried_catch_covid", compute_binary, jeffreys_binary,

# travel outside state
# pre-wave 10
Expand Down Expand Up @@ -420,7 +424,11 @@ get_aggs <- function() {
"pct_vaccine_barrier_type_tried", "v_vaccine_barrier_type_tried", compute_binary, jeffreys_binary,
"pct_vaccine_barrier_none_tried", "v_vaccine_barrier_none_tried", compute_binary, jeffreys_binary,
"pct_vaccine_barrier_appointment_location_tried", "v_vaccine_barrier_appointment_location_tried", compute_binary, jeffreys_binary,
"pct_vaccine_barrier_other_tried", "v_vaccine_barrier_other_tried", compute_binary, jeffreys_binary
"pct_vaccine_barrier_other_tried", "v_vaccine_barrier_other_tried", compute_binary, jeffreys_binary,

# schooling
"pct_inperson_school_fulltime", "s_inperson_school_fulltime", compute_binary, jeffreys_binary,
"pct_inperson_school_parttime", "s_inperson_school_parttime", compute_binary, jeffreys_binary
)

aggs <- create_aggs_product(regions, groups, indicators)
Expand Down
30 changes: 30 additions & 0 deletions facebook/delphiFacebook/R/contingency_variables.R
Original file line number Diff line number Diff line change
Expand Up @@ -1040,6 +1040,36 @@ code_behaviors <- function(input_data, wave) {
} else {
input_data$c_direct_contact <- NA
}

# avoid_contact
# Percentage of respondents that have reported having intentionally avoided
# contact with other people all or most of the time
# 1 = all of the time, 2 = most of the time, 3 = some of the time,
# 4 = none of the time
if ("C7" %in% names(input_data)) {
input_data$c_avoid_contact <- case_when(
input_data$C7 %in% c(1, 2) ~ 1,
input_data$C7 %in% c(3, 4) ~ 0,
TRUE ~ NA_real_
)
} else {
input_data$c_avoid_contact <- NA_real_
}

# avoid_contact_7d
# Percentage of respondents that have reported having intentionally avoided
# contact with other people all or most of the time in the last 7 days
# 1 = all of the time, 2 = most of the time, 3 = some of the time,
# 4 = a little of the time, 5 = none of the time
if ("C7a" %in% names(input_data)) {
input_data$c_avoid_contact_7d <- case_when(
input_data$C7a %in% c(1, 2) ~ 1,
input_data$C7a %in% c(3, 4, 5) ~ 0,
TRUE ~ NA_real_
)
} else {
input_data$c_avoid_contact_7d <- NA_real_
}

return(input_data)
}
Expand Down
31 changes: 10 additions & 21 deletions facebook/delphiFacebook/R/variables.R
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,11 @@
#' @return list of same length, each entry of which is a vector of selected
#' options
split_options <- function(column) {
return(strsplit(column, ",", fixed = TRUE))
if ( any(!is.na(column)) ) {
return(strsplit(column, ",", fixed = TRUE))
} else {
return(rep(list(NA_character_), length(column)))
}
}

#' Test if a specific selection is selected
Expand Down Expand Up @@ -648,16 +652,8 @@ code_vaccines <- function(input_data, wave) {
if ( all(c("V15a", "V15b") %in% names(input_data)) ) {
# introduced in Wave 11
vaccine_barriers <- coalesce(input_data$V15a, input_data$V15b)

# If the entire column is NA, ifelse() results in a logical vector, not a
# character vector, which confuses split_options; since the result should be
# NA anyway
vaccine_barriers <- as.character(
ifelse(vaccine_barriers == "13", NA_character_, vaccine_barriers)
)
if (any(!is.na(vaccine_barriers))) {
vaccine_barriers <- split_options(vaccine_barriers)
}
vaccine_barriers <- ifelse(vaccine_barriers == "13", NA_character_, vaccine_barriers)
vaccine_barriers <- split_options(vaccine_barriers)

input_data$v_vaccine_barrier_eligible <- is_selected(vaccine_barriers, "1")
input_data$v_vaccine_barrier_no_appointments <- is_selected(vaccine_barriers, "2")
Expand All @@ -677,7 +673,7 @@ code_vaccines <- function(input_data, wave) {
} else if ( all(c("V15c", "V15b") %in% names(input_data)) ) {
# V15c introduced in Wave 12, replacing V15a with clarified wording.
vaccine_barriers <- coalesce(input_data$V15c, input_data$V15b)
vaccine_barriers <- ifelse(vaccine_barriers == "13", NA, vaccine_barriers)
vaccine_barriers <- ifelse(vaccine_barriers == "13", NA_character_, vaccine_barriers)
vaccine_barriers <- split_options(vaccine_barriers)

input_data$v_vaccine_barrier_eligible <- is_selected(vaccine_barriers, "1")
Expand Down Expand Up @@ -769,15 +765,8 @@ code_vaccines <- function(input_data, wave) {

if ( "V15b" %in% names(input_data) ) {
# introduced in Wave 11
# If the entire column is NA, ifelse() results in a logical vector, not a
# character vector, which confuses split_options; since the result should be
# NA anyway
vaccine_barriers <- as.character(
ifelse(input_data$V15b == "13", NA, input_data$V15b)
)
if (any(!is.na(vaccine_barriers))) {
vaccine_barriers <- split_options(vaccine_barriers)
}
vaccine_barriers <- ifelse(input_data$V15b == "13", NA_character_, input_data$V15b)
vaccine_barriers <- split_options(vaccine_barriers)

input_data$v_vaccine_barrier_eligible_tried <- is_selected(vaccine_barriers, "1")
input_data$v_vaccine_barrier_no_appointments_tried <- is_selected(vaccine_barriers, "2")
Expand Down
5 changes: 5 additions & 0 deletions facebook/delphiFacebook/src/RcppExports.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,11 @@

using namespace Rcpp;

#ifdef RCPP_USE_GLOBAL_ROSTREAM
Rcpp::Rostream<true>& Rcpp::Rcout = Rcpp::Rcpp_cout_get();
Rcpp::Rostream<false>& Rcpp::Rcerr = Rcpp::Rcpp_cerr_get();
#endif

// is_selected_cpp
LogicalVector is_selected_cpp(List responses, String target);
RcppExport SEXP _delphiFacebook_is_selected_cpp(SEXP responsesSEXP, SEXP targetSEXP) {
Expand Down
28 changes: 28 additions & 0 deletions facebook/delphiFacebook/unit-tests/testthat/test-variables.R
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,22 @@ library(testthat)

context("Testing response coding")

test_that("split_options splits correctly", {
expect_equal(split_options(c("1", "", "1,2")),
list(c("1"), character(0), c("1", "2")))

# Input logical vector
expect_equal(split_options(c(NA, NA, NA)),
list(NA_character_, NA_character_, NA_character_))

# Input character vector
expect_equal(split_options(c(NA_character_, NA_character_, NA_character_)),
list(NA_character_, NA_character_, NA_character_))

expect_equal(split_options(c("", NA_character_, NA)),
list(character(0), NA_character_, NA_character_))
})

test_that("is_selected handles selections correctly", {
expect_equal(is_selected(split_options(c("1", "", "1,2")), "1"),
c(TRUE, NA, TRUE))
Expand All @@ -18,6 +34,18 @@ test_that("is_selected handles selections correctly", {
expect_equal(is_selected(split_options(c("4,54", "3,6,2,54", "5,4,45")),
"54"),
c(TRUE, TRUE, FALSE))

expect_equal(is_selected(c(NA, NA, NA), "14"),
c(NA, NA, NA))

expect_equal(is_selected(c(NA_character_, NA_character_, NA_character_), "14"),
c(NA, NA, NA))

expect_equal(is_selected(list(NA, NA, NA), "14"),
c(NA, NA, NA))

expect_equal(is_selected(list(NA_character_, NA_character_, NA_character_), "14"),
c(NA, NA, NA))
})

test_that("activities items correctly coded", {
Expand Down
Empty file modified facebook/micro/monthly-archive.sh
100644 → 100755
Empty file.
6 changes: 3 additions & 3 deletions facebook/qsf-tools/generate-codebook.R
Original file line number Diff line number Diff line change
Expand Up @@ -350,7 +350,7 @@ add_qdf_to_codebook <- function(qdf,
} else {
codebook <- read_csv(path_to_codebook, col_types = cols(
.default = col_character(),
wave = col_integer(),
wave = col_double(),
variable = col_character(),
replaces = col_character(),
description = col_character(),
Expand Down Expand Up @@ -399,7 +399,7 @@ add_static_fields <- function(codebook,
codebook <- bind_rows(codebook, static_fields) %>%
filter(!(variable == "module" & wave < 11), # module field is only available for wave >= 11
!(variable %in% c("wave", "UserLanguage", "fips") & wave < 4), # wave, UserLangauge, and fips fields are only available for wave >= 4
!(variable == "w12_treatment" & wave == 12.5), # experimental arm field is only available for wave == 12.5
!(variable == "w12_treatment" & wave != 12.5), # experimental arm field is only available for wave == 12.5
variable != "Random_Number"
)

Expand Down Expand Up @@ -438,7 +438,7 @@ get_static_fields <- function(wave,
add_qsf_to_codebook <- function(path_to_qsf, path_to_codebook) {
qdf <- process_qsf(path_to_qsf)
codebook <- add_qdf_to_codebook(qdf, path_to_codebook)
write_excel_csv(codebook, path_to_codebook)
write_excel_csv(codebook, path_to_codebook, quote="needed")
}


Expand Down
4 changes: 0 additions & 4 deletions sir_complainsalot/params.json.template
Original file line number Diff line number Diff line change
Expand Up @@ -101,10 +101,6 @@
"max_age":16,
"maintainers": []
},
"covid-act-now": {
"max_age":9,
"maintainers": []
},
"hhs": {
"max_age":8,
"maintainers": []
Expand Down