Skip to content

Commit f7e2d0f

Browse files
authored
Merge pull request #1308 from cmu-delphi/release/indicators_v0.1.24_utils_v0.1.16
Release covidcast-indicators 0.1.24
2 parents aed081c + ec0b980 commit f7e2d0f

File tree

10 files changed

+52
-13
lines changed

10 files changed

+52
-13
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.1.23
2+
current_version = 0.1.24
33
commit = True
44
message = chore: bump covidcast-indicators to {new_version}
55
tag = False

.github/workflows/r-ci.yml

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -48,17 +48,12 @@ jobs:
4848
${{ runner.os }}-r-facebook-survey-
4949
- name: Install R dependencies
5050
run: |
51-
if ( !require("readr") || packageVersion("readr") != "1.4.0" ) {
52-
install.packages("devtools")
53-
devtools::install_version("readr", version = "1.4.0")
54-
}
55-
5651
if ( !require("remotes") ) {
5752
install.packages("remotes")
5853
}
5954
remotes::update_packages(c("rcmdcheck", "mockr", "remotes"), upgrade="always")
6055
dependency_list <- remotes::dev_package_deps(dependencies=TRUE)
61-
remotes::update_packages(dependency_list$package[dependency_list$package != "readr"], upgrade="always")
56+
remotes::update_packages(dependency_list$package, upgrade="always")
6257
shell: Rscript {0}
6358
- name: Check
6459
run: |

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@
1111
"end_date": "2021-08-16",
1212
"export_dir": "./receiving",
1313
"individual_dir": "./individual",
14+
"individual_raceeth_dir": "./individual_raceeth",
15+
"produce_individual_raceeth": false,
1416
"input": [
1517
"2021-08-17.2021-08-10.2021-08-17.Survey_of_COVID-Like_Illness_-_TODEPLOY_......_-_US_Expansion.csv",
1618
"2021-08-17.2021-08-10.2021-08-17.Survey_of_COVID-Like_Illness_-_Wave_10.csv",

facebook/Dockerfile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,9 @@ RUN install2.r --error \
1010
data.table \
1111
roxygen2 \
1212
Rcpp \
13-
BH
13+
BH \
14+
readr
1415

15-
RUN R --no-restore --no-save -e 'devtools::install_version("readr", version="1.4.0")'
1616
RUN apt-get update && apt-get install -qq -y \
1717
python3-venv \
1818
sshpass \

facebook/delphiFacebook/DESCRIPTION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ Depends:
1313
Imports:
1414
stats,
1515
rlang,
16-
readr (<= 1.4.0),
16+
readr,
1717
dplyr,
1818
stringi,
1919
jsonlite,

facebook/delphiFacebook/R/aggregate.R

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -181,7 +181,10 @@ summarize_indicators_day <- function(day_df, indicators, target_day, geo_level,
181181

182182
# Copy only columns we're using.
183183
select_cols <- c(metric, var_weight, "weight_in_location")
184-
ind_df <- sub_df[, select_cols, with=FALSE][!is.na(sub_df[[var_weight]]) & !is.na(sub_df[[metric]]), ]
184+
# This filter uses `x[, cols, with=FALSE]` rather than the newer
185+
# recommended `x[, ..cols]` format to take advantage of better
186+
# performance. Switch to using `..` if `with` is deprecated in the future.
187+
ind_df <- sub_df[!is.na(sub_df[[var_weight]]) & !is.na(sub_df[[metric]]), select_cols, with=FALSE]
185188

186189
if (nrow(ind_df) > 0)
187190
{

facebook/delphiFacebook/R/contingency_aggregate.R

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -336,7 +336,10 @@ summarize_aggregations_group <- function(group_df, aggregations, target_group, g
336336

337337
# Copy only columns we're using.
338338
select_cols <- c(metric, var_weight, "weight_in_location")
339-
agg_df <- group_df[, select_cols, with=FALSE][!is.na(eval(as.name(metric))), ]
339+
# This filter uses `x[, cols, with=FALSE]` rather than the newer recommended
340+
# `x[, ..cols]` format to take advantage of better performance. Switch to
341+
# using `..` if `with` is deprecated in the future.
342+
agg_df <- group_df[!is.na(eval(as.name(metric))), select_cols, with=FALSE]
340343

341344
if (nrow(agg_df) > 0) {
342345
s_mix_coef <- params$s_mix_coef

facebook/delphiFacebook/R/contingency_indicators.R

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,8 @@ get_aggs <- function() {
6363
c("gender", "edulevel"),
6464
c("occupation"),
6565
c("pregnant", "raceethnicity"),
66-
c("race", "hispanic", "pregnant")
66+
c("race", "hispanic", "pregnant"),
67+
c("vaccinationstatus")
6768
)
6869

6970
indicators <- tribble(

facebook/delphiFacebook/R/contingency_variables.R

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -227,6 +227,40 @@ code_health <- function(input_data, wave) {
227227
return(input_data)
228228
}
229229

230+
#' Vaccinated summary variable for making table cuts
231+
#'
232+
#' @param input_data input data frame of raw survey data
233+
#' @param wave integer indicating survey version
234+
#'
235+
#' @return augmented data frame
236+
code_vaccinated_breakdown <- function(input_data, wave) {
237+
# grouping variable - vaccination status
238+
if (all(c("V1", "V3a", "V11a") %in% names(input_data))) {
239+
input_data$vaccinationstatus <- case_when(
240+
input_data$V1 == 1 ~ "Vaccinated",
241+
input_data$V3a == 1 ~ "Accept/Appointment",
242+
input_data$V3a == 2 ~ "Accept/Appointment",
243+
input_data$V11a == 1 ~ "Accept/Appointment",
244+
input_data$V3a == 3 ~ "Hesitant",
245+
input_data$V3a == 4 ~ "Hesitant",
246+
TRUE ~ NA_character_
247+
)
248+
} else if (all(c("V1", "V3") %in% names(input_data))) {
249+
input_data$vaccinationstatus <- case_when(
250+
input_data$V1 == 1 ~ "Vaccinated",
251+
input_data$V3 == 1 ~ "Accept/Appointment",
252+
input_data$V3 == 2 ~ "Accept/Appointment",
253+
input_data$V3 == 3 ~ "Hesitant",
254+
input_data$V3 == 4 ~ "Hesitant",
255+
TRUE ~ NA_character_
256+
)
257+
} else {
258+
input_data$vaccinationstatus <- NA
259+
}
260+
261+
return(input_data)
262+
}
263+
230264
#' COVID vaccination variables with modifications for contingency tables
231265
#'
232266
#' @param input_data input data frame of raw survey data

facebook/delphiFacebook/R/responses.R

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -220,6 +220,7 @@ load_response_one <- function(input_filename, params, contingency_run) {
220220
input_data <- code_race_ethnicity(input_data, wave)
221221
input_data <- code_occupation(input_data, wave)
222222
input_data <- code_education(input_data, wave)
223+
input_data <- code_vaccinated_breakdown(input_data, wave)
223224

224225
# Indicators
225226
input_data <- code_addl_vaccines(input_data, wave)

0 commit comments

Comments
 (0)