Skip to content

Commit

Permalink
ALZ-200: Test hidden_field filtering
Browse files Browse the repository at this point in the history
  • Loading branch information
JessterB committed Sep 12, 2024
1 parent a78749e commit 0efbd31
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 3 deletions.
17 changes: 14 additions & 3 deletions R/data-gather-clean.R
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,8 @@ get_submissions <- function(syn, group, statuses) {
#' Process submissions
#'
#' Process JSON files into a single table containing all submissions. Cleans up
#' the data to provide user-friendly variable and section names, and remove the
#' `metadata` section.
#' the data to provide user-friendly variable and section names, removes the
#' `metadata` section, and removes any fields with the hidden_field key (see ALZ-283).
#'
#' @param submissions A named list of paths to JSON files, i.e. the output of
#' [get_submissions()]. The name of each element should be its form data ID.
Expand Down Expand Up @@ -77,7 +77,8 @@ process_submissions <- function(submissions, lookup_table, complete = TRUE) {
all_subs <- dplyr::filter(all_subs, .data$section != "metadata") %>%
## Fix display of some responses
change_logical_responses() %>%
therapeutic_approach_response()
therapeutic_approach_response() %>%
remove_hidden_fields()

all_subs
}
Expand Down Expand Up @@ -307,6 +308,16 @@ therapeutic_approach_response <- function(data) {
)
}

#' ALZ-283: Remove hidden fields so they aren't displayed
#'
#' @inheritParams append_exp_nums
remove_hidden_fields <- function(data) {
dplyr::filter(
data,
variable != "hidden_field"
)
}

#' Combine multiple routes into one comma-separated response
#'
#' @param data List containing route data
Expand Down
1 change: 1 addition & 0 deletions data-raw/stopad_lookup_table.csv
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ In Vivo Data,Dosing Regimen,in_vivo_data,dose_regimen
PK In Silico,Drug Partition Coefficient (LogP),pk_in_silico,partition_coefficient
PK In Silico,Acid Dissociation Constant (pKA),pk_in_silico,dissociation_constant
PK In Silico,Molecular Weight (g/mol),pk_in_silico,molecular_weight
PK In Vitro,Ignore me,pk_in_vitro,hidden_field
PK In Vitro,Cell Permeablity Assay,pk_in_vitro,assay_description
PK In Vitro,Permeability,pk_in_vitro,permeability
PK In Vitro,Drug Lipophilicity Coefficient (LogD),pk_in_vitro,lipophilicity
Expand Down

0 comments on commit 0efbd31

Please sign in to comment.