From 15b2676968ae9642bbb881d908e5c7623f623cac Mon Sep 17 00:00:00 2001 From: Gero1999 Date: Tue, 17 Dec 2024 13:06:42 +0100 Subject: [PATCH 01/21] data: add labels metadata file --- inst/shiny/www/data/labels_app.csv | 1 + 1 file changed, 1 insertion(+) create mode 100644 inst/shiny/www/data/labels_app.csv diff --git a/inst/shiny/www/data/labels_app.csv b/inst/shiny/www/data/labels_app.csv new file mode 100644 index 0000000..cb7d392 --- /dev/null +++ b/inst/shiny/www/data/labels_app.csv @@ -0,0 +1 @@ +Variable,Label,Dataset STUDYID,Study Identifier,ADPC USUBJID,Unique Subject Identifier,ADPC SUBJID,Subject Identifier for the Study,ADPC SITEID,Study Site Identifier,ADPC ASEQ,Analysis Sequence Number,ADPC REGION1,Geographic Region 1,ADPC COUNTRY,Country,ADPC ETHNIC,Ethnicity,ADPC AGE,Age,ADPC AGEU,Age Units,ADPC AAGE,Analysis Age,ADPC AAGEU,Analysis Age Unit,ADPC AGEGR1,Pooled Age Group 1,ADPC AGEGR2,Pooled Age Group 2,ADPC AGEGR3,Pooled Age Group 3,ADPC STRATwNM,Description of Stratum w,ADPC STRATw,Randomized Value of Stratum w,ADPC STRATwV,Verified Value of Stratum w,ADPC SEX,Sex,ADPC RACE,Race,ADPC ITTFL,Intent-To-Treat Population Flag,ADPC SAFFL,Safety Population Flag,ADPC PPROTFL,Per-Protocol Population Flag,ADPC TRT01P,Planned Treatment for Period 01,ADPC TRTxxP,Planned Treatment for Period xx,ADPC TRT01A,Actual Treatment for Period xx,ADPC TRTxxA,Actual Treatment for Period xx,ADPC TRTSEQP,Planned Sequence of Treatments,ADPC TRTSEQA,Actual Sequence of Treatments,ADPC TRTSDTM,Datetime of First Exposure to Treatment,ADPC TRTSDT,Date of First Exposure to Treatment,ADPC TRTEDTM,Datetime of Last Exposure to Treatment,ADPC TRTEDT,Date of Last Exposure to Treatment,ADPC DCUTDT,Date of Data Cut,ADPC PCSEQ,Sequence Number,ADPC PCGRPID,Group ID,ADPC PCREFID,Reference ID,ADPC PCSPID,Sponsor-Defined Identifier,ADPC PCTESTCD,Pharmacokinetic Test Short Name,ADPC PCTEST,Pharmacokinetic Test Name,ADPC PCCAT,Test Category,ADPC PCSCAT,Test Subcategory,ADPC PCSTRESC,Character Result/Finding in Std Format,ADPC PCSTRESN,Numeric Result/Finding in Standard Units,ADPC PCSTRESU,Standard Units,ADPC PCSTAT,Completion Status,ADPC PCREASND,Reason Test Not Done,ADPC PCSPEC,Specimen Material Type,ADPC PCSPCCND,Specimen Condition,ADPC PCMETHOD,Method of Test or Examination,ADPC PCFAST,Fasting Status,ADPC PCLLOQ,Lower Limit of Quantitation,ADPC VISITNUM,Visit Number,ADPC VISIT,Visit Name,ADPC VISITDY,Planned Study Day of Visit,ADPC EPOCH,Epoch,ADPC PCDTC,Date/Time of Specimen Collection,ADPC PCDY,Actual Study Day of Specimen Collection,ADPC PCTPT,Planned Time Point Name,ADPC PCTPTNUM,Planned Time Point Number,ADPC PCSMPLID,Alternate Sample Identifier,ADPC PCAINTP,Assay Interpretation,ADPC PARAM,Parameter,ADPC PARAMCD,Parameter Code,ADPC PARCAT1,Parameter Category 1,ADPC AVAL,Analysis Value,ADPC AVALCAT1,Analysis Value Category 1,ADPC AVALU,Analysis Value Unit,ADPC AVALU,Analysis Value Unit,ADPC BASE,Baseline Value,ADPC BASETYPE,Baseline Type,ADPC ABLFL,Baseline Record Flag,ADPC ALLOQ,Analysis Lower Limit of Quantitation,ADPC ADTM,Analysis Datetime,ADPC ADT,Analysis Date,ADPC ATM,Analysis Time,ADPC ADY,Analysis Relative Day,ADPC ADTF,Analysis Date Imputation Flag,ADPC ATMF,Analysis Time Imputation Flag,ADPC ASTDT,Analysis Start Date,ADPC ASTTM,Analysis Start Time,ADPC ASTDTM,Analysis Start Date/Time,ADPC ASTDTF,Analysis Start Date Imputation Flag,ADPC ASTTMF,Analysis Start Time Imputation Flag,ADPC AENDT,Analysis End Date,ADPC AENTM,Analysis End Time,ADPC AENDTM,Analysis End Date/Time,ADPC AENDTF,Analysis End Date Imputation Flag,ADPC AENTMF,Analysis End Time Imputation Flag,ADPC ATPT,Analysis Timepoint,ADPC ATPT,Analysis Timepoint,ADPC ATPTN,Analysis Timepoint (N),ADPC ATPTN,Analysis Timepoint (N),ADPC ATPTREF,Analysis Timepoint Reference,ADPC AVISIT,Analysis Visit,ADPC AVISIT,Analysis Visit,ADPC AVISITN,Analysis Visit (N),ADPC AVISITN,Analysis Visit (N),ADPC APERIOD,Period,ADPC APERIODC,Period (C),ADPC FANLDT,First Date of Dose for Analyte,ADPC FANLTM,First Time of Dose for Analyte,ADPC FANLDTM,First Datetime of Dose for Analyte,ADPC FANLDTMF,First Time of Dose Time Imputation Flag,ADPC FANLEDT,First End Date of Dose for Analyte,ADPC FANLETM,First End Time of Dose for Analyte,ADPC FANLEDTM,First End Datetime of Dose for Analyte,ADPC FANLEDTF,First End of Dose Time Imputation Flag,ADPC PCRFTDT,Reference Date of Dose for Analyte,ADPC PCRFTTM,Reference Time of Dose for Analyte,ADPC PCRFTDTM,Reference Datetime of Dose for Analyte,ADPC PCRFEDT,Reference End Date of Dose for Analyte,ADPC PCRFETM,Reference End Time of Dose for Analyte,ADPC PCRFEDTM,Ref. End Datetime of Dose for Analyte,ADPC NFRLT,Nom. Rel. Time from Analyte First Dose,ADPC AFRLT,Act. Rel. Time from Analyte First Dose,ADPC TMPCTDF,Percent Diff. Nominal vs. Actual Time,ADPC FRLTU,Rel. Time from First Dose Unit,ADPC NEFRLT,Nom. Rel. End Time from First Dose,ADPC AEFRLT,Act. Rel. End Time from First Dose,ADPC NRRLT,Nominal Rel. Time from Ref. Dose,ADPC ARRLT,Actual Rel. Time from Ref. Dose,ADPC MRRLT,Modified Rel. Time from Ref. Dose,ADPC RRLTU,Rel. Time from Ref. Dose Unit,ADPC NERRLT,Nominal Rel. End Time from Ref. Dose,ADPC NERRLT,Nominal Rel. End Time from Ref. Dose,ADPC AERRLT,Actual Rel. End Time from Ref. Dose,ADPC AERRLT,Actual Rel. End Time from Ref. Dose,ADPC MERRLT,Modified Rel. End Time from Ref. Dose,ADPC MERRLT,Modified Rel. End Time from Ref. Dose,ADPC CHG,Change from Baseline,ADPC CRIT1,Analysis Criterion 1,ADPC CRIT1FL,Criterion 1 Evaluation Result Flag,ADPC CRIT1FL,Criterion 1 Evaluation Result Flag,ADPC DTYPE,Derivation Type,ADPC SPARSFL,Sparse Flag,ADPC NCAXFL,PK NCA Exclusion Flag,ADPC NCAXFN,PK NCA Exclusion Flag (N),ADPC NCAwXRS,Reason w for PK NCA Exclusion,ADPC NCAwXRSN,Reason for PK NCA Exclusion of w (N),ADPC PKSUMXF,PK Summary Exclusion Flag,ADPC PKSUMXFN,PK Summary Exclusion Flag (N),ADPC METABFL,Metabolite Flag,ADPC COHORT,Subject Cohort,ADPC COHORTN,Subject Cohort (N),ADPC ROUTE,Route,ADPC TRTRINT,Planned Treatment Interval,ADPC TRTRINTU,Planned Treatment Interval Units,ADPC DOSPCTDF,Percent Diff. Nominal vs. Actual Dose,ADPC DOSEFRQ,Dose Frequency,ADPC DOSEP,Planned Treatment Dose,ADPC DOSEA,Actual Treatment Dose,ADPC DOSEPU,Planned Treatment Dose Units,ADPC DOSEAU,Actual Treatment Dose Units,ADPC ACYCLE,Analysis Cycle,ADPC ACYCLEC,Analysis Cycle (C),ADPC ADOSEDUR,Actual Duration of Treatment Dose,ADPC NDOSEDUR,Nominal duration of Treatment Dose,ADPC DOSEDURU,Duration of Treatment Dose Units,ADPC VOLUME,Volume Value,ADPC VOLUMEU,Volume Value Unit,ADPC SPWEIGHT,Specimen Weight Value,ADPC SPWEIGHU,Specimen Weight Value Unit,ADPC WTBL,Weight at Baseline,ADPC HTBL,Height at Baseline,ADPC IBWBL,Ideal Body Weight (IBW) at Baseline,ADPC LBMBL,Lean Body Mass (LBM) at Baseline,ADPC BMIBL,BMI at Baseline,ADPC BSABL,BSA at Baseline,ADPC SBPBL,Systolic BP at Baseline,ADPC DBPBL,Diastolic BP at Baseline,] TOBBL,Smoking Status at Baseline,ADPC ALCOBL,Alcohol at Baseline,ADPC TEMPBL,Temperature at Baseline,ADPC PULSBL,Pulse rate at Baseline,ADPC ADA,Treatment Emergent ADA status,ADPC AAGBL,Alpha-1 Acid Glycoprotein at Baseline,ADPC CREATBL,Creatinine at Baseline (BLOOD),ADPC CRCLBL,CrCL at Baseline,ADPC ALBUBL,Albumin at Baseline,ADPC EOSBL,Eosinophils at Baseline,ADPC BUNBL,Blood Urea Nitrogen at Baseline,ADPC CALCBL,Calcium at Baseline,ADPC CLBL,Chloride at Baseline,ADPC PHBL,Phosphate at Baseline,ADPC PLATEBL,Platelet Count at Baseline,ADPC WBCBL,WBC Count at Baseline,ADPC GGTBL,GGT at Baseline,ADPC GLUCBL,Glucose at Baseline,ADPC HCTBL,Hematocrit at Baseline,ADPC HGBBL,Hemoglobin at Baseline,ADPC ALKPHBL,Alkaline Phosphatase at Baseline,ADPC KBL,Potassium at Baseline,ADPC LYMBL,Lymphocytes at Baseline,ADPC MONOBL,Monocytes at Baseline,ADPC NABL,Sodium at Baseline,ADPC NEUBL,Neutrophils at Baseline,ADPC RBCBL,RBC Count at Baseline,ADPC TBILIBL,Bilirubin at Baseline (BLOOD),ADPC TPROTBL,Total Protein at Baseline (BLOOD),ADPC SGOTBL,SGOT-AST at Baseline,ADPC SGPTBL,SGPT-ALT at Baseline,ADPC RRBL,RR Duration at Baseline,ADPC PRBL,PR Duration at Baseline,ADPC QRSBL,QRS Duration at Baseline,ADPC QTBL,QT duration at Baseline,ADPC QTCBBL,QTcB at Baseline,ADPC QTCFBL,QTcF at Baseline,ADPC HRBL,Heart Rate at Baseline,ADPC WTBLU,Weight at Baseline (Unit),ADPC HTBLU,Height at Baseline (Unit),ADPC IBWBLU,IBW at Baseline (Unit),ADPC LBWBLU,LBM at Baseline (Unit),ADPC BMIBLU,BMI at Baseline (Unit),ADPC BSABLU,BSA at Baseline (Unit),ADPC SBPBLU,Systolic BP at Baseline (Unit),ADPC DBPBLU,Diastolic BP at Baseline (Unit),ADPC TOBBLU,Smoking Status at Baseline (Unit),ADPC PULSBLU,Pulse rate at Baseline (Unit),ADPC AAGBLU,AAG at baseline (Unit),ADPC CREATBLU,Creat at baseline (BLOOD),ADPC CRCLBLU,CrCL at baseline (BLOOD),ADPC ALBUBLU,Albumin at baseline (Unit),ADPC EOSBLU,Eosinophils at baseline (Unit),ADPC BUNBLU,Blood Urea Nitrogen at baseline (Unit),ADPC CALCBLU,Calcium at baseline (Unit),ADPC CLBLU,Chloride at baseline (Unit),ADPC PHBLU,Phosphate at baseline (Unit),ADPC PLATEBLU,Platelet Count at baseline (Unit),ADPC WBCBLU,WBC Count at baseline (Unit),ADPC GGTBLU,GGT at Baseline (Unit),ADPC GLUBLU,Glucose at Baseline (Unit),ADPC HCTBLU,HCT at Baseline (Unit),ADPC HGBBLU,HGB at Baseline (Unit),ADPC ALKPHBLU,Alkaline Phosphatase at Baseline (Unit),ADPC KBLU,Potassium at Baseline (Unit),ADPC LYMBLU,Lymphocytes at Baseline (Unit),ADPC MONOBLU,Monocytes at Baseline (Unit),ADPC NABLU,Sodium at Baseline (Unit),ADPC NEUBLU,Neutrophils at Baseline (Unit),ADPC RBCBLU,RBC Count at Baseline (Unit),ADPC TBILIBLU,Bilirubin at Baseline (Unit),ADPC TPROTBLU,Total Protein at Baseline (Unit),ADPC SGOTBLU,SGOT-AST at Baseline (Unit),ADPC SGPTBLU,SGPT-ALT at Baseline (Unit),ADPC RRBLU,RR Duration at Baseline (Unit),ADPC PRBLU,PR Duration at Baseline (Unit),ADPC QRSBLU,QRS Duration at Baseline (Unit),ADPC QTBLU,QT Duration at Baseline (Unit),ADPC QTCBBLU,QTcB at Baseline (Unit),ADPC QTCFBLU,QTcF at Baseline (Unit),ADPC HRBLU,Heart Rate at Baseline (Unit),ADPC DRUG,Medication Name,ADPC REGIME,Regimen of Medication,ADPC FRMUL,Treatment Formulation,ADPC DOSNO,Dose Number,ADPC FEDSTATE,Fasted / Fed Status,ADPC ANL01FL,Analysis Flag 01,ADPC ANL02FL,Analysis Flag 02,ADPC ANL03FL,Analysis Flag 03,ADPC ANL04FL,Analysis Flag 04,ADPC ANL05FL,Analysis Flag 05,ADPC STUDYID,Study Identifier,ADPP USUBJID,Unique Subject Identifier,ADPP SUBJID,Subject Identifier for the Study,ADPP SITEID,Study Site Identifier,ADPP ASEQ,Analysis Sequence Number,ADPP REGION1,Geographic Region 1,ADPP COUNTRY,Country,ADPP ETHNIC,Ethnicity,ADPP AGE,Age,ADPP AGEU,Age Units,ADPP AAGE,Analysis Age,ADPP AAGEU,Analysis Age Unit,ADPP AGEGR1,Pooled Age Group 1,ADPP AGEGR2,Pooled Age Group 2,ADPP AGEGR3,Pooled Age Group 3,ADPP STRATwNM,Description of Stratum w,ADPP STRATw,Randomized Value of Stratum w,ADPP STRATwV,Verified Value of Stratum w,ADPP SEX,Sex,ADPP RACE,Race,ADPP ITTFL,Intent-To-Treat Population Flag,ADPP SAFFL,Safety Population Flag,ADPP PPROTFL,Per-Protocol Population Flag,ADPP TRT01P,Planned Treatment for Period 01,ADPP TRTxxP,Planned Treatment for Period xx,ADPP TRT01A,Actual Treatment for Period xx,ADPP TRTxxA,Actual Treatment for Period xx,ADPP TRTSEQP,Planned Sequence of Treatments,ADPP TRTSEQA,Actual Sequence of Treatments,ADPP TRTSDTM,Datetime of First Exposure to Treatment,ADPP TRTSDT,Date of First Exposure to Treatment,ADPP TRTEDTM,Datetime of Last Exposure to Treatment,ADPP TRTEDT,Date of Last Exposure to Treatment,ADPP DCUTDT,Date of Data Cut,ADPP PPSEQ,Sequence Number,ADPP PPGRPID,Group ID,ADPP PPSPID,Sponsor-Defined Identifier,ADPP PPTESTCD,Parameter Short Name,ADPP PPTEST,Parameter Name,ADPP PPCAT,Parameter Category,ADPP PPSCAT,Parameter Subcategory,ADPP PPSTRESC,Character Result/Finding in Std Format,ADPP PPSTRESN,Numeric Result/Finding in Standard Units,ADPP PPSTRESU,Standard Units,ADPP PPSTAT,Completion Status,ADPP PPREASND,Reason Parameter Not Calculated,ADPP PPSPEC,Specimen Material Type,ADPP PPDTC,Date/Time of Parameter Calculations,ADPP PPRFTDTC,Date/Time of Reference Point,ADPP PPSTINT,Planned Start of Assessment Interval,ADPP PPENINT,Planned End of Assessment Interval,ADPP PARAM,Parameter,ADPP PARAMCD,Parameter Code,ADPP PARCAT1,Parameter Category 1,ADPP PARCAT1,Parameter Category 1,ADPP AVAL,Analysis Value,ADPP AVALC,Analysis Value (C),ADPP ADTM,Analysis Datetime,ADPP ADT,Analysis Date,ADPP ATM,Analysis Time,ADPP ADY,Analysis Relative Day,ADPP ADTF,Analysis Date Imputation Flag,ADPP ATMF,Analysis Time Imputation Flag,ADPP ATPT,Analysis Timepoint,ADPP ATPT,Analysis Timepoint,ADPP ATPTN,Analysis Timepoint (N),ADPP ATPTN,Analysis Timepoint (N),ADPP AVISIT,Analysis Visit,ADPP AVISIT,Analysis Visit,ADPP AVISITN,Analysis Visit (N),ADPP AVISITN,Analysis Visit (N),ADPP From 57998d056e34c53ce1f57a4a07ac83dacf9075dd Mon Sep 17 00:00:00 2001 From: Jana Spinner <56519375+js3110@users.noreply.github.com> Date: Tue, 17 Dec 2024 13:44:10 +0100 Subject: [PATCH 02/21] feat: create add labels function --- R/label_operators.R | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/R/label_operators.R b/R/label_operators.R index 09a6472..28b2a56 100644 --- a/R/label_operators.R +++ b/R/label_operators.R @@ -1,3 +1,20 @@ + +# Apply manual labels to data$adpc +apply_labels <- function(data){ + + labels_app <- read.csv("inst/shiny/www/data/labels_app.csv") + # Create the label_ADNCA list from labels_app + label_ADNCA <- labels_app %>% + distinct(Variable, Label) %>% + deframe() + + for (var in names(label_ADNCA)) { + if (var %in% colnames(data)) { + attr(data[[var]], "label") <- data[[var]] + } + } + } + #' Convert to Factor While Preserving Label #' #' This function converts a vector to a factor while preserving its "label" attribute. From dc5e6fd8e1553cfa51132a96fd07ac2b842158d8 Mon Sep 17 00:00:00 2001 From: Jana Spinner <56519375+js3110@users.noreply.github.com> Date: Wed, 18 Dec 2024 13:25:47 +0100 Subject: [PATCH 03/21] feat: add labels to uploaded data --- NAMESPACE | 2 + R/generate_coldefs.R | 42 ++++ R/label_operators.R | 45 +++- inst/shiny/modules/column_mapping.R | 26 ++- inst/shiny/modules/tab_data.R | 5 + inst/shiny/www/data/labels_app.csv | 344 +++++++++++++++++++++++++++- man/apply_labels.Rd | 29 +++ man/generate_col_defs.Rd | 30 +++ 8 files changed, 504 insertions(+), 19 deletions(-) create mode 100644 R/generate_coldefs.R create mode 100644 man/apply_labels.Rd create mode 100644 man/generate_col_defs.Rd diff --git a/NAMESPACE b/NAMESPACE index b77cde1..8941bc6 100644 --- a/NAMESPACE +++ b/NAMESPACE @@ -2,6 +2,7 @@ export(anonymize_pk_data) export(apply_filters) +export(apply_labels) export(as_factor_preserve_label) export(calculate_summary_stats) export(create_conc) @@ -11,6 +12,7 @@ export(flexible_violinboxplot) export(format_data) export(general_lineplot) export(general_meanplot) +export(generate_col_defs) export(geometric_mean) export(has_label) export(lambda_slope_plot) diff --git a/R/generate_coldefs.R b/R/generate_coldefs.R new file mode 100644 index 0000000..5e8eb61 --- /dev/null +++ b/R/generate_coldefs.R @@ -0,0 +1,42 @@ +#' Generate Column Definitions for Tables +#' +#' This function generates column definitions for a reactable table, +#' including both the column heading and the label (if available). +#' +#' @param data A data frame containing the data to be displayed in the reactable table. +#' +#' @return A named list of column definitions for the reactable table. +#' +#' @examples +#' \dontrun{ +#' data <- data.frame( +#' USUBJID = c(1, 2, 3), +#' AVAL = c(4, 5, 6) +#' ) +#' attr(data$USUBJID, "label") <- "Unique Subject Identifier" +#' attr(data$AVAL, "label") <- "Analysis Value" +#' col_defs <- generate_col_defs(data) +#' } +#' +#' @export +generate_col_defs <- function(data) { + + # Extract labels from the dataset + labels <- sapply(data, function(col) attr(col, "label")) + labels[!is.na(labels)] + + # Generate column definitions + col_defs <- lapply(names(data), function(col) { + label <- labels[[col]] + if (!is.null(label)) { + colDef( + name = paste0(col, " : ", label) + ) + } else { + colDef(name = col) + } + }) + names(col_defs) <- names(data) + + return(col_defs) +} \ No newline at end of file diff --git a/R/label_operators.R b/R/label_operators.R index 28b2a56..41b7282 100644 --- a/R/label_operators.R +++ b/R/label_operators.R @@ -1,19 +1,42 @@ +#' Apply Labels to a dataset +#' +#' This function adds "label" attributes to all columns in a dataset +#' Using the labels_app.csv file which contains common labels for ADPP +#' and ADPC column names +#' +#' @param data The dataset to which labels will be applied. +#' +#' @return The same dataset with label attributes applied to all columns. +#' If a column is not present in the labels list, it will be assigned the name of the col. +#' +#' @examples +#' \dontrun{ +#' # Example usage: +#' data <- data.frame(USUBJID = c(1, 2, 3), AVAL = c(4, 5, 6)) +#' data <- apply_labels(data) +#' print(attr(data$A, "label")) +#' } +#' +#' @export +apply_labels <- function(data) { -# Apply manual labels to data$adpc -apply_labels <- function(data){ + labels_app <- read.csv(system.file("shiny/www/data/labels_app.csv", package = "aNCA")) - labels_app <- read.csv("inst/shiny/www/data/labels_app.csv") - # Create the label_ADNCA list from labels_app - label_ADNCA <- labels_app %>% - distinct(Variable, Label) %>% - deframe() + # Create the label_ADNCA named vector from labels_app + label_ADNCA <- setNames(labels_app$Label, labels_app$Variable) + + log_info("Applying labels to data") - for (var in names(label_ADNCA)) { - if (var %in% colnames(data)) { - attr(data[[var]], "label") <- data[[var]] - } + for (col in colnames(data)) { + if (col %in% names(label_ADNCA)) { + attr(data[[col]], "label") <- label_ADNCA[[col]] + } else { + attr(data[[col]], "label") <- col } } + + return(data) + } #' Convert to Factor While Preserving Label #' diff --git a/inst/shiny/modules/column_mapping.R b/inst/shiny/modules/column_mapping.R index 3047193..127ca78 100644 --- a/inst/shiny/modules/column_mapping.R +++ b/inst/shiny/modules/column_mapping.R @@ -251,10 +251,10 @@ column_mapping_server <- function(id, data, manual_units, on_submit) { return(col) }) - # Handle ADOSEDUR == NA case - if (input$select_ADOSEDUR == "NA") { - dataset$ADOSEDUR <- 0 - } + # # Handle ADOSEDUR == NA case + # if (input$select_ADOSEDUR == "NA") { + # dataset$ADOSEDUR <- 0 + # } # Update dataset columns if manual units are selected if (input$select_AVALU %in% manual_units$concentration) { @@ -268,10 +268,22 @@ column_mapping_server <- function(id, data, manual_units, on_submit) { } # Reorder columns based on the desired order - dataset %>% + dataset <- dataset %>% relocate(all_of(desired_order)) %>% - mutate(TIME = ifelse(DOSNO == 1, AFRLT, ARRLT)) %>% #TODO: Remove this after AUC0 merged - processed_data() + mutate(TIME = ifelse(DOSNO == 1, AFRLT, ARRLT))#TODO: Remove this after AUC0 merged + + # Apply labels to the dataset + if (exists("apply_labels") && is.function(apply_labels)) { + message("Calling apply_labels function") + dataset <- apply_labels(dataset) + shiny::showNotification("Labels applied successfully.", type = "message") + } else { + warning("apply_labels function is not defined or not a function.") + shiny::showNotification("apply_labels function is not defined or not a function.", type = "error") + } + + # Update the processed data + processed_data(dataset) # Execute the callback function to change the tab on_submit() diff --git a/inst/shiny/modules/tab_data.R b/inst/shiny/modules/tab_data.R index 3d2c937..0e48b18 100644 --- a/inst/shiny/modules/tab_data.R +++ b/inst/shiny/modules/tab_data.R @@ -154,8 +154,13 @@ tab_data_server <- function(id) { # Update the data table object with the filtered data output$data_processed <- renderReactable({ req(data()) + + # Generate column definitions + col_defs <- generate_col_defs(data()) + reactable( data(), + columns = col_defs, searchable = TRUE, sortable = TRUE, highlight = TRUE, diff --git a/inst/shiny/www/data/labels_app.csv b/inst/shiny/www/data/labels_app.csv index cb7d392..1d375b8 100644 --- a/inst/shiny/www/data/labels_app.csv +++ b/inst/shiny/www/data/labels_app.csv @@ -1 +1,343 @@ -Variable,Label,Dataset STUDYID,Study Identifier,ADPC USUBJID,Unique Subject Identifier,ADPC SUBJID,Subject Identifier for the Study,ADPC SITEID,Study Site Identifier,ADPC ASEQ,Analysis Sequence Number,ADPC REGION1,Geographic Region 1,ADPC COUNTRY,Country,ADPC ETHNIC,Ethnicity,ADPC AGE,Age,ADPC AGEU,Age Units,ADPC AAGE,Analysis Age,ADPC AAGEU,Analysis Age Unit,ADPC AGEGR1,Pooled Age Group 1,ADPC AGEGR2,Pooled Age Group 2,ADPC AGEGR3,Pooled Age Group 3,ADPC STRATwNM,Description of Stratum w,ADPC STRATw,Randomized Value of Stratum w,ADPC STRATwV,Verified Value of Stratum w,ADPC SEX,Sex,ADPC RACE,Race,ADPC ITTFL,Intent-To-Treat Population Flag,ADPC SAFFL,Safety Population Flag,ADPC PPROTFL,Per-Protocol Population Flag,ADPC TRT01P,Planned Treatment for Period 01,ADPC TRTxxP,Planned Treatment for Period xx,ADPC TRT01A,Actual Treatment for Period xx,ADPC TRTxxA,Actual Treatment for Period xx,ADPC TRTSEQP,Planned Sequence of Treatments,ADPC TRTSEQA,Actual Sequence of Treatments,ADPC TRTSDTM,Datetime of First Exposure to Treatment,ADPC TRTSDT,Date of First Exposure to Treatment,ADPC TRTEDTM,Datetime of Last Exposure to Treatment,ADPC TRTEDT,Date of Last Exposure to Treatment,ADPC DCUTDT,Date of Data Cut,ADPC PCSEQ,Sequence Number,ADPC PCGRPID,Group ID,ADPC PCREFID,Reference ID,ADPC PCSPID,Sponsor-Defined Identifier,ADPC PCTESTCD,Pharmacokinetic Test Short Name,ADPC PCTEST,Pharmacokinetic Test Name,ADPC PCCAT,Test Category,ADPC PCSCAT,Test Subcategory,ADPC PCSTRESC,Character Result/Finding in Std Format,ADPC PCSTRESN,Numeric Result/Finding in Standard Units,ADPC PCSTRESU,Standard Units,ADPC PCSTAT,Completion Status,ADPC PCREASND,Reason Test Not Done,ADPC PCSPEC,Specimen Material Type,ADPC PCSPCCND,Specimen Condition,ADPC PCMETHOD,Method of Test or Examination,ADPC PCFAST,Fasting Status,ADPC PCLLOQ,Lower Limit of Quantitation,ADPC VISITNUM,Visit Number,ADPC VISIT,Visit Name,ADPC VISITDY,Planned Study Day of Visit,ADPC EPOCH,Epoch,ADPC PCDTC,Date/Time of Specimen Collection,ADPC PCDY,Actual Study Day of Specimen Collection,ADPC PCTPT,Planned Time Point Name,ADPC PCTPTNUM,Planned Time Point Number,ADPC PCSMPLID,Alternate Sample Identifier,ADPC PCAINTP,Assay Interpretation,ADPC PARAM,Parameter,ADPC PARAMCD,Parameter Code,ADPC PARCAT1,Parameter Category 1,ADPC AVAL,Analysis Value,ADPC AVALCAT1,Analysis Value Category 1,ADPC AVALU,Analysis Value Unit,ADPC AVALU,Analysis Value Unit,ADPC BASE,Baseline Value,ADPC BASETYPE,Baseline Type,ADPC ABLFL,Baseline Record Flag,ADPC ALLOQ,Analysis Lower Limit of Quantitation,ADPC ADTM,Analysis Datetime,ADPC ADT,Analysis Date,ADPC ATM,Analysis Time,ADPC ADY,Analysis Relative Day,ADPC ADTF,Analysis Date Imputation Flag,ADPC ATMF,Analysis Time Imputation Flag,ADPC ASTDT,Analysis Start Date,ADPC ASTTM,Analysis Start Time,ADPC ASTDTM,Analysis Start Date/Time,ADPC ASTDTF,Analysis Start Date Imputation Flag,ADPC ASTTMF,Analysis Start Time Imputation Flag,ADPC AENDT,Analysis End Date,ADPC AENTM,Analysis End Time,ADPC AENDTM,Analysis End Date/Time,ADPC AENDTF,Analysis End Date Imputation Flag,ADPC AENTMF,Analysis End Time Imputation Flag,ADPC ATPT,Analysis Timepoint,ADPC ATPT,Analysis Timepoint,ADPC ATPTN,Analysis Timepoint (N),ADPC ATPTN,Analysis Timepoint (N),ADPC ATPTREF,Analysis Timepoint Reference,ADPC AVISIT,Analysis Visit,ADPC AVISIT,Analysis Visit,ADPC AVISITN,Analysis Visit (N),ADPC AVISITN,Analysis Visit (N),ADPC APERIOD,Period,ADPC APERIODC,Period (C),ADPC FANLDT,First Date of Dose for Analyte,ADPC FANLTM,First Time of Dose for Analyte,ADPC FANLDTM,First Datetime of Dose for Analyte,ADPC FANLDTMF,First Time of Dose Time Imputation Flag,ADPC FANLEDT,First End Date of Dose for Analyte,ADPC FANLETM,First End Time of Dose for Analyte,ADPC FANLEDTM,First End Datetime of Dose for Analyte,ADPC FANLEDTF,First End of Dose Time Imputation Flag,ADPC PCRFTDT,Reference Date of Dose for Analyte,ADPC PCRFTTM,Reference Time of Dose for Analyte,ADPC PCRFTDTM,Reference Datetime of Dose for Analyte,ADPC PCRFEDT,Reference End Date of Dose for Analyte,ADPC PCRFETM,Reference End Time of Dose for Analyte,ADPC PCRFEDTM,Ref. End Datetime of Dose for Analyte,ADPC NFRLT,Nom. Rel. Time from Analyte First Dose,ADPC AFRLT,Act. Rel. Time from Analyte First Dose,ADPC TMPCTDF,Percent Diff. Nominal vs. Actual Time,ADPC FRLTU,Rel. Time from First Dose Unit,ADPC NEFRLT,Nom. Rel. End Time from First Dose,ADPC AEFRLT,Act. Rel. End Time from First Dose,ADPC NRRLT,Nominal Rel. Time from Ref. Dose,ADPC ARRLT,Actual Rel. Time from Ref. Dose,ADPC MRRLT,Modified Rel. Time from Ref. Dose,ADPC RRLTU,Rel. Time from Ref. Dose Unit,ADPC NERRLT,Nominal Rel. End Time from Ref. Dose,ADPC NERRLT,Nominal Rel. End Time from Ref. Dose,ADPC AERRLT,Actual Rel. End Time from Ref. Dose,ADPC AERRLT,Actual Rel. End Time from Ref. Dose,ADPC MERRLT,Modified Rel. End Time from Ref. Dose,ADPC MERRLT,Modified Rel. End Time from Ref. Dose,ADPC CHG,Change from Baseline,ADPC CRIT1,Analysis Criterion 1,ADPC CRIT1FL,Criterion 1 Evaluation Result Flag,ADPC CRIT1FL,Criterion 1 Evaluation Result Flag,ADPC DTYPE,Derivation Type,ADPC SPARSFL,Sparse Flag,ADPC NCAXFL,PK NCA Exclusion Flag,ADPC NCAXFN,PK NCA Exclusion Flag (N),ADPC NCAwXRS,Reason w for PK NCA Exclusion,ADPC NCAwXRSN,Reason for PK NCA Exclusion of w (N),ADPC PKSUMXF,PK Summary Exclusion Flag,ADPC PKSUMXFN,PK Summary Exclusion Flag (N),ADPC METABFL,Metabolite Flag,ADPC COHORT,Subject Cohort,ADPC COHORTN,Subject Cohort (N),ADPC ROUTE,Route,ADPC TRTRINT,Planned Treatment Interval,ADPC TRTRINTU,Planned Treatment Interval Units,ADPC DOSPCTDF,Percent Diff. Nominal vs. Actual Dose,ADPC DOSEFRQ,Dose Frequency,ADPC DOSEP,Planned Treatment Dose,ADPC DOSEA,Actual Treatment Dose,ADPC DOSEPU,Planned Treatment Dose Units,ADPC DOSEAU,Actual Treatment Dose Units,ADPC ACYCLE,Analysis Cycle,ADPC ACYCLEC,Analysis Cycle (C),ADPC ADOSEDUR,Actual Duration of Treatment Dose,ADPC NDOSEDUR,Nominal duration of Treatment Dose,ADPC DOSEDURU,Duration of Treatment Dose Units,ADPC VOLUME,Volume Value,ADPC VOLUMEU,Volume Value Unit,ADPC SPWEIGHT,Specimen Weight Value,ADPC SPWEIGHU,Specimen Weight Value Unit,ADPC WTBL,Weight at Baseline,ADPC HTBL,Height at Baseline,ADPC IBWBL,Ideal Body Weight (IBW) at Baseline,ADPC LBMBL,Lean Body Mass (LBM) at Baseline,ADPC BMIBL,BMI at Baseline,ADPC BSABL,BSA at Baseline,ADPC SBPBL,Systolic BP at Baseline,ADPC DBPBL,Diastolic BP at Baseline,] TOBBL,Smoking Status at Baseline,ADPC ALCOBL,Alcohol at Baseline,ADPC TEMPBL,Temperature at Baseline,ADPC PULSBL,Pulse rate at Baseline,ADPC ADA,Treatment Emergent ADA status,ADPC AAGBL,Alpha-1 Acid Glycoprotein at Baseline,ADPC CREATBL,Creatinine at Baseline (BLOOD),ADPC CRCLBL,CrCL at Baseline,ADPC ALBUBL,Albumin at Baseline,ADPC EOSBL,Eosinophils at Baseline,ADPC BUNBL,Blood Urea Nitrogen at Baseline,ADPC CALCBL,Calcium at Baseline,ADPC CLBL,Chloride at Baseline,ADPC PHBL,Phosphate at Baseline,ADPC PLATEBL,Platelet Count at Baseline,ADPC WBCBL,WBC Count at Baseline,ADPC GGTBL,GGT at Baseline,ADPC GLUCBL,Glucose at Baseline,ADPC HCTBL,Hematocrit at Baseline,ADPC HGBBL,Hemoglobin at Baseline,ADPC ALKPHBL,Alkaline Phosphatase at Baseline,ADPC KBL,Potassium at Baseline,ADPC LYMBL,Lymphocytes at Baseline,ADPC MONOBL,Monocytes at Baseline,ADPC NABL,Sodium at Baseline,ADPC NEUBL,Neutrophils at Baseline,ADPC RBCBL,RBC Count at Baseline,ADPC TBILIBL,Bilirubin at Baseline (BLOOD),ADPC TPROTBL,Total Protein at Baseline (BLOOD),ADPC SGOTBL,SGOT-AST at Baseline,ADPC SGPTBL,SGPT-ALT at Baseline,ADPC RRBL,RR Duration at Baseline,ADPC PRBL,PR Duration at Baseline,ADPC QRSBL,QRS Duration at Baseline,ADPC QTBL,QT duration at Baseline,ADPC QTCBBL,QTcB at Baseline,ADPC QTCFBL,QTcF at Baseline,ADPC HRBL,Heart Rate at Baseline,ADPC WTBLU,Weight at Baseline (Unit),ADPC HTBLU,Height at Baseline (Unit),ADPC IBWBLU,IBW at Baseline (Unit),ADPC LBWBLU,LBM at Baseline (Unit),ADPC BMIBLU,BMI at Baseline (Unit),ADPC BSABLU,BSA at Baseline (Unit),ADPC SBPBLU,Systolic BP at Baseline (Unit),ADPC DBPBLU,Diastolic BP at Baseline (Unit),ADPC TOBBLU,Smoking Status at Baseline (Unit),ADPC PULSBLU,Pulse rate at Baseline (Unit),ADPC AAGBLU,AAG at baseline (Unit),ADPC CREATBLU,Creat at baseline (BLOOD),ADPC CRCLBLU,CrCL at baseline (BLOOD),ADPC ALBUBLU,Albumin at baseline (Unit),ADPC EOSBLU,Eosinophils at baseline (Unit),ADPC BUNBLU,Blood Urea Nitrogen at baseline (Unit),ADPC CALCBLU,Calcium at baseline (Unit),ADPC CLBLU,Chloride at baseline (Unit),ADPC PHBLU,Phosphate at baseline (Unit),ADPC PLATEBLU,Platelet Count at baseline (Unit),ADPC WBCBLU,WBC Count at baseline (Unit),ADPC GGTBLU,GGT at Baseline (Unit),ADPC GLUBLU,Glucose at Baseline (Unit),ADPC HCTBLU,HCT at Baseline (Unit),ADPC HGBBLU,HGB at Baseline (Unit),ADPC ALKPHBLU,Alkaline Phosphatase at Baseline (Unit),ADPC KBLU,Potassium at Baseline (Unit),ADPC LYMBLU,Lymphocytes at Baseline (Unit),ADPC MONOBLU,Monocytes at Baseline (Unit),ADPC NABLU,Sodium at Baseline (Unit),ADPC NEUBLU,Neutrophils at Baseline (Unit),ADPC RBCBLU,RBC Count at Baseline (Unit),ADPC TBILIBLU,Bilirubin at Baseline (Unit),ADPC TPROTBLU,Total Protein at Baseline (Unit),ADPC SGOTBLU,SGOT-AST at Baseline (Unit),ADPC SGPTBLU,SGPT-ALT at Baseline (Unit),ADPC RRBLU,RR Duration at Baseline (Unit),ADPC PRBLU,PR Duration at Baseline (Unit),ADPC QRSBLU,QRS Duration at Baseline (Unit),ADPC QTBLU,QT Duration at Baseline (Unit),ADPC QTCBBLU,QTcB at Baseline (Unit),ADPC QTCFBLU,QTcF at Baseline (Unit),ADPC HRBLU,Heart Rate at Baseline (Unit),ADPC DRUG,Medication Name,ADPC REGIME,Regimen of Medication,ADPC FRMUL,Treatment Formulation,ADPC DOSNO,Dose Number,ADPC FEDSTATE,Fasted / Fed Status,ADPC ANL01FL,Analysis Flag 01,ADPC ANL02FL,Analysis Flag 02,ADPC ANL03FL,Analysis Flag 03,ADPC ANL04FL,Analysis Flag 04,ADPC ANL05FL,Analysis Flag 05,ADPC STUDYID,Study Identifier,ADPP USUBJID,Unique Subject Identifier,ADPP SUBJID,Subject Identifier for the Study,ADPP SITEID,Study Site Identifier,ADPP ASEQ,Analysis Sequence Number,ADPP REGION1,Geographic Region 1,ADPP COUNTRY,Country,ADPP ETHNIC,Ethnicity,ADPP AGE,Age,ADPP AGEU,Age Units,ADPP AAGE,Analysis Age,ADPP AAGEU,Analysis Age Unit,ADPP AGEGR1,Pooled Age Group 1,ADPP AGEGR2,Pooled Age Group 2,ADPP AGEGR3,Pooled Age Group 3,ADPP STRATwNM,Description of Stratum w,ADPP STRATw,Randomized Value of Stratum w,ADPP STRATwV,Verified Value of Stratum w,ADPP SEX,Sex,ADPP RACE,Race,ADPP ITTFL,Intent-To-Treat Population Flag,ADPP SAFFL,Safety Population Flag,ADPP PPROTFL,Per-Protocol Population Flag,ADPP TRT01P,Planned Treatment for Period 01,ADPP TRTxxP,Planned Treatment for Period xx,ADPP TRT01A,Actual Treatment for Period xx,ADPP TRTxxA,Actual Treatment for Period xx,ADPP TRTSEQP,Planned Sequence of Treatments,ADPP TRTSEQA,Actual Sequence of Treatments,ADPP TRTSDTM,Datetime of First Exposure to Treatment,ADPP TRTSDT,Date of First Exposure to Treatment,ADPP TRTEDTM,Datetime of Last Exposure to Treatment,ADPP TRTEDT,Date of Last Exposure to Treatment,ADPP DCUTDT,Date of Data Cut,ADPP PPSEQ,Sequence Number,ADPP PPGRPID,Group ID,ADPP PPSPID,Sponsor-Defined Identifier,ADPP PPTESTCD,Parameter Short Name,ADPP PPTEST,Parameter Name,ADPP PPCAT,Parameter Category,ADPP PPSCAT,Parameter Subcategory,ADPP PPSTRESC,Character Result/Finding in Std Format,ADPP PPSTRESN,Numeric Result/Finding in Standard Units,ADPP PPSTRESU,Standard Units,ADPP PPSTAT,Completion Status,ADPP PPREASND,Reason Parameter Not Calculated,ADPP PPSPEC,Specimen Material Type,ADPP PPDTC,Date/Time of Parameter Calculations,ADPP PPRFTDTC,Date/Time of Reference Point,ADPP PPSTINT,Planned Start of Assessment Interval,ADPP PPENINT,Planned End of Assessment Interval,ADPP PARAM,Parameter,ADPP PARAMCD,Parameter Code,ADPP PARCAT1,Parameter Category 1,ADPP PARCAT1,Parameter Category 1,ADPP AVAL,Analysis Value,ADPP AVALC,Analysis Value (C),ADPP ADTM,Analysis Datetime,ADPP ADT,Analysis Date,ADPP ATM,Analysis Time,ADPP ADY,Analysis Relative Day,ADPP ADTF,Analysis Date Imputation Flag,ADPP ATMF,Analysis Time Imputation Flag,ADPP ATPT,Analysis Timepoint,ADPP ATPT,Analysis Timepoint,ADPP ATPTN,Analysis Timepoint (N),ADPP ATPTN,Analysis Timepoint (N),ADPP AVISIT,Analysis Visit,ADPP AVISIT,Analysis Visit,ADPP AVISITN,Analysis Visit (N),ADPP AVISITN,Analysis Visit (N),ADPP +Variable,Label,Dataset +STUDYID,Study Identifier,ADPC +USUBJID,Unique Subject Identifier,ADPC +SUBJID,Subject Identifier for the Study,ADPC +SITEID,Study Site Identifier,ADPC +ASEQ,Analysis Sequence Number,ADPC +REGION1,Geographic Region 1,ADPC +COUNTRY,Country,ADPC +ETHNIC,Ethnicity,ADPC +AGE,Age,ADPC +AGEU,Age Units,ADPC +AAGE,Analysis Age,ADPC +AAGEU,Analysis Age Unit,ADPC +AGEGR1,Pooled Age Group 1,ADPC +AGEGR2,Pooled Age Group 2,ADPC +AGEGR3,Pooled Age Group 3,ADPC +STRATwNM,Description of Stratum w,ADPC +STRATw,Randomized Value of Stratum w,ADPC +STRATwV,Verified Value of Stratum w,ADPC +SEX,Sex,ADPC +RACE,Race,ADPC +ITTFL,Intent-To-Treat Population Flag,ADPC +SAFFL,Safety Population Flag,ADPC +PPROTFL,Per-Protocol Population Flag,ADPC +TRT01P,Planned Treatment for Period 01,ADPC +TRT02P,Planned Treatment for Period 02,ADPC +TRT03P,Planned Treatment for Period 03,ADPC +TRT04P,Planned Treatment for Period 04,ADPC +TRT05P,Planned Treatment for Period 05,ADPC +TRT01A,Actual Treatment for Period 01,ADPC +TRT02A,Actual Treatment for Period 02,ADPC +TRT03A,Actual Treatment for Period 03,ADPC +TRT04A,Actual Treatment for Period 04,ADPC +TRT05A,Actual Treatment for Period 05,ADPC +TRTSEQP,Planned Sequence of Treatments,ADPC +TRTSEQA,Actual Sequence of Treatments,ADPC +TRTSDTM,Datetime of First Exposure to Treatment,ADPC +TRTSDT,Date of First Exposure to Treatment,ADPC +TRTEDTM,Datetime of Last Exposure to Treatment,ADPC +TRTEDT,Date of Last Exposure to Treatment,ADPC +DCUTDT,Date of Data Cut,ADPC +PCSEQ,Sequence Number,ADPC +PCGRPID,Group ID,ADPC +PCREFID,Reference ID,ADPC +PCSPID,Sponsor-Defined Identifier,ADPC +PCTESTCD,Pharmacokinetic Test Short Name,ADPC +PCTEST,Pharmacokinetic Test Name,ADPC +PCCAT,Test Category,ADPC +PCSCAT,Test Subcategory,ADPC +PCSTRESC,Character Result/Finding in Std Format,ADPC +PCSTRESN,Numeric Result/Finding in Standard Units,ADPC +PCSTRESU,Standard Units,ADPC +PCSTAT,Completion Status,ADPC +PCREASND,Reason Test Not Done,ADPC +PCSPEC,Specimen Material Type,ADPC +PCSPCCND,Specimen Condition,ADPC +PCMETHOD,Method of Test or Examination,ADPC +PCFAST,Fasting Status,ADPC +PCLLOQ,Lower Limit of Quantitation,ADPC +VISITNUM,Visit Number,ADPC +VISIT,Visit Name,ADPC +VISITDY,Planned Study Day of Visit,ADPC +EPOCH,Epoch,ADPC +PCDTC,Date/Time of Specimen Collection,ADPC +PCDY,Actual Study Day of Specimen Collection,ADPC +PCTPT,Planned Time Point Name,ADPC +PCTPTNUM,Planned Time Point Number,ADPC +PCSMPLID,Alternate Sample Identifier,ADPC +PCAINTP,Assay Interpretation,ADPC +PARAM,Parameter,ADPC +PARAMCD,Parameter Code,ADPC +PARCAT1,Parameter Category 1,ADPC +AVAL,Analysis Value,ADPC +AVALCAT1,Analysis Value Category 1,ADPC +AVALU,Analysis Value Unit,ADPC +AVALU,Analysis Value Unit,ADPC +BASE,Baseline Value,ADPC +BASETYPE,Baseline Type,ADPC +ABLFL,Baseline Record Flag,ADPC +ALLOQ,Analysis Lower Limit of Quantitation,ADPC +ADTM,Analysis Datetime,ADPC +ADT,Analysis Date,ADPC +ATM,Analysis Time,ADPC +ADY,Analysis Relative Day,ADPC +ADTF,Analysis Date Imputation Flag,ADPC +ATMF,Analysis Time Imputation Flag,ADPC +ASTDT,Analysis Start Date,ADPC +ASTTM,Analysis Start Time,ADPC +ASTDTM,Analysis Start Date/Time,ADPC +ASTDTF,Analysis Start Date Imputation Flag,ADPC +ASTTMF,Analysis Start Time Imputation Flag,ADPC +AENDT,Analysis End Date,ADPC +AENTM,Analysis End Time,ADPC +AENDTM,Analysis End Date/Time,ADPC +AENDTF,Analysis End Date Imputation Flag,ADPC +AENTMF,Analysis End Time Imputation Flag,ADPC +ATPT,Analysis Timepoint,ADPC +ATPT,Analysis Timepoint,ADPC +ATPTN,Analysis Timepoint (N),ADPC +ATPTN,Analysis Timepoint (N),ADPC +ATPTREF,Analysis Timepoint Reference,ADPC +AVISIT,Analysis Visit,ADPC +AVISIT,Analysis Visit,ADPC +AVISITN,Analysis Visit (N),ADPC +AVISITN,Analysis Visit (N),ADPC +APERIOD,Period,ADPC +APERIODC,Period (C),ADPC +FANLDT,First Date of Dose for Analyte,ADPC +FANLTM,First Time of Dose for Analyte,ADPC +FANLDTM,First Datetime of Dose for Analyte,ADPC +FANLDTMF,First Time of Dose Time Imputation Flag,ADPC +FANLEDT,First End Date of Dose for Analyte,ADPC +FANLETM,First End Time of Dose for Analyte,ADPC +FANLEDTM,First End Datetime of Dose for Analyte,ADPC +FANLEDTF,First End of Dose Time Imputation Flag,ADPC +PCRFTDT,Reference Date of Dose for Analyte,ADPC +PCRFTTM,Reference Time of Dose for Analyte,ADPC +PCRFTDTM,Reference Datetime of Dose for Analyte,ADPC +PCRFEDT,Reference End Date of Dose for Analyte,ADPC +PCRFETM,Reference End Time of Dose for Analyte,ADPC +PCRFEDTM,Ref. End Datetime of Dose for Analyte,ADPC +NFRLT,Nom. Rel. Time from Analyte First Dose,ADPC +AFRLT,Act. Rel. Time from Analyte First Dose,ADPC +TMPCTDF,Percent Diff. Nominal vs. Actual Time,ADPC +FRLTU,Rel. Time from First Dose Unit,ADPC +NEFRLT,Nom. Rel. End Time from First Dose,ADPC +AEFRLT,Act. Rel. End Time from First Dose,ADPC +NRRLT,Nominal Rel. Time from Ref. Dose,ADPC +ARRLT,Actual Rel. Time from Ref. Dose,ADPC +MRRLT,Modified Rel. Time from Ref. Dose,ADPC +RRLTU,Rel. Time from Ref. Dose Unit,ADPC +NERRLT,Nominal Rel. End Time from Ref. Dose,ADPC +NERRLT,Nominal Rel. End Time from Ref. Dose,ADPC +AERRLT,Actual Rel. End Time from Ref. Dose,ADPC +AERRLT,Actual Rel. End Time from Ref. Dose,ADPC +MERRLT,Modified Rel. End Time from Ref. Dose,ADPC +MERRLT,Modified Rel. End Time from Ref. Dose,ADPC +CHG,Change from Baseline,ADPC +CRIT1,Analysis Criterion 1,ADPC +CRIT1FL,Criterion 1 Evaluation Result Flag,ADPC +CRIT1FL,Criterion 1 Evaluation Result Flag,ADPC +DTYPE,Derivation Type,ADPC +SPARSFL,Sparse Flag,ADPC +NCAXFL,PK NCA Exclusion Flag,ADPC +NCAXFN,PK NCA Exclusion Flag (N),ADPC +NCAwXRS,Reason w for PK NCA Exclusion,ADPC +NCAwXRSN,Reason for PK NCA Exclusion of w (N),ADPC +PKSUMXF,PK Summary Exclusion Flag,ADPC +PKSUMXFN,PK Summary Exclusion Flag (N),ADPC +METABFL,Metabolite Flag,ADPC +COHORT,Subject Cohort,ADPC +COHORTN,Subject Cohort (N),ADPC +ROUTE,Route,ADPC +TRTRINT,Planned Treatment Interval,ADPC +TRTRINTU,Planned Treatment Interval Units,ADPC +DOSPCTDF,Percent Diff. Nominal vs. Actual Dose,ADPC +DOSEFRQ,Dose Frequency,ADPC +DOSEP,Planned Treatment Dose,ADPC +DOSEA,Actual Treatment Dose,ADPC +DOSEPU,Planned Treatment Dose Units,ADPC +DOSEAU,Actual Treatment Dose Units,ADPC +ACYCLE,Analysis Cycle,ADPC +ACYCLEC,Analysis Cycle (C),ADPC +ADOSEDUR,Actual Duration of Treatment Dose,ADPC +NDOSEDUR,Nominal duration of Treatment Dose,ADPC +DOSEDURU,Duration of Treatment Dose Units,ADPC +VOLUME,Volume Value,ADPC +VOLUMEU,Volume Value Unit,ADPC +SPWEIGHT,Specimen Weight Value,ADPC +SPWEIGHU,Specimen Weight Value Unit,ADPC +WTBL,Weight at Baseline,ADPC +HTBL,Height at Baseline,ADPC +IBWBL,Ideal Body Weight (IBW) at Baseline,ADPC +LBMBL,Lean Body Mass (LBM) at Baseline,ADPC +BMIBL,BMI at Baseline,ADPC +BSABL,BSA at Baseline,ADPC +SBPBL,Systolic BP at Baseline,ADPC +DBPBL,Diastolic BP at Baseline,] +TOBBL,Smoking Status at Baseline,ADPC +ALCOBL,Alcohol at Baseline,ADPC +TEMPBL,Temperature at Baseline,ADPC +PULSBL,Pulse rate at Baseline,ADPC +ADA,Treatment Emergent ADA status,ADPC +AAGBL,Alpha-1 Acid Glycoprotein at Baseline,ADPC +CREATBL,Creatinine at Baseline (BLOOD),ADPC +CRCLBL,CrCL at Baseline,ADPC +ALBUBL,Albumin at Baseline,ADPC +EOSBL,Eosinophils at Baseline,ADPC +BUNBL,Blood Urea Nitrogen at Baseline,ADPC +CALCBL,Calcium at Baseline,ADPC +CLBL,Chloride at Baseline,ADPC +PHBL,Phosphate at Baseline,ADPC +PLATEBL,Platelet Count at Baseline,ADPC +WBCBL,WBC Count at Baseline,ADPC +GGTBL,GGT at Baseline,ADPC +GLUCBL,Glucose at Baseline,ADPC +HCTBL,Hematocrit at Baseline,ADPC +HGBBL,Hemoglobin at Baseline,ADPC +ALKPHBL,Alkaline Phosphatase at Baseline,ADPC +KBL,Potassium at Baseline,ADPC +LYMBL,Lymphocytes at Baseline,ADPC +MONOBL,Monocytes at Baseline,ADPC +NABL,Sodium at Baseline,ADPC +NEUBL,Neutrophils at Baseline,ADPC +RBCBL,RBC Count at Baseline,ADPC +TBILIBL,Bilirubin at Baseline (BLOOD),ADPC +TPROTBL,Total Protein at Baseline (BLOOD),ADPC +SGOTBL,SGOT-AST at Baseline,ADPC +SGPTBL,SGPT-ALT at Baseline,ADPC +RRBL,RR Duration at Baseline,ADPC +PRBL,PR Duration at Baseline,ADPC +QRSBL,QRS Duration at Baseline,ADPC +QTBL,QT duration at Baseline,ADPC +QTCBBL,QTcB at Baseline,ADPC +QTCFBL,QTcF at Baseline,ADPC +HRBL,Heart Rate at Baseline,ADPC +WTBLU,Weight at Baseline (Unit),ADPC +HTBLU,Height at Baseline (Unit),ADPC +IBWBLU,IBW at Baseline (Unit),ADPC +LBWBLU,LBM at Baseline (Unit),ADPC +BMIBLU,BMI at Baseline (Unit),ADPC +BSABLU,BSA at Baseline (Unit),ADPC +SBPBLU,Systolic BP at Baseline (Unit),ADPC +DBPBLU,Diastolic BP at Baseline (Unit),ADPC +TOBBLU,Smoking Status at Baseline (Unit),ADPC +PULSBLU,Pulse rate at Baseline (Unit),ADPC +AAGBLU,AAG at baseline (Unit),ADPC +CREATBLU,Creat at baseline (BLOOD),ADPC +CRCLBLU,CrCL at baseline (BLOOD),ADPC +ALBUBLU,Albumin at baseline (Unit),ADPC +EOSBLU,Eosinophils at baseline (Unit),ADPC +BUNBLU,Blood Urea Nitrogen at baseline (Unit),ADPC +CALCBLU,Calcium at baseline (Unit),ADPC +CLBLU,Chloride at baseline (Unit),ADPC +PHBLU,Phosphate at baseline (Unit),ADPC +PLATEBLU,Platelet Count at baseline (Unit),ADPC +WBCBLU,WBC Count at baseline (Unit),ADPC +GGTBLU,GGT at Baseline (Unit),ADPC +GLUBLU,Glucose at Baseline (Unit),ADPC +HCTBLU,HCT at Baseline (Unit),ADPC +HGBBLU,HGB at Baseline (Unit),ADPC +ALKPHBLU,Alkaline Phosphatase at Baseline (Unit),ADPC +KBLU,Potassium at Baseline (Unit),ADPC +LYMBLU,Lymphocytes at Baseline (Unit),ADPC +MONOBLU,Monocytes at Baseline (Unit),ADPC +NABLU,Sodium at Baseline (Unit),ADPC +NEUBLU,Neutrophils at Baseline (Unit),ADPC +RBCBLU,RBC Count at Baseline (Unit),ADPC +TBILIBLU,Bilirubin at Baseline (Unit),ADPC +TPROTBLU,Total Protein at Baseline (Unit),ADPC +SGOTBLU,SGOT-AST at Baseline (Unit),ADPC +SGPTBLU,SGPT-ALT at Baseline (Unit),ADPC +RRBLU,RR Duration at Baseline (Unit),ADPC +PRBLU,PR Duration at Baseline (Unit),ADPC +QRSBLU,QRS Duration at Baseline (Unit),ADPC +QTBLU,QT Duration at Baseline (Unit),ADPC +QTCBBLU,QTcB at Baseline (Unit),ADPC +QTCFBLU,QTcF at Baseline (Unit),ADPC +HRBLU,Heart Rate at Baseline (Unit),ADPC +DRUG,Medication Name,ADPC +REGIME,Regimen of Medication,ADPC +FRMUL,Treatment Formulation,ADPC +DOSNO,Dose Number,ADPC +FEDSTATE,Fasted / Fed Status,ADPC +ANL01FL,Analysis Flag 01,ADPC +ANL02FL,Analysis Flag 02,ADPC +ANL03FL,Analysis Flag 03,ADPC +ANL04FL,Analysis Flag 04,ADPC +ANL05FL,Analysis Flag 05,ADPC +STUDYID,Study Identifier,ADPP +USUBJID,Unique Subject Identifier,ADPP +SUBJID,Subject Identifier for the Study,ADPP +SITEID,Study Site Identifier,ADPP +ASEQ,Analysis Sequence Number,ADPP +REGION1,Geographic Region 1,ADPP +COUNTRY,Country,ADPP +ETHNIC,Ethnicity,ADPP +AGE,Age,ADPP +AGEU,Age Units,ADPP +AAGE,Analysis Age,ADPP +AAGEU,Analysis Age Unit,ADPP +AGEGR1,Pooled Age Group 1,ADPP +AGEGR2,Pooled Age Group 2,ADPP +AGEGR3,Pooled Age Group 3,ADPP +STRATwNM,Description of Stratum w,ADPP +STRATw,Randomized Value of Stratum w,ADPP +STRATwV,Verified Value of Stratum w,ADPP +SEX,Sex,ADPP +RACE,Race,ADPP +ITTFL,Intent-To-Treat Population Flag,ADPP +SAFFL,Safety Population Flag,ADPP +PPROTFL,Per-Protocol Population Flag,ADPP +TRT01P,Planned Treatment for Period 01,ADPP +TRTxxP,Planned Treatment for Period xx,ADPP +TRT01A,Actual Treatment for Period 01,ADPP +TRTxxA,Actual Treatment for Period xx,ADPP +TRTSEQP,Planned Sequence of Treatments,ADPP +TRTSEQA,Actual Sequence of Treatments,ADPP +TRTSDTM,Datetime of First Exposure to Treatment,ADPP +TRTSDT,Date of First Exposure to Treatment,ADPP +TRTEDTM,Datetime of Last Exposure to Treatment,ADPP +TRTEDT,Date of Last Exposure to Treatment,ADPP +DCUTDT,Date of Data Cut,ADPP +PPSEQ,Sequence Number,ADPP +PPGRPID,Group ID,ADPP +PPSPID,Sponsor-Defined Identifier,ADPP +PPTESTCD,Parameter Short Name,ADPP +PPTEST,Parameter Name,ADPP +PPCAT,Parameter Category,ADPP +PPSCAT,Parameter Subcategory,ADPP +PPSTRESC,Character Result/Finding in Std Format,ADPP +PPSTRESN,Numeric Result/Finding in Standard Units,ADPP +PPSTRESU,Standard Units,ADPP +PPSTAT,Completion Status,ADPP +PPREASND,Reason Parameter Not Calculated,ADPP +PPSPEC,Specimen Material Type,ADPP +PPDTC,Date/Time of Parameter Calculations,ADPP +PPRFTDTC,Date/Time of Reference Point,ADPP +PPSTINT,Planned Start of Assessment Interval,ADPP +PPENINT,Planned End of Assessment Interval,ADPP +PARAM,Parameter,ADPP +PARAMCD,Parameter Code,ADPP +PARCAT1,Parameter Category 1,ADPP +PARCAT1,Parameter Category 1,ADPP +AVAL,Analysis Value,ADPP +AVALC,Analysis Value (C),ADPP +ADTM,Analysis Datetime,ADPP +ADT,Analysis Date,ADPP +ATM,Analysis Time,ADPP +ADY,Analysis Relative Day,ADPP +ADTF,Analysis Date Imputation Flag,ADPP +ATMF,Analysis Time Imputation Flag,ADPP +ATPT,Analysis Timepoint,ADPP +ATPT,Analysis Timepoint,ADPP +ATPTN,Analysis Timepoint (N),ADPP +ATPTN,Analysis Timepoint (N),ADPP +AVISIT,Analysis Visit,ADPP +AVISIT,Analysis Visit,ADPP +AVISITN,Analysis Visit (N),ADPP +AVISITN,Analysis Visit (N),ADPP +ANALYTE,Analyte,ADPC +EVID,Event ID,ADPC +DOSEU,Treatment Dose Units,ADPC diff --git a/man/apply_labels.Rd b/man/apply_labels.Rd new file mode 100644 index 0000000..54f6d25 --- /dev/null +++ b/man/apply_labels.Rd @@ -0,0 +1,29 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/label_operators.R +\name{apply_labels} +\alias{apply_labels} +\title{Apply Labels to a dataset} +\usage{ +apply_labels(data) +} +\arguments{ +\item{data}{The dataset to which labels will be applied.} +} +\value{ +The same dataset with label attributes applied to all columns. +If a column is not present in the labels list, it will be assigned the name of the col. +} +\description{ +This function adds "label" attributes to all columns in a dataset +Using the labels_app.csv file which contains common labels for ADPP +and ADPC column names +} +\examples{ +\dontrun{ + # Example usage: + data <- data.frame(USUBJID = c(1, 2, 3), AVAL = c(4, 5, 6)) + data <- apply_labels(data) + print(attr(data$A, "label")) +} + +} diff --git a/man/generate_col_defs.Rd b/man/generate_col_defs.Rd new file mode 100644 index 0000000..453745b --- /dev/null +++ b/man/generate_col_defs.Rd @@ -0,0 +1,30 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/generate_coldefs.R +\name{generate_col_defs} +\alias{generate_col_defs} +\title{Generate Column Definitions for Tables} +\usage{ +generate_col_defs(data) +} +\arguments{ +\item{data}{A data frame containing the data to be displayed in the reactable table.} +} +\value{ +A named list of column definitions for the reactable table. +} +\description{ +This function generates column definitions for a reactable table, +including both the column heading and the label (if available). +} +\examples{ +\dontrun{ + data <- data.frame( + USUBJID = c(1, 2, 3), + AVAL = c(4, 5, 6) + ) + attr(data$USUBJID, "label") <- "Unique Subject Identifier" + attr(data$AVAL, "label") <- "Analysis Value" + col_defs <- generate_col_defs(data) +} + +} From a9b1ebe2bff241567f5513d31453176e9f91126d Mon Sep 17 00:00:00 2001 From: Jana Spinner <56519375+js3110@users.noreply.github.com> Date: Wed, 18 Dec 2024 13:28:43 +0100 Subject: [PATCH 04/21] fix: remove debug statements --- inst/shiny/modules/column_mapping.R | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/inst/shiny/modules/column_mapping.R b/inst/shiny/modules/column_mapping.R index 127ca78..098b7c3 100644 --- a/inst/shiny/modules/column_mapping.R +++ b/inst/shiny/modules/column_mapping.R @@ -273,14 +273,8 @@ column_mapping_server <- function(id, data, manual_units, on_submit) { mutate(TIME = ifelse(DOSNO == 1, AFRLT, ARRLT))#TODO: Remove this after AUC0 merged # Apply labels to the dataset - if (exists("apply_labels") && is.function(apply_labels)) { - message("Calling apply_labels function") - dataset <- apply_labels(dataset) - shiny::showNotification("Labels applied successfully.", type = "message") - } else { - warning("apply_labels function is not defined or not a function.") - shiny::showNotification("apply_labels function is not defined or not a function.", type = "error") - } + message("Calling apply_labels function") + dataset <- apply_labels(dataset) # Update the processed data processed_data(dataset) From bef9ff7faa6715ee98ad73e1516b52384d152ccc Mon Sep 17 00:00:00 2001 From: Jana Spinner <56519375+js3110@users.noreply.github.com> Date: Thu, 19 Dec 2024 11:08:04 +0100 Subject: [PATCH 05/21] feat: labels as tooltips --- R/generate_coldefs.R | 11 ++++++++--- inst/shiny/modules/tab_data.R | 7 ++++++- 2 files changed, 14 insertions(+), 4 deletions(-) diff --git a/R/generate_coldefs.R b/R/generate_coldefs.R index 5e8eb61..d19e9f8 100644 --- a/R/generate_coldefs.R +++ b/R/generate_coldefs.R @@ -1,7 +1,7 @@ #' Generate Column Definitions for Tables #' #' This function generates column definitions for a reactable table, -#' including both the column heading and the label (if available). +#' including both the column heading and the label (if available) as a tooltip. #' #' @param data A data frame containing the data to be displayed in the reactable table. #' @@ -23,14 +23,19 @@ generate_col_defs <- function(data) { # Extract labels from the dataset labels <- sapply(data, function(col) attr(col, "label")) - labels[!is.na(labels)] # Generate column definitions col_defs <- lapply(names(data), function(col) { label <- labels[[col]] if (!is.null(label)) { colDef( - name = paste0(col, " : ", label) + html = TRUE, + header = htmltools::tags$span( + col, + `data-toggle` = "tooltip", + `data-placement` = "top", + title = label + ) ) } else { colDef(name = col) diff --git a/inst/shiny/modules/tab_data.R b/inst/shiny/modules/tab_data.R index 0e48b18..5aa33d2 100644 --- a/inst/shiny/modules/tab_data.R +++ b/inst/shiny/modules/tab_data.R @@ -41,7 +41,12 @@ tab_data_ui <- function(id) { nav_panel("Review Data", "This is the data set that will be used for the analysis. If you want to make any changes, please do so in the Mapping and Filters tab.", - reactableOutput(ns("data_processed")) + reactableOutput(ns("data_processed")), + tags$script(HTML(" + $(document).ready(function(){ + $('[data-toggle=\"tooltip\"]').tooltip(); + }); + ")) ) ) From f5ec8116634e0f91b1b66b6e1637d6ec1faceca7 Mon Sep 17 00:00:00 2001 From: Jana Spinner <56519375+js3110@users.noreply.github.com> Date: Thu, 19 Dec 2024 11:37:15 +0100 Subject: [PATCH 06/21] lint, roxygen update, tests added --- R/generate_coldefs.R | 4 ++-- R/label_operators.R | 18 +++++++++--------- inst/shiny/modules/column_mapping.R | 8 ++++---- inst/shiny/modules/tab_data.R | 4 ++-- man/generate_col_defs.Rd | 2 +- tests/testthat/test-apply_labels.R | 21 +++++++++++++++++++++ tests/testthat/test-generate_coldefs.R | 21 +++++++++++++++++++++ 7 files changed, 60 insertions(+), 18 deletions(-) create mode 100644 tests/testthat/test-apply_labels.R create mode 100644 tests/testthat/test-generate_coldefs.R diff --git a/R/generate_coldefs.R b/R/generate_coldefs.R index d19e9f8..69b8ce5 100644 --- a/R/generate_coldefs.R +++ b/R/generate_coldefs.R @@ -23,7 +23,7 @@ generate_col_defs <- function(data) { # Extract labels from the dataset labels <- sapply(data, function(col) attr(col, "label")) - + # Generate column definitions col_defs <- lapply(names(data), function(col) { label <- labels[[col]] @@ -42,6 +42,6 @@ generate_col_defs <- function(data) { } }) names(col_defs) <- names(data) - + return(col_defs) } \ No newline at end of file diff --git a/R/label_operators.R b/R/label_operators.R index 41b7282..4228d5c 100644 --- a/R/label_operators.R +++ b/R/label_operators.R @@ -1,7 +1,7 @@ #' Apply Labels to a dataset #' #' This function adds "label" attributes to all columns in a dataset -#' Using the labels_app.csv file which contains common labels for ADPP +#' Using the labels_app.csv file which contains common labels for ADPP #' and ADPC column names #' #' @param data The dataset to which labels will be applied. @@ -21,22 +21,22 @@ apply_labels <- function(data) { labels_app <- read.csv(system.file("shiny/www/data/labels_app.csv", package = "aNCA")) - + # Create the label_ADNCA named vector from labels_app - label_ADNCA <- setNames(labels_app$Label, labels_app$Variable) - + label_adnca <- setNames(labels_app$Label, labels_app$Variable) + log_info("Applying labels to data") - + for (col in colnames(data)) { - if (col %in% names(label_ADNCA)) { - attr(data[[col]], "label") <- label_ADNCA[[col]] + if (col %in% names(label_adnca)) { + attr(data[[col]], "label") <- label_adnca[[col]] } else { attr(data[[col]], "label") <- col } } - + return(data) - } +} #' Convert to Factor While Preserving Label #' diff --git a/inst/shiny/modules/column_mapping.R b/inst/shiny/modules/column_mapping.R index 098b7c3..58e0680 100644 --- a/inst/shiny/modules/column_mapping.R +++ b/inst/shiny/modules/column_mapping.R @@ -251,10 +251,10 @@ column_mapping_server <- function(id, data, manual_units, on_submit) { return(col) }) - # # Handle ADOSEDUR == NA case - # if (input$select_ADOSEDUR == "NA") { - # dataset$ADOSEDUR <- 0 - # } + # Handle ADOSEDUR == NA case + if (input$select_ADOSEDUR == "NA") { + dataset$ADOSEDUR <- 0 + } # Update dataset columns if manual units are selected if (input$select_AVALU %in% manual_units$concentration) { diff --git a/inst/shiny/modules/tab_data.R b/inst/shiny/modules/tab_data.R index 5aa33d2..25de537 100644 --- a/inst/shiny/modules/tab_data.R +++ b/inst/shiny/modules/tab_data.R @@ -159,10 +159,10 @@ tab_data_server <- function(id) { # Update the data table object with the filtered data output$data_processed <- renderReactable({ req(data()) - + # Generate column definitions col_defs <- generate_col_defs(data()) - + reactable( data(), columns = col_defs, diff --git a/man/generate_col_defs.Rd b/man/generate_col_defs.Rd index 453745b..48eb3db 100644 --- a/man/generate_col_defs.Rd +++ b/man/generate_col_defs.Rd @@ -14,7 +14,7 @@ A named list of column definitions for the reactable table. } \description{ This function generates column definitions for a reactable table, -including both the column heading and the label (if available). +including both the column heading and the label (if available) as a tooltip. } \examples{ \dontrun{ diff --git a/tests/testthat/test-apply_labels.R b/tests/testthat/test-apply_labels.R new file mode 100644 index 0000000..d2a8104 --- /dev/null +++ b/tests/testthat/test-apply_labels.R @@ -0,0 +1,21 @@ +describe("apply labels works correctly", { + it("applies labels to matching data", { + data <- data.frame( + USUBJID = c(1, 2, 3), + AVAL = c(4, 5, 6) + ) + data <- apply_labels(data) + expect_equal(attr(data$USUBJID, "label"), "Unique Subject Identifier") + expect_equal(attr(data$AVAL, "label"), "Analysis Value") + + }) + it("appplies labels to non matching data", { + data <- data.frame( + COL1 = c(1, 2, 3), + COL2 = c(4, 5, 6) + ) + data <- apply_labels(data) + expect_equal(attr(data$COL1, "label"), "COL1") + expect_equal(attr(data$COL2, "label"), "COL2") + }) +}) \ No newline at end of file diff --git a/tests/testthat/test-generate_coldefs.R b/tests/testthat/test-generate_coldefs.R new file mode 100644 index 0000000..1bda2c9 --- /dev/null +++ b/tests/testthat/test-generate_coldefs.R @@ -0,0 +1,21 @@ +describe("column definitions generated correctly", { + it("generates column definitions with labels", { + data <- data.frame( + USUBJID = c(1, 2, 3), + AVAL = c(4, 5, 6) + ) + attr(data$USUBJID, "label") <- "Unique Subject Identifier" + attr(data$AVAL, "label") <- "Analysis Value" + col_defs <- generate_col_defs(data) + expect_equal(col_defs$USUBJID$header$attribs$title, "Unique Subject Identifier") + expect_equal(col_defs$AVAL$header$attribs$title, "Analysis Value") + }) + it("returns a list of column definitions", { + data <- data.frame( + USUBJID = c(1, 2, 3), + AVAL = c(4, 5, 6) + ) + col_defs <- generate_col_defs(data) + expect_type(col_defs, "list") + }) +}) \ No newline at end of file From b6bd1d051f9a9bc27120e4eb4ae1baab64bb19c5 Mon Sep 17 00:00:00 2001 From: Jana Spinner <56519375+js3110@users.noreply.github.com> Date: Fri, 20 Dec 2024 11:16:10 +0100 Subject: [PATCH 07/21] preserve factors and show labels in nca setup --- R/label_operators.R | 5 +++++ inst/shiny/tabs/nca.R | 27 +++++++++++++++++---------- inst/shiny/ui.R | 2 +- 3 files changed, 23 insertions(+), 11 deletions(-) diff --git a/R/label_operators.R b/R/label_operators.R index 4228d5c..4253321 100644 --- a/R/label_operators.R +++ b/R/label_operators.R @@ -33,6 +33,11 @@ apply_labels <- function(data) { } else { attr(data[[col]], "label") <- col } + + # Check if the column is a factor and keep the levels order + if (is.factor(data[[col]])) { + data[[col]] <- as_factor_preserve_label(data[[col]]) + } } return(data) diff --git a/inst/shiny/tabs/nca.R b/inst/shiny/tabs/nca.R index f1700e3..2960fb0 100644 --- a/inst/shiny/tabs/nca.R +++ b/inst/shiny/tabs/nca.R @@ -218,17 +218,24 @@ observeEvent(input$submit_analyte, priority = 2, { }) # Display the PKNCA data object for the user (concentration records) -output$datatable <- DT::renderDataTable({ +output$datatable <- renderReactable({ req(mydata()) - DT::datatable( - data = mydata()$conc$data, - extensions = "FixedHeader", - options = list( - scrollX = TRUE, - scrollY = TRUE, - lengthMenu = list(c(10, 25, -1), c("10", "25", "All")), - fixedHeader = TRUE - ) + data <- mydata()$conc$data + # Generate column definitions + col_defs <- generate_col_defs(data) + + reactable( + data, + columns = col_defs, + searchable = TRUE, + sortable = TRUE, + highlight = TRUE, + wrap = FALSE, + resizable = TRUE, + showPageSizeOptions = TRUE, + striped = TRUE, + bordered = TRUE, + height = "60vh" ) }) diff --git a/inst/shiny/ui.R b/inst/shiny/ui.R index 31007b0..6015a8e 100644 --- a/inst/shiny/ui.R +++ b/inst/shiny/ui.R @@ -48,7 +48,7 @@ fluidPage( selectInput("analyte", "Choose the analyte :", choices = NULL), br(), actionButton("submit_analyte", "Submit"), - DTOutput("datatable"), + reactableOutput("datatable"), ), tabPanel("Settings", selectInput( From f8ac5ccfec49e4f1cb27c8c21de0dccf927a452f Mon Sep 17 00:00:00 2001 From: Jana Spinner <56519375+js3110@users.noreply.github.com> Date: Fri, 20 Dec 2024 11:24:10 +0100 Subject: [PATCH 08/21] update wordlist --- inst/WORDLIST | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/inst/WORDLIST b/inst/WORDLIST index 548d118..f9d236b 100644 --- a/inst/WORDLIST +++ b/inst/WORDLIST @@ -1,4 +1,5 @@ ADNCA +ADPC ADPP AFRLT AUClast @@ -25,8 +26,8 @@ analyte analytes anonymized anonymizes -cheatsheet cmax +codebase csv customizable ggplot @@ -36,12 +37,13 @@ pknca plotly pptest pre +reactable reupload ruleset rulesets sas summarization timepoint +tooltip visualizable xpt -codebase From 0ec40750d0dc77eaa0b4b129a7ee18fcd5307eb3 Mon Sep 17 00:00:00 2001 From: Jana Spinner <56519375+js3110@users.noreply.github.com> Date: Fri, 20 Dec 2024 11:31:05 +0100 Subject: [PATCH 09/21] lint update --- inst/shiny/tabs/nca.R | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/inst/shiny/tabs/nca.R b/inst/shiny/tabs/nca.R index 2960fb0..5576fd9 100644 --- a/inst/shiny/tabs/nca.R +++ b/inst/shiny/tabs/nca.R @@ -223,7 +223,7 @@ output$datatable <- renderReactable({ data <- mydata()$conc$data # Generate column definitions col_defs <- generate_col_defs(data) - + reactable( data, columns = col_defs, From a3d2ef84c64eb6bc5c08fa69b3cce1e1c7318e6a Mon Sep 17 00:00:00 2001 From: Jana Spinner <56519375+js3110@users.noreply.github.com> Date: Fri, 20 Dec 2024 13:08:45 +0100 Subject: [PATCH 10/21] Update test apply_labels.R MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Mateusz Kołomański <63905560+m-kolomanski@users.noreply.github.com> --- tests/testthat/test-apply_labels.R | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/testthat/test-apply_labels.R b/tests/testthat/test-apply_labels.R index d2a8104..d37b0ff 100644 --- a/tests/testthat/test-apply_labels.R +++ b/tests/testthat/test-apply_labels.R @@ -1,4 +1,4 @@ -describe("apply labels works correctly", { +describe("apply_labels", { it("applies labels to matching data", { data <- data.frame( USUBJID = c(1, 2, 3), From 696db909b039a2ef01b6575a7ecefe769298660d Mon Sep 17 00:00:00 2001 From: Jana Spinner <56519375+js3110@users.noreply.github.com> Date: Fri, 20 Dec 2024 13:09:15 +0100 Subject: [PATCH 11/21] Update test generate_coldefs.R MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Mateusz Kołomański <63905560+m-kolomanski@users.noreply.github.com> --- tests/testthat/test-generate_coldefs.R | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/testthat/test-generate_coldefs.R b/tests/testthat/test-generate_coldefs.R index 1bda2c9..f98f58e 100644 --- a/tests/testthat/test-generate_coldefs.R +++ b/tests/testthat/test-generate_coldefs.R @@ -1,4 +1,4 @@ -describe("column definitions generated correctly", { +describe("generate_col_defs", { it("generates column definitions with labels", { data <- data.frame( USUBJID = c(1, 2, 3), From e3fff0bfba083afb666df791f9a0af8ecbc491fb Mon Sep 17 00:00:00 2001 From: Jana Spinner <56519375+js3110@users.noreply.github.com> Date: Fri, 20 Dec 2024 13:18:49 +0100 Subject: [PATCH 12/21] Update R/label_operators.R MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Mateusz Kołomański <63905560+m-kolomanski@users.noreply.github.com> --- R/label_operators.R | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/R/label_operators.R b/R/label_operators.R index 4253321..8310218 100644 --- a/R/label_operators.R +++ b/R/label_operators.R @@ -40,7 +40,7 @@ apply_labels <- function(data) { } } - return(data) + data } #' Convert to Factor While Preserving Label From eda0593b0d29b3a58ed7ab6bbf25bacf262343bc Mon Sep 17 00:00:00 2001 From: Jana Spinner <56519375+js3110@users.noreply.github.com> Date: Fri, 20 Dec 2024 13:19:31 +0100 Subject: [PATCH 13/21] Update R/generate_coldefs.R MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Mateusz Kołomański <63905560+m-kolomanski@users.noreply.github.com> --- R/generate_coldefs.R | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/R/generate_coldefs.R b/R/generate_coldefs.R index 69b8ce5..76d6c82 100644 --- a/R/generate_coldefs.R +++ b/R/generate_coldefs.R @@ -40,8 +40,6 @@ generate_col_defs <- function(data) { } else { colDef(name = col) } - }) - names(col_defs) <- names(data) - - return(col_defs) + }) |> + setNames(names(data)) } \ No newline at end of file From 9c58316f63d8e7517a2d650d0c16e067fd0823bb Mon Sep 17 00:00:00 2001 From: Jana Spinner <56519375+js3110@users.noreply.github.com> Date: Fri, 20 Dec 2024 13:20:54 +0100 Subject: [PATCH 14/21] fix: rename variables --- NAMESPACE | 1 - R/label_operators.R | 12 +++----- .../shiny/functions/generate_col_defs.R | 0 inst/shiny/global.R | 1 + inst/shiny/modules/column_mapping.R | 5 ++-- .../data/{labels_app.csv => adnca_labels.csv} | 0 man/apply_labels.Rd | 2 +- man/generate_col_defs.Rd | 30 ------------------- 8 files changed, 9 insertions(+), 42 deletions(-) rename R/generate_coldefs.R => inst/shiny/functions/generate_col_defs.R (100%) rename inst/shiny/www/data/{labels_app.csv => adnca_labels.csv} (100%) delete mode 100644 man/generate_col_defs.Rd diff --git a/NAMESPACE b/NAMESPACE index 8941bc6..32c78d5 100644 --- a/NAMESPACE +++ b/NAMESPACE @@ -12,7 +12,6 @@ export(flexible_violinboxplot) export(format_data) export(general_lineplot) export(general_meanplot) -export(generate_col_defs) export(geometric_mean) export(has_label) export(lambda_slope_plot) diff --git a/R/label_operators.R b/R/label_operators.R index 4253321..f38e001 100644 --- a/R/label_operators.R +++ b/R/label_operators.R @@ -18,14 +18,10 @@ #' } #' #' @export -apply_labels <- function(data) { - - labels_app <- read.csv(system.file("shiny/www/data/labels_app.csv", package = "aNCA")) +apply_labels <- function(data, labels_file) { # Create the label_ADNCA named vector from labels_app - label_adnca <- setNames(labels_app$Label, labels_app$Variable) - - log_info("Applying labels to data") + label_adnca <- setNames(labels_file$Label, labels_file$Variable) for (col in colnames(data)) { if (col %in% names(label_adnca)) { @@ -39,8 +35,8 @@ apply_labels <- function(data) { data[[col]] <- as_factor_preserve_label(data[[col]]) } } - - return(data) + + data } #' Convert to Factor While Preserving Label diff --git a/R/generate_coldefs.R b/inst/shiny/functions/generate_col_defs.R similarity index 100% rename from R/generate_coldefs.R rename to inst/shiny/functions/generate_col_defs.R diff --git a/inst/shiny/global.R b/inst/shiny/global.R index c794d3e..90c0fc1 100644 --- a/inst/shiny/global.R +++ b/inst/shiny/global.R @@ -4,3 +4,4 @@ source("modules/slope_selector.R") source("functions/partial_auc_input.R") source("functions/mapping_selectize_inputs.R") +source("functions/generate_col_defs.R") diff --git a/inst/shiny/modules/column_mapping.R b/inst/shiny/modules/column_mapping.R index 58e0680..e1ad185 100644 --- a/inst/shiny/modules/column_mapping.R +++ b/inst/shiny/modules/column_mapping.R @@ -272,9 +272,10 @@ column_mapping_server <- function(id, data, manual_units, on_submit) { relocate(all_of(desired_order)) %>% mutate(TIME = ifelse(DOSNO == 1, AFRLT, ARRLT))#TODO: Remove this after AUC0 merged + #Load labels + labels_file <- read.csv(system.file("shiny/www/data/adnca_labels.csv", package = "aNCA")) # Apply labels to the dataset - message("Calling apply_labels function") - dataset <- apply_labels(dataset) + dataset <- apply_labels(dataset, labels_file) # Update the processed data processed_data(dataset) diff --git a/inst/shiny/www/data/labels_app.csv b/inst/shiny/www/data/adnca_labels.csv similarity index 100% rename from inst/shiny/www/data/labels_app.csv rename to inst/shiny/www/data/adnca_labels.csv diff --git a/man/apply_labels.Rd b/man/apply_labels.Rd index 54f6d25..366f124 100644 --- a/man/apply_labels.Rd +++ b/man/apply_labels.Rd @@ -4,7 +4,7 @@ \alias{apply_labels} \title{Apply Labels to a dataset} \usage{ -apply_labels(data) +apply_labels(data, labels_file) } \arguments{ \item{data}{The dataset to which labels will be applied.} diff --git a/man/generate_col_defs.Rd b/man/generate_col_defs.Rd deleted file mode 100644 index 48eb3db..0000000 --- a/man/generate_col_defs.Rd +++ /dev/null @@ -1,30 +0,0 @@ -% Generated by roxygen2: do not edit by hand -% Please edit documentation in R/generate_coldefs.R -\name{generate_col_defs} -\alias{generate_col_defs} -\title{Generate Column Definitions for Tables} -\usage{ -generate_col_defs(data) -} -\arguments{ -\item{data}{A data frame containing the data to be displayed in the reactable table.} -} -\value{ -A named list of column definitions for the reactable table. -} -\description{ -This function generates column definitions for a reactable table, -including both the column heading and the label (if available) as a tooltip. -} -\examples{ -\dontrun{ - data <- data.frame( - USUBJID = c(1, 2, 3), - AVAL = c(4, 5, 6) - ) - attr(data$USUBJID, "label") <- "Unique Subject Identifier" - attr(data$AVAL, "label") <- "Analysis Value" - col_defs <- generate_col_defs(data) -} - -} From db42d3b212a62423fd5529578ad6238c757dafc5 Mon Sep 17 00:00:00 2001 From: Jana Spinner <56519375+js3110@users.noreply.github.com> Date: Fri, 20 Dec 2024 15:36:50 +0100 Subject: [PATCH 15/21] fix: testing source function --- R/label_operators.R | 6 +++++- man/apply_labels.Rd | 6 +++++- tests/testthat/test-apply_labels.R | 12 ++++++++++-- ...t-generate_coldefs.R => test-generate_col_defs.R} | 3 +++ 4 files changed, 23 insertions(+), 4 deletions(-) rename tests/testthat/{test-generate_coldefs.R => test-generate_col_defs.R} (84%) diff --git a/R/label_operators.R b/R/label_operators.R index 58085cb..3ab560a 100644 --- a/R/label_operators.R +++ b/R/label_operators.R @@ -13,7 +13,11 @@ #' \dontrun{ #' # Example usage: #' data <- data.frame(USUBJID = c(1, 2, 3), AVAL = c(4, 5, 6)) -#' data <- apply_labels(data) +#' labels <- data.frame( +#' Variable = c("USUBJID", "AVAL"), +#' Label = c("Unique Subject Identifier", "Analysis Value") +#' ) +#' data <- apply_labels(data, labels) #' print(attr(data$A, "label")) #' } #' diff --git a/man/apply_labels.Rd b/man/apply_labels.Rd index 366f124..f03dd5d 100644 --- a/man/apply_labels.Rd +++ b/man/apply_labels.Rd @@ -22,7 +22,11 @@ and ADPC column names \dontrun{ # Example usage: data <- data.frame(USUBJID = c(1, 2, 3), AVAL = c(4, 5, 6)) - data <- apply_labels(data) + labels <- data.frame( + Variable = c("USUBJID", "AVAL"), + Label = c("Unique Subject Identifier", "Analysis Value") + ) + data <- apply_labels(data, labels) print(attr(data$A, "label")) } diff --git a/tests/testthat/test-apply_labels.R b/tests/testthat/test-apply_labels.R index d37b0ff..960b007 100644 --- a/tests/testthat/test-apply_labels.R +++ b/tests/testthat/test-apply_labels.R @@ -4,7 +4,11 @@ describe("apply_labels", { USUBJID = c(1, 2, 3), AVAL = c(4, 5, 6) ) - data <- apply_labels(data) + labels <- data.frame( + Variable = c("USUBJID", "AVAL"), + Label = c("Unique Subject Identifier", "Analysis Value") + ) + data <- apply_labels(data, labels) expect_equal(attr(data$USUBJID, "label"), "Unique Subject Identifier") expect_equal(attr(data$AVAL, "label"), "Analysis Value") @@ -14,7 +18,11 @@ describe("apply_labels", { COL1 = c(1, 2, 3), COL2 = c(4, 5, 6) ) - data <- apply_labels(data) + labels <- data.frame( + Variable = c("USUBJID", "AVAL"), + Label = c("Unique Subject Identifier", "Analysis Value") + ) + data <- apply_labels(data, labels) expect_equal(attr(data$COL1, "label"), "COL1") expect_equal(attr(data$COL2, "label"), "COL2") }) diff --git a/tests/testthat/test-generate_coldefs.R b/tests/testthat/test-generate_col_defs.R similarity index 84% rename from tests/testthat/test-generate_coldefs.R rename to tests/testthat/test-generate_col_defs.R index f98f58e..08d5104 100644 --- a/tests/testthat/test-generate_coldefs.R +++ b/tests/testthat/test-generate_col_defs.R @@ -1,3 +1,6 @@ +root <- rprojroot::find_root(rprojroot::is_r_package) +source(file.path(root, "/inst/shiny/functions/generate_col_defs.R")) + describe("generate_col_defs", { it("generates column definitions with labels", { data <- data.frame( From d4dd0665ffbc46a3d41e10d9a783f023ddf93fd0 Mon Sep 17 00:00:00 2001 From: m-kolomanski Date: Thu, 2 Jan 2025 08:04:28 +0100 Subject: [PATCH 16/21] chore: changes sourcing of function file to fix R CMD check namespaced function calls as they were not sourced properly when in R CMD check --- inst/shiny/functions/generate_col_defs.R | 4 ++-- tests/testthat/test-generate_col_defs.R | 3 +-- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/inst/shiny/functions/generate_col_defs.R b/inst/shiny/functions/generate_col_defs.R index 3b14b08..796524e 100644 --- a/inst/shiny/functions/generate_col_defs.R +++ b/inst/shiny/functions/generate_col_defs.R @@ -27,7 +27,7 @@ generate_col_defs <- function(data) { col_defs <- lapply(names(data), function(col) { label <- labels[[col]] if (!is.null(label)) { - colDef( + reactable::colDef( html = TRUE, header = htmltools::tags$span( col, @@ -37,7 +37,7 @@ generate_col_defs <- function(data) { ) ) } else { - colDef(name = col) + reactable::colDef(name = col) } }) |> setNames(names(data)) diff --git a/tests/testthat/test-generate_col_defs.R b/tests/testthat/test-generate_col_defs.R index 08d5104..1e95c4c 100644 --- a/tests/testthat/test-generate_col_defs.R +++ b/tests/testthat/test-generate_col_defs.R @@ -1,5 +1,4 @@ -root <- rprojroot::find_root(rprojroot::is_r_package) -source(file.path(root, "/inst/shiny/functions/generate_col_defs.R")) +source(system.file("shiny/functions/generate_col_defs.R", package = "aNCA")) describe("generate_col_defs", { it("generates column definitions with labels", { From f2f9b0a237f80e39c9e21d71ebd464bd3b1f848e Mon Sep 17 00:00:00 2001 From: Jana Spinner <56519375+js3110@users.noreply.github.com> Date: Thu, 2 Jan 2025 08:33:04 +0100 Subject: [PATCH 17/21] change data location --- inst/shiny/modules/column_mapping.R | 2 +- inst/shiny/www/data/adnca_labels.csv | 343 --------------------------- 2 files changed, 1 insertion(+), 344 deletions(-) delete mode 100644 inst/shiny/www/data/adnca_labels.csv diff --git a/inst/shiny/modules/column_mapping.R b/inst/shiny/modules/column_mapping.R index b1ff6b3..9a0b1b9 100644 --- a/inst/shiny/modules/column_mapping.R +++ b/inst/shiny/modules/column_mapping.R @@ -339,7 +339,7 @@ column_mapping_server <- function(id, data, manual_units, on_submit) { mutate(TIME = ifelse(DOSNO == 1, AFRLT, ARRLT))#TODO: Remove this after AUC0 merged #Load labels - labels_file <- read.csv(system.file("shiny/www/data/adnca_labels.csv", package = "aNCA")) + labels_file <- read.csv(system.file("shiny/data/adnca_labels.csv", package = "aNCA")) # Apply labels to the dataset dataset <- apply_labels(dataset, labels_file) diff --git a/inst/shiny/www/data/adnca_labels.csv b/inst/shiny/www/data/adnca_labels.csv deleted file mode 100644 index 1d375b8..0000000 --- a/inst/shiny/www/data/adnca_labels.csv +++ /dev/null @@ -1,343 +0,0 @@ -Variable,Label,Dataset -STUDYID,Study Identifier,ADPC -USUBJID,Unique Subject Identifier,ADPC -SUBJID,Subject Identifier for the Study,ADPC -SITEID,Study Site Identifier,ADPC -ASEQ,Analysis Sequence Number,ADPC -REGION1,Geographic Region 1,ADPC -COUNTRY,Country,ADPC -ETHNIC,Ethnicity,ADPC -AGE,Age,ADPC -AGEU,Age Units,ADPC -AAGE,Analysis Age,ADPC -AAGEU,Analysis Age Unit,ADPC -AGEGR1,Pooled Age Group 1,ADPC -AGEGR2,Pooled Age Group 2,ADPC -AGEGR3,Pooled Age Group 3,ADPC -STRATwNM,Description of Stratum w,ADPC -STRATw,Randomized Value of Stratum w,ADPC -STRATwV,Verified Value of Stratum w,ADPC -SEX,Sex,ADPC -RACE,Race,ADPC -ITTFL,Intent-To-Treat Population Flag,ADPC -SAFFL,Safety Population Flag,ADPC -PPROTFL,Per-Protocol Population Flag,ADPC -TRT01P,Planned Treatment for Period 01,ADPC -TRT02P,Planned Treatment for Period 02,ADPC -TRT03P,Planned Treatment for Period 03,ADPC -TRT04P,Planned Treatment for Period 04,ADPC -TRT05P,Planned Treatment for Period 05,ADPC -TRT01A,Actual Treatment for Period 01,ADPC -TRT02A,Actual Treatment for Period 02,ADPC -TRT03A,Actual Treatment for Period 03,ADPC -TRT04A,Actual Treatment for Period 04,ADPC -TRT05A,Actual Treatment for Period 05,ADPC -TRTSEQP,Planned Sequence of Treatments,ADPC -TRTSEQA,Actual Sequence of Treatments,ADPC -TRTSDTM,Datetime of First Exposure to Treatment,ADPC -TRTSDT,Date of First Exposure to Treatment,ADPC -TRTEDTM,Datetime of Last Exposure to Treatment,ADPC -TRTEDT,Date of Last Exposure to Treatment,ADPC -DCUTDT,Date of Data Cut,ADPC -PCSEQ,Sequence Number,ADPC -PCGRPID,Group ID,ADPC -PCREFID,Reference ID,ADPC -PCSPID,Sponsor-Defined Identifier,ADPC -PCTESTCD,Pharmacokinetic Test Short Name,ADPC -PCTEST,Pharmacokinetic Test Name,ADPC -PCCAT,Test Category,ADPC -PCSCAT,Test Subcategory,ADPC -PCSTRESC,Character Result/Finding in Std Format,ADPC -PCSTRESN,Numeric Result/Finding in Standard Units,ADPC -PCSTRESU,Standard Units,ADPC -PCSTAT,Completion Status,ADPC -PCREASND,Reason Test Not Done,ADPC -PCSPEC,Specimen Material Type,ADPC -PCSPCCND,Specimen Condition,ADPC -PCMETHOD,Method of Test or Examination,ADPC -PCFAST,Fasting Status,ADPC -PCLLOQ,Lower Limit of Quantitation,ADPC -VISITNUM,Visit Number,ADPC -VISIT,Visit Name,ADPC -VISITDY,Planned Study Day of Visit,ADPC -EPOCH,Epoch,ADPC -PCDTC,Date/Time of Specimen Collection,ADPC -PCDY,Actual Study Day of Specimen Collection,ADPC -PCTPT,Planned Time Point Name,ADPC -PCTPTNUM,Planned Time Point Number,ADPC -PCSMPLID,Alternate Sample Identifier,ADPC -PCAINTP,Assay Interpretation,ADPC -PARAM,Parameter,ADPC -PARAMCD,Parameter Code,ADPC -PARCAT1,Parameter Category 1,ADPC -AVAL,Analysis Value,ADPC -AVALCAT1,Analysis Value Category 1,ADPC -AVALU,Analysis Value Unit,ADPC -AVALU,Analysis Value Unit,ADPC -BASE,Baseline Value,ADPC -BASETYPE,Baseline Type,ADPC -ABLFL,Baseline Record Flag,ADPC -ALLOQ,Analysis Lower Limit of Quantitation,ADPC -ADTM,Analysis Datetime,ADPC -ADT,Analysis Date,ADPC -ATM,Analysis Time,ADPC -ADY,Analysis Relative Day,ADPC -ADTF,Analysis Date Imputation Flag,ADPC -ATMF,Analysis Time Imputation Flag,ADPC -ASTDT,Analysis Start Date,ADPC -ASTTM,Analysis Start Time,ADPC -ASTDTM,Analysis Start Date/Time,ADPC -ASTDTF,Analysis Start Date Imputation Flag,ADPC -ASTTMF,Analysis Start Time Imputation Flag,ADPC -AENDT,Analysis End Date,ADPC -AENTM,Analysis End Time,ADPC -AENDTM,Analysis End Date/Time,ADPC -AENDTF,Analysis End Date Imputation Flag,ADPC -AENTMF,Analysis End Time Imputation Flag,ADPC -ATPT,Analysis Timepoint,ADPC -ATPT,Analysis Timepoint,ADPC -ATPTN,Analysis Timepoint (N),ADPC -ATPTN,Analysis Timepoint (N),ADPC -ATPTREF,Analysis Timepoint Reference,ADPC -AVISIT,Analysis Visit,ADPC -AVISIT,Analysis Visit,ADPC -AVISITN,Analysis Visit (N),ADPC -AVISITN,Analysis Visit (N),ADPC -APERIOD,Period,ADPC -APERIODC,Period (C),ADPC -FANLDT,First Date of Dose for Analyte,ADPC -FANLTM,First Time of Dose for Analyte,ADPC -FANLDTM,First Datetime of Dose for Analyte,ADPC -FANLDTMF,First Time of Dose Time Imputation Flag,ADPC -FANLEDT,First End Date of Dose for Analyte,ADPC -FANLETM,First End Time of Dose for Analyte,ADPC -FANLEDTM,First End Datetime of Dose for Analyte,ADPC -FANLEDTF,First End of Dose Time Imputation Flag,ADPC -PCRFTDT,Reference Date of Dose for Analyte,ADPC -PCRFTTM,Reference Time of Dose for Analyte,ADPC -PCRFTDTM,Reference Datetime of Dose for Analyte,ADPC -PCRFEDT,Reference End Date of Dose for Analyte,ADPC -PCRFETM,Reference End Time of Dose for Analyte,ADPC -PCRFEDTM,Ref. End Datetime of Dose for Analyte,ADPC -NFRLT,Nom. Rel. Time from Analyte First Dose,ADPC -AFRLT,Act. Rel. Time from Analyte First Dose,ADPC -TMPCTDF,Percent Diff. Nominal vs. Actual Time,ADPC -FRLTU,Rel. Time from First Dose Unit,ADPC -NEFRLT,Nom. Rel. End Time from First Dose,ADPC -AEFRLT,Act. Rel. End Time from First Dose,ADPC -NRRLT,Nominal Rel. Time from Ref. Dose,ADPC -ARRLT,Actual Rel. Time from Ref. Dose,ADPC -MRRLT,Modified Rel. Time from Ref. Dose,ADPC -RRLTU,Rel. Time from Ref. Dose Unit,ADPC -NERRLT,Nominal Rel. End Time from Ref. Dose,ADPC -NERRLT,Nominal Rel. End Time from Ref. Dose,ADPC -AERRLT,Actual Rel. End Time from Ref. Dose,ADPC -AERRLT,Actual Rel. End Time from Ref. Dose,ADPC -MERRLT,Modified Rel. End Time from Ref. Dose,ADPC -MERRLT,Modified Rel. End Time from Ref. Dose,ADPC -CHG,Change from Baseline,ADPC -CRIT1,Analysis Criterion 1,ADPC -CRIT1FL,Criterion 1 Evaluation Result Flag,ADPC -CRIT1FL,Criterion 1 Evaluation Result Flag,ADPC -DTYPE,Derivation Type,ADPC -SPARSFL,Sparse Flag,ADPC -NCAXFL,PK NCA Exclusion Flag,ADPC -NCAXFN,PK NCA Exclusion Flag (N),ADPC -NCAwXRS,Reason w for PK NCA Exclusion,ADPC -NCAwXRSN,Reason for PK NCA Exclusion of w (N),ADPC -PKSUMXF,PK Summary Exclusion Flag,ADPC -PKSUMXFN,PK Summary Exclusion Flag (N),ADPC -METABFL,Metabolite Flag,ADPC -COHORT,Subject Cohort,ADPC -COHORTN,Subject Cohort (N),ADPC -ROUTE,Route,ADPC -TRTRINT,Planned Treatment Interval,ADPC -TRTRINTU,Planned Treatment Interval Units,ADPC -DOSPCTDF,Percent Diff. Nominal vs. Actual Dose,ADPC -DOSEFRQ,Dose Frequency,ADPC -DOSEP,Planned Treatment Dose,ADPC -DOSEA,Actual Treatment Dose,ADPC -DOSEPU,Planned Treatment Dose Units,ADPC -DOSEAU,Actual Treatment Dose Units,ADPC -ACYCLE,Analysis Cycle,ADPC -ACYCLEC,Analysis Cycle (C),ADPC -ADOSEDUR,Actual Duration of Treatment Dose,ADPC -NDOSEDUR,Nominal duration of Treatment Dose,ADPC -DOSEDURU,Duration of Treatment Dose Units,ADPC -VOLUME,Volume Value,ADPC -VOLUMEU,Volume Value Unit,ADPC -SPWEIGHT,Specimen Weight Value,ADPC -SPWEIGHU,Specimen Weight Value Unit,ADPC -WTBL,Weight at Baseline,ADPC -HTBL,Height at Baseline,ADPC -IBWBL,Ideal Body Weight (IBW) at Baseline,ADPC -LBMBL,Lean Body Mass (LBM) at Baseline,ADPC -BMIBL,BMI at Baseline,ADPC -BSABL,BSA at Baseline,ADPC -SBPBL,Systolic BP at Baseline,ADPC -DBPBL,Diastolic BP at Baseline,] -TOBBL,Smoking Status at Baseline,ADPC -ALCOBL,Alcohol at Baseline,ADPC -TEMPBL,Temperature at Baseline,ADPC -PULSBL,Pulse rate at Baseline,ADPC -ADA,Treatment Emergent ADA status,ADPC -AAGBL,Alpha-1 Acid Glycoprotein at Baseline,ADPC -CREATBL,Creatinine at Baseline (BLOOD),ADPC -CRCLBL,CrCL at Baseline,ADPC -ALBUBL,Albumin at Baseline,ADPC -EOSBL,Eosinophils at Baseline,ADPC -BUNBL,Blood Urea Nitrogen at Baseline,ADPC -CALCBL,Calcium at Baseline,ADPC -CLBL,Chloride at Baseline,ADPC -PHBL,Phosphate at Baseline,ADPC -PLATEBL,Platelet Count at Baseline,ADPC -WBCBL,WBC Count at Baseline,ADPC -GGTBL,GGT at Baseline,ADPC -GLUCBL,Glucose at Baseline,ADPC -HCTBL,Hematocrit at Baseline,ADPC -HGBBL,Hemoglobin at Baseline,ADPC -ALKPHBL,Alkaline Phosphatase at Baseline,ADPC -KBL,Potassium at Baseline,ADPC -LYMBL,Lymphocytes at Baseline,ADPC -MONOBL,Monocytes at Baseline,ADPC -NABL,Sodium at Baseline,ADPC -NEUBL,Neutrophils at Baseline,ADPC -RBCBL,RBC Count at Baseline,ADPC -TBILIBL,Bilirubin at Baseline (BLOOD),ADPC -TPROTBL,Total Protein at Baseline (BLOOD),ADPC -SGOTBL,SGOT-AST at Baseline,ADPC -SGPTBL,SGPT-ALT at Baseline,ADPC -RRBL,RR Duration at Baseline,ADPC -PRBL,PR Duration at Baseline,ADPC -QRSBL,QRS Duration at Baseline,ADPC -QTBL,QT duration at Baseline,ADPC -QTCBBL,QTcB at Baseline,ADPC -QTCFBL,QTcF at Baseline,ADPC -HRBL,Heart Rate at Baseline,ADPC -WTBLU,Weight at Baseline (Unit),ADPC -HTBLU,Height at Baseline (Unit),ADPC -IBWBLU,IBW at Baseline (Unit),ADPC -LBWBLU,LBM at Baseline (Unit),ADPC -BMIBLU,BMI at Baseline (Unit),ADPC -BSABLU,BSA at Baseline (Unit),ADPC -SBPBLU,Systolic BP at Baseline (Unit),ADPC -DBPBLU,Diastolic BP at Baseline (Unit),ADPC -TOBBLU,Smoking Status at Baseline (Unit),ADPC -PULSBLU,Pulse rate at Baseline (Unit),ADPC -AAGBLU,AAG at baseline (Unit),ADPC -CREATBLU,Creat at baseline (BLOOD),ADPC -CRCLBLU,CrCL at baseline (BLOOD),ADPC -ALBUBLU,Albumin at baseline (Unit),ADPC -EOSBLU,Eosinophils at baseline (Unit),ADPC -BUNBLU,Blood Urea Nitrogen at baseline (Unit),ADPC -CALCBLU,Calcium at baseline (Unit),ADPC -CLBLU,Chloride at baseline (Unit),ADPC -PHBLU,Phosphate at baseline (Unit),ADPC -PLATEBLU,Platelet Count at baseline (Unit),ADPC -WBCBLU,WBC Count at baseline (Unit),ADPC -GGTBLU,GGT at Baseline (Unit),ADPC -GLUBLU,Glucose at Baseline (Unit),ADPC -HCTBLU,HCT at Baseline (Unit),ADPC -HGBBLU,HGB at Baseline (Unit),ADPC -ALKPHBLU,Alkaline Phosphatase at Baseline (Unit),ADPC -KBLU,Potassium at Baseline (Unit),ADPC -LYMBLU,Lymphocytes at Baseline (Unit),ADPC -MONOBLU,Monocytes at Baseline (Unit),ADPC -NABLU,Sodium at Baseline (Unit),ADPC -NEUBLU,Neutrophils at Baseline (Unit),ADPC -RBCBLU,RBC Count at Baseline (Unit),ADPC -TBILIBLU,Bilirubin at Baseline (Unit),ADPC -TPROTBLU,Total Protein at Baseline (Unit),ADPC -SGOTBLU,SGOT-AST at Baseline (Unit),ADPC -SGPTBLU,SGPT-ALT at Baseline (Unit),ADPC -RRBLU,RR Duration at Baseline (Unit),ADPC -PRBLU,PR Duration at Baseline (Unit),ADPC -QRSBLU,QRS Duration at Baseline (Unit),ADPC -QTBLU,QT Duration at Baseline (Unit),ADPC -QTCBBLU,QTcB at Baseline (Unit),ADPC -QTCFBLU,QTcF at Baseline (Unit),ADPC -HRBLU,Heart Rate at Baseline (Unit),ADPC -DRUG,Medication Name,ADPC -REGIME,Regimen of Medication,ADPC -FRMUL,Treatment Formulation,ADPC -DOSNO,Dose Number,ADPC -FEDSTATE,Fasted / Fed Status,ADPC -ANL01FL,Analysis Flag 01,ADPC -ANL02FL,Analysis Flag 02,ADPC -ANL03FL,Analysis Flag 03,ADPC -ANL04FL,Analysis Flag 04,ADPC -ANL05FL,Analysis Flag 05,ADPC -STUDYID,Study Identifier,ADPP -USUBJID,Unique Subject Identifier,ADPP -SUBJID,Subject Identifier for the Study,ADPP -SITEID,Study Site Identifier,ADPP -ASEQ,Analysis Sequence Number,ADPP -REGION1,Geographic Region 1,ADPP -COUNTRY,Country,ADPP -ETHNIC,Ethnicity,ADPP -AGE,Age,ADPP -AGEU,Age Units,ADPP -AAGE,Analysis Age,ADPP -AAGEU,Analysis Age Unit,ADPP -AGEGR1,Pooled Age Group 1,ADPP -AGEGR2,Pooled Age Group 2,ADPP -AGEGR3,Pooled Age Group 3,ADPP -STRATwNM,Description of Stratum w,ADPP -STRATw,Randomized Value of Stratum w,ADPP -STRATwV,Verified Value of Stratum w,ADPP -SEX,Sex,ADPP -RACE,Race,ADPP -ITTFL,Intent-To-Treat Population Flag,ADPP -SAFFL,Safety Population Flag,ADPP -PPROTFL,Per-Protocol Population Flag,ADPP -TRT01P,Planned Treatment for Period 01,ADPP -TRTxxP,Planned Treatment for Period xx,ADPP -TRT01A,Actual Treatment for Period 01,ADPP -TRTxxA,Actual Treatment for Period xx,ADPP -TRTSEQP,Planned Sequence of Treatments,ADPP -TRTSEQA,Actual Sequence of Treatments,ADPP -TRTSDTM,Datetime of First Exposure to Treatment,ADPP -TRTSDT,Date of First Exposure to Treatment,ADPP -TRTEDTM,Datetime of Last Exposure to Treatment,ADPP -TRTEDT,Date of Last Exposure to Treatment,ADPP -DCUTDT,Date of Data Cut,ADPP -PPSEQ,Sequence Number,ADPP -PPGRPID,Group ID,ADPP -PPSPID,Sponsor-Defined Identifier,ADPP -PPTESTCD,Parameter Short Name,ADPP -PPTEST,Parameter Name,ADPP -PPCAT,Parameter Category,ADPP -PPSCAT,Parameter Subcategory,ADPP -PPSTRESC,Character Result/Finding in Std Format,ADPP -PPSTRESN,Numeric Result/Finding in Standard Units,ADPP -PPSTRESU,Standard Units,ADPP -PPSTAT,Completion Status,ADPP -PPREASND,Reason Parameter Not Calculated,ADPP -PPSPEC,Specimen Material Type,ADPP -PPDTC,Date/Time of Parameter Calculations,ADPP -PPRFTDTC,Date/Time of Reference Point,ADPP -PPSTINT,Planned Start of Assessment Interval,ADPP -PPENINT,Planned End of Assessment Interval,ADPP -PARAM,Parameter,ADPP -PARAMCD,Parameter Code,ADPP -PARCAT1,Parameter Category 1,ADPP -PARCAT1,Parameter Category 1,ADPP -AVAL,Analysis Value,ADPP -AVALC,Analysis Value (C),ADPP -ADTM,Analysis Datetime,ADPP -ADT,Analysis Date,ADPP -ATM,Analysis Time,ADPP -ADY,Analysis Relative Day,ADPP -ADTF,Analysis Date Imputation Flag,ADPP -ATMF,Analysis Time Imputation Flag,ADPP -ATPT,Analysis Timepoint,ADPP -ATPT,Analysis Timepoint,ADPP -ATPTN,Analysis Timepoint (N),ADPP -ATPTN,Analysis Timepoint (N),ADPP -AVISIT,Analysis Visit,ADPP -AVISIT,Analysis Visit,ADPP -AVISITN,Analysis Visit (N),ADPP -AVISITN,Analysis Visit (N),ADPP -ANALYTE,Analyte,ADPC -EVID,Event ID,ADPC -DOSEU,Treatment Dose Units,ADPC From a6c505eed47a7b3c76ef6356a5d88dbc35ed66b0 Mon Sep 17 00:00:00 2001 From: Jana Spinner <56519375+js3110@users.noreply.github.com> Date: Thu, 2 Jan 2025 08:33:28 +0100 Subject: [PATCH 18/21] Update test-generate_col_defs.R MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Mateusz Kołomański <63905560+m-kolomanski@users.noreply.github.com> --- tests/testthat/test-generate_col_defs.R | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) diff --git a/tests/testthat/test-generate_col_defs.R b/tests/testthat/test-generate_col_defs.R index 1e95c4c..633bb47 100644 --- a/tests/testthat/test-generate_col_defs.R +++ b/tests/testthat/test-generate_col_defs.R @@ -1,7 +1,7 @@ source(system.file("shiny/functions/generate_col_defs.R", package = "aNCA")) describe("generate_col_defs", { - it("generates column definitions with labels", { + it("generates a list of column definitions with labels", { data <- data.frame( USUBJID = c(1, 2, 3), AVAL = c(4, 5, 6) @@ -9,15 +9,8 @@ describe("generate_col_defs", { attr(data$USUBJID, "label") <- "Unique Subject Identifier" attr(data$AVAL, "label") <- "Analysis Value" col_defs <- generate_col_defs(data) + expect_type(col_defs, "list") expect_equal(col_defs$USUBJID$header$attribs$title, "Unique Subject Identifier") expect_equal(col_defs$AVAL$header$attribs$title, "Analysis Value") }) - it("returns a list of column definitions", { - data <- data.frame( - USUBJID = c(1, 2, 3), - AVAL = c(4, 5, 6) - ) - col_defs <- generate_col_defs(data) - expect_type(col_defs, "list") - }) }) \ No newline at end of file From 90ecb476e67304e668df863da912c091a11b1e5c Mon Sep 17 00:00:00 2001 From: Jana Spinner <56519375+js3110@users.noreply.github.com> Date: Thu, 2 Jan 2025 08:39:15 +0100 Subject: [PATCH 19/21] update docs and lint fix --- R/label_operators.R | 4 ++-- inst/shiny/functions/generate_col_defs.R | 2 +- inst/shiny/functions/mapping_selectize_inputs.R | 2 +- inst/shiny/modules/column_mapping.R | 2 +- inst/shiny/modules/tab_data.R | 2 +- man/apply_labels.Rd | 5 +++-- tests/testthat/test-apply_labels.R | 2 +- tests/testthat/test-generate_col_defs.R | 2 +- 8 files changed, 11 insertions(+), 10 deletions(-) diff --git a/R/label_operators.R b/R/label_operators.R index 3ab560a..b272392 100644 --- a/R/label_operators.R +++ b/R/label_operators.R @@ -1,10 +1,10 @@ #' Apply Labels to a dataset #' #' This function adds "label" attributes to all columns in a dataset -#' Using the labels_app.csv file which contains common labels for ADPP -#' and ADPC column names #' #' @param data The dataset to which labels will be applied. +#' @param labels_file A data frame with two columns: Variable and Label, +#' for the dataset you are applying it . #' #' @return The same dataset with label attributes applied to all columns. #' If a column is not present in the labels list, it will be assigned the name of the col. diff --git a/inst/shiny/functions/generate_col_defs.R b/inst/shiny/functions/generate_col_defs.R index 796524e..2038ac2 100644 --- a/inst/shiny/functions/generate_col_defs.R +++ b/inst/shiny/functions/generate_col_defs.R @@ -41,4 +41,4 @@ generate_col_defs <- function(data) { } }) |> setNames(names(data)) -} \ No newline at end of file +} diff --git a/inst/shiny/functions/mapping_selectize_inputs.R b/inst/shiny/functions/mapping_selectize_inputs.R index 62bf77e..b4f67a8 100644 --- a/inst/shiny/functions/mapping_selectize_inputs.R +++ b/inst/shiny/functions/mapping_selectize_inputs.R @@ -51,4 +51,4 @@ update_selectize_inputs <- function(session, input_ids, column_names, manual_uni session, "select_Grouping_Variables", choices = setdiff(column_names, desired_order) ) -} \ No newline at end of file +} diff --git a/inst/shiny/modules/column_mapping.R b/inst/shiny/modules/column_mapping.R index 9a0b1b9..827f181 100644 --- a/inst/shiny/modules/column_mapping.R +++ b/inst/shiny/modules/column_mapping.R @@ -355,4 +355,4 @@ column_mapping_server <- function(id, data, manual_units, on_submit) { grouping_variables = grouping_variables ) }) -} \ No newline at end of file +} diff --git a/inst/shiny/modules/tab_data.R b/inst/shiny/modules/tab_data.R index 25de537..d61a5ff 100644 --- a/inst/shiny/modules/tab_data.R +++ b/inst/shiny/modules/tab_data.R @@ -184,4 +184,4 @@ tab_data_server <- function(id) { grouping_variables = grouping_variables ) }) -} \ No newline at end of file +} diff --git a/man/apply_labels.Rd b/man/apply_labels.Rd index f03dd5d..932505b 100644 --- a/man/apply_labels.Rd +++ b/man/apply_labels.Rd @@ -8,6 +8,9 @@ apply_labels(data, labels_file) } \arguments{ \item{data}{The dataset to which labels will be applied.} + +\item{labels_file}{A data frame with two columns: Variable and Label, +for the dataset you are applying it .} } \value{ The same dataset with label attributes applied to all columns. @@ -15,8 +18,6 @@ If a column is not present in the labels list, it will be assigned the name of t } \description{ This function adds "label" attributes to all columns in a dataset -Using the labels_app.csv file which contains common labels for ADPP -and ADPC column names } \examples{ \dontrun{ diff --git a/tests/testthat/test-apply_labels.R b/tests/testthat/test-apply_labels.R index 960b007..9fb0e8e 100644 --- a/tests/testthat/test-apply_labels.R +++ b/tests/testthat/test-apply_labels.R @@ -26,4 +26,4 @@ describe("apply_labels", { expect_equal(attr(data$COL1, "label"), "COL1") expect_equal(attr(data$COL2, "label"), "COL2") }) -}) \ No newline at end of file +}) diff --git a/tests/testthat/test-generate_col_defs.R b/tests/testthat/test-generate_col_defs.R index 1e95c4c..735f201 100644 --- a/tests/testthat/test-generate_col_defs.R +++ b/tests/testthat/test-generate_col_defs.R @@ -20,4 +20,4 @@ describe("generate_col_defs", { col_defs <- generate_col_defs(data) expect_type(col_defs, "list") }) -}) \ No newline at end of file +}) From 3716d1fdb29fbb88b71719e00b95bca63472987a Mon Sep 17 00:00:00 2001 From: Jana Spinner <56519375+js3110@users.noreply.github.com> Date: Thu, 2 Jan 2025 09:50:09 +0100 Subject: [PATCH 20/21] fix: !ignore labels data --- .gitignore | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitignore b/.gitignore index 91544cf..ec17d0c 100644 --- a/.gitignore +++ b/.gitignore @@ -7,4 +7,5 @@ inst/guidelines inst/templates inst/shiny/data !inst/shiny/data/DummyRO_ADNCA.csv +!inst/shiny/data/adnca_labels.csv .Rprofile \ No newline at end of file From 5ca266124b51dc100f780056386aca4fbe3a2e6e Mon Sep 17 00:00:00 2001 From: Jana Spinner <56519375+js3110@users.noreply.github.com> Date: Thu, 2 Jan 2025 12:43:24 +0100 Subject: [PATCH 21/21] add labels file --- inst/shiny/data/adnca_labels.csv | 343 +++++++++++++++++++++++++++++++ 1 file changed, 343 insertions(+) create mode 100644 inst/shiny/data/adnca_labels.csv diff --git a/inst/shiny/data/adnca_labels.csv b/inst/shiny/data/adnca_labels.csv new file mode 100644 index 0000000..1d375b8 --- /dev/null +++ b/inst/shiny/data/adnca_labels.csv @@ -0,0 +1,343 @@ +Variable,Label,Dataset +STUDYID,Study Identifier,ADPC +USUBJID,Unique Subject Identifier,ADPC +SUBJID,Subject Identifier for the Study,ADPC +SITEID,Study Site Identifier,ADPC +ASEQ,Analysis Sequence Number,ADPC +REGION1,Geographic Region 1,ADPC +COUNTRY,Country,ADPC +ETHNIC,Ethnicity,ADPC +AGE,Age,ADPC +AGEU,Age Units,ADPC +AAGE,Analysis Age,ADPC +AAGEU,Analysis Age Unit,ADPC +AGEGR1,Pooled Age Group 1,ADPC +AGEGR2,Pooled Age Group 2,ADPC +AGEGR3,Pooled Age Group 3,ADPC +STRATwNM,Description of Stratum w,ADPC +STRATw,Randomized Value of Stratum w,ADPC +STRATwV,Verified Value of Stratum w,ADPC +SEX,Sex,ADPC +RACE,Race,ADPC +ITTFL,Intent-To-Treat Population Flag,ADPC +SAFFL,Safety Population Flag,ADPC +PPROTFL,Per-Protocol Population Flag,ADPC +TRT01P,Planned Treatment for Period 01,ADPC +TRT02P,Planned Treatment for Period 02,ADPC +TRT03P,Planned Treatment for Period 03,ADPC +TRT04P,Planned Treatment for Period 04,ADPC +TRT05P,Planned Treatment for Period 05,ADPC +TRT01A,Actual Treatment for Period 01,ADPC +TRT02A,Actual Treatment for Period 02,ADPC +TRT03A,Actual Treatment for Period 03,ADPC +TRT04A,Actual Treatment for Period 04,ADPC +TRT05A,Actual Treatment for Period 05,ADPC +TRTSEQP,Planned Sequence of Treatments,ADPC +TRTSEQA,Actual Sequence of Treatments,ADPC +TRTSDTM,Datetime of First Exposure to Treatment,ADPC +TRTSDT,Date of First Exposure to Treatment,ADPC +TRTEDTM,Datetime of Last Exposure to Treatment,ADPC +TRTEDT,Date of Last Exposure to Treatment,ADPC +DCUTDT,Date of Data Cut,ADPC +PCSEQ,Sequence Number,ADPC +PCGRPID,Group ID,ADPC +PCREFID,Reference ID,ADPC +PCSPID,Sponsor-Defined Identifier,ADPC +PCTESTCD,Pharmacokinetic Test Short Name,ADPC +PCTEST,Pharmacokinetic Test Name,ADPC +PCCAT,Test Category,ADPC +PCSCAT,Test Subcategory,ADPC +PCSTRESC,Character Result/Finding in Std Format,ADPC +PCSTRESN,Numeric Result/Finding in Standard Units,ADPC +PCSTRESU,Standard Units,ADPC +PCSTAT,Completion Status,ADPC +PCREASND,Reason Test Not Done,ADPC +PCSPEC,Specimen Material Type,ADPC +PCSPCCND,Specimen Condition,ADPC +PCMETHOD,Method of Test or Examination,ADPC +PCFAST,Fasting Status,ADPC +PCLLOQ,Lower Limit of Quantitation,ADPC +VISITNUM,Visit Number,ADPC +VISIT,Visit Name,ADPC +VISITDY,Planned Study Day of Visit,ADPC +EPOCH,Epoch,ADPC +PCDTC,Date/Time of Specimen Collection,ADPC +PCDY,Actual Study Day of Specimen Collection,ADPC +PCTPT,Planned Time Point Name,ADPC +PCTPTNUM,Planned Time Point Number,ADPC +PCSMPLID,Alternate Sample Identifier,ADPC +PCAINTP,Assay Interpretation,ADPC +PARAM,Parameter,ADPC +PARAMCD,Parameter Code,ADPC +PARCAT1,Parameter Category 1,ADPC +AVAL,Analysis Value,ADPC +AVALCAT1,Analysis Value Category 1,ADPC +AVALU,Analysis Value Unit,ADPC +AVALU,Analysis Value Unit,ADPC +BASE,Baseline Value,ADPC +BASETYPE,Baseline Type,ADPC +ABLFL,Baseline Record Flag,ADPC +ALLOQ,Analysis Lower Limit of Quantitation,ADPC +ADTM,Analysis Datetime,ADPC +ADT,Analysis Date,ADPC +ATM,Analysis Time,ADPC +ADY,Analysis Relative Day,ADPC +ADTF,Analysis Date Imputation Flag,ADPC +ATMF,Analysis Time Imputation Flag,ADPC +ASTDT,Analysis Start Date,ADPC +ASTTM,Analysis Start Time,ADPC +ASTDTM,Analysis Start Date/Time,ADPC +ASTDTF,Analysis Start Date Imputation Flag,ADPC +ASTTMF,Analysis Start Time Imputation Flag,ADPC +AENDT,Analysis End Date,ADPC +AENTM,Analysis End Time,ADPC +AENDTM,Analysis End Date/Time,ADPC +AENDTF,Analysis End Date Imputation Flag,ADPC +AENTMF,Analysis End Time Imputation Flag,ADPC +ATPT,Analysis Timepoint,ADPC +ATPT,Analysis Timepoint,ADPC +ATPTN,Analysis Timepoint (N),ADPC +ATPTN,Analysis Timepoint (N),ADPC +ATPTREF,Analysis Timepoint Reference,ADPC +AVISIT,Analysis Visit,ADPC +AVISIT,Analysis Visit,ADPC +AVISITN,Analysis Visit (N),ADPC +AVISITN,Analysis Visit (N),ADPC +APERIOD,Period,ADPC +APERIODC,Period (C),ADPC +FANLDT,First Date of Dose for Analyte,ADPC +FANLTM,First Time of Dose for Analyte,ADPC +FANLDTM,First Datetime of Dose for Analyte,ADPC +FANLDTMF,First Time of Dose Time Imputation Flag,ADPC +FANLEDT,First End Date of Dose for Analyte,ADPC +FANLETM,First End Time of Dose for Analyte,ADPC +FANLEDTM,First End Datetime of Dose for Analyte,ADPC +FANLEDTF,First End of Dose Time Imputation Flag,ADPC +PCRFTDT,Reference Date of Dose for Analyte,ADPC +PCRFTTM,Reference Time of Dose for Analyte,ADPC +PCRFTDTM,Reference Datetime of Dose for Analyte,ADPC +PCRFEDT,Reference End Date of Dose for Analyte,ADPC +PCRFETM,Reference End Time of Dose for Analyte,ADPC +PCRFEDTM,Ref. End Datetime of Dose for Analyte,ADPC +NFRLT,Nom. Rel. Time from Analyte First Dose,ADPC +AFRLT,Act. Rel. Time from Analyte First Dose,ADPC +TMPCTDF,Percent Diff. Nominal vs. Actual Time,ADPC +FRLTU,Rel. Time from First Dose Unit,ADPC +NEFRLT,Nom. Rel. End Time from First Dose,ADPC +AEFRLT,Act. Rel. End Time from First Dose,ADPC +NRRLT,Nominal Rel. Time from Ref. Dose,ADPC +ARRLT,Actual Rel. Time from Ref. Dose,ADPC +MRRLT,Modified Rel. Time from Ref. Dose,ADPC +RRLTU,Rel. Time from Ref. Dose Unit,ADPC +NERRLT,Nominal Rel. End Time from Ref. Dose,ADPC +NERRLT,Nominal Rel. End Time from Ref. Dose,ADPC +AERRLT,Actual Rel. End Time from Ref. Dose,ADPC +AERRLT,Actual Rel. End Time from Ref. Dose,ADPC +MERRLT,Modified Rel. End Time from Ref. Dose,ADPC +MERRLT,Modified Rel. End Time from Ref. Dose,ADPC +CHG,Change from Baseline,ADPC +CRIT1,Analysis Criterion 1,ADPC +CRIT1FL,Criterion 1 Evaluation Result Flag,ADPC +CRIT1FL,Criterion 1 Evaluation Result Flag,ADPC +DTYPE,Derivation Type,ADPC +SPARSFL,Sparse Flag,ADPC +NCAXFL,PK NCA Exclusion Flag,ADPC +NCAXFN,PK NCA Exclusion Flag (N),ADPC +NCAwXRS,Reason w for PK NCA Exclusion,ADPC +NCAwXRSN,Reason for PK NCA Exclusion of w (N),ADPC +PKSUMXF,PK Summary Exclusion Flag,ADPC +PKSUMXFN,PK Summary Exclusion Flag (N),ADPC +METABFL,Metabolite Flag,ADPC +COHORT,Subject Cohort,ADPC +COHORTN,Subject Cohort (N),ADPC +ROUTE,Route,ADPC +TRTRINT,Planned Treatment Interval,ADPC +TRTRINTU,Planned Treatment Interval Units,ADPC +DOSPCTDF,Percent Diff. Nominal vs. Actual Dose,ADPC +DOSEFRQ,Dose Frequency,ADPC +DOSEP,Planned Treatment Dose,ADPC +DOSEA,Actual Treatment Dose,ADPC +DOSEPU,Planned Treatment Dose Units,ADPC +DOSEAU,Actual Treatment Dose Units,ADPC +ACYCLE,Analysis Cycle,ADPC +ACYCLEC,Analysis Cycle (C),ADPC +ADOSEDUR,Actual Duration of Treatment Dose,ADPC +NDOSEDUR,Nominal duration of Treatment Dose,ADPC +DOSEDURU,Duration of Treatment Dose Units,ADPC +VOLUME,Volume Value,ADPC +VOLUMEU,Volume Value Unit,ADPC +SPWEIGHT,Specimen Weight Value,ADPC +SPWEIGHU,Specimen Weight Value Unit,ADPC +WTBL,Weight at Baseline,ADPC +HTBL,Height at Baseline,ADPC +IBWBL,Ideal Body Weight (IBW) at Baseline,ADPC +LBMBL,Lean Body Mass (LBM) at Baseline,ADPC +BMIBL,BMI at Baseline,ADPC +BSABL,BSA at Baseline,ADPC +SBPBL,Systolic BP at Baseline,ADPC +DBPBL,Diastolic BP at Baseline,] +TOBBL,Smoking Status at Baseline,ADPC +ALCOBL,Alcohol at Baseline,ADPC +TEMPBL,Temperature at Baseline,ADPC +PULSBL,Pulse rate at Baseline,ADPC +ADA,Treatment Emergent ADA status,ADPC +AAGBL,Alpha-1 Acid Glycoprotein at Baseline,ADPC +CREATBL,Creatinine at Baseline (BLOOD),ADPC +CRCLBL,CrCL at Baseline,ADPC +ALBUBL,Albumin at Baseline,ADPC +EOSBL,Eosinophils at Baseline,ADPC +BUNBL,Blood Urea Nitrogen at Baseline,ADPC +CALCBL,Calcium at Baseline,ADPC +CLBL,Chloride at Baseline,ADPC +PHBL,Phosphate at Baseline,ADPC +PLATEBL,Platelet Count at Baseline,ADPC +WBCBL,WBC Count at Baseline,ADPC +GGTBL,GGT at Baseline,ADPC +GLUCBL,Glucose at Baseline,ADPC +HCTBL,Hematocrit at Baseline,ADPC +HGBBL,Hemoglobin at Baseline,ADPC +ALKPHBL,Alkaline Phosphatase at Baseline,ADPC +KBL,Potassium at Baseline,ADPC +LYMBL,Lymphocytes at Baseline,ADPC +MONOBL,Monocytes at Baseline,ADPC +NABL,Sodium at Baseline,ADPC +NEUBL,Neutrophils at Baseline,ADPC +RBCBL,RBC Count at Baseline,ADPC +TBILIBL,Bilirubin at Baseline (BLOOD),ADPC +TPROTBL,Total Protein at Baseline (BLOOD),ADPC +SGOTBL,SGOT-AST at Baseline,ADPC +SGPTBL,SGPT-ALT at Baseline,ADPC +RRBL,RR Duration at Baseline,ADPC +PRBL,PR Duration at Baseline,ADPC +QRSBL,QRS Duration at Baseline,ADPC +QTBL,QT duration at Baseline,ADPC +QTCBBL,QTcB at Baseline,ADPC +QTCFBL,QTcF at Baseline,ADPC +HRBL,Heart Rate at Baseline,ADPC +WTBLU,Weight at Baseline (Unit),ADPC +HTBLU,Height at Baseline (Unit),ADPC +IBWBLU,IBW at Baseline (Unit),ADPC +LBWBLU,LBM at Baseline (Unit),ADPC +BMIBLU,BMI at Baseline (Unit),ADPC +BSABLU,BSA at Baseline (Unit),ADPC +SBPBLU,Systolic BP at Baseline (Unit),ADPC +DBPBLU,Diastolic BP at Baseline (Unit),ADPC +TOBBLU,Smoking Status at Baseline (Unit),ADPC +PULSBLU,Pulse rate at Baseline (Unit),ADPC +AAGBLU,AAG at baseline (Unit),ADPC +CREATBLU,Creat at baseline (BLOOD),ADPC +CRCLBLU,CrCL at baseline (BLOOD),ADPC +ALBUBLU,Albumin at baseline (Unit),ADPC +EOSBLU,Eosinophils at baseline (Unit),ADPC +BUNBLU,Blood Urea Nitrogen at baseline (Unit),ADPC +CALCBLU,Calcium at baseline (Unit),ADPC +CLBLU,Chloride at baseline (Unit),ADPC +PHBLU,Phosphate at baseline (Unit),ADPC +PLATEBLU,Platelet Count at baseline (Unit),ADPC +WBCBLU,WBC Count at baseline (Unit),ADPC +GGTBLU,GGT at Baseline (Unit),ADPC +GLUBLU,Glucose at Baseline (Unit),ADPC +HCTBLU,HCT at Baseline (Unit),ADPC +HGBBLU,HGB at Baseline (Unit),ADPC +ALKPHBLU,Alkaline Phosphatase at Baseline (Unit),ADPC +KBLU,Potassium at Baseline (Unit),ADPC +LYMBLU,Lymphocytes at Baseline (Unit),ADPC +MONOBLU,Monocytes at Baseline (Unit),ADPC +NABLU,Sodium at Baseline (Unit),ADPC +NEUBLU,Neutrophils at Baseline (Unit),ADPC +RBCBLU,RBC Count at Baseline (Unit),ADPC +TBILIBLU,Bilirubin at Baseline (Unit),ADPC +TPROTBLU,Total Protein at Baseline (Unit),ADPC +SGOTBLU,SGOT-AST at Baseline (Unit),ADPC +SGPTBLU,SGPT-ALT at Baseline (Unit),ADPC +RRBLU,RR Duration at Baseline (Unit),ADPC +PRBLU,PR Duration at Baseline (Unit),ADPC +QRSBLU,QRS Duration at Baseline (Unit),ADPC +QTBLU,QT Duration at Baseline (Unit),ADPC +QTCBBLU,QTcB at Baseline (Unit),ADPC +QTCFBLU,QTcF at Baseline (Unit),ADPC +HRBLU,Heart Rate at Baseline (Unit),ADPC +DRUG,Medication Name,ADPC +REGIME,Regimen of Medication,ADPC +FRMUL,Treatment Formulation,ADPC +DOSNO,Dose Number,ADPC +FEDSTATE,Fasted / Fed Status,ADPC +ANL01FL,Analysis Flag 01,ADPC +ANL02FL,Analysis Flag 02,ADPC +ANL03FL,Analysis Flag 03,ADPC +ANL04FL,Analysis Flag 04,ADPC +ANL05FL,Analysis Flag 05,ADPC +STUDYID,Study Identifier,ADPP +USUBJID,Unique Subject Identifier,ADPP +SUBJID,Subject Identifier for the Study,ADPP +SITEID,Study Site Identifier,ADPP +ASEQ,Analysis Sequence Number,ADPP +REGION1,Geographic Region 1,ADPP +COUNTRY,Country,ADPP +ETHNIC,Ethnicity,ADPP +AGE,Age,ADPP +AGEU,Age Units,ADPP +AAGE,Analysis Age,ADPP +AAGEU,Analysis Age Unit,ADPP +AGEGR1,Pooled Age Group 1,ADPP +AGEGR2,Pooled Age Group 2,ADPP +AGEGR3,Pooled Age Group 3,ADPP +STRATwNM,Description of Stratum w,ADPP +STRATw,Randomized Value of Stratum w,ADPP +STRATwV,Verified Value of Stratum w,ADPP +SEX,Sex,ADPP +RACE,Race,ADPP +ITTFL,Intent-To-Treat Population Flag,ADPP +SAFFL,Safety Population Flag,ADPP +PPROTFL,Per-Protocol Population Flag,ADPP +TRT01P,Planned Treatment for Period 01,ADPP +TRTxxP,Planned Treatment for Period xx,ADPP +TRT01A,Actual Treatment for Period 01,ADPP +TRTxxA,Actual Treatment for Period xx,ADPP +TRTSEQP,Planned Sequence of Treatments,ADPP +TRTSEQA,Actual Sequence of Treatments,ADPP +TRTSDTM,Datetime of First Exposure to Treatment,ADPP +TRTSDT,Date of First Exposure to Treatment,ADPP +TRTEDTM,Datetime of Last Exposure to Treatment,ADPP +TRTEDT,Date of Last Exposure to Treatment,ADPP +DCUTDT,Date of Data Cut,ADPP +PPSEQ,Sequence Number,ADPP +PPGRPID,Group ID,ADPP +PPSPID,Sponsor-Defined Identifier,ADPP +PPTESTCD,Parameter Short Name,ADPP +PPTEST,Parameter Name,ADPP +PPCAT,Parameter Category,ADPP +PPSCAT,Parameter Subcategory,ADPP +PPSTRESC,Character Result/Finding in Std Format,ADPP +PPSTRESN,Numeric Result/Finding in Standard Units,ADPP +PPSTRESU,Standard Units,ADPP +PPSTAT,Completion Status,ADPP +PPREASND,Reason Parameter Not Calculated,ADPP +PPSPEC,Specimen Material Type,ADPP +PPDTC,Date/Time of Parameter Calculations,ADPP +PPRFTDTC,Date/Time of Reference Point,ADPP +PPSTINT,Planned Start of Assessment Interval,ADPP +PPENINT,Planned End of Assessment Interval,ADPP +PARAM,Parameter,ADPP +PARAMCD,Parameter Code,ADPP +PARCAT1,Parameter Category 1,ADPP +PARCAT1,Parameter Category 1,ADPP +AVAL,Analysis Value,ADPP +AVALC,Analysis Value (C),ADPP +ADTM,Analysis Datetime,ADPP +ADT,Analysis Date,ADPP +ATM,Analysis Time,ADPP +ADY,Analysis Relative Day,ADPP +ADTF,Analysis Date Imputation Flag,ADPP +ATMF,Analysis Time Imputation Flag,ADPP +ATPT,Analysis Timepoint,ADPP +ATPT,Analysis Timepoint,ADPP +ATPTN,Analysis Timepoint (N),ADPP +ATPTN,Analysis Timepoint (N),ADPP +AVISIT,Analysis Visit,ADPP +AVISIT,Analysis Visit,ADPP +AVISITN,Analysis Visit (N),ADPP +AVISITN,Analysis Visit (N),ADPP +ANALYTE,Analyte,ADPC +EVID,Event ID,ADPC +DOSEU,Treatment Dose Units,ADPC