Repository: pharmaverse/admiralneuro
Pull request #17: Closes #7 create test nv suppnv and ag for neuro
Author: login: jwang-lilly
Created: 2025-04-09T22:54:16Z | Merged: 2025-04-25T10:15:39Z

Thank you for your Pull Request! We have developed this task checklist from the [Development Process Guide](https://pharmaverse.github.io/admiral/CONTRIBUTING.html#detailed-development-process) to help with the final steps of the process. Completing the below tasks helps to ensure our reviewers can maximize their time on your code as well as making sure the admiral family codebase remains robust and consistent.   

Please check off each taskbox as an acknowledgment that you completed the task or check off that it is not relevant to your Pull Request. This checklist is part of the Github Action workflows and the Pull Request will not be merged into the `main` branch until you have checked off each task.

- [x] Place Closes #<insert_issue_number> into the beginning of your Pull Request Title (Use Edit button in top-right if you need to update)
- [x] Code is formatted according to the [tidyverse style guide](https://style.tidyverse.org/). Run `styler::style_file()` to style R and Rmd files
- [x] Updated relevant unit tests or have written new unit tests, which should consider realistic data scenarios and edge cases, e.g. empty datasets, errors, boundary cases etc. - See [Unit Test Guide](https://pharmaverse.github.io/admiraldev/articles/unit_test_guidance.html#tests-should-be-robust-to-cover-realistic-data-scenarios)
- [x] If you removed/replaced any function and/or function parameters, did you fully follow the [deprecation guidance](https://pharmaverse.github.io/admiraldev/articles/programming_strategy.html#deprecation)?
- [x] Update to all relevant roxygen headers and examples, including keywords and families. Refer to the [categorization of functions](https://pharmaverse.github.io/admiraldev/articles/programming_strategy.html#categorization-of-functions) to tag appropriate keyword/family.
- [x] Run `devtools::document()` so all `.Rd` files in the `man` folder and the `NAMESPACE` file in the project root are updated appropriately
- [x] Address any updates needed for vignettes and/or templates
- [x] Update `NEWS.md` under the header `# admiral<ext> (development version)` if the changes pertain to a user-facing function (i.e. it has an `@export` tag) or documentation aimed at users (rather than developers)
- [x] Build site `pkgdown::build_site()` and check that all affected examples are displayed correctly and that all new functions occur on the Reference page. 
- [x] Address or fix all lintr warnings and errors - `lintr::lint_package()`
- [x] Run `R CMD check` locally and address all errors and warnings - `devtools::check()`
- [x] Link the issue in the Development Section on the right hand side.
- [x] Address all merge conflicts and resolve appropriately
- [x] Pat yourself on the back for a job well done! Much love to your accomplishment!


Linked issue #7: Test Data: NV, SUPPNV and AG
### Background Information

Add NV or XP test dataset (decide on naming!) to {admiralneuro}, to contain amyloid/tau PET imaging data

Note 1: this issue should be on hold until #6 is completed. Once we have a DM dataset, ensure to use the same patients for NV/XP.

Note 2: this test data will be moved to [{pharmaversesdtm}](https://github.com/pharmaverse/pharmaversesdtm/) after the first release of {admiralneuro}


### Definition of Done

- [ ] `data-raw` folder should contain new program `nv_neuro` that creates DM datasetDM test dataset added to {admiralneuro} package
 - [ ] `R/data.R` should be updated to document the new DM dataset (see [here](https://github.com/pharmaverse/admiral/blob/main/R/data.R) for an example file)
Linked issue comments: user: login: manciniedoardo
created_at: 2025-03-19T16:45:07Z
body: @jwang-lilly I leave the contents of NV/XP (as well as the name!) up to you. Then, everyone in @pharmaverse/admiralneuro can review and offer feedback.
author_association: COLLABORATOR
user: login: manciniedoardo
created_at: 2025-03-20T14:35:51Z
body: @jwang-lilly this can now start as #6 is merged 😄 
author_association: COLLABORATOR
user: login: Fanny-Gautier
created_at: 2025-04-04T10:36:48Z
body: Having another look at the current `[NV]` test data, please find below my comments while PR #14 has been closed:

- `NVTEST` is the same for 2 different `NVTESTCD`. I believe it should be different (highlighted in yellow)
- `NVTESTCD` is more than 8 characters for the blue highlighted ones

![Image](https://github.com/user-attachments/assets/548f94c6-a607-4113-9f80-e3027bd896c0)

- Since `NVLOC` will be added, should `NVDIR`  also be added ?

author_association: CONTRIBUTOR
user: login: cgpele
created_at: 2025-04-04T11:45:49Z
body: Some comments from me on the NV domain:

At Roche we tend to also use the NV.NVLOC variable for the location (conatins values like CEREBELLAR CORTEX, CEREBELLUM etc).

For the reference region, we use NVREFREG. Since this is a supp qual, this would need to go into the NV supp qual SDTM, if we're programming from pure SDTM.

In addition, we would keep the tracer information in the AG domain.  If we want to use the tracer info for the centiloid calculations, should we also create an AG for Alzheimer's? Currently there is no AG in the pharmaversesdtm


author_association: CONTRIBUTOR
user: login: manciniedoardo
created_at: 2025-04-08T08:38:17Z
body: @jwang-lilly any comments on the above?
author_association: COLLABORATOR
user: login: manciniedoardo
created_at: 2025-04-08T08:43:49Z
body: @jwang-lilly #13 is now merged into `main` with the requested updates to `dm_neuro`, so if you merge `main` into your `nv` feature branch you are good to go. lmk of any questions
author_association: COLLABORATOR
user: login: jwang-lilly
created_at: 2025-04-09T20:49:22Z
body: @Fanny-Gautier @cgpele.  Would you agree with this naming scheme? We can avoid additional datasets this way.  Three tracers, two amyloid PET (florbetapir and florbetaben), and one tau PET (flortaucipir).  

![Image](https://github.com/user-attachments/assets/beadf85b-bbab-4981-aa8c-003618391798)

author_association: COLLABORATOR

Diff:
diff --git a/R/data.R b/R/data.R
index 1a53491..aac5725 100644
--- a/R/data.R
+++ b/R/data.R
@@ -4,3 +4,105 @@
 #' @keywords datasets
 #' @family datasets
 "dm_neuro"
+
+# This file is automatically generated by data-raw/nv_neuro.R.
+# Please rerun nv_enuro.R to create it again.
+# Manual edits are not recommended, as changes may be overwritten.
+#' Nervous System Findings Dataset
+#'
+#' A SDTM NV domain dataset for Alzheimer's disease observational and interventional studies, including amyloid and tau PET data at baseline and two follow-up visits reflect levels of pathology appropriate for disease or treatment course
+#' @keywords datasets
+#' @family datasets
+#'
+#' @name nv_neuro
+#' @title Nervous System Findings Dataset
+#' @description A SDTM NV domain dataset containing nervous system findings and measurements
+#' @docType data
+#' @format A data frame with 20 columns:
+#'   \describe{
+#'     \item{STUDYID}{Study Identifier}
+#'     \item{DOMAIN}{Domain Abbreviation}
+#'     \item{USUBJID}{Unique Subject Identifier}
+#'     \item{NVSEQ}{Sequence Number}
+#'     \item{NVLNKID}{Link ID}
+#'     \item{NVTESTCD}{Short Name of Nervous System Test}
+#'     \item{NVTEST}{Name of Nervous System Test}
+#'     \item{NVCAT}{Category for Nervous System Test}
+#'     \item{NVLOC}{Location Used for the Measurement}
+#'     \item{NVMETHOD}{Method of Test or Examination}
+#'     \item{NVNAM}{Vendor Name}
+#'     \item{NVORRES}{Result or Finding in Original Units}
+#'     \item{NVORRESU}{Original Units}
+#'     \item{NVSTRESC}{Character Result/Finding in Std Format}
+#'     \item{NVSTRESN}{Numeric Result/Finding in Standard Units}
+#'     \item{NVSTRESU}{Standard Units}
+#'     \item{VISITNUM}{Visit Number}
+#'     \item{VISIT}{Visit Name}
+#'     \item{NVDTC}{Date/Time of Collection}
+#'     \item{NVDY}{Study Day of Collection}
+#'     \item{NVLOBXFL}{Last Observation Before Exposure Flag}
+#'   }
+#'
+#' @source Constructed using `dm_neuro` from `{admiralneuro}` package for USUBJID and cohort information, `vs` from `{pharmaversesdtm}` for visit schedule such as VISIT, NVDTC, NVDY
+"nv_neuro"
+
+# This file is automatically generated by data-raw/suppnv_neuro.R
+# Please rerun suppnv_neuro.R to create it again.
+# Manual edits are not recommended, as changes may be overwritten.
+#' Supplemental Nervous System Findings Dataset
+#'
+#' A SDTM SUPPNV domain dataset
+#' @keywords datasets
+#' @family datasets
+#'
+#' @name suppnv_neuro
+#' @title Supplemental Nervous System Findings Dataset
+#' @description A SDTM SUPPNV domain dataset containing reference regions used for SUVR calculation
+#' @docType data
+#' @format A data frame with 8 columns:
+#'  \describe{
+#'   \item{STUDYID}{Study Identifier}
+#'   \item{RDOMAIN}{Related Domain Abbreviation}
+#'   \item{USUBJID}{Unique Subject Identifier}
+#'   \item{IDVAR}{Identifying Variable}
+#'   \item{IDVARVAL}{Identifying Variable Value}
+#'   \item{QNAM}{Qualifier Variable Name}
+#'   \item{QLABEL}{Qualifier Variable Label}
+#'   \item{QVAL}{Data Value}
+#'   \item{QORIG}{Origin}
+#'   \item{QEVAL}{Evaluator}
+#'   }
+#' @source Constructed using `nv_neuro` from `{admiralneuro}` package
+"suppnv_neuro"
+
+# This file is automatically generated by data-raw/ag_neuro.R
+# Please rerun ag_neuro.R to create it again.
+# Manual edits are not recommended, as changes may be overwritten.
+#' Procedure Agents for Nervous System Dataset
+#'
+#' A SDTM AG domain dataset
+#' @keywords keyword
+#' @family datasets
+#'
+#' @name ag_neuro
+#' @title Procedure Agents for Nervous System Dataset
+#' @description A SDTM AG domain dataset containing procedure agents for nervous system
+#' @docType data
+#' @format A data frame with 12 columns:
+#' \describe{
+#'  \item{STUDYID}{Study Identifier}
+#'  \item{DOMAIN}{Domain Abbreviation}
+#'  \item{USUBJID}{Unique Subject Identifier}
+#'  \item{AGSEQ}{Sequence Number}
+#'  \item{AGTRT}{Reported Agent Name}
+#'  \item{AGCAT}{Category for Category}
+#'  \item{AGDOSE}{Dose per Administration}
+#'  \item{AGDOSEU}{Dose Units}
+#'  \item{AGROUTE}{Route of Administration}
+#'  \item{AGLNKID}{Link ID}
+#'  \item{VISITNUM}{Visit Number}
+#'  \item{VISIT}{Visit Name}
+#'  \item{AGSTDTC}{Start Date/Time of Agent}
+#'  }
+#' @source Constructed using `nv_neuro` from `{admiralneuro}` package
+"ag_neuro"
diff --git a/data-raw/ag_neuro.R b/data-raw/ag_neuro.R
new file mode 100644
index 0000000..efc0cec
--- /dev/null
+++ b/data-raw/ag_neuro.R
@@ -0,0 +1,77 @@
+# Dataset: ag_neuro
+# Description: Create AG test SDTM dataset for Alzheimer's Disease (neuro studies)
+
+# Load libraries ----
+
+library(tibble)
+library(dplyr)
+library(stringr)
+library(admiral)
+
+# Read input data ----
+
+data("nv_neuro")
+
+# Convert blank to NA ----
+
+nv_neuro <- convert_blanks_to_na(nv_neuro)
+
+ag_neuro <- nv_neuro %>%
+  dplyr::select(STUDYID, USUBJID, NVLNKID, NVDTC, NVCAT, VISITNUM, VISIT) %>%
+  distinct() %>%
+  dplyr::mutate(DOMAIN = "AG", AGLNKID = NVLNKID, AGSTDTC = NVDTC) %>%
+  dplyr::mutate(AGTRT = case_when(
+    NVCAT == "FBP" ~ "18F-Florbetapir",
+    NVCAT == "FBB" ~ "18F-Florbetaben",
+    NVCAT == "FTP" ~ "18F-Flortaucipir"
+  )) %>%
+  dplyr::mutate(AGCAT = case_when(
+    NVCAT == "FBP" ~ "AMYLOID TRACER",
+    NVCAT == "FBB" ~ "AMYLOID TRACER",
+    NVCAT == "FTP" ~ "TAU TRACER"
+  )) %>%
+  dplyr::mutate(AGDOSE = case_when(
+    NVCAT == "FBP" ~ "370",
+    NVCAT == "FBB" ~ "300",
+    NVCAT == "FTP" ~ "370"
+  )) %>%
+  dplyr::group_by(USUBJID) %>%
+  dplyr::mutate(AGSEQ = row_number()) %>%
+  dplyr::ungroup() %>%
+  dplyr::mutate(AGDOSEU = "MBq") %>%
+  dplyr::mutate(AGROUTE = "Intravenous") %>%
+  dplyr::select(
+    STUDYID, DOMAIN, USUBJID, AGSEQ, AGTRT, AGCAT,
+    AGDOSE, AGDOSEU, AGROUTE, AGLNKID,
+    VISITNUM, VISIT, AGSTDTC
+  )
+
+# Add labels to variables ----
+
+labels <- list(
+  STUDYID = "Study Identifier",
+  DOMAIN = "Domain Abbreviation",
+  USUBJID = "Unique Subject Identifier",
+  AGSEQ = "Sequence Number",
+  AGTRT = "Reported Agent Name",
+  AGCAT = "Category for Agent",
+  AGDOSE = "Dose per Administration",
+  AGDOSEU = "Dose Units",
+  AGROUTE = "Route of Administration",
+  AGLNKID = "Link ID",
+  VISITNUM = "Visit Number",
+  VISIT = "Visit Name",
+  AGSTDTC = "Start Date/Time of Agent"
+)
+
+for (var in names(labels)) {
+  attr(ag_neuro[[var]], "label") <- labels[[var]]
+}
+
+# Label AG dataset ----
+
+attr(ag_neuro, "label") <- "Procedure Agents"
+
+# Save dataset ----
+
+usethis::use_data(ag_neuro, overwrite = TRUE)
diff --git a/data-raw/nv_neuro.R b/data-raw/nv_neuro.R
new file mode 100644
index 0000000..fd70bb6
--- /dev/null
+++ b/data-raw/nv_neuro.R
@@ -0,0 +1,251 @@
+# Dataset: nv_neuro
+# Description: Create NV test SDTM dataset for Alzheimer's Disease (neuro studies)
+
+# Load libraries ----
+
+library(tibble)
+library(dplyr)
+library(stringr)
+library(admiral)
+
+# Read input data ----
+
+data("dm_neuro")
+
+# Convert blank to NA ----
+
+dm_neuro <- convert_blanks_to_na(dm_neuro)
+
+# Separate placebo and observation from treatment group to mimic different disease progression ----
+
+placebo_group <- dm_neuro %>%
+  dplyr::filter(!is.na(ARMCD) & ARMCD == "Pbo")
+
+treatment_group <- dm_neuro %>%
+  dplyr::filter(!is.na(ARMCD) & ARMCD == "Xan_Hi")
+
+observation_group <- dm_neuro %>%
+  dplyr::filter(is.na(ARMCD) & ARMNRS == "Observational Study")
+
+# Leverage VS visits at BASELINE, WEEK12 and WEEK26
+
+visit_schedule <- pharmaversesdtm::vs %>%
+  dplyr::filter(USUBJID %in% dm_neuro$USUBJID) %>%
+  dplyr::filter(VISITNUM %in% c(3.0, 9.0, 13.0)) %>%
+  dplyr::rename(NVDTC = VSDTC, NVDY = VSDY) %>%
+  dplyr::select(USUBJID, VISITNUM, VISIT, VISITDY, NVDTC, NVDY) %>%
+  group_by(USUBJID) %>%
+  distinct()
+
+# All USUBJID have BASELINE but not all have visits 9 or 13 data
+
+visit9_usubjid <- visit_schedule %>%
+  dplyr::filter(VISITNUM == 9) %>%
+  dplyr::select(USUBJID) %>%
+  distinct() %>%
+  unlist()
+
+visit13_usubjid <- visit_schedule %>%
+  dplyr::filter(VISITNUM == 13) %>%
+  distinct() %>%
+  unlist()
+
+# Create records for one USUBJID ----
+
+create_records_for_one_id <- function(usubjid = "01-701-1015", visitnum = 3,
+                                      fbp_suvr_cb = 1.461, fbb_suvr_com = 1.452, ftp_suvr_icbgm = 1.331) {
+  tibble(
+    STUDYID = rep("CDISCPILOT01", 5),
+    DOMAIN = rep("NV", 5),
+    USUBJID = rep(usubjid, 5),
+    SUBJID = sub(".*-", "", rep(usubjid, 5)),
+    NVTESTCD = c("VR", "SUVR", "SUVR", "VR", "SUVR"),
+    NVTEST = c(
+      "Qualitative Visual Classification",
+      "Standardized Uptake Value Ratio",
+      "Standardized Uptake Value Ratio",
+      "Qualitative Visual Classification",
+      "Standardized Uptake Value Ratio"
+    ),
+    NVCAT = c("FBP", "FBP", "FBB", "FTP", "FTP"),
+    NVORRES = c("Positive", as.character(fbp_suvr_cb), as.character(fbb_suvr_com), "Positive", as.character(ftp_suvr_icbgm)),
+    NVLOC = c(NA, "NEOCORTICAL COMPOSITE", "NEOCORTICAL COMPOSITE", NA, "NEOCORTICAL COMPOSITE"),
+    NVNAM = c("IXICO", "AVID", "BERKELEY", "IXICO", "BERKELEY"),
+    NVMETHOD = c("FBP VISUAL CLASSIFICATION", "AVID FBP SUVR PIPELINE", "BERKELEY FBB SUVR PIPELINE", "FTP VISUAL CLASSIFICATION", "BERKELEY FTP SUVR PIPELINE"),
+    VISITNUM = visitnum
+  )
+}
+
+# Create dataset for visit 3 (baseline) for all ids from dm_neuro ----
+
+# Set the seed for reproducibility
+set.seed(2774)
+
+# Generate the data using lapply
+all_visit3_dat <- dplyr::bind_rows(
+  lapply(dm_neuro$USUBJID, function(id) {
+    # Generate random values for the parameters
+    fbp_suvr_cb <- round(runif(1, 1.25, 2.5), 3)
+    fbb_suvr_com <- round(fbp_suvr_cb - runif(1, min = 0.005, max = 0.01), 3)
+    ftp_suvr_icbgm <- round(fbp_suvr_cb - runif(1, min = 0.1, max = 0.13), 3)
+
+    # Create the dataset using create_records_for_one_id function
+    create_records_for_one_id(
+      usubjid = id,
+      visitnum = 3,
+      fbp_suvr_cb = fbp_suvr_cb,
+      fbb_suvr_com = fbb_suvr_com,
+      ftp_suvr_icbgm = ftp_suvr_icbgm
+    )
+  })
+)
+
+# Create visit 9 dataset for placebo and observational groups ----
+
+pbo_obs_visit9_dat <- all_visit3_dat %>%
+  dplyr::filter(USUBJID %in% c(placebo_group$USUBJID, observation_group$USUBJID)) %>%
+  dplyr::filter(NVTESTCD == "SUVR") %>%
+  dplyr::mutate(
+    VISITNUM = 9,
+    NVORRES = as.character(round(as.numeric(NVORRES) + runif(1, min = 0.1, max = 0.2), 3)),
+    NVORRES
+  )
+
+# Create visit 9 dataset for treatment group ----
+
+treat_visit9_dat <- all_visit3_dat %>%
+  dplyr::filter(USUBJID %in% treatment_group$USUBJID) %>%
+  dplyr::filter(NVTESTCD == "SUVR") %>%
+  dplyr::mutate(
+    VISITNUM = 9,
+    NVORRES = ifelse(NVCAT %in% c("FBP", "FBB"),
+      as.character(round(as.numeric(NVORRES) - runif(1, min = 0.3, max = 0.8), 3)),
+      ifelse(NVCAT == "FTP",
+        as.character(round(as.numeric(NVORRES) - runif(1, min = 0.005, max = 0.01), 3)), NVORRES
+      )
+    )
+  )
+
+# Create visit 13 dataset for placebo and observational groups ----
+
+pbo_obs_visit13_dat <- pbo_obs_visit9_dat %>%
+  dplyr::filter(NVTESTCD == "SUVR") %>%
+  dplyr::mutate(
+    VISITNUM = 13,
+    NVORRES = as.character(round(as.numeric(NVORRES) + runif(1, min = 0.2, max = 0.3), 3)),
+    NVORRES
+  )
+
+# Create visit 13 dataset for treatment group ----
+
+treat_visit13_dat <- treat_visit9_dat %>%
+  dplyr::filter(NVTESTCD == "SUVR") %>%
+  dplyr::mutate(
+    VISITNUM = 13,
+    NVORRES = ifelse(NVCAT %in% c("FBP", "FBB"),
+      as.character(round(as.numeric(NVORRES) - runif(1, min = 0.3, max = 0.8), 3)),
+      ifelse(NVCAT == "FTP",
+        as.character(round(as.numeric(NVORRES) - runif(1, min = 0.01, max = 0.05), 3)), NVORRES
+      )
+    )
+  )
+
+# Combine datasets and add additional variables ----
+
+all_dat <- bind_rows(
+  all_visit3_dat,
+  pbo_obs_visit9_dat %>%
+    dplyr::filter(USUBJID %in% visit9_usubjid),
+  treat_visit9_dat %>%
+    dplyr::filter(USUBJID %in% visit9_usubjid),
+  pbo_obs_visit13_dat %>%
+    dplyr::filter(USUBJID %in% visit13_usubjid),
+  treat_visit13_dat %>%
+    dplyr::filter(USUBJID %in% visit13_usubjid)
+) %>%
+  dplyr::mutate(
+    NVLOBXFL = ifelse(VISITNUM == 3, "Y", NA_character_),
+    NVORRESU = ifelse(NVTESTCD == "SUVR",
+      "RATIO", NA
+    ),
+    NVSTRESC = NVORRES,
+    NVSTRESN = ifelse(NVTESTCD == "SUVR",
+      suppressWarnings(as.numeric(NVORRES)), NA
+    ),
+    NVSTRESU = ifelse(NVTESTCD == "SUVR",
+      "RATIO", NA
+    )
+  ) %>%
+  dplyr::left_join(
+    visit_schedule,
+    by = c("USUBJID", "VISITNUM")
+  ) %>%
+  dplyr::group_by(USUBJID) %>%
+  dplyr::mutate(NVSEQ = row_number()) %>%
+  dplyr::ungroup() %>%
+  dplyr::arrange(USUBJID, VISIT) %>%
+  dplyr::group_by(USUBJID) %>%
+  dplyr::mutate(
+    NVLNKID = match(NVCAT, c("FBP", "FBB", "FTP")) +
+      (n_distinct(NVCAT) * (dense_rank(VISIT) - 1))
+  ) %>%
+  dplyr::ungroup() %>%
+  dplyr::select(
+    STUDYID, DOMAIN, USUBJID, NVSEQ, NVLNKID,
+    NVTESTCD, NVTEST, NVCAT,
+    NVLOC, NVMETHOD, NVNAM,
+    NVORRES, NVORRESU, NVSTRESC, NVSTRESN, NVSTRESU,
+    VISITNUM, VISIT, NVDTC, NVDY,
+    NVLOBXFL
+  )
+
+# Add labels to variables ----
+
+labels <- list(
+  # Identifier Variables (Key variables)
+  STUDYID = "Study Identifier",
+  DOMAIN = "Domain Abbreviation",
+  USUBJID = "Unique Subject Identifier",
+  NVSEQ = "Sequence Number",
+  NVLNKID = "Link ID",
+
+  # Topic Variables\
+  NVTESTCD = "Short Name of Nervous System Test",
+  NVTEST = "Name of Nervous System Test",
+  NVCAT = "Category for Nervous System Test",
+
+  # Qualifier Variables
+  NVLOC = "Location Used for the Measurement",
+  NVMETHOD = "Method of Test or Examination",
+  NVNAM = "Vendor Name",
+
+  # Result Variables
+  NVORRES = "Result or Finding in Original Units",
+  NVORRESU = "Original Units",
+  NVSTRESC = "Character Result/Finding in Std Format",
+  NVSTRESN = "Numeric Result/Finding in Standard Units",
+  NVSTRESU = "Standard Units",
+
+  # Timing Variables
+  VISITNUM = "Visit Number",
+  VISIT = "Visit Name",
+  NVDTC = "Date/Time of Collection",
+  NVDY = "Study Day of Collection",
+
+  # Additional Qualifier
+  NVLOBXFL = "Last Observation Before Exposure Flag"
+)
+
+for (var in names(labels)) {
+  attr(all_dat[[var]], "label") <- labels[[var]]
+}
+
+nv_neuro <- all_dat
+
+# Label NV dataset ----
+
+attr(nv_neuro, "label") <- "Nervous System Findings"
+
+# Save dataset ----
+
+usethis::use_data(nv_neuro, overwrite = TRUE)
diff --git a/data-raw/suppnv_neuro.R b/data-raw/suppnv_neuro.R
new file mode 100644
index 0000000..0f3c28a
--- /dev/null
+++ b/data-raw/suppnv_neuro.R
@@ -0,0 +1,55 @@
+# Dataset: suppnv_neuro
+# Description: Create SUPPNV test SDTM dataset for Alzheimer's Disease (neuro studies)
+
+# Load libraries ----
+
+library(tibble)
+library(dplyr)
+library(stringr)
+library(admiral)
+
+# Read input data ----
+
+data("nv_neuro")
+
+# Convert blank to NA ----
+
+nv_neuro <- convert_blanks_to_na(nv_neuro)
+
+suppnv_neuro <- nv_neuro %>%
+  dplyr::filter(!is.na(NVLOC)) %>%
+  dplyr::mutate(RDOMAIN = "NV", IDVAR = "NVSEQ", IDVARVAL = NVSEQ, QNAM = "REFREG", QLABEL = "Reference Region") %>%
+  dplyr::mutate(QVAL = case_when(
+    NVCAT %in% c("FBP", "FBB") ~ "Whole Cerebellum",
+    NVCAT == "FTP" ~ "Inferior Cerebellar Gray Matter",
+    TRUE ~ NA_character_
+  )) %>%
+  dplyr::mutate(QORIG = "Assigned", QEVAL = "STATISTICIAN") %>%
+  dplyr::select(STUDYID, RDOMAIN, USUBJID, IDVAR, IDVARVAL, QNAM, QLABEL, QVAL, QORIG, QEVAL)
+
+# Add labels to variables ----
+
+labels <- list(
+  STUDYID = "Study Identifier",
+  RDOMAIN = "Related Domain Abbreviation",
+  USUBJID = "Unique Subject Identifier",
+  IDVAR = "Identifying Variable",
+  IDVARVAL = "Identifying Variable Value",
+  QNAM = "Qualifier Variable Name",
+  QLABEL = "Qualifier Variable Label",
+  QVAL = "Data Value",
+  QORIG = "Origin",
+  QEVAL = "Evaluator"
+)
+
+for (var in names(labels)) {
+  attr(suppnv_neuro[[var]], "label") <- labels[[var]]
+}
+
+# Label SUPPNV dataset ----
+
+attr(suppnv_neuro, "label") <- "Supplemental Qualifiers for Nervous System Findings"
+
+# Save dataset ----
+
+usethis::use_data(suppnv_neuro, overwrite = TRUE)
diff --git a/data/ag_neuro.rda b/data/ag_neuro.rda
new file mode 100644
index 0000000..8c8c080
Binary files /dev/null and b/data/ag_neuro.rda differ
diff --git a/data/dm_neuro.rda b/data/dm_neuro.rda
index 51fc37e..3ff6de7 100644
Binary files a/data/dm_neuro.rda and b/data/dm_neuro.rda differ
diff --git a/data/nv_neuro.rda b/data/nv_neuro.rda
new file mode 100644
index 0000000..266cae3
Binary files /dev/null and b/data/nv_neuro.rda differ
diff --git a/data/suppnv_neuro.rda b/data/suppnv_neuro.rda
new file mode 100644
index 0000000..d99d09c
Binary files /dev/null and b/data/suppnv_neuro.rda differ
diff --git a/inst/WORDLIST b/inst/WORDLIST
index ebd5966..9c61628 100644
--- a/inst/WORDLIST
+++ b/inst/WORDLIST
@@ -29,3 +29,10 @@ repo
 roxygen
 Template
 neuro
+interventional
+NVDTC
+NVDY
+USUBJID
+SUVR
+SUPPNV
+
diff --git a/man/ag_neuro.Rd b/man/ag_neuro.Rd
new file mode 100644
index 0000000..647d699
--- /dev/null
+++ b/man/ag_neuro.Rd
@@ -0,0 +1,46 @@
+% Generated by roxygen2: do not edit by hand
+% Please edit documentation in R/data.R
+\docType{data}
+\name{ag_neuro}
+\alias{ag_neuro}
+\title{Procedure Agents for Nervous System Dataset}
+\format{
+A data frame with 12 columns:
+\describe{
+\item{STUDYID}{Study Identifier}
+\item{DOMAIN}{Domain Abbreviation}
+\item{USUBJID}{Unique Subject Identifier}
+\item{AGSEQ}{Sequence Number}
+\item{AGTRT}{Reported Agent Name}
+\item{AGCAT}{Category for Category}
+\item{AGDOSE}{Dose per Administration}
+\item{AGDOSEU}{Dose Units}
+\item{AGROUTE}{Route of Administration}
+\item{AGLNKID}{Link ID}
+\item{VISITNUM}{Visit Number}
+\item{VISIT}{Visit Name}
+\item{AGSTDTC}{Start Date/Time of Agent}
+}
+}
+\source{
+Constructed using \code{nv_neuro} from \code{{admiralneuro}} package
+}
+\usage{
+ag_neuro
+}
+\description{
+A SDTM AG domain dataset containing procedure agents for nervous system
+}
+\details{
+Procedure Agents for Nervous System Dataset
+
+A SDTM AG domain dataset
+}
+\seealso{
+Other datasets: 
+\code{\link{dm_neuro}},
+\code{\link{nv_neuro}},
+\code{\link{suppnv_neuro}}
+}
+\concept{datasets}
+\keyword{keyword}
diff --git a/man/dm_neuro.Rd b/man/dm_neuro.Rd
index e72740c..c592d3e 100644
--- a/man/dm_neuro.Rd
+++ b/man/dm_neuro.Rd
@@ -13,5 +13,11 @@ dm_neuro
 \description{
 An updated SDTM DM dataset subset with age appropriate Alzheimer's Disease patients
 }
+\seealso{
+Other datasets: 
+\code{\link{ag_neuro}},
+\code{\link{nv_neuro}},
+\code{\link{suppnv_neuro}}
+}
 \concept{datasets}
 \keyword{datasets}
diff --git a/man/nv_neuro.Rd b/man/nv_neuro.Rd
new file mode 100644
index 0000000..663716d
--- /dev/null
+++ b/man/nv_neuro.Rd
@@ -0,0 +1,54 @@
+% Generated by roxygen2: do not edit by hand
+% Please edit documentation in R/data.R
+\docType{data}
+\name{nv_neuro}
+\alias{nv_neuro}
+\title{Nervous System Findings Dataset}
+\format{
+A data frame with 20 columns:
+\describe{
+\item{STUDYID}{Study Identifier}
+\item{DOMAIN}{Domain Abbreviation}
+\item{USUBJID}{Unique Subject Identifier}
+\item{NVSEQ}{Sequence Number}
+\item{NVLNKID}{Link ID}
+\item{NVTESTCD}{Short Name of Nervous System Test}
+\item{NVTEST}{Name of Nervous System Test}
+\item{NVCAT}{Category for Nervous System Test}
+\item{NVLOC}{Location Used for the Measurement}
+\item{NVMETHOD}{Method of Test or Examination}
+\item{NVNAM}{Vendor Name}
+\item{NVORRES}{Result or Finding in Original Units}
+\item{NVORRESU}{Original Units}
+\item{NVSTRESC}{Character Result/Finding in Std Format}
+\item{NVSTRESN}{Numeric Result/Finding in Standard Units}
+\item{NVSTRESU}{Standard Units}
+\item{VISITNUM}{Visit Number}
+\item{VISIT}{Visit Name}
+\item{NVDTC}{Date/Time of Collection}
+\item{NVDY}{Study Day of Collection}
+\item{NVLOBXFL}{Last Observation Before Exposure Flag}
+}
+}
+\source{
+Constructed using \code{dm_neuro} from \code{{admiralneuro}} package for USUBJID and cohort information, \code{vs} from \code{{pharmaversesdtm}} for visit schedule such as VISIT, NVDTC, NVDY
+}
+\usage{
+nv_neuro
+}
+\description{
+A SDTM NV domain dataset containing nervous system findings and measurements
+}
+\details{
+Nervous System Findings Dataset
+
+A SDTM NV domain dataset for Alzheimer's disease observational and interventional studies, including amyloid and tau PET data at baseline and two follow-up visits reflect levels of pathology appropriate for disease or treatment course
+}
+\seealso{
+Other datasets: 
+\code{\link{ag_neuro}},
+\code{\link{dm_neuro}},
+\code{\link{suppnv_neuro}}
+}
+\concept{datasets}
+\keyword{datasets}
diff --git a/man/suppnv_neuro.Rd b/man/suppnv_neuro.Rd
new file mode 100644
index 0000000..e13ced8
--- /dev/null
+++ b/man/suppnv_neuro.Rd
@@ -0,0 +1,43 @@
+% Generated by roxygen2: do not edit by hand
+% Please edit documentation in R/data.R
+\docType{data}
+\name{suppnv_neuro}
+\alias{suppnv_neuro}
+\title{Supplemental Nervous System Findings Dataset}
+\format{
+A data frame with 8 columns:
+\describe{
+\item{STUDYID}{Study Identifier}
+\item{RDOMAIN}{Related Domain Abbreviation}
+\item{USUBJID}{Unique Subject Identifier}
+\item{IDVAR}{Identifying Variable}
+\item{IDVARVAL}{Identifying Variable Value}
+\item{QNAM}{Qualifier Variable Name}
+\item{QLABEL}{Qualifier Variable Label}
+\item{QVAL}{Data Value}
+\item{QORIG}{Origin}
+\item{QEVAL}{Evaluator}
+}
+}
+\source{
+Constructed using \code{nv_neuro} from \code{{admiralneuro}} package
+}
+\usage{
+suppnv_neuro
+}
+\description{
+A SDTM SUPPNV domain dataset containing reference regions used for SUVR calculation
+}
+\details{
+Supplemental Nervous System Findings Dataset
+
+A SDTM SUPPNV domain dataset
+}
+\seealso{
+Other datasets: 
+\code{\link{ag_neuro}},
+\code{\link{dm_neuro}},
+\code{\link{nv_neuro}}
+}
+\concept{datasets}
+\keyword{datasets}


Reviews:
user: login: manciniedoardo
body: Thanks @jwang-lilly! Looking much better and great job with all the checks! I left a comment around simplifying your code. Also I have the following general comments (some may be due to my unfamiliarity with the TA).

- NVTESTCD = "FTPSICBGM" is still >8 chars long
- NVTESTCD = "FBPVR" only has "Positive" as results - is that intended? 
- NVTESTCD = "FBVPR" and "FTPVR" - is it correct we only have baseline records?

I leave @pharmaverse/admiralneuro to review the actual data.


state: CHANGES_REQUESTED
author_association: COLLABORATOR
submitted_at: 2025-04-10T09:01:26Z
user: login: jwang-lilly
state: COMMENTED
author_association: COLLABORATOR
submitted_at: 2025-04-10T13:52:53Z
user: login: Fanny-Gautier
body: `NVLNKID` to add, and `Reference Region` to probably add in `SUPPNV`.
1 Note left to read `dm_neuro` after the first release of `{admiralneuro}`
state: COMMENTED
author_association: CONTRIBUTOR
submitted_at: 2025-04-11T13:56:53Z
user: login: meilinjiang
body: Looks great! Same question as Jian about the "NVNAM". I think it serves as the variable for reference brain region.
state: COMMENTED
author_association: CONTRIBUTOR
submitted_at: 2025-04-15T19:58:47Z
user: login: Fanny-Gautier
body: I think that's it from my end. Available to discuss about the `xxLNKID` issue, or if someone else has any other approach, please feel free to add your suggestion.
state: CHANGES_REQUESTED
author_association: CONTRIBUTOR
submitted_at: 2025-04-23T13:40:42Z
user: login: manciniedoardo
state: COMMENTED
author_association: COLLABORATOR
submitted_at: 2025-04-23T14:56:07Z
user: login: jwang-lilly
state: COMMENTED
author_association: COLLABORATOR
submitted_at: 2025-04-23T15:08:29Z
user: login: jwang-lilly
state: COMMENTED
author_association: COLLABORATOR
submitted_at: 2025-04-23T15:09:59Z
user: login: jwang-lilly
state: COMMENTED
author_association: COLLABORATOR
submitted_at: 2025-04-23T15:11:13Z
user: login: jwang-lilly
state: COMMENTED
author_association: COLLABORATOR
submitted_at: 2025-04-23T15:12:43Z
user: login: jwang-lilly
state: COMMENTED
author_association: COLLABORATOR
submitted_at: 2025-04-23T15:41:02Z
user: login: jwang-lilly
state: COMMENTED
author_association: COLLABORATOR
submitted_at: 2025-04-23T15:45:10Z
user: login: jwang-lilly
state: COMMENTED
author_association: COLLABORATOR
submitted_at: 2025-04-23T15:45:47Z
user: login: jwang-lilly
state: COMMENTED
author_association: COLLABORATOR
submitted_at: 2025-04-23T15:47:59Z
user: login: jwang-lilly
state: COMMENTED
author_association: COLLABORATOR
submitted_at: 2025-04-23T16:02:35Z
user: login: jwang-lilly
state: COMMENTED
author_association: COLLABORATOR
submitted_at: 2025-04-23T16:15:01Z
user: login: jwang-lilly
state: COMMENTED
author_association: COLLABORATOR
submitted_at: 2025-04-23T16:18:02Z
user: login: jwang-lilly
state: COMMENTED
author_association: COLLABORATOR
submitted_at: 2025-04-23T17:31:42Z
user: login: Fanny-Gautier
body: Only 1 minor comment (delete commented out line of code) and then it looks good to me. Thanks for all the updates
state: CHANGES_REQUESTED
author_association: CONTRIBUTOR
submitted_at: 2025-04-24T09:13:07Z
user: login: manciniedoardo
body: Thanks @jwang-lilly !
state: COMMENTED
author_association: COLLABORATOR
submitted_at: 2025-04-25T10:14:54Z
user: login: manciniedoardo
state: APPROVED
author_association: COLLABORATOR
submitted_at: 2025-04-25T10:15:30Z

Review comments:
diff_hunk: @@ -0,0 +1,255 @@
+# Dataset: nv_neuro
+# Description: Create NV test SDTM dataset for Alzheimer's Disease (neuro studies)
+
+# Load libraries ----
+
+library(tibble)
+library(dplyr)
+library(stringr)
+library(admiral)
+
+# Read input data ----
+
+data("dm_neuro")
+
+# Convert blank to NA ----
+
+dm_neuro <- convert_blanks_to_na(dm_neuro)
+
+# Separate placebo and observation from treatment group to mimic different disease progression ----
+
+placebo_group <- dm_neuro %>%
+  dplyr::filter(!is.na(ARMCD) & ARMCD == "Pbo")
+
+treatment_group <- dm_neuro %>%
+  dplyr::filter(!is.na(ARMCD) & ARMCD == "Xan_Hi")
+
+observation_group <- dm_neuro %>%
+  dplyr::filter(is.na(ARMCD) & ARMNRS == "Observational Study")
+
+# Leverage VS visits at BASELINE, WEEK12 and WEEK26
+
+visit_schedule <- pharmaversesdtm::vs %>%
+  dplyr::filter(USUBJID %in% dm_neuro$USUBJID) %>%
+  dplyr::filter(VISITNUM %in% c(3.0, 9.0, 13.0)) %>%
+  dplyr::rename(NVDTC = VSDTC, NVDY = VSDY) %>%
+  dplyr::select(USUBJID, VISITNUM, VISIT, VISITDY, NVDTC, NVDY) %>%
+  group_by(USUBJID) %>%
+  distinct()
+
+# All USUBJID have BASELINE but not all have visits 9 or 13 data
+
+visit9_usubjid <- visit_schedule %>%
+  dplyr::filter(VISITNUM == 9) %>%
+  dplyr::select(USUBJID) %>%
+  distinct() %>%
+  unlist()
+
+visit13_usubjid <- visit_schedule %>%
+  dplyr::filter(VISITNUM == 13) %>%
+  distinct() %>%
+  unlist()
+
+# Create records for one USUBJID ----
+
+create_records_for_one_id <- function(usubjid = "01-701-1015", visitnum = 3,
+                                      fbp_suvr_cb = 1.461, fbb_suvr_com = 1.452, ftp_suvr_icbgm = 1.331) {
+  tibble(
+    STUDYID = rep("CDISCPILOT01", 5),
+    DOMAIN = rep("NV", 5),
+    USUBJID = rep(usubjid, 5),
+    SUBJID = sub(".*-", "", rep(usubjid, 5)),
+    NVSEQ = 1:5,
+    NVTESTCD = c("FBPVR", "FBPSCB", "FBBSCB", "FTPVR", "FTPSICBGM"),
+    NVTEST = c(
+      "FBP Qualitative Visual Classification",
+      "FBP SUVR Ref Cerebellum",
+      "FBB SUVR Ref Cerebellum",
+      "FTP Qualitative Visual Classification",
+      "FTP SUVR Ref Inf Cerebellar GM"
+    ),
+    NVCAT = c("FBP", "FBP", "FBB", "FTP", "FTP"),
+    NVORRES = c("Positive", as.character(fbp_suvr_cb), as.character(fbb_suvr_com), "Positive", as.character(ftp_suvr_icbgm)),
+    NVLOC = c(NA, "NEOCORTICAL COMPOSITE", "NEOCORTICAL COMPOSITE", NA, "NEOCORTICAL COMPOSITE"),
+    NVNAM = c(NA, "Whole Cerebellum", "Whole Cerebellum", NA, "Inferior Cerebellar Gray Matter"),
+    NVMETHOD = c("FBP VISUAL CLASSIFICATION", "AVID FBP SUVR PIPELINE", "BERKELEY FBB SUVR PIPELINE", "FTP VISUAL CLASSIFICATION", "BERKELEY FTP SUVR PIPELINE"),
+    VISITNUM = visitnum
+  )
+}
+
+# Create records for multiple USUBJIDs ----
+
+create_records_for_multiple_ids <- function(ids, visitnum = 3, suvr_lo = 1.25, suvr_hi = 2.5) {
path: data-raw/nv_neuro.R
user: login: manciniedoardo
body: I think you can forgo `create_records_for_multiple_ids()` entirely with an `lapply()` call:
```
# Create records for multiple USUBJIDs ----

# Set the seed for reproducibility
set.seed(2774)

# Generate the data using lapply
all_visit3_dat <- dplyr::bind_rows(
  lapply(dm_neuro$USUBJID, function(id) {
    # Generate random values for the parameters
    fbp_suvr_cb <- round(runif(1, 1.25, 2.5), 3)
    fbb_suvr_com <- round(fbp_suvr_cb - runif(1, min = 0.005, max = 0.01), 3)
    ftp_suvr_icbgm <- round(fbp_suvr_cb - runif(1, min = 0.1, max = 0.13), 3)
    
    # Create the dataset using create_records_for_one_id function
    create_records_for_one_id(
      usubjid = id,
      visitnum = 3,
      fbp_suvr_cb = fbp_suvr_cb,
      fbb_suvr_com = fbb_suvr_com,
      ftp_suvr_icbgm = ftp_suvr_icbgm
    )
  })
)

```
created_at: 2025-04-10T08:50:10Z
author_association: COLLABORATOR
diff_hunk: @@ -0,0 +1,255 @@
+# Dataset: nv_neuro
+# Description: Create NV test SDTM dataset for Alzheimer's Disease (neuro studies)
+
+# Load libraries ----
+
+library(tibble)
+library(dplyr)
+library(stringr)
+library(admiral)
+
+# Read input data ----
+
+data("dm_neuro")
+
+# Convert blank to NA ----
+
+dm_neuro <- convert_blanks_to_na(dm_neuro)
+
+# Separate placebo and observation from treatment group to mimic different disease progression ----
+
+placebo_group <- dm_neuro %>%
+  dplyr::filter(!is.na(ARMCD) & ARMCD == "Pbo")
+
+treatment_group <- dm_neuro %>%
+  dplyr::filter(!is.na(ARMCD) & ARMCD == "Xan_Hi")
+
+observation_group <- dm_neuro %>%
+  dplyr::filter(is.na(ARMCD) & ARMNRS == "Observational Study")
+
+# Leverage VS visits at BASELINE, WEEK12 and WEEK26
+
+visit_schedule <- pharmaversesdtm::vs %>%
+  dplyr::filter(USUBJID %in% dm_neuro$USUBJID) %>%
+  dplyr::filter(VISITNUM %in% c(3.0, 9.0, 13.0)) %>%
+  dplyr::rename(NVDTC = VSDTC, NVDY = VSDY) %>%
+  dplyr::select(USUBJID, VISITNUM, VISIT, VISITDY, NVDTC, NVDY) %>%
+  group_by(USUBJID) %>%
+  distinct()
+
+# All USUBJID have BASELINE but not all have visits 9 or 13 data
+
+visit9_usubjid <- visit_schedule %>%
+  dplyr::filter(VISITNUM == 9) %>%
+  dplyr::select(USUBJID) %>%
+  distinct() %>%
+  unlist()
+
+visit13_usubjid <- visit_schedule %>%
+  dplyr::filter(VISITNUM == 13) %>%
+  distinct() %>%
+  unlist()
+
+# Create records for one USUBJID ----
+
+create_records_for_one_id <- function(usubjid = "01-701-1015", visitnum = 3,
+                                      fbp_suvr_cb = 1.461, fbb_suvr_com = 1.452, ftp_suvr_icbgm = 1.331) {
+  tibble(
+    STUDYID = rep("CDISCPILOT01", 5),
+    DOMAIN = rep("NV", 5),
+    USUBJID = rep(usubjid, 5),
+    SUBJID = sub(".*-", "", rep(usubjid, 5)),
+    NVSEQ = 1:5,
+    NVTESTCD = c("FBPVR", "FBPSCB", "FBBSCB", "FTPVR", "FTPSICBGM"),
+    NVTEST = c(
+      "FBP Qualitative Visual Classification",
+      "FBP SUVR Ref Cerebellum",
+      "FBB SUVR Ref Cerebellum",
+      "FTP Qualitative Visual Classification",
+      "FTP SUVR Ref Inf Cerebellar GM"
+    ),
+    NVCAT = c("FBP", "FBP", "FBB", "FTP", "FTP"),
+    NVORRES = c("Positive", as.character(fbp_suvr_cb), as.character(fbb_suvr_com), "Positive", as.character(ftp_suvr_icbgm)),
+    NVLOC = c(NA, "NEOCORTICAL COMPOSITE", "NEOCORTICAL COMPOSITE", NA, "NEOCORTICAL COMPOSITE"),
+    NVNAM = c(NA, "Whole Cerebellum", "Whole Cerebellum", NA, "Inferior Cerebellar Gray Matter"),
+    NVMETHOD = c("FBP VISUAL CLASSIFICATION", "AVID FBP SUVR PIPELINE", "BERKELEY FBB SUVR PIPELINE", "FTP VISUAL CLASSIFICATION", "BERKELEY FTP SUVR PIPELINE"),
+    VISITNUM = visitnum
+  )
+}
+
+# Create records for multiple USUBJIDs ----
+
+create_records_for_multiple_ids <- function(ids, visitnum = 3, suvr_lo = 1.25, suvr_hi = 2.5) {
path: data-raw/nv_neuro.R
user: login: jwang-lilly
body: Thanks @manciniedoardo 

- NVTESTCD = "FTPSICBGM" is still >8 chars long  =>  Thanks for catching this.  Will remove the last character.
- NVTESTCD = "FBPVR" only has "Positive" as results - is that intended? => Yes.  AD patients with positive pathology.
- NVTESTCD = "FBVPR" and "FTPVR" - is it correct we only have baseline records? => Yes, only visual assessment at baseline.
created_at: 2025-04-10T13:52:53Z
author_association: COLLABORATOR
diff_hunk: @@ -0,0 +1,247 @@
+# Dataset: nv_neuro
+# Description: Create NV test SDTM dataset for Alzheimer's Disease (neuro studies)
+
+# Load libraries ----
+
+library(tibble)
+library(dplyr)
+library(stringr)
+library(admiral)
+
+# Read input data ----
+
+data("dm_neuro")
path: data-raw/nv_neuro.R
user: login: Fanny-Gautier
body: Note: It will have to be replaced by `dm_neuro <- pharmaversesdtm::dm_neuro` once it is added in `pharmaversesdtm` (after first release only)
created_at: 2025-04-11T13:12:54Z
author_association: CONTRIBUTOR
diff_hunk: @@ -0,0 +1,248 @@
+# Dataset: nv_neuro
+# Description: Create NV test SDTM dataset for Alzheimer's Disease (neuro studies)
+
+# Load libraries ----
+
+library(tibble)
+library(dplyr)
+library(stringr)
+library(admiral)
+
+# Read input data ----
+
+data("dm_neuro")
+
+# Convert blank to NA ----
+
+dm_neuro <- convert_blanks_to_na(dm_neuro)
+
+# Separate placebo and observation from treatment group to mimic different disease progression ----
+
+placebo_group <- dm_neuro %>%
+  dplyr::filter(!is.na(ARMCD) & ARMCD == "Pbo")
+
+treatment_group <- dm_neuro %>%
+  dplyr::filter(!is.na(ARMCD) & ARMCD == "Xan_Hi")
+
+observation_group <- dm_neuro %>%
+  dplyr::filter(is.na(ARMCD) & ARMNRS == "Observational Study")
+
+# Leverage VS visits at BASELINE, WEEK12 and WEEK26
+
+visit_schedule <- pharmaversesdtm::vs %>%
+  dplyr::filter(USUBJID %in% dm_neuro$USUBJID) %>%
+  dplyr::filter(VISITNUM %in% c(3.0, 9.0, 13.0)) %>%
+  dplyr::rename(NVDTC = VSDTC, NVDY = VSDY) %>%
+  dplyr::select(USUBJID, VISITNUM, VISIT, VISITDY, NVDTC, NVDY) %>%
+  group_by(USUBJID) %>%
+  distinct()
+
+# All USUBJID have BASELINE but not all have visits 9 or 13 data
+
+visit9_usubjid <- visit_schedule %>%
+  dplyr::filter(VISITNUM == 9) %>%
+  dplyr::select(USUBJID) %>%
+  distinct() %>%
+  unlist()
+
+visit13_usubjid <- visit_schedule %>%
+  dplyr::filter(VISITNUM == 13) %>%
+  distinct() %>%
+  unlist()
+
+# Create records for one USUBJID ----
+
+create_records_for_one_id <- function(usubjid = "01-701-1015", visitnum = 3,
+                                      fbp_suvr_cb = 1.461, fbb_suvr_com = 1.452, ftp_suvr_icbgm = 1.331) {
+  tibble(
+    STUDYID = rep("CDISCPILOT01", 5),
+    DOMAIN = rep("NV", 5),
+    USUBJID = rep(usubjid, 5),
+    SUBJID = sub(".*-", "", rep(usubjid, 5)),
+    NVSEQ = 1:5,
+    NVTESTCD = c("VR", "SUVR", "SUVR", "VR", "SUVR"),
+    NVTEST = c(
+      "Qualitative Visual Classification",
+      "Standardized Uptake Value Ratio",
+      "Standardized Uptake Value Ratio",
+      "Qualitative Visual Classification",
+      "Standardized Uptake Value Ratio"
+    ),
+    NVCAT = c("FBP", "FBP", "FBB", "FTP", "FTP"),
+    NVORRES = c("Positive", as.character(fbp_suvr_cb), as.character(fbb_suvr_com), "Positive", as.character(ftp_suvr_icbgm)),
+    NVLOC = c(NA, "NEOCORTICAL COMPOSITE", "NEOCORTICAL COMPOSITE", NA, "NEOCORTICAL COMPOSITE"),
+    NVNAM = c("IXICO", "AVID", "BERKELEY", "IXICO", "BERKELEY"),
+    NVMETHOD = c("FBP VISUAL CLASSIFICATION", "AVID FBP SUVR PIPELINE", "BERKELEY FBB SUVR PIPELINE", "FTP VISUAL CLASSIFICATION", "BERKELEY FTP SUVR PIPELINE"),
+    VISITNUM = visitnum
+  )
+}
+
+# Create dataset for visit 3 (baseline) for all ids from dm_neuro ----
+
+# Set the seed for reproducibility
+set.seed(2774)
+
+# Generate the data using lapply
+all_visit3_dat <- dplyr::bind_rows(
+  lapply(dm_neuro$USUBJID, function(id) {
+    # Generate random values for the parameters
+    fbp_suvr_cb <- round(runif(1, 1.25, 2.5), 3)
+    fbb_suvr_com <- round(fbp_suvr_cb - runif(1, min = 0.005, max = 0.01), 3)
+    ftp_suvr_icbgm <- round(fbp_suvr_cb - runif(1, min = 0.1, max = 0.13), 3)
+
+    # Create the dataset using create_records_for_one_id function
+    create_records_for_one_id(
+      usubjid = id,
+      visitnum = 3,
+      fbp_suvr_cb = fbp_suvr_cb,
+      fbb_suvr_com = fbb_suvr_com,
+      ftp_suvr_icbgm = ftp_suvr_icbgm
+    )
+  })
+)
+
+# Create visit 9 dataset for placebo and observational groups ----
+
+pbo_obs_visit9_dat <- all_visit3_dat %>%
+  dplyr::filter(USUBJID %in% c(placebo_group$USUBJID, observation_group$USUBJID)) %>%
+  dplyr::filter(NVTESTCD == "SUVR") %>%
+  dplyr::mutate(
+    VISITNUM = 9,
+    NVSEQ = NVSEQ + 5,
+    NVORRES = as.character(round(as.numeric(NVORRES) + runif(1, min = 0.1, max = 0.2), 3)),
+    NVORRES
+  )
+
+# Create visit 9 dataset for treatment group ----
+
+treat_visit9_dat <- all_visit3_dat %>%
+  dplyr::filter(USUBJID %in% treatment_group$USUBJID) %>%
+  dplyr::filter(NVTESTCD == "SUVR") %>%
+  dplyr::mutate(
+    VISITNUM = 9,
+    NVSEQ = NVSEQ + 5,
+    NVORRES = ifelse(NVCAT %in% c("FBP", "FBB"),
+      as.character(round(as.numeric(NVORRES) - runif(1, min = 0.3, max = 0.8), 3)),
+      ifelse(NVCAT == "FTP",
+        as.character(round(as.numeric(NVORRES) - runif(1, min = 0.005, max = 0.01), 3)), NVORRES
+      )
+    )
+  )
+
+# Create visit 13 dataset for placebo and observational groups ----
+
+pbo_obs_visit13_dat <- pbo_obs_visit9_dat %>%
+  dplyr::filter(NVTESTCD == "SUVR") %>%
+  dplyr::mutate(
+    VISITNUM = 13,
+    NVSEQ = NVSEQ + 5,
+    NVORRES = as.character(round(as.numeric(NVORRES) + runif(1, min = 0.2, max = 0.3), 3)),
+    NVORRES
+  )
+
+# Create visit 13 dataset for treatment group ----
+
+treat_visit13_dat <- treat_visit9_dat %>%
+  # dplyr::filter(USUBJID %in% visit_13_usubjid$USUBJID) %>%
+  dplyr::filter(NVTESTCD == "SUVR") %>%
+  dplyr::mutate(
+    VISITNUM = 13,
+    NVSEQ = NVSEQ + 5,
+    NVORRES = ifelse(NVCAT %in% c("FBP", "FBB"),
+      as.character(round(as.numeric(NVORRES) - runif(1, min = 0.3, max = 0.8), 3)),
+      ifelse(NVCAT == "FTP",
+        as.character(round(as.numeric(NVORRES) - runif(1, min = 0.01, max = 0.05), 3)), NVORRES
+      )
+    )
+  )
+
+# Combine datasets and add additional variables ----
+
+all_dat <- bind_rows(
+  all_visit3_dat,
+  pbo_obs_visit9_dat %>%
+    dplyr::filter(USUBJID %in% visit9_usubjid),
+  treat_visit9_dat %>%
+    dplyr::filter(USUBJID %in% visit9_usubjid),
+  pbo_obs_visit13_dat %>%
+    dplyr::filter(USUBJID %in% visit13_usubjid),
+  treat_visit13_dat %>%
+    dplyr::filter(USUBJID %in% visit13_usubjid)
+) %>%
+  dplyr::mutate(
+    NVBLFL = ifelse(VISITNUM == 3, "Y", NA_character_),
+    NVORRESU = ifelse(NVTESTCD == "SUVR",
+      "RATIO", NA
+    ),
+    NVSTRESC = NVORRES,
+    NVSTRESN = ifelse(NVTESTCD == "SUVR",
+      suppressWarnings(as.numeric(NVORRES)), NA
+    ),
+    NVSTRESU = ifelse(NVTESTCD == "SUVR",
+      "RATIO", NA
+    )
+  ) %>%
+  dplyr::left_join(
+    visit_schedule,
+    by = c("USUBJID", "VISITNUM")
+  ) %>%
+  dplyr::mutate(NVLNKID = NVSEQ) %>%
+  dplyr::select(
+    STUDYID, DOMAIN, USUBJID, NVSEQ, NVLNKID,
+    NVTESTCD, NVTEST, NVCAT,
+    NVLOC, NVMETHOD, NVNAM,
+    NVORRES, NVORRESU, NVSTRESC, NVSTRESN, NVSTRESU,
+    VISITNUM, VISIT, NVDTC, NVDY,
+    NVBLFL
+  )
+
+# Add labels to variables ----
+
+labels <- list(
+  # Identifier Variables (Key variables)
+  STUDYID = "Study Identifier",
+  DOMAIN = "Domain Abbreviation",
+  USUBJID = "Unique Subject Identifier",
+  NVSEQ = "Sequence Number",
+  NVLNKID = "Link to Subject's AG Domain Record",
path: data-raw/nv_neuro.R
user: login: Fanny-Gautier
body: Is it standard label or should it be "Link ID" instead?
created_at: 2025-04-23T11:41:54Z
author_association: CONTRIBUTOR
diff_hunk: @@ -0,0 +1,248 @@
+# Dataset: nv_neuro
+# Description: Create NV test SDTM dataset for Alzheimer's Disease (neuro studies)
+
+# Load libraries ----
+
+library(tibble)
+library(dplyr)
+library(stringr)
+library(admiral)
+
+# Read input data ----
+
+data("dm_neuro")
+
+# Convert blank to NA ----
+
+dm_neuro <- convert_blanks_to_na(dm_neuro)
+
+# Separate placebo and observation from treatment group to mimic different disease progression ----
+
+placebo_group <- dm_neuro %>%
+  dplyr::filter(!is.na(ARMCD) & ARMCD == "Pbo")
+
+treatment_group <- dm_neuro %>%
+  dplyr::filter(!is.na(ARMCD) & ARMCD == "Xan_Hi")
+
+observation_group <- dm_neuro %>%
+  dplyr::filter(is.na(ARMCD) & ARMNRS == "Observational Study")
+
+# Leverage VS visits at BASELINE, WEEK12 and WEEK26
+
+visit_schedule <- pharmaversesdtm::vs %>%
+  dplyr::filter(USUBJID %in% dm_neuro$USUBJID) %>%
+  dplyr::filter(VISITNUM %in% c(3.0, 9.0, 13.0)) %>%
+  dplyr::rename(NVDTC = VSDTC, NVDY = VSDY) %>%
+  dplyr::select(USUBJID, VISITNUM, VISIT, VISITDY, NVDTC, NVDY) %>%
+  group_by(USUBJID) %>%
+  distinct()
+
+# All USUBJID have BASELINE but not all have visits 9 or 13 data
+
+visit9_usubjid <- visit_schedule %>%
+  dplyr::filter(VISITNUM == 9) %>%
+  dplyr::select(USUBJID) %>%
+  distinct() %>%
+  unlist()
+
+visit13_usubjid <- visit_schedule %>%
+  dplyr::filter(VISITNUM == 13) %>%
+  distinct() %>%
+  unlist()
+
+# Create records for one USUBJID ----
+
+create_records_for_one_id <- function(usubjid = "01-701-1015", visitnum = 3,
+                                      fbp_suvr_cb = 1.461, fbb_suvr_com = 1.452, ftp_suvr_icbgm = 1.331) {
+  tibble(
+    STUDYID = rep("CDISCPILOT01", 5),
+    DOMAIN = rep("NV", 5),
+    USUBJID = rep(usubjid, 5),
+    SUBJID = sub(".*-", "", rep(usubjid, 5)),
+    NVSEQ = 1:5,
+    NVTESTCD = c("VR", "SUVR", "SUVR", "VR", "SUVR"),
+    NVTEST = c(
+      "Qualitative Visual Classification",
+      "Standardized Uptake Value Ratio",
+      "Standardized Uptake Value Ratio",
+      "Qualitative Visual Classification",
+      "Standardized Uptake Value Ratio"
+    ),
+    NVCAT = c("FBP", "FBP", "FBB", "FTP", "FTP"),
+    NVORRES = c("Positive", as.character(fbp_suvr_cb), as.character(fbb_suvr_com), "Positive", as.character(ftp_suvr_icbgm)),
+    NVLOC = c(NA, "NEOCORTICAL COMPOSITE", "NEOCORTICAL COMPOSITE", NA, "NEOCORTICAL COMPOSITE"),
+    NVNAM = c("IXICO", "AVID", "BERKELEY", "IXICO", "BERKELEY"),
+    NVMETHOD = c("FBP VISUAL CLASSIFICATION", "AVID FBP SUVR PIPELINE", "BERKELEY FBB SUVR PIPELINE", "FTP VISUAL CLASSIFICATION", "BERKELEY FTP SUVR PIPELINE"),
+    VISITNUM = visitnum
+  )
+}
+
+# Create dataset for visit 3 (baseline) for all ids from dm_neuro ----
+
+# Set the seed for reproducibility
+set.seed(2774)
+
+# Generate the data using lapply
+all_visit3_dat <- dplyr::bind_rows(
+  lapply(dm_neuro$USUBJID, function(id) {
+    # Generate random values for the parameters
+    fbp_suvr_cb <- round(runif(1, 1.25, 2.5), 3)
+    fbb_suvr_com <- round(fbp_suvr_cb - runif(1, min = 0.005, max = 0.01), 3)
+    ftp_suvr_icbgm <- round(fbp_suvr_cb - runif(1, min = 0.1, max = 0.13), 3)
+
+    # Create the dataset using create_records_for_one_id function
+    create_records_for_one_id(
+      usubjid = id,
+      visitnum = 3,
+      fbp_suvr_cb = fbp_suvr_cb,
+      fbb_suvr_com = fbb_suvr_com,
+      ftp_suvr_icbgm = ftp_suvr_icbgm
+    )
+  })
+)
+
+# Create visit 9 dataset for placebo and observational groups ----
+
+pbo_obs_visit9_dat <- all_visit3_dat %>%
+  dplyr::filter(USUBJID %in% c(placebo_group$USUBJID, observation_group$USUBJID)) %>%
+  dplyr::filter(NVTESTCD == "SUVR") %>%
+  dplyr::mutate(
+    VISITNUM = 9,
+    NVSEQ = NVSEQ + 5,
+    NVORRES = as.character(round(as.numeric(NVORRES) + runif(1, min = 0.1, max = 0.2), 3)),
+    NVORRES
+  )
+
+# Create visit 9 dataset for treatment group ----
+
+treat_visit9_dat <- all_visit3_dat %>%
+  dplyr::filter(USUBJID %in% treatment_group$USUBJID) %>%
+  dplyr::filter(NVTESTCD == "SUVR") %>%
+  dplyr::mutate(
+    VISITNUM = 9,
+    NVSEQ = NVSEQ + 5,
+    NVORRES = ifelse(NVCAT %in% c("FBP", "FBB"),
+      as.character(round(as.numeric(NVORRES) - runif(1, min = 0.3, max = 0.8), 3)),
+      ifelse(NVCAT == "FTP",
+        as.character(round(as.numeric(NVORRES) - runif(1, min = 0.005, max = 0.01), 3)), NVORRES
+      )
+    )
+  )
+
+# Create visit 13 dataset for placebo and observational groups ----
+
+pbo_obs_visit13_dat <- pbo_obs_visit9_dat %>%
+  dplyr::filter(NVTESTCD == "SUVR") %>%
+  dplyr::mutate(
+    VISITNUM = 13,
+    NVSEQ = NVSEQ + 5,
+    NVORRES = as.character(round(as.numeric(NVORRES) + runif(1, min = 0.2, max = 0.3), 3)),
+    NVORRES
+  )
+
+# Create visit 13 dataset for treatment group ----
+
+treat_visit13_dat <- treat_visit9_dat %>%
+  # dplyr::filter(USUBJID %in% visit_13_usubjid$USUBJID) %>%
+  dplyr::filter(NVTESTCD == "SUVR") %>%
+  dplyr::mutate(
+    VISITNUM = 13,
+    NVSEQ = NVSEQ + 5,
+    NVORRES = ifelse(NVCAT %in% c("FBP", "FBB"),
+      as.character(round(as.numeric(NVORRES) - runif(1, min = 0.3, max = 0.8), 3)),
+      ifelse(NVCAT == "FTP",
+        as.character(round(as.numeric(NVORRES) - runif(1, min = 0.01, max = 0.05), 3)), NVORRES
+      )
+    )
+  )
+
+# Combine datasets and add additional variables ----
+
+all_dat <- bind_rows(
+  all_visit3_dat,
+  pbo_obs_visit9_dat %>%
+    dplyr::filter(USUBJID %in% visit9_usubjid),
+  treat_visit9_dat %>%
+    dplyr::filter(USUBJID %in% visit9_usubjid),
+  pbo_obs_visit13_dat %>%
+    dplyr::filter(USUBJID %in% visit13_usubjid),
+  treat_visit13_dat %>%
+    dplyr::filter(USUBJID %in% visit13_usubjid)
+) %>%
+  dplyr::mutate(
+    NVBLFL = ifelse(VISITNUM == 3, "Y", NA_character_),
+    NVORRESU = ifelse(NVTESTCD == "SUVR",
+      "RATIO", NA
+    ),
+    NVSTRESC = NVORRES,
+    NVSTRESN = ifelse(NVTESTCD == "SUVR",
+      suppressWarnings(as.numeric(NVORRES)), NA
+    ),
+    NVSTRESU = ifelse(NVTESTCD == "SUVR",
+      "RATIO", NA
+    )
+  ) %>%
+  dplyr::left_join(
+    visit_schedule,
+    by = c("USUBJID", "VISITNUM")
+  ) %>%
+  dplyr::mutate(NVLNKID = NVSEQ) %>%
+  dplyr::select(
+    STUDYID, DOMAIN, USUBJID, NVSEQ, NVLNKID,
+    NVTESTCD, NVTEST, NVCAT,
+    NVLOC, NVMETHOD, NVNAM,
+    NVORRES, NVORRESU, NVSTRESC, NVSTRESN, NVSTRESU,
+    VISITNUM, VISIT, NVDTC, NVDY,
+    NVBLFL
+  )
+
+# Add labels to variables ----
+
+labels <- list(
+  # Identifier Variables (Key variables)
+  STUDYID = "Study Identifier",
+  DOMAIN = "Domain Abbreviation",
+  USUBJID = "Unique Subject Identifier",
+  NVSEQ = "Sequence Number",
+  NVLNKID = "Link to Subject's AG Domain Record",
+
+  # Topic Variables\
+  NVTESTCD = "Nervous System Test Short Name",
path: data-raw/nv_neuro.R
user: login: Fanny-Gautier
body: "Short Name of Nervous System Test" as per IG 3.4
created_at: 2025-04-23T11:47:28Z
author_association: CONTRIBUTOR
diff_hunk: @@ -0,0 +1,248 @@
+# Dataset: nv_neuro
+# Description: Create NV test SDTM dataset for Alzheimer's Disease (neuro studies)
+
+# Load libraries ----
+
+library(tibble)
+library(dplyr)
+library(stringr)
+library(admiral)
+
+# Read input data ----
+
+data("dm_neuro")
+
+# Convert blank to NA ----
+
+dm_neuro <- convert_blanks_to_na(dm_neuro)
+
+# Separate placebo and observation from treatment group to mimic different disease progression ----
+
+placebo_group <- dm_neuro %>%
+  dplyr::filter(!is.na(ARMCD) & ARMCD == "Pbo")
+
+treatment_group <- dm_neuro %>%
+  dplyr::filter(!is.na(ARMCD) & ARMCD == "Xan_Hi")
+
+observation_group <- dm_neuro %>%
+  dplyr::filter(is.na(ARMCD) & ARMNRS == "Observational Study")
+
+# Leverage VS visits at BASELINE, WEEK12 and WEEK26
+
+visit_schedule <- pharmaversesdtm::vs %>%
+  dplyr::filter(USUBJID %in% dm_neuro$USUBJID) %>%
+  dplyr::filter(VISITNUM %in% c(3.0, 9.0, 13.0)) %>%
+  dplyr::rename(NVDTC = VSDTC, NVDY = VSDY) %>%
+  dplyr::select(USUBJID, VISITNUM, VISIT, VISITDY, NVDTC, NVDY) %>%
+  group_by(USUBJID) %>%
+  distinct()
+
+# All USUBJID have BASELINE but not all have visits 9 or 13 data
+
+visit9_usubjid <- visit_schedule %>%
+  dplyr::filter(VISITNUM == 9) %>%
+  dplyr::select(USUBJID) %>%
+  distinct() %>%
+  unlist()
+
+visit13_usubjid <- visit_schedule %>%
+  dplyr::filter(VISITNUM == 13) %>%
+  distinct() %>%
+  unlist()
+
+# Create records for one USUBJID ----
+
+create_records_for_one_id <- function(usubjid = "01-701-1015", visitnum = 3,
+                                      fbp_suvr_cb = 1.461, fbb_suvr_com = 1.452, ftp_suvr_icbgm = 1.331) {
+  tibble(
+    STUDYID = rep("CDISCPILOT01", 5),
+    DOMAIN = rep("NV", 5),
+    USUBJID = rep(usubjid, 5),
+    SUBJID = sub(".*-", "", rep(usubjid, 5)),
+    NVSEQ = 1:5,
+    NVTESTCD = c("VR", "SUVR", "SUVR", "VR", "SUVR"),
+    NVTEST = c(
+      "Qualitative Visual Classification",
+      "Standardized Uptake Value Ratio",
+      "Standardized Uptake Value Ratio",
+      "Qualitative Visual Classification",
+      "Standardized Uptake Value Ratio"
+    ),
+    NVCAT = c("FBP", "FBP", "FBB", "FTP", "FTP"),
+    NVORRES = c("Positive", as.character(fbp_suvr_cb), as.character(fbb_suvr_com), "Positive", as.character(ftp_suvr_icbgm)),
+    NVLOC = c(NA, "NEOCORTICAL COMPOSITE", "NEOCORTICAL COMPOSITE", NA, "NEOCORTICAL COMPOSITE"),
+    NVNAM = c("IXICO", "AVID", "BERKELEY", "IXICO", "BERKELEY"),
+    NVMETHOD = c("FBP VISUAL CLASSIFICATION", "AVID FBP SUVR PIPELINE", "BERKELEY FBB SUVR PIPELINE", "FTP VISUAL CLASSIFICATION", "BERKELEY FTP SUVR PIPELINE"),
+    VISITNUM = visitnum
+  )
+}
+
+# Create dataset for visit 3 (baseline) for all ids from dm_neuro ----
+
+# Set the seed for reproducibility
+set.seed(2774)
+
+# Generate the data using lapply
+all_visit3_dat <- dplyr::bind_rows(
+  lapply(dm_neuro$USUBJID, function(id) {
+    # Generate random values for the parameters
+    fbp_suvr_cb <- round(runif(1, 1.25, 2.5), 3)
+    fbb_suvr_com <- round(fbp_suvr_cb - runif(1, min = 0.005, max = 0.01), 3)
+    ftp_suvr_icbgm <- round(fbp_suvr_cb - runif(1, min = 0.1, max = 0.13), 3)
+
+    # Create the dataset using create_records_for_one_id function
+    create_records_for_one_id(
+      usubjid = id,
+      visitnum = 3,
+      fbp_suvr_cb = fbp_suvr_cb,
+      fbb_suvr_com = fbb_suvr_com,
+      ftp_suvr_icbgm = ftp_suvr_icbgm
+    )
+  })
+)
+
+# Create visit 9 dataset for placebo and observational groups ----
+
+pbo_obs_visit9_dat <- all_visit3_dat %>%
+  dplyr::filter(USUBJID %in% c(placebo_group$USUBJID, observation_group$USUBJID)) %>%
+  dplyr::filter(NVTESTCD == "SUVR") %>%
+  dplyr::mutate(
+    VISITNUM = 9,
+    NVSEQ = NVSEQ + 5,
+    NVORRES = as.character(round(as.numeric(NVORRES) + runif(1, min = 0.1, max = 0.2), 3)),
+    NVORRES
+  )
+
+# Create visit 9 dataset for treatment group ----
+
+treat_visit9_dat <- all_visit3_dat %>%
+  dplyr::filter(USUBJID %in% treatment_group$USUBJID) %>%
+  dplyr::filter(NVTESTCD == "SUVR") %>%
+  dplyr::mutate(
+    VISITNUM = 9,
+    NVSEQ = NVSEQ + 5,
+    NVORRES = ifelse(NVCAT %in% c("FBP", "FBB"),
+      as.character(round(as.numeric(NVORRES) - runif(1, min = 0.3, max = 0.8), 3)),
+      ifelse(NVCAT == "FTP",
+        as.character(round(as.numeric(NVORRES) - runif(1, min = 0.005, max = 0.01), 3)), NVORRES
+      )
+    )
+  )
+
+# Create visit 13 dataset for placebo and observational groups ----
+
+pbo_obs_visit13_dat <- pbo_obs_visit9_dat %>%
+  dplyr::filter(NVTESTCD == "SUVR") %>%
+  dplyr::mutate(
+    VISITNUM = 13,
+    NVSEQ = NVSEQ + 5,
+    NVORRES = as.character(round(as.numeric(NVORRES) + runif(1, min = 0.2, max = 0.3), 3)),
+    NVORRES
+  )
+
+# Create visit 13 dataset for treatment group ----
+
+treat_visit13_dat <- treat_visit9_dat %>%
+  # dplyr::filter(USUBJID %in% visit_13_usubjid$USUBJID) %>%
+  dplyr::filter(NVTESTCD == "SUVR") %>%
+  dplyr::mutate(
+    VISITNUM = 13,
+    NVSEQ = NVSEQ + 5,
+    NVORRES = ifelse(NVCAT %in% c("FBP", "FBB"),
+      as.character(round(as.numeric(NVORRES) - runif(1, min = 0.3, max = 0.8), 3)),
+      ifelse(NVCAT == "FTP",
+        as.character(round(as.numeric(NVORRES) - runif(1, min = 0.01, max = 0.05), 3)), NVORRES
+      )
+    )
+  )
+
+# Combine datasets and add additional variables ----
+
+all_dat <- bind_rows(
+  all_visit3_dat,
+  pbo_obs_visit9_dat %>%
+    dplyr::filter(USUBJID %in% visit9_usubjid),
+  treat_visit9_dat %>%
+    dplyr::filter(USUBJID %in% visit9_usubjid),
+  pbo_obs_visit13_dat %>%
+    dplyr::filter(USUBJID %in% visit13_usubjid),
+  treat_visit13_dat %>%
+    dplyr::filter(USUBJID %in% visit13_usubjid)
+) %>%
+  dplyr::mutate(
+    NVBLFL = ifelse(VISITNUM == 3, "Y", NA_character_),
+    NVORRESU = ifelse(NVTESTCD == "SUVR",
+      "RATIO", NA
+    ),
+    NVSTRESC = NVORRES,
+    NVSTRESN = ifelse(NVTESTCD == "SUVR",
+      suppressWarnings(as.numeric(NVORRES)), NA
+    ),
+    NVSTRESU = ifelse(NVTESTCD == "SUVR",
+      "RATIO", NA
+    )
+  ) %>%
+  dplyr::left_join(
+    visit_schedule,
+    by = c("USUBJID", "VISITNUM")
+  ) %>%
+  dplyr::mutate(NVLNKID = NVSEQ) %>%
+  dplyr::select(
+    STUDYID, DOMAIN, USUBJID, NVSEQ, NVLNKID,
+    NVTESTCD, NVTEST, NVCAT,
+    NVLOC, NVMETHOD, NVNAM,
+    NVORRES, NVORRESU, NVSTRESC, NVSTRESN, NVSTRESU,
+    VISITNUM, VISIT, NVDTC, NVDY,
+    NVBLFL
+  )
+
+# Add labels to variables ----
+
+labels <- list(
+  # Identifier Variables (Key variables)
+  STUDYID = "Study Identifier",
+  DOMAIN = "Domain Abbreviation",
+  USUBJID = "Unique Subject Identifier",
+  NVSEQ = "Sequence Number",
+  NVLNKID = "Link to Subject's AG Domain Record",
+
+  # Topic Variables\
+  NVTESTCD = "Nervous System Test Short Name",
+  NVTEST = "Nervous System Test Name",
path: data-raw/nv_neuro.R
user: login: Fanny-Gautier
body: "Name of Nervous System Test" as per IG v3.4
created_at: 2025-04-23T11:48:23Z
author_association: CONTRIBUTOR
diff_hunk: @@ -0,0 +1,248 @@
+# Dataset: nv_neuro
+# Description: Create NV test SDTM dataset for Alzheimer's Disease (neuro studies)
+
+# Load libraries ----
+
+library(tibble)
+library(dplyr)
+library(stringr)
+library(admiral)
+
+# Read input data ----
+
+data("dm_neuro")
+
+# Convert blank to NA ----
+
+dm_neuro <- convert_blanks_to_na(dm_neuro)
+
+# Separate placebo and observation from treatment group to mimic different disease progression ----
+
+placebo_group <- dm_neuro %>%
+  dplyr::filter(!is.na(ARMCD) & ARMCD == "Pbo")
+
+treatment_group <- dm_neuro %>%
+  dplyr::filter(!is.na(ARMCD) & ARMCD == "Xan_Hi")
+
+observation_group <- dm_neuro %>%
+  dplyr::filter(is.na(ARMCD) & ARMNRS == "Observational Study")
+
+# Leverage VS visits at BASELINE, WEEK12 and WEEK26
+
+visit_schedule <- pharmaversesdtm::vs %>%
+  dplyr::filter(USUBJID %in% dm_neuro$USUBJID) %>%
+  dplyr::filter(VISITNUM %in% c(3.0, 9.0, 13.0)) %>%
+  dplyr::rename(NVDTC = VSDTC, NVDY = VSDY) %>%
+  dplyr::select(USUBJID, VISITNUM, VISIT, VISITDY, NVDTC, NVDY) %>%
+  group_by(USUBJID) %>%
+  distinct()
+
+# All USUBJID have BASELINE but not all have visits 9 or 13 data
+
+visit9_usubjid <- visit_schedule %>%
+  dplyr::filter(VISITNUM == 9) %>%
+  dplyr::select(USUBJID) %>%
+  distinct() %>%
+  unlist()
+
+visit13_usubjid <- visit_schedule %>%
+  dplyr::filter(VISITNUM == 13) %>%
+  distinct() %>%
+  unlist()
+
+# Create records for one USUBJID ----
+
+create_records_for_one_id <- function(usubjid = "01-701-1015", visitnum = 3,
+                                      fbp_suvr_cb = 1.461, fbb_suvr_com = 1.452, ftp_suvr_icbgm = 1.331) {
+  tibble(
+    STUDYID = rep("CDISCPILOT01", 5),
+    DOMAIN = rep("NV", 5),
+    USUBJID = rep(usubjid, 5),
+    SUBJID = sub(".*-", "", rep(usubjid, 5)),
+    NVSEQ = 1:5,
+    NVTESTCD = c("VR", "SUVR", "SUVR", "VR", "SUVR"),
+    NVTEST = c(
+      "Qualitative Visual Classification",
+      "Standardized Uptake Value Ratio",
+      "Standardized Uptake Value Ratio",
+      "Qualitative Visual Classification",
+      "Standardized Uptake Value Ratio"
+    ),
+    NVCAT = c("FBP", "FBP", "FBB", "FTP", "FTP"),
+    NVORRES = c("Positive", as.character(fbp_suvr_cb), as.character(fbb_suvr_com), "Positive", as.character(ftp_suvr_icbgm)),
+    NVLOC = c(NA, "NEOCORTICAL COMPOSITE", "NEOCORTICAL COMPOSITE", NA, "NEOCORTICAL COMPOSITE"),
+    NVNAM = c("IXICO", "AVID", "BERKELEY", "IXICO", "BERKELEY"),
+    NVMETHOD = c("FBP VISUAL CLASSIFICATION", "AVID FBP SUVR PIPELINE", "BERKELEY FBB SUVR PIPELINE", "FTP VISUAL CLASSIFICATION", "BERKELEY FTP SUVR PIPELINE"),
+    VISITNUM = visitnum
+  )
+}
+
+# Create dataset for visit 3 (baseline) for all ids from dm_neuro ----
+
+# Set the seed for reproducibility
+set.seed(2774)
+
+# Generate the data using lapply
+all_visit3_dat <- dplyr::bind_rows(
+  lapply(dm_neuro$USUBJID, function(id) {
+    # Generate random values for the parameters
+    fbp_suvr_cb <- round(runif(1, 1.25, 2.5), 3)
+    fbb_suvr_com <- round(fbp_suvr_cb - runif(1, min = 0.005, max = 0.01), 3)
+    ftp_suvr_icbgm <- round(fbp_suvr_cb - runif(1, min = 0.1, max = 0.13), 3)
+
+    # Create the dataset using create_records_for_one_id function
+    create_records_for_one_id(
+      usubjid = id,
+      visitnum = 3,
+      fbp_suvr_cb = fbp_suvr_cb,
+      fbb_suvr_com = fbb_suvr_com,
+      ftp_suvr_icbgm = ftp_suvr_icbgm
+    )
+  })
+)
+
+# Create visit 9 dataset for placebo and observational groups ----
+
+pbo_obs_visit9_dat <- all_visit3_dat %>%
+  dplyr::filter(USUBJID %in% c(placebo_group$USUBJID, observation_group$USUBJID)) %>%
+  dplyr::filter(NVTESTCD == "SUVR") %>%
+  dplyr::mutate(
+    VISITNUM = 9,
+    NVSEQ = NVSEQ + 5,
+    NVORRES = as.character(round(as.numeric(NVORRES) + runif(1, min = 0.1, max = 0.2), 3)),
+    NVORRES
+  )
+
+# Create visit 9 dataset for treatment group ----
+
+treat_visit9_dat <- all_visit3_dat %>%
+  dplyr::filter(USUBJID %in% treatment_group$USUBJID) %>%
+  dplyr::filter(NVTESTCD == "SUVR") %>%
+  dplyr::mutate(
+    VISITNUM = 9,
+    NVSEQ = NVSEQ + 5,
+    NVORRES = ifelse(NVCAT %in% c("FBP", "FBB"),
+      as.character(round(as.numeric(NVORRES) - runif(1, min = 0.3, max = 0.8), 3)),
+      ifelse(NVCAT == "FTP",
+        as.character(round(as.numeric(NVORRES) - runif(1, min = 0.005, max = 0.01), 3)), NVORRES
+      )
+    )
+  )
+
+# Create visit 13 dataset for placebo and observational groups ----
+
+pbo_obs_visit13_dat <- pbo_obs_visit9_dat %>%
+  dplyr::filter(NVTESTCD == "SUVR") %>%
+  dplyr::mutate(
+    VISITNUM = 13,
+    NVSEQ = NVSEQ + 5,
+    NVORRES = as.character(round(as.numeric(NVORRES) + runif(1, min = 0.2, max = 0.3), 3)),
+    NVORRES
+  )
+
+# Create visit 13 dataset for treatment group ----
+
+treat_visit13_dat <- treat_visit9_dat %>%
+  # dplyr::filter(USUBJID %in% visit_13_usubjid$USUBJID) %>%
+  dplyr::filter(NVTESTCD == "SUVR") %>%
+  dplyr::mutate(
+    VISITNUM = 13,
+    NVSEQ = NVSEQ + 5,
+    NVORRES = ifelse(NVCAT %in% c("FBP", "FBB"),
+      as.character(round(as.numeric(NVORRES) - runif(1, min = 0.3, max = 0.8), 3)),
+      ifelse(NVCAT == "FTP",
+        as.character(round(as.numeric(NVORRES) - runif(1, min = 0.01, max = 0.05), 3)), NVORRES
+      )
+    )
+  )
+
+# Combine datasets and add additional variables ----
+
+all_dat <- bind_rows(
+  all_visit3_dat,
+  pbo_obs_visit9_dat %>%
+    dplyr::filter(USUBJID %in% visit9_usubjid),
+  treat_visit9_dat %>%
+    dplyr::filter(USUBJID %in% visit9_usubjid),
+  pbo_obs_visit13_dat %>%
+    dplyr::filter(USUBJID %in% visit13_usubjid),
+  treat_visit13_dat %>%
+    dplyr::filter(USUBJID %in% visit13_usubjid)
+) %>%
+  dplyr::mutate(
+    NVBLFL = ifelse(VISITNUM == 3, "Y", NA_character_),
+    NVORRESU = ifelse(NVTESTCD == "SUVR",
+      "RATIO", NA
+    ),
+    NVSTRESC = NVORRES,
+    NVSTRESN = ifelse(NVTESTCD == "SUVR",
+      suppressWarnings(as.numeric(NVORRES)), NA
+    ),
+    NVSTRESU = ifelse(NVTESTCD == "SUVR",
+      "RATIO", NA
+    )
+  ) %>%
+  dplyr::left_join(
+    visit_schedule,
+    by = c("USUBJID", "VISITNUM")
+  ) %>%
+  dplyr::mutate(NVLNKID = NVSEQ) %>%
+  dplyr::select(
+    STUDYID, DOMAIN, USUBJID, NVSEQ, NVLNKID,
+    NVTESTCD, NVTEST, NVCAT,
+    NVLOC, NVMETHOD, NVNAM,
+    NVORRES, NVORRESU, NVSTRESC, NVSTRESN, NVSTRESU,
+    VISITNUM, VISIT, NVDTC, NVDY,
+    NVBLFL
+  )
+
+# Add labels to variables ----
+
+labels <- list(
+  # Identifier Variables (Key variables)
+  STUDYID = "Study Identifier",
+  DOMAIN = "Domain Abbreviation",
+  USUBJID = "Unique Subject Identifier",
+  NVSEQ = "Sequence Number",
+  NVLNKID = "Link to Subject's AG Domain Record",
+
+  # Topic Variables\
+  NVTESTCD = "Nervous System Test Short Name",
+  NVTEST = "Nervous System Test Name",
+  NVCAT = "Category for Nervous System Test",
+
+  # Qualifier Variables
+  NVLOC = "Location of Nervous System Finding",
path: data-raw/nv_neuro.R
user: login: Fanny-Gautier
body: "Location Used for the Measurement" as per IG v3.4
created_at: 2025-04-23T11:48:57Z
author_association: CONTRIBUTOR
diff_hunk: @@ -0,0 +1,248 @@
+# Dataset: nv_neuro
+# Description: Create NV test SDTM dataset for Alzheimer's Disease (neuro studies)
+
+# Load libraries ----
+
+library(tibble)
+library(dplyr)
+library(stringr)
+library(admiral)
+
+# Read input data ----
+
+data("dm_neuro")
+
+# Convert blank to NA ----
+
+dm_neuro <- convert_blanks_to_na(dm_neuro)
+
+# Separate placebo and observation from treatment group to mimic different disease progression ----
+
+placebo_group <- dm_neuro %>%
+  dplyr::filter(!is.na(ARMCD) & ARMCD == "Pbo")
+
+treatment_group <- dm_neuro %>%
+  dplyr::filter(!is.na(ARMCD) & ARMCD == "Xan_Hi")
+
+observation_group <- dm_neuro %>%
+  dplyr::filter(is.na(ARMCD) & ARMNRS == "Observational Study")
+
+# Leverage VS visits at BASELINE, WEEK12 and WEEK26
+
+visit_schedule <- pharmaversesdtm::vs %>%
+  dplyr::filter(USUBJID %in% dm_neuro$USUBJID) %>%
+  dplyr::filter(VISITNUM %in% c(3.0, 9.0, 13.0)) %>%
+  dplyr::rename(NVDTC = VSDTC, NVDY = VSDY) %>%
+  dplyr::select(USUBJID, VISITNUM, VISIT, VISITDY, NVDTC, NVDY) %>%
+  group_by(USUBJID) %>%
+  distinct()
+
+# All USUBJID have BASELINE but not all have visits 9 or 13 data
+
+visit9_usubjid <- visit_schedule %>%
+  dplyr::filter(VISITNUM == 9) %>%
+  dplyr::select(USUBJID) %>%
+  distinct() %>%
+  unlist()
+
+visit13_usubjid <- visit_schedule %>%
+  dplyr::filter(VISITNUM == 13) %>%
+  distinct() %>%
+  unlist()
+
+# Create records for one USUBJID ----
+
+create_records_for_one_id <- function(usubjid = "01-701-1015", visitnum = 3,
+                                      fbp_suvr_cb = 1.461, fbb_suvr_com = 1.452, ftp_suvr_icbgm = 1.331) {
+  tibble(
+    STUDYID = rep("CDISCPILOT01", 5),
+    DOMAIN = rep("NV", 5),
+    USUBJID = rep(usubjid, 5),
+    SUBJID = sub(".*-", "", rep(usubjid, 5)),
+    NVSEQ = 1:5,
+    NVTESTCD = c("VR", "SUVR", "SUVR", "VR", "SUVR"),
+    NVTEST = c(
+      "Qualitative Visual Classification",
+      "Standardized Uptake Value Ratio",
+      "Standardized Uptake Value Ratio",
+      "Qualitative Visual Classification",
+      "Standardized Uptake Value Ratio"
+    ),
+    NVCAT = c("FBP", "FBP", "FBB", "FTP", "FTP"),
+    NVORRES = c("Positive", as.character(fbp_suvr_cb), as.character(fbb_suvr_com), "Positive", as.character(ftp_suvr_icbgm)),
+    NVLOC = c(NA, "NEOCORTICAL COMPOSITE", "NEOCORTICAL COMPOSITE", NA, "NEOCORTICAL COMPOSITE"),
+    NVNAM = c("IXICO", "AVID", "BERKELEY", "IXICO", "BERKELEY"),
+    NVMETHOD = c("FBP VISUAL CLASSIFICATION", "AVID FBP SUVR PIPELINE", "BERKELEY FBB SUVR PIPELINE", "FTP VISUAL CLASSIFICATION", "BERKELEY FTP SUVR PIPELINE"),
+    VISITNUM = visitnum
+  )
+}
+
+# Create dataset for visit 3 (baseline) for all ids from dm_neuro ----
+
+# Set the seed for reproducibility
+set.seed(2774)
+
+# Generate the data using lapply
+all_visit3_dat <- dplyr::bind_rows(
+  lapply(dm_neuro$USUBJID, function(id) {
+    # Generate random values for the parameters
+    fbp_suvr_cb <- round(runif(1, 1.25, 2.5), 3)
+    fbb_suvr_com <- round(fbp_suvr_cb - runif(1, min = 0.005, max = 0.01), 3)
+    ftp_suvr_icbgm <- round(fbp_suvr_cb - runif(1, min = 0.1, max = 0.13), 3)
+
+    # Create the dataset using create_records_for_one_id function
+    create_records_for_one_id(
+      usubjid = id,
+      visitnum = 3,
+      fbp_suvr_cb = fbp_suvr_cb,
+      fbb_suvr_com = fbb_suvr_com,
+      ftp_suvr_icbgm = ftp_suvr_icbgm
+    )
+  })
+)
+
+# Create visit 9 dataset for placebo and observational groups ----
+
+pbo_obs_visit9_dat <- all_visit3_dat %>%
+  dplyr::filter(USUBJID %in% c(placebo_group$USUBJID, observation_group$USUBJID)) %>%
+  dplyr::filter(NVTESTCD == "SUVR") %>%
+  dplyr::mutate(
+    VISITNUM = 9,
+    NVSEQ = NVSEQ + 5,
+    NVORRES = as.character(round(as.numeric(NVORRES) + runif(1, min = 0.1, max = 0.2), 3)),
+    NVORRES
+  )
+
+# Create visit 9 dataset for treatment group ----
+
+treat_visit9_dat <- all_visit3_dat %>%
+  dplyr::filter(USUBJID %in% treatment_group$USUBJID) %>%
+  dplyr::filter(NVTESTCD == "SUVR") %>%
+  dplyr::mutate(
+    VISITNUM = 9,
+    NVSEQ = NVSEQ + 5,
+    NVORRES = ifelse(NVCAT %in% c("FBP", "FBB"),
+      as.character(round(as.numeric(NVORRES) - runif(1, min = 0.3, max = 0.8), 3)),
+      ifelse(NVCAT == "FTP",
+        as.character(round(as.numeric(NVORRES) - runif(1, min = 0.005, max = 0.01), 3)), NVORRES
+      )
+    )
+  )
+
+# Create visit 13 dataset for placebo and observational groups ----
+
+pbo_obs_visit13_dat <- pbo_obs_visit9_dat %>%
+  dplyr::filter(NVTESTCD == "SUVR") %>%
+  dplyr::mutate(
+    VISITNUM = 13,
+    NVSEQ = NVSEQ + 5,
+    NVORRES = as.character(round(as.numeric(NVORRES) + runif(1, min = 0.2, max = 0.3), 3)),
+    NVORRES
+  )
+
+# Create visit 13 dataset for treatment group ----
+
+treat_visit13_dat <- treat_visit9_dat %>%
+  # dplyr::filter(USUBJID %in% visit_13_usubjid$USUBJID) %>%
+  dplyr::filter(NVTESTCD == "SUVR") %>%
+  dplyr::mutate(
+    VISITNUM = 13,
+    NVSEQ = NVSEQ + 5,
+    NVORRES = ifelse(NVCAT %in% c("FBP", "FBB"),
+      as.character(round(as.numeric(NVORRES) - runif(1, min = 0.3, max = 0.8), 3)),
+      ifelse(NVCAT == "FTP",
+        as.character(round(as.numeric(NVORRES) - runif(1, min = 0.01, max = 0.05), 3)), NVORRES
+      )
+    )
+  )
+
+# Combine datasets and add additional variables ----
+
+all_dat <- bind_rows(
+  all_visit3_dat,
+  pbo_obs_visit9_dat %>%
+    dplyr::filter(USUBJID %in% visit9_usubjid),
+  treat_visit9_dat %>%
+    dplyr::filter(USUBJID %in% visit9_usubjid),
+  pbo_obs_visit13_dat %>%
+    dplyr::filter(USUBJID %in% visit13_usubjid),
+  treat_visit13_dat %>%
+    dplyr::filter(USUBJID %in% visit13_usubjid)
+) %>%
+  dplyr::mutate(
+    NVBLFL = ifelse(VISITNUM == 3, "Y", NA_character_),
+    NVORRESU = ifelse(NVTESTCD == "SUVR",
+      "RATIO", NA
+    ),
+    NVSTRESC = NVORRES,
+    NVSTRESN = ifelse(NVTESTCD == "SUVR",
+      suppressWarnings(as.numeric(NVORRES)), NA
+    ),
+    NVSTRESU = ifelse(NVTESTCD == "SUVR",
+      "RATIO", NA
+    )
+  ) %>%
+  dplyr::left_join(
+    visit_schedule,
+    by = c("USUBJID", "VISITNUM")
+  ) %>%
+  dplyr::mutate(NVLNKID = NVSEQ) %>%
+  dplyr::select(
+    STUDYID, DOMAIN, USUBJID, NVSEQ, NVLNKID,
+    NVTESTCD, NVTEST, NVCAT,
+    NVLOC, NVMETHOD, NVNAM,
+    NVORRES, NVORRESU, NVSTRESC, NVSTRESN, NVSTRESU,
+    VISITNUM, VISIT, NVDTC, NVDY,
+    NVBLFL
+  )
+
+# Add labels to variables ----
+
+labels <- list(
+  # Identifier Variables (Key variables)
+  STUDYID = "Study Identifier",
+  DOMAIN = "Domain Abbreviation",
+  USUBJID = "Unique Subject Identifier",
+  NVSEQ = "Sequence Number",
+  NVLNKID = "Link to Subject's AG Domain Record",
+
+  # Topic Variables\
+  NVTESTCD = "Nervous System Test Short Name",
+  NVTEST = "Nervous System Test Name",
+  NVCAT = "Category for Nervous System Test",
+
+  # Qualifier Variables
+  NVLOC = "Location of Nervous System Finding",
+  NVMETHOD = "Method of Test or Examination",
+  NVNAM = "Vendor Name",
+
+  # Result Variables
+  NVORRES = "Result or Finding in Original Units",
+  NVORRESU = "Original Units",
+  NVSTRESC = "Character Result/Finding in Std Format",
+  NVSTRESN = "Numeric Result/Finding in Standard Units",
+  NVSTRESU = "Standard Units",
+
+  # Timing Variables
+  VISITNUM = "Visit Number",
+  VISIT = "Visit Name",
+  NVDTC = "Date/Time of Collection",
+  NVDY = "Study Day of Collection",
+
+  # Additional Qualifier
+  NVBLFL = "Baseline Flag"
path: data-raw/nv_neuro.R
user: login: Fanny-Gautier
body: Do we also need to include `NVLOBXFL`?
created_at: 2025-04-23T11:52:19Z
author_association: CONTRIBUTOR
diff_hunk: @@ -0,0 +1,72 @@
+# Dataset: ag_neuro
+# Description: Create AG test SDTM dataset for Alzheimer's Disease (neuro studies)
+
+# Load libraries ----
+
+library(tibble)
+library(dplyr)
+library(stringr)
+library(admiral)
+
+# Read input data ----
+
+data("nv_neuro")
+
+# Convert blank to NA ----
+
+nv_neuro <- convert_blanks_to_na(nv_neuro)
+
+ag_neuro <- nv_neuro %>%
+  dplyr::mutate(DOMAIN = "AG", AGSEQ = NVSEQ, AGLNKID = NVLNKID, AGSTDTC = NVDTC) %>%
+  dplyr::mutate(AGTRT = case_when(
+    NVCAT == "FBP" ~ "18F-Florbetapir",
+    NVCAT == "FBB" ~ "18F-Florbetaben",
+    NVCAT == "FTP" ~ "18F-Flortaucipir"
+  )) %>%
+  dplyr::mutate(AGCAT = case_when(
+    NVCAT == "FBP" ~ "AMYLOID TRACER",
+    NVCAT == "FBB" ~ "AMYLOID TRACER",
+    NVCAT == "FTP" ~ "TAU TRACER"
+  )) %>%
+  dplyr::mutate(AGDOSE = case_when(
+    NVCAT == "FBP" ~ "370 MBq",
+    NVCAT == "FBB" ~ "300 MBq",
+    NVCAT == "FTP" ~ "370 MBq"
+  )) %>%
+  dplyr::mutate(AGDOSEU = "MBq") %>%
+  dplyr::mutate(AGROUTE = "Intravenous") %>%
+  dplyr::select(
+    STUDYID, DOMAIN, USUBJID, AGSEQ, AGTRT, AGCAT,
+    AGDOSE, AGDOSEU, AGROUTE, AGLNKID,
+    VISITNUM, VISIT, AGSTDTC
+  )
+
+# Add labels to variables ----
+
+labels <- list(
+  STUDYID = "Study Identifier",
+  DOMAIN = "Domain Abbreviation",
+  USUBJID = "Unique Subject Identifier",
+  AGSEQ = "Sequence Number",
+  AGTRT = "Tracer Name",
+  AGCAT = "Tracer Category",
+  AGDOSE = "Dose per Administration",
+  AGDOSEU = "Dose Units",
+  AGROUTE = "Route of Administration",
+  AGLNKID = "Link to Subject's NV Domain Record",
path: data-raw/ag_neuro.R
user: login: Fanny-Gautier
body: " Link ID" as per SDTMIG v3.4
created_at: 2025-04-23T12:03:28Z
author_association: CONTRIBUTOR
diff_hunk: @@ -0,0 +1,72 @@
+# Dataset: ag_neuro
+# Description: Create AG test SDTM dataset for Alzheimer's Disease (neuro studies)
+
+# Load libraries ----
+
+library(tibble)
+library(dplyr)
+library(stringr)
+library(admiral)
+
+# Read input data ----
+
+data("nv_neuro")
+
+# Convert blank to NA ----
+
+nv_neuro <- convert_blanks_to_na(nv_neuro)
+
+ag_neuro <- nv_neuro %>%
+  dplyr::mutate(DOMAIN = "AG", AGSEQ = NVSEQ, AGLNKID = NVLNKID, AGSTDTC = NVDTC) %>%
+  dplyr::mutate(AGTRT = case_when(
+    NVCAT == "FBP" ~ "18F-Florbetapir",
+    NVCAT == "FBB" ~ "18F-Florbetaben",
+    NVCAT == "FTP" ~ "18F-Flortaucipir"
+  )) %>%
+  dplyr::mutate(AGCAT = case_when(
+    NVCAT == "FBP" ~ "AMYLOID TRACER",
+    NVCAT == "FBB" ~ "AMYLOID TRACER",
+    NVCAT == "FTP" ~ "TAU TRACER"
+  )) %>%
+  dplyr::mutate(AGDOSE = case_when(
+    NVCAT == "FBP" ~ "370 MBq",
+    NVCAT == "FBB" ~ "300 MBq",
+    NVCAT == "FTP" ~ "370 MBq"
+  )) %>%
+  dplyr::mutate(AGDOSEU = "MBq") %>%
+  dplyr::mutate(AGROUTE = "Intravenous") %>%
+  dplyr::select(
+    STUDYID, DOMAIN, USUBJID, AGSEQ, AGTRT, AGCAT,
+    AGDOSE, AGDOSEU, AGROUTE, AGLNKID,
+    VISITNUM, VISIT, AGSTDTC
+  )
+
+# Add labels to variables ----
+
+labels <- list(
+  STUDYID = "Study Identifier",
+  DOMAIN = "Domain Abbreviation",
+  USUBJID = "Unique Subject Identifier",
+  AGSEQ = "Sequence Number",
+  AGTRT = "Tracer Name",
path: data-raw/ag_neuro.R
user: login: Fanny-Gautier
body: "Reported Agent Name" as per SDTMIG v3.4
created_at: 2025-04-23T12:04:01Z
author_association: CONTRIBUTOR
diff_hunk: @@ -0,0 +1,72 @@
+# Dataset: ag_neuro
+# Description: Create AG test SDTM dataset for Alzheimer's Disease (neuro studies)
+
+# Load libraries ----
+
+library(tibble)
+library(dplyr)
+library(stringr)
+library(admiral)
+
+# Read input data ----
+
+data("nv_neuro")
+
+# Convert blank to NA ----
+
+nv_neuro <- convert_blanks_to_na(nv_neuro)
+
+ag_neuro <- nv_neuro %>%
+  dplyr::mutate(DOMAIN = "AG", AGSEQ = NVSEQ, AGLNKID = NVLNKID, AGSTDTC = NVDTC) %>%
+  dplyr::mutate(AGTRT = case_when(
+    NVCAT == "FBP" ~ "18F-Florbetapir",
+    NVCAT == "FBB" ~ "18F-Florbetaben",
+    NVCAT == "FTP" ~ "18F-Flortaucipir"
+  )) %>%
+  dplyr::mutate(AGCAT = case_when(
+    NVCAT == "FBP" ~ "AMYLOID TRACER",
+    NVCAT == "FBB" ~ "AMYLOID TRACER",
+    NVCAT == "FTP" ~ "TAU TRACER"
+  )) %>%
+  dplyr::mutate(AGDOSE = case_when(
+    NVCAT == "FBP" ~ "370 MBq",
+    NVCAT == "FBB" ~ "300 MBq",
+    NVCAT == "FTP" ~ "370 MBq"
+  )) %>%
+  dplyr::mutate(AGDOSEU = "MBq") %>%
+  dplyr::mutate(AGROUTE = "Intravenous") %>%
+  dplyr::select(
+    STUDYID, DOMAIN, USUBJID, AGSEQ, AGTRT, AGCAT,
+    AGDOSE, AGDOSEU, AGROUTE, AGLNKID,
+    VISITNUM, VISIT, AGSTDTC
+  )
+
+# Add labels to variables ----
+
+labels <- list(
+  STUDYID = "Study Identifier",
+  DOMAIN = "Domain Abbreviation",
+  USUBJID = "Unique Subject Identifier",
+  AGSEQ = "Sequence Number",
+  AGTRT = "Tracer Name",
+  AGCAT = "Tracer Category",
path: data-raw/ag_neuro.R
user: login: Fanny-Gautier
body: "Category for Agent" as per SDTMIG v3.4
created_at: 2025-04-23T12:04:28Z
author_association: CONTRIBUTOR
diff_hunk: @@ -0,0 +1,72 @@
+# Dataset: ag_neuro
+# Description: Create AG test SDTM dataset for Alzheimer's Disease (neuro studies)
+
+# Load libraries ----
+
+library(tibble)
+library(dplyr)
+library(stringr)
+library(admiral)
+
+# Read input data ----
+
+data("nv_neuro")
+
+# Convert blank to NA ----
+
+nv_neuro <- convert_blanks_to_na(nv_neuro)
+
+ag_neuro <- nv_neuro %>%
+  dplyr::mutate(DOMAIN = "AG", AGSEQ = NVSEQ, AGLNKID = NVLNKID, AGSTDTC = NVDTC) %>%
+  dplyr::mutate(AGTRT = case_when(
+    NVCAT == "FBP" ~ "18F-Florbetapir",
+    NVCAT == "FBB" ~ "18F-Florbetaben",
+    NVCAT == "FTP" ~ "18F-Flortaucipir"
+  )) %>%
+  dplyr::mutate(AGCAT = case_when(
+    NVCAT == "FBP" ~ "AMYLOID TRACER",
+    NVCAT == "FBB" ~ "AMYLOID TRACER",
+    NVCAT == "FTP" ~ "TAU TRACER"
+  )) %>%
+  dplyr::mutate(AGDOSE = case_when(
+    NVCAT == "FBP" ~ "370 MBq",
+    NVCAT == "FBB" ~ "300 MBq",
+    NVCAT == "FTP" ~ "370 MBq"
+  )) %>%
+  dplyr::mutate(AGDOSEU = "MBq") %>%
+  dplyr::mutate(AGROUTE = "Intravenous") %>%
+  dplyr::select(
+    STUDYID, DOMAIN, USUBJID, AGSEQ, AGTRT, AGCAT,
+    AGDOSE, AGDOSEU, AGROUTE, AGLNKID,
+    VISITNUM, VISIT, AGSTDTC
+  )
+
+# Add labels to variables ----
+
+labels <- list(
+  STUDYID = "Study Identifier",
+  DOMAIN = "Domain Abbreviation",
+  USUBJID = "Unique Subject Identifier",
+  AGSEQ = "Sequence Number",
+  AGTRT = "Tracer Name",
+  AGCAT = "Tracer Category",
+  AGDOSE = "Dose per Administration",
+  AGDOSEU = "Dose Units",
+  AGROUTE = "Route of Administration",
+  AGLNKID = "Link to Subject's NV Domain Record",
+  VISITNUM = "Visit Number",
+  VISIT = "Visit Name",
+  AGSTDTC = "Date/Time of Administration"
path: data-raw/ag_neuro.R
user: login: Fanny-Gautier
body: "Start Date/Time of  Agent" as per SDTMIG v3.4
created_at: 2025-04-23T12:06:18Z
author_association: CONTRIBUTOR
diff_hunk: @@ -0,0 +1,72 @@
+# Dataset: ag_neuro
+# Description: Create AG test SDTM dataset for Alzheimer's Disease (neuro studies)
+
+# Load libraries ----
+
+library(tibble)
+library(dplyr)
+library(stringr)
+library(admiral)
+
+# Read input data ----
+
+data("nv_neuro")
+
+# Convert blank to NA ----
+
+nv_neuro <- convert_blanks_to_na(nv_neuro)
+
+ag_neuro <- nv_neuro %>%
+  dplyr::mutate(DOMAIN = "AG", AGSEQ = NVSEQ, AGLNKID = NVLNKID, AGSTDTC = NVDTC) %>%
+  dplyr::mutate(AGTRT = case_when(
+    NVCAT == "FBP" ~ "18F-Florbetapir",
+    NVCAT == "FBB" ~ "18F-Florbetaben",
+    NVCAT == "FTP" ~ "18F-Flortaucipir"
+  )) %>%
+  dplyr::mutate(AGCAT = case_when(
+    NVCAT == "FBP" ~ "AMYLOID TRACER",
+    NVCAT == "FBB" ~ "AMYLOID TRACER",
+    NVCAT == "FTP" ~ "TAU TRACER"
+  )) %>%
+  dplyr::mutate(AGDOSE = case_when(
+    NVCAT == "FBP" ~ "370 MBq",
path: data-raw/ag_neuro.R
user: login: Fanny-Gautier
body: The dose `AGDOSE` should not contain the units. `MBq` to be populated in `AGDOSEU` only
created_at: 2025-04-23T12:11:33Z
author_association: CONTRIBUTOR
diff_hunk: @@ -0,0 +1,72 @@
+# Dataset: ag_neuro
+# Description: Create AG test SDTM dataset for Alzheimer's Disease (neuro studies)
+
+# Load libraries ----
+
+library(tibble)
+library(dplyr)
+library(stringr)
+library(admiral)
+
+# Read input data ----
+
+data("nv_neuro")
+
+# Convert blank to NA ----
+
+nv_neuro <- convert_blanks_to_na(nv_neuro)
+
+ag_neuro <- nv_neuro %>%
+  dplyr::mutate(DOMAIN = "AG", AGSEQ = NVSEQ, AGLNKID = NVLNKID, AGSTDTC = NVDTC) %>%
path: data-raw/ag_neuro.R
user: login: Fanny-Gautier
body: Patient 01-701-1015 (as for example) is having `NV.NVLNKID` from 1 to 5, all on '2014-01-02'.
Corresponding links are created in `AG` as `AGLNKID`. Does it mean that the patient received 5 different times an Agent (twice 18F-Florbetapir, once 18F-Florbetaben, and twice 18F-Flortaucipir) on the same date? or should the `xxLNKID` be grouped by agent administration? e.g having only 3 records in `AG` and corresponding `xxLNKID` such as `xxLNKID = 1` for 18F-Florbetapir, `xxLNKID = 2` for 18F-Florbetaben and `xxLNKID = 3`  for 18F-Flortaucipir.
created_at: 2025-04-23T13:02:23Z
author_association: CONTRIBUTOR
diff_hunk: @@ -0,0 +1,52 @@
+# Dataset: suppnv_neuro
+# Description: Create SUPPNV test SDTM dataset for Alzheimer's Disease (neuro studies)
+
+# Load libraries ----
+
+library(tibble)
+library(dplyr)
+library(stringr)
+library(admiral)
+
+# Read input data ----
+
+data("nv_neuro")
+
+# Convert blank to NA ----
+
+nv_neuro <- convert_blanks_to_na(nv_neuro)
+
+suppnv_neuro <- nv_neuro %>%
+  dplyr::filter(!is.na(NVLOC)) %>%
+  dplyr::mutate(RDOMAIN = "NV", IDVAR = "NVSEQ", IDVARVAL = NVSEQ, QNAM = "REFREG", QLABEL = "Reference Region") %>%
+  dplyr::mutate(QVAL = case_when(
+    NVCAT %in% c("FBP", "FBB") ~ "Whole Cerebellum",
+    NVCAT == "FTP" ~ "Inferior Cerebellar Gray Matter",
+    TRUE ~ NA_character_
+  )) %>%
+  dplyr::select(STUDYID, RDOMAIN, USUBJID, IDVAR, IDVARVAL, QNAM, QLABEL, QVAL)
+
+# Add labels to variables ----
+
+labels <- list(
+  STUDYID = "Study Identifier",
+  RDOMAIN = "Related Domain Abbreviation",
+  USUBJID = "Unique Subject Identifier",
+  IDVAR = "Identifying Variable",
+  IDVARVAL = "Identifying Variable Value",
+  QNAM = "Qualifier Variable Name",
+  QLABEL = "Qualifier Variable Label",
+  QVAL = "Qualifier Value"
+)
+
+for (var in names(labels)) {
+  attr(suppnv_neuro[[var]], "label") <- labels[[var]]
+}
+
+# Label SUPPNV dataset ----
+
+attr(suppnv_neuro, "label") <- "Supplemental to Nervous System Findings"
path: data-raw/suppnv_neuro.R
user: login: Fanny-Gautier
body: I think should be "Supplemental **Qualifiers for** Nervous ..."
created_at: 2025-04-23T13:17:07Z
author_association: CONTRIBUTOR
diff_hunk: @@ -0,0 +1,72 @@
+# Dataset: ag_neuro
+# Description: Create AG test SDTM dataset for Alzheimer's Disease (neuro studies)
+
+# Load libraries ----
+
+library(tibble)
+library(dplyr)
+library(stringr)
+library(admiral)
+
+# Read input data ----
+
+data("nv_neuro")
+
+# Convert blank to NA ----
+
+nv_neuro <- convert_blanks_to_na(nv_neuro)
+
+ag_neuro <- nv_neuro %>%
+  dplyr::mutate(DOMAIN = "AG", AGSEQ = NVSEQ, AGLNKID = NVLNKID, AGSTDTC = NVDTC) %>%
+  dplyr::mutate(AGTRT = case_when(
+    NVCAT == "FBP" ~ "18F-Florbetapir",
+    NVCAT == "FBB" ~ "18F-Florbetaben",
+    NVCAT == "FTP" ~ "18F-Flortaucipir"
+  )) %>%
+  dplyr::mutate(AGCAT = case_when(
+    NVCAT == "FBP" ~ "AMYLOID TRACER",
+    NVCAT == "FBB" ~ "AMYLOID TRACER",
+    NVCAT == "FTP" ~ "TAU TRACER"
+  )) %>%
+  dplyr::mutate(AGDOSE = case_when(
+    NVCAT == "FBP" ~ "370 MBq",
+    NVCAT == "FBB" ~ "300 MBq",
+    NVCAT == "FTP" ~ "370 MBq"
+  )) %>%
+  dplyr::mutate(AGDOSEU = "MBq") %>%
+  dplyr::mutate(AGROUTE = "Intravenous") %>%
+  dplyr::select(
+    STUDYID, DOMAIN, USUBJID, AGSEQ, AGTRT, AGCAT,
+    AGDOSE, AGDOSEU, AGROUTE, AGLNKID,
+    VISITNUM, VISIT, AGSTDTC
+  )
+
+# Add labels to variables ----
+
+labels <- list(
+  STUDYID = "Study Identifier",
+  DOMAIN = "Domain Abbreviation",
+  USUBJID = "Unique Subject Identifier",
+  AGSEQ = "Sequence Number",
+  AGTRT = "Tracer Name",
+  AGCAT = "Tracer Category",
+  AGDOSE = "Dose per Administration",
+  AGDOSEU = "Dose Units",
+  AGROUTE = "Route of Administration",
+  AGLNKID = "Link to Subject's NV Domain Record",
+  VISITNUM = "Visit Number",
+  VISIT = "Visit Name",
+  AGSTDTC = "Date/Time of Administration"
+)
+
+for (var in names(labels)) {
+  attr(ag_neuro[[var]], "label") <- labels[[var]]
+}
+
+# Label AG dataset ----
+
+attr(ag_neuro, "label") <- "Procedure Agents for Nervous System"
path: data-raw/ag_neuro.R
user: login: Fanny-Gautier
body: Should be "Procedure Agents" only
created_at: 2025-04-23T13:18:14Z
author_association: CONTRIBUTOR
diff_hunk: @@ -0,0 +1,52 @@
+# Dataset: suppnv_neuro
+# Description: Create SUPPNV test SDTM dataset for Alzheimer's Disease (neuro studies)
+
+# Load libraries ----
+
+library(tibble)
+library(dplyr)
+library(stringr)
+library(admiral)
+
+# Read input data ----
+
+data("nv_neuro")
+
+# Convert blank to NA ----
+
+nv_neuro <- convert_blanks_to_na(nv_neuro)
+
+suppnv_neuro <- nv_neuro %>%
+  dplyr::filter(!is.na(NVLOC)) %>%
+  dplyr::mutate(RDOMAIN = "NV", IDVAR = "NVSEQ", IDVARVAL = NVSEQ, QNAM = "REFREG", QLABEL = "Reference Region") %>%
+  dplyr::mutate(QVAL = case_when(
+    NVCAT %in% c("FBP", "FBB") ~ "Whole Cerebellum",
+    NVCAT == "FTP" ~ "Inferior Cerebellar Gray Matter",
+    TRUE ~ NA_character_
+  )) %>%
+  dplyr::select(STUDYID, RDOMAIN, USUBJID, IDVAR, IDVARVAL, QNAM, QLABEL, QVAL)
+
+# Add labels to variables ----
+
+labels <- list(
+  STUDYID = "Study Identifier",
+  RDOMAIN = "Related Domain Abbreviation",
+  USUBJID = "Unique Subject Identifier",
+  IDVAR = "Identifying Variable",
+  IDVARVAL = "Identifying Variable Value",
+  QNAM = "Qualifier Variable Name",
+  QLABEL = "Qualifier Variable Label",
+  QVAL = "Qualifier Value"
path: data-raw/suppnv_neuro.R
user: login: Fanny-Gautier
body: should be "Data Value"
created_at: 2025-04-23T13:21:36Z
author_association: CONTRIBUTOR
diff_hunk: @@ -0,0 +1,52 @@
+# Dataset: suppnv_neuro
+# Description: Create SUPPNV test SDTM dataset for Alzheimer's Disease (neuro studies)
+
+# Load libraries ----
+
+library(tibble)
+library(dplyr)
+library(stringr)
+library(admiral)
+
+# Read input data ----
+
+data("nv_neuro")
+
+# Convert blank to NA ----
+
+nv_neuro <- convert_blanks_to_na(nv_neuro)
+
+suppnv_neuro <- nv_neuro %>%
+  dplyr::filter(!is.na(NVLOC)) %>%
+  dplyr::mutate(RDOMAIN = "NV", IDVAR = "NVSEQ", IDVARVAL = NVSEQ, QNAM = "REFREG", QLABEL = "Reference Region") %>%
+  dplyr::mutate(QVAL = case_when(
+    NVCAT %in% c("FBP", "FBB") ~ "Whole Cerebellum",
+    NVCAT == "FTP" ~ "Inferior Cerebellar Gray Matter",
+    TRUE ~ NA_character_
+  )) %>%
+  dplyr::select(STUDYID, RDOMAIN, USUBJID, IDVAR, IDVARVAL, QNAM, QLABEL, QVAL)
+
+# Add labels to variables ----
+
+labels <- list(
+  STUDYID = "Study Identifier",
+  RDOMAIN = "Related Domain Abbreviation",
+  USUBJID = "Unique Subject Identifier",
+  IDVAR = "Identifying Variable",
+  IDVARVAL = "Identifying Variable Value",
+  QNAM = "Qualifier Variable Name",
+  QLABEL = "Qualifier Variable Label",
+  QVAL = "Qualifier Value"
+)
path: data-raw/suppnv_neuro.R
user: login: Fanny-Gautier
body: `QORIG` ("Origin") variable is missing. To be added - Required variable.
Depending on the values of `QORIG`, the variable `QEVAL` might also be needed.
created_at: 2025-04-23T13:25:29Z
author_association: CONTRIBUTOR
diff_hunk: @@ -0,0 +1,248 @@
+# Dataset: nv_neuro
+# Description: Create NV test SDTM dataset for Alzheimer's Disease (neuro studies)
+
+# Load libraries ----
+
+library(tibble)
+library(dplyr)
+library(stringr)
+library(admiral)
+
+# Read input data ----
+
+data("dm_neuro")
+
+# Convert blank to NA ----
+
+dm_neuro <- convert_blanks_to_na(dm_neuro)
+
+# Separate placebo and observation from treatment group to mimic different disease progression ----
+
+placebo_group <- dm_neuro %>%
+  dplyr::filter(!is.na(ARMCD) & ARMCD == "Pbo")
+
+treatment_group <- dm_neuro %>%
+  dplyr::filter(!is.na(ARMCD) & ARMCD == "Xan_Hi")
+
+observation_group <- dm_neuro %>%
+  dplyr::filter(is.na(ARMCD) & ARMNRS == "Observational Study")
+
+# Leverage VS visits at BASELINE, WEEK12 and WEEK26
+
+visit_schedule <- pharmaversesdtm::vs %>%
+  dplyr::filter(USUBJID %in% dm_neuro$USUBJID) %>%
+  dplyr::filter(VISITNUM %in% c(3.0, 9.0, 13.0)) %>%
+  dplyr::rename(NVDTC = VSDTC, NVDY = VSDY) %>%
+  dplyr::select(USUBJID, VISITNUM, VISIT, VISITDY, NVDTC, NVDY) %>%
+  group_by(USUBJID) %>%
+  distinct()
+
+# All USUBJID have BASELINE but not all have visits 9 or 13 data
+
+visit9_usubjid <- visit_schedule %>%
+  dplyr::filter(VISITNUM == 9) %>%
+  dplyr::select(USUBJID) %>%
+  distinct() %>%
+  unlist()
+
+visit13_usubjid <- visit_schedule %>%
+  dplyr::filter(VISITNUM == 13) %>%
+  distinct() %>%
+  unlist()
+
+# Create records for one USUBJID ----
+
+create_records_for_one_id <- function(usubjid = "01-701-1015", visitnum = 3,
+                                      fbp_suvr_cb = 1.461, fbb_suvr_com = 1.452, ftp_suvr_icbgm = 1.331) {
+  tibble(
+    STUDYID = rep("CDISCPILOT01", 5),
+    DOMAIN = rep("NV", 5),
+    USUBJID = rep(usubjid, 5),
+    SUBJID = sub(".*-", "", rep(usubjid, 5)),
+    NVSEQ = 1:5,
+    NVTESTCD = c("VR", "SUVR", "SUVR", "VR", "SUVR"),
+    NVTEST = c(
+      "Qualitative Visual Classification",
+      "Standardized Uptake Value Ratio",
+      "Standardized Uptake Value Ratio",
+      "Qualitative Visual Classification",
+      "Standardized Uptake Value Ratio"
+    ),
+    NVCAT = c("FBP", "FBP", "FBB", "FTP", "FTP"),
+    NVORRES = c("Positive", as.character(fbp_suvr_cb), as.character(fbb_suvr_com), "Positive", as.character(ftp_suvr_icbgm)),
+    NVLOC = c(NA, "NEOCORTICAL COMPOSITE", "NEOCORTICAL COMPOSITE", NA, "NEOCORTICAL COMPOSITE"),
+    NVNAM = c("IXICO", "AVID", "BERKELEY", "IXICO", "BERKELEY"),
+    NVMETHOD = c("FBP VISUAL CLASSIFICATION", "AVID FBP SUVR PIPELINE", "BERKELEY FBB SUVR PIPELINE", "FTP VISUAL CLASSIFICATION", "BERKELEY FTP SUVR PIPELINE"),
+    VISITNUM = visitnum
+  )
+}
+
+# Create dataset for visit 3 (baseline) for all ids from dm_neuro ----
+
+# Set the seed for reproducibility
+set.seed(2774)
+
+# Generate the data using lapply
+all_visit3_dat <- dplyr::bind_rows(
+  lapply(dm_neuro$USUBJID, function(id) {
+    # Generate random values for the parameters
+    fbp_suvr_cb <- round(runif(1, 1.25, 2.5), 3)
+    fbb_suvr_com <- round(fbp_suvr_cb - runif(1, min = 0.005, max = 0.01), 3)
+    ftp_suvr_icbgm <- round(fbp_suvr_cb - runif(1, min = 0.1, max = 0.13), 3)
+
+    # Create the dataset using create_records_for_one_id function
+    create_records_for_one_id(
+      usubjid = id,
+      visitnum = 3,
+      fbp_suvr_cb = fbp_suvr_cb,
+      fbb_suvr_com = fbb_suvr_com,
+      ftp_suvr_icbgm = ftp_suvr_icbgm
+    )
+  })
+)
+
+# Create visit 9 dataset for placebo and observational groups ----
+
+pbo_obs_visit9_dat <- all_visit3_dat %>%
+  dplyr::filter(USUBJID %in% c(placebo_group$USUBJID, observation_group$USUBJID)) %>%
+  dplyr::filter(NVTESTCD == "SUVR") %>%
+  dplyr::mutate(
+    VISITNUM = 9,
+    NVSEQ = NVSEQ + 5,
+    NVORRES = as.character(round(as.numeric(NVORRES) + runif(1, min = 0.1, max = 0.2), 3)),
+    NVORRES
+  )
+
+# Create visit 9 dataset for treatment group ----
+
+treat_visit9_dat <- all_visit3_dat %>%
+  dplyr::filter(USUBJID %in% treatment_group$USUBJID) %>%
+  dplyr::filter(NVTESTCD == "SUVR") %>%
+  dplyr::mutate(
+    VISITNUM = 9,
+    NVSEQ = NVSEQ + 5,
+    NVORRES = ifelse(NVCAT %in% c("FBP", "FBB"),
+      as.character(round(as.numeric(NVORRES) - runif(1, min = 0.3, max = 0.8), 3)),
+      ifelse(NVCAT == "FTP",
+        as.character(round(as.numeric(NVORRES) - runif(1, min = 0.005, max = 0.01), 3)), NVORRES
+      )
+    )
+  )
+
+# Create visit 13 dataset for placebo and observational groups ----
+
+pbo_obs_visit13_dat <- pbo_obs_visit9_dat %>%
+  dplyr::filter(NVTESTCD == "SUVR") %>%
+  dplyr::mutate(
+    VISITNUM = 13,
+    NVSEQ = NVSEQ + 5,
+    NVORRES = as.character(round(as.numeric(NVORRES) + runif(1, min = 0.2, max = 0.3), 3)),
+    NVORRES
+  )
+
+# Create visit 13 dataset for treatment group ----
+
+treat_visit13_dat <- treat_visit9_dat %>%
+  # dplyr::filter(USUBJID %in% visit_13_usubjid$USUBJID) %>%
+  dplyr::filter(NVTESTCD == "SUVR") %>%
+  dplyr::mutate(
+    VISITNUM = 13,
+    NVSEQ = NVSEQ + 5,
+    NVORRES = ifelse(NVCAT %in% c("FBP", "FBB"),
+      as.character(round(as.numeric(NVORRES) - runif(1, min = 0.3, max = 0.8), 3)),
+      ifelse(NVCAT == "FTP",
+        as.character(round(as.numeric(NVORRES) - runif(1, min = 0.01, max = 0.05), 3)), NVORRES
+      )
+    )
+  )
+
+# Combine datasets and add additional variables ----
+
+all_dat <- bind_rows(
+  all_visit3_dat,
+  pbo_obs_visit9_dat %>%
+    dplyr::filter(USUBJID %in% visit9_usubjid),
+  treat_visit9_dat %>%
+    dplyr::filter(USUBJID %in% visit9_usubjid),
+  pbo_obs_visit13_dat %>%
+    dplyr::filter(USUBJID %in% visit13_usubjid),
+  treat_visit13_dat %>%
+    dplyr::filter(USUBJID %in% visit13_usubjid)
+) %>%
+  dplyr::mutate(
+    NVBLFL = ifelse(VISITNUM == 3, "Y", NA_character_),
+    NVORRESU = ifelse(NVTESTCD == "SUVR",
+      "RATIO", NA
+    ),
+    NVSTRESC = NVORRES,
+    NVSTRESN = ifelse(NVTESTCD == "SUVR",
+      suppressWarnings(as.numeric(NVORRES)), NA
+    ),
+    NVSTRESU = ifelse(NVTESTCD == "SUVR",
+      "RATIO", NA
+    )
+  ) %>%
+  dplyr::left_join(
+    visit_schedule,
+    by = c("USUBJID", "VISITNUM")
+  ) %>%
+  dplyr::mutate(NVLNKID = NVSEQ) %>%
+  dplyr::select(
+    STUDYID, DOMAIN, USUBJID, NVSEQ, NVLNKID,
+    NVTESTCD, NVTEST, NVCAT,
+    NVLOC, NVMETHOD, NVNAM,
+    NVORRES, NVORRESU, NVSTRESC, NVSTRESN, NVSTRESU,
+    VISITNUM, VISIT, NVDTC, NVDY,
+    NVBLFL
+  )
+
+# Add labels to variables ----
+
+labels <- list(
+  # Identifier Variables (Key variables)
+  STUDYID = "Study Identifier",
+  DOMAIN = "Domain Abbreviation",
+  USUBJID = "Unique Subject Identifier",
+  NVSEQ = "Sequence Number",
+  NVLNKID = "Link to Subject's AG Domain Record",
+
+  # Topic Variables\
+  NVTESTCD = "Nervous System Test Short Name",
+  NVTEST = "Nervous System Test Name",
+  NVCAT = "Category for Nervous System Test",
+
+  # Qualifier Variables
+  NVLOC = "Location of Nervous System Finding",
+  NVMETHOD = "Method of Test or Examination",
+  NVNAM = "Vendor Name",
+
+  # Result Variables
+  NVORRES = "Result or Finding in Original Units",
+  NVORRESU = "Original Units",
+  NVSTRESC = "Character Result/Finding in Std Format",
+  NVSTRESN = "Numeric Result/Finding in Standard Units",
+  NVSTRESU = "Standard Units",
+
+  # Timing Variables
+  VISITNUM = "Visit Number",
+  VISIT = "Visit Name",
+  NVDTC = "Date/Time of Collection",
+  NVDY = "Study Day of Collection",
+
+  # Additional Qualifier
+  NVBLFL = "Baseline Flag"
path: data-raw/nv_neuro.R
user: login: manciniedoardo
body: I think given this [issue](https://github.com/pharmaverse/pharmaversesdtm/issues/119), we should have LOBXFL and not BLFL
created_at: 2025-04-23T14:56:07Z
author_association: COLLABORATOR
diff_hunk: @@ -0,0 +1,248 @@
+# Dataset: nv_neuro
+# Description: Create NV test SDTM dataset for Alzheimer's Disease (neuro studies)
+
+# Load libraries ----
+
+library(tibble)
+library(dplyr)
+library(stringr)
+library(admiral)
+
+# Read input data ----
+
+data("dm_neuro")
+
+# Convert blank to NA ----
+
+dm_neuro <- convert_blanks_to_na(dm_neuro)
+
+# Separate placebo and observation from treatment group to mimic different disease progression ----
+
+placebo_group <- dm_neuro %>%
+  dplyr::filter(!is.na(ARMCD) & ARMCD == "Pbo")
+
+treatment_group <- dm_neuro %>%
+  dplyr::filter(!is.na(ARMCD) & ARMCD == "Xan_Hi")
+
+observation_group <- dm_neuro %>%
+  dplyr::filter(is.na(ARMCD) & ARMNRS == "Observational Study")
+
+# Leverage VS visits at BASELINE, WEEK12 and WEEK26
+
+visit_schedule <- pharmaversesdtm::vs %>%
+  dplyr::filter(USUBJID %in% dm_neuro$USUBJID) %>%
+  dplyr::filter(VISITNUM %in% c(3.0, 9.0, 13.0)) %>%
+  dplyr::rename(NVDTC = VSDTC, NVDY = VSDY) %>%
+  dplyr::select(USUBJID, VISITNUM, VISIT, VISITDY, NVDTC, NVDY) %>%
+  group_by(USUBJID) %>%
+  distinct()
+
+# All USUBJID have BASELINE but not all have visits 9 or 13 data
+
+visit9_usubjid <- visit_schedule %>%
+  dplyr::filter(VISITNUM == 9) %>%
+  dplyr::select(USUBJID) %>%
+  distinct() %>%
+  unlist()
+
+visit13_usubjid <- visit_schedule %>%
+  dplyr::filter(VISITNUM == 13) %>%
+  distinct() %>%
+  unlist()
+
+# Create records for one USUBJID ----
+
+create_records_for_one_id <- function(usubjid = "01-701-1015", visitnum = 3,
+                                      fbp_suvr_cb = 1.461, fbb_suvr_com = 1.452, ftp_suvr_icbgm = 1.331) {
+  tibble(
+    STUDYID = rep("CDISCPILOT01", 5),
+    DOMAIN = rep("NV", 5),
+    USUBJID = rep(usubjid, 5),
+    SUBJID = sub(".*-", "", rep(usubjid, 5)),
+    NVSEQ = 1:5,
+    NVTESTCD = c("VR", "SUVR", "SUVR", "VR", "SUVR"),
+    NVTEST = c(
+      "Qualitative Visual Classification",
+      "Standardized Uptake Value Ratio",
+      "Standardized Uptake Value Ratio",
+      "Qualitative Visual Classification",
+      "Standardized Uptake Value Ratio"
+    ),
+    NVCAT = c("FBP", "FBP", "FBB", "FTP", "FTP"),
+    NVORRES = c("Positive", as.character(fbp_suvr_cb), as.character(fbb_suvr_com), "Positive", as.character(ftp_suvr_icbgm)),
+    NVLOC = c(NA, "NEOCORTICAL COMPOSITE", "NEOCORTICAL COMPOSITE", NA, "NEOCORTICAL COMPOSITE"),
+    NVNAM = c("IXICO", "AVID", "BERKELEY", "IXICO", "BERKELEY"),
+    NVMETHOD = c("FBP VISUAL CLASSIFICATION", "AVID FBP SUVR PIPELINE", "BERKELEY FBB SUVR PIPELINE", "FTP VISUAL CLASSIFICATION", "BERKELEY FTP SUVR PIPELINE"),
+    VISITNUM = visitnum
+  )
+}
+
+# Create dataset for visit 3 (baseline) for all ids from dm_neuro ----
+
+# Set the seed for reproducibility
+set.seed(2774)
+
+# Generate the data using lapply
+all_visit3_dat <- dplyr::bind_rows(
+  lapply(dm_neuro$USUBJID, function(id) {
+    # Generate random values for the parameters
+    fbp_suvr_cb <- round(runif(1, 1.25, 2.5), 3)
+    fbb_suvr_com <- round(fbp_suvr_cb - runif(1, min = 0.005, max = 0.01), 3)
+    ftp_suvr_icbgm <- round(fbp_suvr_cb - runif(1, min = 0.1, max = 0.13), 3)
+
+    # Create the dataset using create_records_for_one_id function
+    create_records_for_one_id(
+      usubjid = id,
+      visitnum = 3,
+      fbp_suvr_cb = fbp_suvr_cb,
+      fbb_suvr_com = fbb_suvr_com,
+      ftp_suvr_icbgm = ftp_suvr_icbgm
+    )
+  })
+)
+
+# Create visit 9 dataset for placebo and observational groups ----
+
+pbo_obs_visit9_dat <- all_visit3_dat %>%
+  dplyr::filter(USUBJID %in% c(placebo_group$USUBJID, observation_group$USUBJID)) %>%
+  dplyr::filter(NVTESTCD == "SUVR") %>%
+  dplyr::mutate(
+    VISITNUM = 9,
+    NVSEQ = NVSEQ + 5,
+    NVORRES = as.character(round(as.numeric(NVORRES) + runif(1, min = 0.1, max = 0.2), 3)),
+    NVORRES
+  )
+
+# Create visit 9 dataset for treatment group ----
+
+treat_visit9_dat <- all_visit3_dat %>%
+  dplyr::filter(USUBJID %in% treatment_group$USUBJID) %>%
+  dplyr::filter(NVTESTCD == "SUVR") %>%
+  dplyr::mutate(
+    VISITNUM = 9,
+    NVSEQ = NVSEQ + 5,
+    NVORRES = ifelse(NVCAT %in% c("FBP", "FBB"),
+      as.character(round(as.numeric(NVORRES) - runif(1, min = 0.3, max = 0.8), 3)),
+      ifelse(NVCAT == "FTP",
+        as.character(round(as.numeric(NVORRES) - runif(1, min = 0.005, max = 0.01), 3)), NVORRES
+      )
+    )
+  )
+
+# Create visit 13 dataset for placebo and observational groups ----
+
+pbo_obs_visit13_dat <- pbo_obs_visit9_dat %>%
+  dplyr::filter(NVTESTCD == "SUVR") %>%
+  dplyr::mutate(
+    VISITNUM = 13,
+    NVSEQ = NVSEQ + 5,
+    NVORRES = as.character(round(as.numeric(NVORRES) + runif(1, min = 0.2, max = 0.3), 3)),
+    NVORRES
+  )
+
+# Create visit 13 dataset for treatment group ----
+
+treat_visit13_dat <- treat_visit9_dat %>%
+  # dplyr::filter(USUBJID %in% visit_13_usubjid$USUBJID) %>%
+  dplyr::filter(NVTESTCD == "SUVR") %>%
+  dplyr::mutate(
+    VISITNUM = 13,
+    NVSEQ = NVSEQ + 5,
+    NVORRES = ifelse(NVCAT %in% c("FBP", "FBB"),
+      as.character(round(as.numeric(NVORRES) - runif(1, min = 0.3, max = 0.8), 3)),
+      ifelse(NVCAT == "FTP",
+        as.character(round(as.numeric(NVORRES) - runif(1, min = 0.01, max = 0.05), 3)), NVORRES
+      )
+    )
+  )
+
+# Combine datasets and add additional variables ----
+
+all_dat <- bind_rows(
+  all_visit3_dat,
+  pbo_obs_visit9_dat %>%
+    dplyr::filter(USUBJID %in% visit9_usubjid),
+  treat_visit9_dat %>%
+    dplyr::filter(USUBJID %in% visit9_usubjid),
+  pbo_obs_visit13_dat %>%
+    dplyr::filter(USUBJID %in% visit13_usubjid),
+  treat_visit13_dat %>%
+    dplyr::filter(USUBJID %in% visit13_usubjid)
+) %>%
+  dplyr::mutate(
+    NVBLFL = ifelse(VISITNUM == 3, "Y", NA_character_),
+    NVORRESU = ifelse(NVTESTCD == "SUVR",
+      "RATIO", NA
+    ),
+    NVSTRESC = NVORRES,
+    NVSTRESN = ifelse(NVTESTCD == "SUVR",
+      suppressWarnings(as.numeric(NVORRES)), NA
+    ),
+    NVSTRESU = ifelse(NVTESTCD == "SUVR",
+      "RATIO", NA
+    )
+  ) %>%
+  dplyr::left_join(
+    visit_schedule,
+    by = c("USUBJID", "VISITNUM")
+  ) %>%
+  dplyr::mutate(NVLNKID = NVSEQ) %>%
+  dplyr::select(
+    STUDYID, DOMAIN, USUBJID, NVSEQ, NVLNKID,
+    NVTESTCD, NVTEST, NVCAT,
+    NVLOC, NVMETHOD, NVNAM,
+    NVORRES, NVORRESU, NVSTRESC, NVSTRESN, NVSTRESU,
+    VISITNUM, VISIT, NVDTC, NVDY,
+    NVBLFL
+  )
+
+# Add labels to variables ----
+
+labels <- list(
+  # Identifier Variables (Key variables)
+  STUDYID = "Study Identifier",
+  DOMAIN = "Domain Abbreviation",
+  USUBJID = "Unique Subject Identifier",
+  NVSEQ = "Sequence Number",
+  NVLNKID = "Link to Subject's AG Domain Record",
path: data-raw/nv_neuro.R
user: login: jwang-lilly
body: Good, changed to Link ID.
created_at: 2025-04-23T15:08:29Z
author_association: COLLABORATOR
diff_hunk: @@ -0,0 +1,248 @@
+# Dataset: nv_neuro
+# Description: Create NV test SDTM dataset for Alzheimer's Disease (neuro studies)
+
+# Load libraries ----
+
+library(tibble)
+library(dplyr)
+library(stringr)
+library(admiral)
+
+# Read input data ----
+
+data("dm_neuro")
+
+# Convert blank to NA ----
+
+dm_neuro <- convert_blanks_to_na(dm_neuro)
+
+# Separate placebo and observation from treatment group to mimic different disease progression ----
+
+placebo_group <- dm_neuro %>%
+  dplyr::filter(!is.na(ARMCD) & ARMCD == "Pbo")
+
+treatment_group <- dm_neuro %>%
+  dplyr::filter(!is.na(ARMCD) & ARMCD == "Xan_Hi")
+
+observation_group <- dm_neuro %>%
+  dplyr::filter(is.na(ARMCD) & ARMNRS == "Observational Study")
+
+# Leverage VS visits at BASELINE, WEEK12 and WEEK26
+
+visit_schedule <- pharmaversesdtm::vs %>%
+  dplyr::filter(USUBJID %in% dm_neuro$USUBJID) %>%
+  dplyr::filter(VISITNUM %in% c(3.0, 9.0, 13.0)) %>%
+  dplyr::rename(NVDTC = VSDTC, NVDY = VSDY) %>%
+  dplyr::select(USUBJID, VISITNUM, VISIT, VISITDY, NVDTC, NVDY) %>%
+  group_by(USUBJID) %>%
+  distinct()
+
+# All USUBJID have BASELINE but not all have visits 9 or 13 data
+
+visit9_usubjid <- visit_schedule %>%
+  dplyr::filter(VISITNUM == 9) %>%
+  dplyr::select(USUBJID) %>%
+  distinct() %>%
+  unlist()
+
+visit13_usubjid <- visit_schedule %>%
+  dplyr::filter(VISITNUM == 13) %>%
+  distinct() %>%
+  unlist()
+
+# Create records for one USUBJID ----
+
+create_records_for_one_id <- function(usubjid = "01-701-1015", visitnum = 3,
+                                      fbp_suvr_cb = 1.461, fbb_suvr_com = 1.452, ftp_suvr_icbgm = 1.331) {
+  tibble(
+    STUDYID = rep("CDISCPILOT01", 5),
+    DOMAIN = rep("NV", 5),
+    USUBJID = rep(usubjid, 5),
+    SUBJID = sub(".*-", "", rep(usubjid, 5)),
+    NVSEQ = 1:5,
+    NVTESTCD = c("VR", "SUVR", "SUVR", "VR", "SUVR"),
+    NVTEST = c(
+      "Qualitative Visual Classification",
+      "Standardized Uptake Value Ratio",
+      "Standardized Uptake Value Ratio",
+      "Qualitative Visual Classification",
+      "Standardized Uptake Value Ratio"
+    ),
+    NVCAT = c("FBP", "FBP", "FBB", "FTP", "FTP"),
+    NVORRES = c("Positive", as.character(fbp_suvr_cb), as.character(fbb_suvr_com), "Positive", as.character(ftp_suvr_icbgm)),
+    NVLOC = c(NA, "NEOCORTICAL COMPOSITE", "NEOCORTICAL COMPOSITE", NA, "NEOCORTICAL COMPOSITE"),
+    NVNAM = c("IXICO", "AVID", "BERKELEY", "IXICO", "BERKELEY"),
+    NVMETHOD = c("FBP VISUAL CLASSIFICATION", "AVID FBP SUVR PIPELINE", "BERKELEY FBB SUVR PIPELINE", "FTP VISUAL CLASSIFICATION", "BERKELEY FTP SUVR PIPELINE"),
+    VISITNUM = visitnum
+  )
+}
+
+# Create dataset for visit 3 (baseline) for all ids from dm_neuro ----
+
+# Set the seed for reproducibility
+set.seed(2774)
+
+# Generate the data using lapply
+all_visit3_dat <- dplyr::bind_rows(
+  lapply(dm_neuro$USUBJID, function(id) {
+    # Generate random values for the parameters
+    fbp_suvr_cb <- round(runif(1, 1.25, 2.5), 3)
+    fbb_suvr_com <- round(fbp_suvr_cb - runif(1, min = 0.005, max = 0.01), 3)
+    ftp_suvr_icbgm <- round(fbp_suvr_cb - runif(1, min = 0.1, max = 0.13), 3)
+
+    # Create the dataset using create_records_for_one_id function
+    create_records_for_one_id(
+      usubjid = id,
+      visitnum = 3,
+      fbp_suvr_cb = fbp_suvr_cb,
+      fbb_suvr_com = fbb_suvr_com,
+      ftp_suvr_icbgm = ftp_suvr_icbgm
+    )
+  })
+)
+
+# Create visit 9 dataset for placebo and observational groups ----
+
+pbo_obs_visit9_dat <- all_visit3_dat %>%
+  dplyr::filter(USUBJID %in% c(placebo_group$USUBJID, observation_group$USUBJID)) %>%
+  dplyr::filter(NVTESTCD == "SUVR") %>%
+  dplyr::mutate(
+    VISITNUM = 9,
+    NVSEQ = NVSEQ + 5,
+    NVORRES = as.character(round(as.numeric(NVORRES) + runif(1, min = 0.1, max = 0.2), 3)),
+    NVORRES
+  )
+
+# Create visit 9 dataset for treatment group ----
+
+treat_visit9_dat <- all_visit3_dat %>%
+  dplyr::filter(USUBJID %in% treatment_group$USUBJID) %>%
+  dplyr::filter(NVTESTCD == "SUVR") %>%
+  dplyr::mutate(
+    VISITNUM = 9,
+    NVSEQ = NVSEQ + 5,
+    NVORRES = ifelse(NVCAT %in% c("FBP", "FBB"),
+      as.character(round(as.numeric(NVORRES) - runif(1, min = 0.3, max = 0.8), 3)),
+      ifelse(NVCAT == "FTP",
+        as.character(round(as.numeric(NVORRES) - runif(1, min = 0.005, max = 0.01), 3)), NVORRES
+      )
+    )
+  )
+
+# Create visit 13 dataset for placebo and observational groups ----
+
+pbo_obs_visit13_dat <- pbo_obs_visit9_dat %>%
+  dplyr::filter(NVTESTCD == "SUVR") %>%
+  dplyr::mutate(
+    VISITNUM = 13,
+    NVSEQ = NVSEQ + 5,
+    NVORRES = as.character(round(as.numeric(NVORRES) + runif(1, min = 0.2, max = 0.3), 3)),
+    NVORRES
+  )
+
+# Create visit 13 dataset for treatment group ----
+
+treat_visit13_dat <- treat_visit9_dat %>%
+  # dplyr::filter(USUBJID %in% visit_13_usubjid$USUBJID) %>%
+  dplyr::filter(NVTESTCD == "SUVR") %>%
+  dplyr::mutate(
+    VISITNUM = 13,
+    NVSEQ = NVSEQ + 5,
+    NVORRES = ifelse(NVCAT %in% c("FBP", "FBB"),
+      as.character(round(as.numeric(NVORRES) - runif(1, min = 0.3, max = 0.8), 3)),
+      ifelse(NVCAT == "FTP",
+        as.character(round(as.numeric(NVORRES) - runif(1, min = 0.01, max = 0.05), 3)), NVORRES
+      )
+    )
+  )
+
+# Combine datasets and add additional variables ----
+
+all_dat <- bind_rows(
+  all_visit3_dat,
+  pbo_obs_visit9_dat %>%
+    dplyr::filter(USUBJID %in% visit9_usubjid),
+  treat_visit9_dat %>%
+    dplyr::filter(USUBJID %in% visit9_usubjid),
+  pbo_obs_visit13_dat %>%
+    dplyr::filter(USUBJID %in% visit13_usubjid),
+  treat_visit13_dat %>%
+    dplyr::filter(USUBJID %in% visit13_usubjid)
+) %>%
+  dplyr::mutate(
+    NVBLFL = ifelse(VISITNUM == 3, "Y", NA_character_),
+    NVORRESU = ifelse(NVTESTCD == "SUVR",
+      "RATIO", NA
+    ),
+    NVSTRESC = NVORRES,
+    NVSTRESN = ifelse(NVTESTCD == "SUVR",
+      suppressWarnings(as.numeric(NVORRES)), NA
+    ),
+    NVSTRESU = ifelse(NVTESTCD == "SUVR",
+      "RATIO", NA
+    )
+  ) %>%
+  dplyr::left_join(
+    visit_schedule,
+    by = c("USUBJID", "VISITNUM")
+  ) %>%
+  dplyr::mutate(NVLNKID = NVSEQ) %>%
+  dplyr::select(
+    STUDYID, DOMAIN, USUBJID, NVSEQ, NVLNKID,
+    NVTESTCD, NVTEST, NVCAT,
+    NVLOC, NVMETHOD, NVNAM,
+    NVORRES, NVORRESU, NVSTRESC, NVSTRESN, NVSTRESU,
+    VISITNUM, VISIT, NVDTC, NVDY,
+    NVBLFL
+  )
+
+# Add labels to variables ----
+
+labels <- list(
+  # Identifier Variables (Key variables)
+  STUDYID = "Study Identifier",
+  DOMAIN = "Domain Abbreviation",
+  USUBJID = "Unique Subject Identifier",
+  NVSEQ = "Sequence Number",
+  NVLNKID = "Link to Subject's AG Domain Record",
+
+  # Topic Variables\
+  NVTESTCD = "Nervous System Test Short Name",
path: data-raw/nv_neuro.R
user: login: jwang-lilly
body: Ok, changed to "Short Name of Nervous System Test".
created_at: 2025-04-23T15:09:59Z
author_association: COLLABORATOR
diff_hunk: @@ -0,0 +1,248 @@
+# Dataset: nv_neuro
+# Description: Create NV test SDTM dataset for Alzheimer's Disease (neuro studies)
+
+# Load libraries ----
+
+library(tibble)
+library(dplyr)
+library(stringr)
+library(admiral)
+
+# Read input data ----
+
+data("dm_neuro")
+
+# Convert blank to NA ----
+
+dm_neuro <- convert_blanks_to_na(dm_neuro)
+
+# Separate placebo and observation from treatment group to mimic different disease progression ----
+
+placebo_group <- dm_neuro %>%
+  dplyr::filter(!is.na(ARMCD) & ARMCD == "Pbo")
+
+treatment_group <- dm_neuro %>%
+  dplyr::filter(!is.na(ARMCD) & ARMCD == "Xan_Hi")
+
+observation_group <- dm_neuro %>%
+  dplyr::filter(is.na(ARMCD) & ARMNRS == "Observational Study")
+
+# Leverage VS visits at BASELINE, WEEK12 and WEEK26
+
+visit_schedule <- pharmaversesdtm::vs %>%
+  dplyr::filter(USUBJID %in% dm_neuro$USUBJID) %>%
+  dplyr::filter(VISITNUM %in% c(3.0, 9.0, 13.0)) %>%
+  dplyr::rename(NVDTC = VSDTC, NVDY = VSDY) %>%
+  dplyr::select(USUBJID, VISITNUM, VISIT, VISITDY, NVDTC, NVDY) %>%
+  group_by(USUBJID) %>%
+  distinct()
+
+# All USUBJID have BASELINE but not all have visits 9 or 13 data
+
+visit9_usubjid <- visit_schedule %>%
+  dplyr::filter(VISITNUM == 9) %>%
+  dplyr::select(USUBJID) %>%
+  distinct() %>%
+  unlist()
+
+visit13_usubjid <- visit_schedule %>%
+  dplyr::filter(VISITNUM == 13) %>%
+  distinct() %>%
+  unlist()
+
+# Create records for one USUBJID ----
+
+create_records_for_one_id <- function(usubjid = "01-701-1015", visitnum = 3,
+                                      fbp_suvr_cb = 1.461, fbb_suvr_com = 1.452, ftp_suvr_icbgm = 1.331) {
+  tibble(
+    STUDYID = rep("CDISCPILOT01", 5),
+    DOMAIN = rep("NV", 5),
+    USUBJID = rep(usubjid, 5),
+    SUBJID = sub(".*-", "", rep(usubjid, 5)),
+    NVSEQ = 1:5,
+    NVTESTCD = c("VR", "SUVR", "SUVR", "VR", "SUVR"),
+    NVTEST = c(
+      "Qualitative Visual Classification",
+      "Standardized Uptake Value Ratio",
+      "Standardized Uptake Value Ratio",
+      "Qualitative Visual Classification",
+      "Standardized Uptake Value Ratio"
+    ),
+    NVCAT = c("FBP", "FBP", "FBB", "FTP", "FTP"),
+    NVORRES = c("Positive", as.character(fbp_suvr_cb), as.character(fbb_suvr_com), "Positive", as.character(ftp_suvr_icbgm)),
+    NVLOC = c(NA, "NEOCORTICAL COMPOSITE", "NEOCORTICAL COMPOSITE", NA, "NEOCORTICAL COMPOSITE"),
+    NVNAM = c("IXICO", "AVID", "BERKELEY", "IXICO", "BERKELEY"),
+    NVMETHOD = c("FBP VISUAL CLASSIFICATION", "AVID FBP SUVR PIPELINE", "BERKELEY FBB SUVR PIPELINE", "FTP VISUAL CLASSIFICATION", "BERKELEY FTP SUVR PIPELINE"),
+    VISITNUM = visitnum
+  )
+}
+
+# Create dataset for visit 3 (baseline) for all ids from dm_neuro ----
+
+# Set the seed for reproducibility
+set.seed(2774)
+
+# Generate the data using lapply
+all_visit3_dat <- dplyr::bind_rows(
+  lapply(dm_neuro$USUBJID, function(id) {
+    # Generate random values for the parameters
+    fbp_suvr_cb <- round(runif(1, 1.25, 2.5), 3)
+    fbb_suvr_com <- round(fbp_suvr_cb - runif(1, min = 0.005, max = 0.01), 3)
+    ftp_suvr_icbgm <- round(fbp_suvr_cb - runif(1, min = 0.1, max = 0.13), 3)
+
+    # Create the dataset using create_records_for_one_id function
+    create_records_for_one_id(
+      usubjid = id,
+      visitnum = 3,
+      fbp_suvr_cb = fbp_suvr_cb,
+      fbb_suvr_com = fbb_suvr_com,
+      ftp_suvr_icbgm = ftp_suvr_icbgm
+    )
+  })
+)
+
+# Create visit 9 dataset for placebo and observational groups ----
+
+pbo_obs_visit9_dat <- all_visit3_dat %>%
+  dplyr::filter(USUBJID %in% c(placebo_group$USUBJID, observation_group$USUBJID)) %>%
+  dplyr::filter(NVTESTCD == "SUVR") %>%
+  dplyr::mutate(
+    VISITNUM = 9,
+    NVSEQ = NVSEQ + 5,
+    NVORRES = as.character(round(as.numeric(NVORRES) + runif(1, min = 0.1, max = 0.2), 3)),
+    NVORRES
+  )
+
+# Create visit 9 dataset for treatment group ----
+
+treat_visit9_dat <- all_visit3_dat %>%
+  dplyr::filter(USUBJID %in% treatment_group$USUBJID) %>%
+  dplyr::filter(NVTESTCD == "SUVR") %>%
+  dplyr::mutate(
+    VISITNUM = 9,
+    NVSEQ = NVSEQ + 5,
+    NVORRES = ifelse(NVCAT %in% c("FBP", "FBB"),
+      as.character(round(as.numeric(NVORRES) - runif(1, min = 0.3, max = 0.8), 3)),
+      ifelse(NVCAT == "FTP",
+        as.character(round(as.numeric(NVORRES) - runif(1, min = 0.005, max = 0.01), 3)), NVORRES
+      )
+    )
+  )
+
+# Create visit 13 dataset for placebo and observational groups ----
+
+pbo_obs_visit13_dat <- pbo_obs_visit9_dat %>%
+  dplyr::filter(NVTESTCD == "SUVR") %>%
+  dplyr::mutate(
+    VISITNUM = 13,
+    NVSEQ = NVSEQ + 5,
+    NVORRES = as.character(round(as.numeric(NVORRES) + runif(1, min = 0.2, max = 0.3), 3)),
+    NVORRES
+  )
+
+# Create visit 13 dataset for treatment group ----
+
+treat_visit13_dat <- treat_visit9_dat %>%
+  # dplyr::filter(USUBJID %in% visit_13_usubjid$USUBJID) %>%
+  dplyr::filter(NVTESTCD == "SUVR") %>%
+  dplyr::mutate(
+    VISITNUM = 13,
+    NVSEQ = NVSEQ + 5,
+    NVORRES = ifelse(NVCAT %in% c("FBP", "FBB"),
+      as.character(round(as.numeric(NVORRES) - runif(1, min = 0.3, max = 0.8), 3)),
+      ifelse(NVCAT == "FTP",
+        as.character(round(as.numeric(NVORRES) - runif(1, min = 0.01, max = 0.05), 3)), NVORRES
+      )
+    )
+  )
+
+# Combine datasets and add additional variables ----
+
+all_dat <- bind_rows(
+  all_visit3_dat,
+  pbo_obs_visit9_dat %>%
+    dplyr::filter(USUBJID %in% visit9_usubjid),
+  treat_visit9_dat %>%
+    dplyr::filter(USUBJID %in% visit9_usubjid),
+  pbo_obs_visit13_dat %>%
+    dplyr::filter(USUBJID %in% visit13_usubjid),
+  treat_visit13_dat %>%
+    dplyr::filter(USUBJID %in% visit13_usubjid)
+) %>%
+  dplyr::mutate(
+    NVBLFL = ifelse(VISITNUM == 3, "Y", NA_character_),
+    NVORRESU = ifelse(NVTESTCD == "SUVR",
+      "RATIO", NA
+    ),
+    NVSTRESC = NVORRES,
+    NVSTRESN = ifelse(NVTESTCD == "SUVR",
+      suppressWarnings(as.numeric(NVORRES)), NA
+    ),
+    NVSTRESU = ifelse(NVTESTCD == "SUVR",
+      "RATIO", NA
+    )
+  ) %>%
+  dplyr::left_join(
+    visit_schedule,
+    by = c("USUBJID", "VISITNUM")
+  ) %>%
+  dplyr::mutate(NVLNKID = NVSEQ) %>%
+  dplyr::select(
+    STUDYID, DOMAIN, USUBJID, NVSEQ, NVLNKID,
+    NVTESTCD, NVTEST, NVCAT,
+    NVLOC, NVMETHOD, NVNAM,
+    NVORRES, NVORRESU, NVSTRESC, NVSTRESN, NVSTRESU,
+    VISITNUM, VISIT, NVDTC, NVDY,
+    NVBLFL
+  )
+
+# Add labels to variables ----
+
+labels <- list(
+  # Identifier Variables (Key variables)
+  STUDYID = "Study Identifier",
+  DOMAIN = "Domain Abbreviation",
+  USUBJID = "Unique Subject Identifier",
+  NVSEQ = "Sequence Number",
+  NVLNKID = "Link to Subject's AG Domain Record",
+
+  # Topic Variables\
+  NVTESTCD = "Nervous System Test Short Name",
+  NVTEST = "Nervous System Test Name",
+  NVCAT = "Category for Nervous System Test",
+
+  # Qualifier Variables
+  NVLOC = "Location of Nervous System Finding",
path: data-raw/nv_neuro.R
user: login: jwang-lilly
body: Ok, changed to "Location Used for the Measurement".
created_at: 2025-04-23T15:11:12Z
author_association: COLLABORATOR
diff_hunk: @@ -0,0 +1,248 @@
+# Dataset: nv_neuro
+# Description: Create NV test SDTM dataset for Alzheimer's Disease (neuro studies)
+
+# Load libraries ----
+
+library(tibble)
+library(dplyr)
+library(stringr)
+library(admiral)
+
+# Read input data ----
+
+data("dm_neuro")
+
+# Convert blank to NA ----
+
+dm_neuro <- convert_blanks_to_na(dm_neuro)
+
+# Separate placebo and observation from treatment group to mimic different disease progression ----
+
+placebo_group <- dm_neuro %>%
+  dplyr::filter(!is.na(ARMCD) & ARMCD == "Pbo")
+
+treatment_group <- dm_neuro %>%
+  dplyr::filter(!is.na(ARMCD) & ARMCD == "Xan_Hi")
+
+observation_group <- dm_neuro %>%
+  dplyr::filter(is.na(ARMCD) & ARMNRS == "Observational Study")
+
+# Leverage VS visits at BASELINE, WEEK12 and WEEK26
+
+visit_schedule <- pharmaversesdtm::vs %>%
+  dplyr::filter(USUBJID %in% dm_neuro$USUBJID) %>%
+  dplyr::filter(VISITNUM %in% c(3.0, 9.0, 13.0)) %>%
+  dplyr::rename(NVDTC = VSDTC, NVDY = VSDY) %>%
+  dplyr::select(USUBJID, VISITNUM, VISIT, VISITDY, NVDTC, NVDY) %>%
+  group_by(USUBJID) %>%
+  distinct()
+
+# All USUBJID have BASELINE but not all have visits 9 or 13 data
+
+visit9_usubjid <- visit_schedule %>%
+  dplyr::filter(VISITNUM == 9) %>%
+  dplyr::select(USUBJID) %>%
+  distinct() %>%
+  unlist()
+
+visit13_usubjid <- visit_schedule %>%
+  dplyr::filter(VISITNUM == 13) %>%
+  distinct() %>%
+  unlist()
+
+# Create records for one USUBJID ----
+
+create_records_for_one_id <- function(usubjid = "01-701-1015", visitnum = 3,
+                                      fbp_suvr_cb = 1.461, fbb_suvr_com = 1.452, ftp_suvr_icbgm = 1.331) {
+  tibble(
+    STUDYID = rep("CDISCPILOT01", 5),
+    DOMAIN = rep("NV", 5),
+    USUBJID = rep(usubjid, 5),
+    SUBJID = sub(".*-", "", rep(usubjid, 5)),
+    NVSEQ = 1:5,
+    NVTESTCD = c("VR", "SUVR", "SUVR", "VR", "SUVR"),
+    NVTEST = c(
+      "Qualitative Visual Classification",
+      "Standardized Uptake Value Ratio",
+      "Standardized Uptake Value Ratio",
+      "Qualitative Visual Classification",
+      "Standardized Uptake Value Ratio"
+    ),
+    NVCAT = c("FBP", "FBP", "FBB", "FTP", "FTP"),
+    NVORRES = c("Positive", as.character(fbp_suvr_cb), as.character(fbb_suvr_com), "Positive", as.character(ftp_suvr_icbgm)),
+    NVLOC = c(NA, "NEOCORTICAL COMPOSITE", "NEOCORTICAL COMPOSITE", NA, "NEOCORTICAL COMPOSITE"),
+    NVNAM = c("IXICO", "AVID", "BERKELEY", "IXICO", "BERKELEY"),
+    NVMETHOD = c("FBP VISUAL CLASSIFICATION", "AVID FBP SUVR PIPELINE", "BERKELEY FBB SUVR PIPELINE", "FTP VISUAL CLASSIFICATION", "BERKELEY FTP SUVR PIPELINE"),
+    VISITNUM = visitnum
+  )
+}
+
+# Create dataset for visit 3 (baseline) for all ids from dm_neuro ----
+
+# Set the seed for reproducibility
+set.seed(2774)
+
+# Generate the data using lapply
+all_visit3_dat <- dplyr::bind_rows(
+  lapply(dm_neuro$USUBJID, function(id) {
+    # Generate random values for the parameters
+    fbp_suvr_cb <- round(runif(1, 1.25, 2.5), 3)
+    fbb_suvr_com <- round(fbp_suvr_cb - runif(1, min = 0.005, max = 0.01), 3)
+    ftp_suvr_icbgm <- round(fbp_suvr_cb - runif(1, min = 0.1, max = 0.13), 3)
+
+    # Create the dataset using create_records_for_one_id function
+    create_records_for_one_id(
+      usubjid = id,
+      visitnum = 3,
+      fbp_suvr_cb = fbp_suvr_cb,
+      fbb_suvr_com = fbb_suvr_com,
+      ftp_suvr_icbgm = ftp_suvr_icbgm
+    )
+  })
+)
+
+# Create visit 9 dataset for placebo and observational groups ----
+
+pbo_obs_visit9_dat <- all_visit3_dat %>%
+  dplyr::filter(USUBJID %in% c(placebo_group$USUBJID, observation_group$USUBJID)) %>%
+  dplyr::filter(NVTESTCD == "SUVR") %>%
+  dplyr::mutate(
+    VISITNUM = 9,
+    NVSEQ = NVSEQ + 5,
+    NVORRES = as.character(round(as.numeric(NVORRES) + runif(1, min = 0.1, max = 0.2), 3)),
+    NVORRES
+  )
+
+# Create visit 9 dataset for treatment group ----
+
+treat_visit9_dat <- all_visit3_dat %>%
+  dplyr::filter(USUBJID %in% treatment_group$USUBJID) %>%
+  dplyr::filter(NVTESTCD == "SUVR") %>%
+  dplyr::mutate(
+    VISITNUM = 9,
+    NVSEQ = NVSEQ + 5,
+    NVORRES = ifelse(NVCAT %in% c("FBP", "FBB"),
+      as.character(round(as.numeric(NVORRES) - runif(1, min = 0.3, max = 0.8), 3)),
+      ifelse(NVCAT == "FTP",
+        as.character(round(as.numeric(NVORRES) - runif(1, min = 0.005, max = 0.01), 3)), NVORRES
+      )
+    )
+  )
+
+# Create visit 13 dataset for placebo and observational groups ----
+
+pbo_obs_visit13_dat <- pbo_obs_visit9_dat %>%
+  dplyr::filter(NVTESTCD == "SUVR") %>%
+  dplyr::mutate(
+    VISITNUM = 13,
+    NVSEQ = NVSEQ + 5,
+    NVORRES = as.character(round(as.numeric(NVORRES) + runif(1, min = 0.2, max = 0.3), 3)),
+    NVORRES
+  )
+
+# Create visit 13 dataset for treatment group ----
+
+treat_visit13_dat <- treat_visit9_dat %>%
+  # dplyr::filter(USUBJID %in% visit_13_usubjid$USUBJID) %>%
+  dplyr::filter(NVTESTCD == "SUVR") %>%
+  dplyr::mutate(
+    VISITNUM = 13,
+    NVSEQ = NVSEQ + 5,
+    NVORRES = ifelse(NVCAT %in% c("FBP", "FBB"),
+      as.character(round(as.numeric(NVORRES) - runif(1, min = 0.3, max = 0.8), 3)),
+      ifelse(NVCAT == "FTP",
+        as.character(round(as.numeric(NVORRES) - runif(1, min = 0.01, max = 0.05), 3)), NVORRES
+      )
+    )
+  )
+
+# Combine datasets and add additional variables ----
+
+all_dat <- bind_rows(
+  all_visit3_dat,
+  pbo_obs_visit9_dat %>%
+    dplyr::filter(USUBJID %in% visit9_usubjid),
+  treat_visit9_dat %>%
+    dplyr::filter(USUBJID %in% visit9_usubjid),
+  pbo_obs_visit13_dat %>%
+    dplyr::filter(USUBJID %in% visit13_usubjid),
+  treat_visit13_dat %>%
+    dplyr::filter(USUBJID %in% visit13_usubjid)
+) %>%
+  dplyr::mutate(
+    NVBLFL = ifelse(VISITNUM == 3, "Y", NA_character_),
+    NVORRESU = ifelse(NVTESTCD == "SUVR",
+      "RATIO", NA
+    ),
+    NVSTRESC = NVORRES,
+    NVSTRESN = ifelse(NVTESTCD == "SUVR",
+      suppressWarnings(as.numeric(NVORRES)), NA
+    ),
+    NVSTRESU = ifelse(NVTESTCD == "SUVR",
+      "RATIO", NA
+    )
+  ) %>%
+  dplyr::left_join(
+    visit_schedule,
+    by = c("USUBJID", "VISITNUM")
+  ) %>%
+  dplyr::mutate(NVLNKID = NVSEQ) %>%
+  dplyr::select(
+    STUDYID, DOMAIN, USUBJID, NVSEQ, NVLNKID,
+    NVTESTCD, NVTEST, NVCAT,
+    NVLOC, NVMETHOD, NVNAM,
+    NVORRES, NVORRESU, NVSTRESC, NVSTRESN, NVSTRESU,
+    VISITNUM, VISIT, NVDTC, NVDY,
+    NVBLFL
+  )
+
+# Add labels to variables ----
+
+labels <- list(
+  # Identifier Variables (Key variables)
+  STUDYID = "Study Identifier",
+  DOMAIN = "Domain Abbreviation",
+  USUBJID = "Unique Subject Identifier",
+  NVSEQ = "Sequence Number",
+  NVLNKID = "Link to Subject's AG Domain Record",
+
+  # Topic Variables\
+  NVTESTCD = "Nervous System Test Short Name",
+  NVTEST = "Nervous System Test Name",
path: data-raw/nv_neuro.R
user: login: jwang-lilly
body: Ok, changed to "Name of Nervous System Test".
created_at: 2025-04-23T15:12:43Z
author_association: COLLABORATOR
diff_hunk: @@ -0,0 +1,248 @@
+# Dataset: nv_neuro
+# Description: Create NV test SDTM dataset for Alzheimer's Disease (neuro studies)
+
+# Load libraries ----
+
+library(tibble)
+library(dplyr)
+library(stringr)
+library(admiral)
+
+# Read input data ----
+
+data("dm_neuro")
+
+# Convert blank to NA ----
+
+dm_neuro <- convert_blanks_to_na(dm_neuro)
+
+# Separate placebo and observation from treatment group to mimic different disease progression ----
+
+placebo_group <- dm_neuro %>%
+  dplyr::filter(!is.na(ARMCD) & ARMCD == "Pbo")
+
+treatment_group <- dm_neuro %>%
+  dplyr::filter(!is.na(ARMCD) & ARMCD == "Xan_Hi")
+
+observation_group <- dm_neuro %>%
+  dplyr::filter(is.na(ARMCD) & ARMNRS == "Observational Study")
+
+# Leverage VS visits at BASELINE, WEEK12 and WEEK26
+
+visit_schedule <- pharmaversesdtm::vs %>%
+  dplyr::filter(USUBJID %in% dm_neuro$USUBJID) %>%
+  dplyr::filter(VISITNUM %in% c(3.0, 9.0, 13.0)) %>%
+  dplyr::rename(NVDTC = VSDTC, NVDY = VSDY) %>%
+  dplyr::select(USUBJID, VISITNUM, VISIT, VISITDY, NVDTC, NVDY) %>%
+  group_by(USUBJID) %>%
+  distinct()
+
+# All USUBJID have BASELINE but not all have visits 9 or 13 data
+
+visit9_usubjid <- visit_schedule %>%
+  dplyr::filter(VISITNUM == 9) %>%
+  dplyr::select(USUBJID) %>%
+  distinct() %>%
+  unlist()
+
+visit13_usubjid <- visit_schedule %>%
+  dplyr::filter(VISITNUM == 13) %>%
+  distinct() %>%
+  unlist()
+
+# Create records for one USUBJID ----
+
+create_records_for_one_id <- function(usubjid = "01-701-1015", visitnum = 3,
+                                      fbp_suvr_cb = 1.461, fbb_suvr_com = 1.452, ftp_suvr_icbgm = 1.331) {
+  tibble(
+    STUDYID = rep("CDISCPILOT01", 5),
+    DOMAIN = rep("NV", 5),
+    USUBJID = rep(usubjid, 5),
+    SUBJID = sub(".*-", "", rep(usubjid, 5)),
+    NVSEQ = 1:5,
+    NVTESTCD = c("VR", "SUVR", "SUVR", "VR", "SUVR"),
+    NVTEST = c(
+      "Qualitative Visual Classification",
+      "Standardized Uptake Value Ratio",
+      "Standardized Uptake Value Ratio",
+      "Qualitative Visual Classification",
+      "Standardized Uptake Value Ratio"
+    ),
+    NVCAT = c("FBP", "FBP", "FBB", "FTP", "FTP"),
+    NVORRES = c("Positive", as.character(fbp_suvr_cb), as.character(fbb_suvr_com), "Positive", as.character(ftp_suvr_icbgm)),
+    NVLOC = c(NA, "NEOCORTICAL COMPOSITE", "NEOCORTICAL COMPOSITE", NA, "NEOCORTICAL COMPOSITE"),
+    NVNAM = c("IXICO", "AVID", "BERKELEY", "IXICO", "BERKELEY"),
+    NVMETHOD = c("FBP VISUAL CLASSIFICATION", "AVID FBP SUVR PIPELINE", "BERKELEY FBB SUVR PIPELINE", "FTP VISUAL CLASSIFICATION", "BERKELEY FTP SUVR PIPELINE"),
+    VISITNUM = visitnum
+  )
+}
+
+# Create dataset for visit 3 (baseline) for all ids from dm_neuro ----
+
+# Set the seed for reproducibility
+set.seed(2774)
+
+# Generate the data using lapply
+all_visit3_dat <- dplyr::bind_rows(
+  lapply(dm_neuro$USUBJID, function(id) {
+    # Generate random values for the parameters
+    fbp_suvr_cb <- round(runif(1, 1.25, 2.5), 3)
+    fbb_suvr_com <- round(fbp_suvr_cb - runif(1, min = 0.005, max = 0.01), 3)
+    ftp_suvr_icbgm <- round(fbp_suvr_cb - runif(1, min = 0.1, max = 0.13), 3)
+
+    # Create the dataset using create_records_for_one_id function
+    create_records_for_one_id(
+      usubjid = id,
+      visitnum = 3,
+      fbp_suvr_cb = fbp_suvr_cb,
+      fbb_suvr_com = fbb_suvr_com,
+      ftp_suvr_icbgm = ftp_suvr_icbgm
+    )
+  })
+)
+
+# Create visit 9 dataset for placebo and observational groups ----
+
+pbo_obs_visit9_dat <- all_visit3_dat %>%
+  dplyr::filter(USUBJID %in% c(placebo_group$USUBJID, observation_group$USUBJID)) %>%
+  dplyr::filter(NVTESTCD == "SUVR") %>%
+  dplyr::mutate(
+    VISITNUM = 9,
+    NVSEQ = NVSEQ + 5,
+    NVORRES = as.character(round(as.numeric(NVORRES) + runif(1, min = 0.1, max = 0.2), 3)),
+    NVORRES
+  )
+
+# Create visit 9 dataset for treatment group ----
+
+treat_visit9_dat <- all_visit3_dat %>%
+  dplyr::filter(USUBJID %in% treatment_group$USUBJID) %>%
+  dplyr::filter(NVTESTCD == "SUVR") %>%
+  dplyr::mutate(
+    VISITNUM = 9,
+    NVSEQ = NVSEQ + 5,
+    NVORRES = ifelse(NVCAT %in% c("FBP", "FBB"),
+      as.character(round(as.numeric(NVORRES) - runif(1, min = 0.3, max = 0.8), 3)),
+      ifelse(NVCAT == "FTP",
+        as.character(round(as.numeric(NVORRES) - runif(1, min = 0.005, max = 0.01), 3)), NVORRES
+      )
+    )
+  )
+
+# Create visit 13 dataset for placebo and observational groups ----
+
+pbo_obs_visit13_dat <- pbo_obs_visit9_dat %>%
+  dplyr::filter(NVTESTCD == "SUVR") %>%
+  dplyr::mutate(
+    VISITNUM = 13,
+    NVSEQ = NVSEQ + 5,
+    NVORRES = as.character(round(as.numeric(NVORRES) + runif(1, min = 0.2, max = 0.3), 3)),
+    NVORRES
+  )
+
+# Create visit 13 dataset for treatment group ----
+
+treat_visit13_dat <- treat_visit9_dat %>%
+  # dplyr::filter(USUBJID %in% visit_13_usubjid$USUBJID) %>%
+  dplyr::filter(NVTESTCD == "SUVR") %>%
+  dplyr::mutate(
+    VISITNUM = 13,
+    NVSEQ = NVSEQ + 5,
+    NVORRES = ifelse(NVCAT %in% c("FBP", "FBB"),
+      as.character(round(as.numeric(NVORRES) - runif(1, min = 0.3, max = 0.8), 3)),
+      ifelse(NVCAT == "FTP",
+        as.character(round(as.numeric(NVORRES) - runif(1, min = 0.01, max = 0.05), 3)), NVORRES
+      )
+    )
+  )
+
+# Combine datasets and add additional variables ----
+
+all_dat <- bind_rows(
+  all_visit3_dat,
+  pbo_obs_visit9_dat %>%
+    dplyr::filter(USUBJID %in% visit9_usubjid),
+  treat_visit9_dat %>%
+    dplyr::filter(USUBJID %in% visit9_usubjid),
+  pbo_obs_visit13_dat %>%
+    dplyr::filter(USUBJID %in% visit13_usubjid),
+  treat_visit13_dat %>%
+    dplyr::filter(USUBJID %in% visit13_usubjid)
+) %>%
+  dplyr::mutate(
+    NVBLFL = ifelse(VISITNUM == 3, "Y", NA_character_),
+    NVORRESU = ifelse(NVTESTCD == "SUVR",
+      "RATIO", NA
+    ),
+    NVSTRESC = NVORRES,
+    NVSTRESN = ifelse(NVTESTCD == "SUVR",
+      suppressWarnings(as.numeric(NVORRES)), NA
+    ),
+    NVSTRESU = ifelse(NVTESTCD == "SUVR",
+      "RATIO", NA
+    )
+  ) %>%
+  dplyr::left_join(
+    visit_schedule,
+    by = c("USUBJID", "VISITNUM")
+  ) %>%
+  dplyr::mutate(NVLNKID = NVSEQ) %>%
+  dplyr::select(
+    STUDYID, DOMAIN, USUBJID, NVSEQ, NVLNKID,
+    NVTESTCD, NVTEST, NVCAT,
+    NVLOC, NVMETHOD, NVNAM,
+    NVORRES, NVORRESU, NVSTRESC, NVSTRESN, NVSTRESU,
+    VISITNUM, VISIT, NVDTC, NVDY,
+    NVBLFL
+  )
+
+# Add labels to variables ----
+
+labels <- list(
+  # Identifier Variables (Key variables)
+  STUDYID = "Study Identifier",
+  DOMAIN = "Domain Abbreviation",
+  USUBJID = "Unique Subject Identifier",
+  NVSEQ = "Sequence Number",
+  NVLNKID = "Link to Subject's AG Domain Record",
+
+  # Topic Variables\
+  NVTESTCD = "Nervous System Test Short Name",
+  NVTEST = "Nervous System Test Name",
+  NVCAT = "Category for Nervous System Test",
+
+  # Qualifier Variables
+  NVLOC = "Location of Nervous System Finding",
+  NVMETHOD = "Method of Test or Examination",
+  NVNAM = "Vendor Name",
+
+  # Result Variables
+  NVORRES = "Result or Finding in Original Units",
+  NVORRESU = "Original Units",
+  NVSTRESC = "Character Result/Finding in Std Format",
+  NVSTRESN = "Numeric Result/Finding in Standard Units",
+  NVSTRESU = "Standard Units",
+
+  # Timing Variables
+  VISITNUM = "Visit Number",
+  VISIT = "Visit Name",
+  NVDTC = "Date/Time of Collection",
+  NVDY = "Study Day of Collection",
+
+  # Additional Qualifier
+  NVBLFL = "Baseline Flag"
path: data-raw/nv_neuro.R
user: login: jwang-lilly
body: Great idea.  Changed NVBLFL with NVLOBXFL (last observation before exposure flag)
created_at: 2025-04-23T15:41:02Z
author_association: COLLABORATOR
diff_hunk: @@ -0,0 +1,52 @@
+# Dataset: suppnv_neuro
+# Description: Create SUPPNV test SDTM dataset for Alzheimer's Disease (neuro studies)
+
+# Load libraries ----
+
+library(tibble)
+library(dplyr)
+library(stringr)
+library(admiral)
+
+# Read input data ----
+
+data("nv_neuro")
+
+# Convert blank to NA ----
+
+nv_neuro <- convert_blanks_to_na(nv_neuro)
+
+suppnv_neuro <- nv_neuro %>%
+  dplyr::filter(!is.na(NVLOC)) %>%
+  dplyr::mutate(RDOMAIN = "NV", IDVAR = "NVSEQ", IDVARVAL = NVSEQ, QNAM = "REFREG", QLABEL = "Reference Region") %>%
+  dplyr::mutate(QVAL = case_when(
+    NVCAT %in% c("FBP", "FBB") ~ "Whole Cerebellum",
+    NVCAT == "FTP" ~ "Inferior Cerebellar Gray Matter",
+    TRUE ~ NA_character_
+  )) %>%
+  dplyr::select(STUDYID, RDOMAIN, USUBJID, IDVAR, IDVARVAL, QNAM, QLABEL, QVAL)
+
+# Add labels to variables ----
+
+labels <- list(
+  STUDYID = "Study Identifier",
+  RDOMAIN = "Related Domain Abbreviation",
+  USUBJID = "Unique Subject Identifier",
+  IDVAR = "Identifying Variable",
+  IDVARVAL = "Identifying Variable Value",
+  QNAM = "Qualifier Variable Name",
+  QLABEL = "Qualifier Variable Label",
+  QVAL = "Qualifier Value"
+)
+
+for (var in names(labels)) {
+  attr(suppnv_neuro[[var]], "label") <- labels[[var]]
+}
+
+# Label SUPPNV dataset ----
+
+attr(suppnv_neuro, "label") <- "Supplemental to Nervous System Findings"
path: data-raw/suppnv_neuro.R
user: login: jwang-lilly
body: ok, changed to "Supplemental Qualifiers for Nervous System Findings".
created_at: 2025-04-23T15:45:10Z
author_association: COLLABORATOR
diff_hunk: @@ -0,0 +1,52 @@
+# Dataset: suppnv_neuro
+# Description: Create SUPPNV test SDTM dataset for Alzheimer's Disease (neuro studies)
+
+# Load libraries ----
+
+library(tibble)
+library(dplyr)
+library(stringr)
+library(admiral)
+
+# Read input data ----
+
+data("nv_neuro")
+
+# Convert blank to NA ----
+
+nv_neuro <- convert_blanks_to_na(nv_neuro)
+
+suppnv_neuro <- nv_neuro %>%
+  dplyr::filter(!is.na(NVLOC)) %>%
+  dplyr::mutate(RDOMAIN = "NV", IDVAR = "NVSEQ", IDVARVAL = NVSEQ, QNAM = "REFREG", QLABEL = "Reference Region") %>%
+  dplyr::mutate(QVAL = case_when(
+    NVCAT %in% c("FBP", "FBB") ~ "Whole Cerebellum",
+    NVCAT == "FTP" ~ "Inferior Cerebellar Gray Matter",
+    TRUE ~ NA_character_
+  )) %>%
+  dplyr::select(STUDYID, RDOMAIN, USUBJID, IDVAR, IDVARVAL, QNAM, QLABEL, QVAL)
+
+# Add labels to variables ----
+
+labels <- list(
+  STUDYID = "Study Identifier",
+  RDOMAIN = "Related Domain Abbreviation",
+  USUBJID = "Unique Subject Identifier",
+  IDVAR = "Identifying Variable",
+  IDVARVAL = "Identifying Variable Value",
+  QNAM = "Qualifier Variable Name",
+  QLABEL = "Qualifier Variable Label",
+  QVAL = "Qualifier Value"
path: data-raw/suppnv_neuro.R
user: login: jwang-lilly
body: Ok, changed to "Data Value".
created_at: 2025-04-23T15:45:46Z
author_association: COLLABORATOR
diff_hunk: @@ -0,0 +1,72 @@
+# Dataset: ag_neuro
+# Description: Create AG test SDTM dataset for Alzheimer's Disease (neuro studies)
+
+# Load libraries ----
+
+library(tibble)
+library(dplyr)
+library(stringr)
+library(admiral)
+
+# Read input data ----
+
+data("nv_neuro")
+
+# Convert blank to NA ----
+
+nv_neuro <- convert_blanks_to_na(nv_neuro)
+
+ag_neuro <- nv_neuro %>%
+  dplyr::mutate(DOMAIN = "AG", AGSEQ = NVSEQ, AGLNKID = NVLNKID, AGSTDTC = NVDTC) %>%
+  dplyr::mutate(AGTRT = case_when(
+    NVCAT == "FBP" ~ "18F-Florbetapir",
+    NVCAT == "FBB" ~ "18F-Florbetaben",
+    NVCAT == "FTP" ~ "18F-Flortaucipir"
+  )) %>%
+  dplyr::mutate(AGCAT = case_when(
+    NVCAT == "FBP" ~ "AMYLOID TRACER",
+    NVCAT == "FBB" ~ "AMYLOID TRACER",
+    NVCAT == "FTP" ~ "TAU TRACER"
+  )) %>%
+  dplyr::mutate(AGDOSE = case_when(
+    NVCAT == "FBP" ~ "370 MBq",
+    NVCAT == "FBB" ~ "300 MBq",
+    NVCAT == "FTP" ~ "370 MBq"
+  )) %>%
+  dplyr::mutate(AGDOSEU = "MBq") %>%
+  dplyr::mutate(AGROUTE = "Intravenous") %>%
+  dplyr::select(
+    STUDYID, DOMAIN, USUBJID, AGSEQ, AGTRT, AGCAT,
+    AGDOSE, AGDOSEU, AGROUTE, AGLNKID,
+    VISITNUM, VISIT, AGSTDTC
+  )
+
+# Add labels to variables ----
+
+labels <- list(
+  STUDYID = "Study Identifier",
+  DOMAIN = "Domain Abbreviation",
+  USUBJID = "Unique Subject Identifier",
+  AGSEQ = "Sequence Number",
+  AGTRT = "Tracer Name",
+  AGCAT = "Tracer Category",
+  AGDOSE = "Dose per Administration",
+  AGDOSEU = "Dose Units",
+  AGROUTE = "Route of Administration",
+  AGLNKID = "Link to Subject's NV Domain Record",
+  VISITNUM = "Visit Number",
+  VISIT = "Visit Name",
+  AGSTDTC = "Date/Time of Administration"
+)
+
+for (var in names(labels)) {
+  attr(ag_neuro[[var]], "label") <- labels[[var]]
+}
+
+# Label AG dataset ----
+
+attr(ag_neuro, "label") <- "Procedure Agents for Nervous System"
path: data-raw/ag_neuro.R
user: login: jwang-lilly
body: ok, changed to "Procedure Agents"
created_at: 2025-04-23T15:47:59Z
author_association: COLLABORATOR
diff_hunk: @@ -0,0 +1,52 @@
+# Dataset: suppnv_neuro
+# Description: Create SUPPNV test SDTM dataset for Alzheimer's Disease (neuro studies)
+
+# Load libraries ----
+
+library(tibble)
+library(dplyr)
+library(stringr)
+library(admiral)
+
+# Read input data ----
+
+data("nv_neuro")
+
+# Convert blank to NA ----
+
+nv_neuro <- convert_blanks_to_na(nv_neuro)
+
+suppnv_neuro <- nv_neuro %>%
+  dplyr::filter(!is.na(NVLOC)) %>%
+  dplyr::mutate(RDOMAIN = "NV", IDVAR = "NVSEQ", IDVARVAL = NVSEQ, QNAM = "REFREG", QLABEL = "Reference Region") %>%
+  dplyr::mutate(QVAL = case_when(
+    NVCAT %in% c("FBP", "FBB") ~ "Whole Cerebellum",
+    NVCAT == "FTP" ~ "Inferior Cerebellar Gray Matter",
+    TRUE ~ NA_character_
+  )) %>%
+  dplyr::select(STUDYID, RDOMAIN, USUBJID, IDVAR, IDVARVAL, QNAM, QLABEL, QVAL)
+
+# Add labels to variables ----
+
+labels <- list(
+  STUDYID = "Study Identifier",
+  RDOMAIN = "Related Domain Abbreviation",
+  USUBJID = "Unique Subject Identifier",
+  IDVAR = "Identifying Variable",
+  IDVARVAL = "Identifying Variable Value",
+  QNAM = "Qualifier Variable Name",
+  QLABEL = "Qualifier Variable Label",
+  QVAL = "Qualifier Value"
+)
path: data-raw/suppnv_neuro.R
user: login: jwang-lilly
body: Added QORIG and QEVAL to suppnv_neuro.R
created_at: 2025-04-23T16:02:35Z
author_association: COLLABORATOR
diff_hunk: @@ -0,0 +1,72 @@
+# Dataset: ag_neuro
+# Description: Create AG test SDTM dataset for Alzheimer's Disease (neuro studies)
+
+# Load libraries ----
+
+library(tibble)
+library(dplyr)
+library(stringr)
+library(admiral)
+
+# Read input data ----
+
+data("nv_neuro")
+
+# Convert blank to NA ----
+
+nv_neuro <- convert_blanks_to_na(nv_neuro)
+
+ag_neuro <- nv_neuro %>%
+  dplyr::mutate(DOMAIN = "AG", AGSEQ = NVSEQ, AGLNKID = NVLNKID, AGSTDTC = NVDTC) %>%
+  dplyr::mutate(AGTRT = case_when(
+    NVCAT == "FBP" ~ "18F-Florbetapir",
+    NVCAT == "FBB" ~ "18F-Florbetaben",
+    NVCAT == "FTP" ~ "18F-Flortaucipir"
+  )) %>%
+  dplyr::mutate(AGCAT = case_when(
+    NVCAT == "FBP" ~ "AMYLOID TRACER",
+    NVCAT == "FBB" ~ "AMYLOID TRACER",
+    NVCAT == "FTP" ~ "TAU TRACER"
+  )) %>%
+  dplyr::mutate(AGDOSE = case_when(
+    NVCAT == "FBP" ~ "370 MBq",
+    NVCAT == "FBB" ~ "300 MBq",
+    NVCAT == "FTP" ~ "370 MBq"
+  )) %>%
+  dplyr::mutate(AGDOSEU = "MBq") %>%
+  dplyr::mutate(AGROUTE = "Intravenous") %>%
+  dplyr::select(
+    STUDYID, DOMAIN, USUBJID, AGSEQ, AGTRT, AGCAT,
+    AGDOSE, AGDOSEU, AGROUTE, AGLNKID,
+    VISITNUM, VISIT, AGSTDTC
+  )
+
+# Add labels to variables ----
+
+labels <- list(
+  STUDYID = "Study Identifier",
+  DOMAIN = "Domain Abbreviation",
+  USUBJID = "Unique Subject Identifier",
+  AGSEQ = "Sequence Number",
+  AGTRT = "Tracer Name",
+  AGCAT = "Tracer Category",
+  AGDOSE = "Dose per Administration",
+  AGDOSEU = "Dose Units",
+  AGROUTE = "Route of Administration",
+  AGLNKID = "Link to Subject's NV Domain Record",
path: data-raw/ag_neuro.R
user: login: jwang-lilly
body: O, changed to "Link ID".
created_at: 2025-04-23T16:15:00Z
author_association: COLLABORATOR
diff_hunk: @@ -0,0 +1,72 @@
+# Dataset: ag_neuro
+# Description: Create AG test SDTM dataset for Alzheimer's Disease (neuro studies)
+
+# Load libraries ----
+
+library(tibble)
+library(dplyr)
+library(stringr)
+library(admiral)
+
+# Read input data ----
+
+data("nv_neuro")
+
+# Convert blank to NA ----
+
+nv_neuro <- convert_blanks_to_na(nv_neuro)
+
+ag_neuro <- nv_neuro %>%
+  dplyr::mutate(DOMAIN = "AG", AGSEQ = NVSEQ, AGLNKID = NVLNKID, AGSTDTC = NVDTC) %>%
+  dplyr::mutate(AGTRT = case_when(
+    NVCAT == "FBP" ~ "18F-Florbetapir",
+    NVCAT == "FBB" ~ "18F-Florbetaben",
+    NVCAT == "FTP" ~ "18F-Flortaucipir"
+  )) %>%
+  dplyr::mutate(AGCAT = case_when(
+    NVCAT == "FBP" ~ "AMYLOID TRACER",
+    NVCAT == "FBB" ~ "AMYLOID TRACER",
+    NVCAT == "FTP" ~ "TAU TRACER"
+  )) %>%
+  dplyr::mutate(AGDOSE = case_when(
+    NVCAT == "FBP" ~ "370 MBq",
+    NVCAT == "FBB" ~ "300 MBq",
+    NVCAT == "FTP" ~ "370 MBq"
+  )) %>%
+  dplyr::mutate(AGDOSEU = "MBq") %>%
+  dplyr::mutate(AGROUTE = "Intravenous") %>%
+  dplyr::select(
+    STUDYID, DOMAIN, USUBJID, AGSEQ, AGTRT, AGCAT,
+    AGDOSE, AGDOSEU, AGROUTE, AGLNKID,
+    VISITNUM, VISIT, AGSTDTC
+  )
+
+# Add labels to variables ----
+
+labels <- list(
+  STUDYID = "Study Identifier",
+  DOMAIN = "Domain Abbreviation",
+  USUBJID = "Unique Subject Identifier",
+  AGSEQ = "Sequence Number",
+  AGTRT = "Tracer Name",
path: data-raw/ag_neuro.R
user: login: jwang-lilly
body: Ok changed to "Reported Agent Name".
created_at: 2025-04-23T16:18:02Z
author_association: COLLABORATOR
diff_hunk: @@ -0,0 +1,72 @@
+# Dataset: ag_neuro
+# Description: Create AG test SDTM dataset for Alzheimer's Disease (neuro studies)
+
+# Load libraries ----
+
+library(tibble)
+library(dplyr)
+library(stringr)
+library(admiral)
+
+# Read input data ----
+
+data("nv_neuro")
+
+# Convert blank to NA ----
+
+nv_neuro <- convert_blanks_to_na(nv_neuro)
+
+ag_neuro <- nv_neuro %>%
+  dplyr::mutate(DOMAIN = "AG", AGSEQ = NVSEQ, AGLNKID = NVLNKID, AGSTDTC = NVDTC) %>%
path: data-raw/ag_neuro.R
user: login: jwang-lilly
body: Thanks Fanny.  Ok.
created_at: 2025-04-23T17:31:42Z
author_association: COLLABORATOR
diff_hunk: @@ -0,0 +1,252 @@
+# Dataset: nv_neuro
+# Description: Create NV test SDTM dataset for Alzheimer's Disease (neuro studies)
+
+# Load libraries ----
+
+library(tibble)
+library(dplyr)
+library(stringr)
+library(admiral)
+
+# Read input data ----
+
+data("dm_neuro")
+
+# Convert blank to NA ----
+
+dm_neuro <- convert_blanks_to_na(dm_neuro)
+
+# Separate placebo and observation from treatment group to mimic different disease progression ----
+
+placebo_group <- dm_neuro %>%
+  dplyr::filter(!is.na(ARMCD) & ARMCD == "Pbo")
+
+treatment_group <- dm_neuro %>%
+  dplyr::filter(!is.na(ARMCD) & ARMCD == "Xan_Hi")
+
+observation_group <- dm_neuro %>%
+  dplyr::filter(is.na(ARMCD) & ARMNRS == "Observational Study")
+
+# Leverage VS visits at BASELINE, WEEK12 and WEEK26
+
+visit_schedule <- pharmaversesdtm::vs %>%
+  dplyr::filter(USUBJID %in% dm_neuro$USUBJID) %>%
+  dplyr::filter(VISITNUM %in% c(3.0, 9.0, 13.0)) %>%
+  dplyr::rename(NVDTC = VSDTC, NVDY = VSDY) %>%
+  dplyr::select(USUBJID, VISITNUM, VISIT, VISITDY, NVDTC, NVDY) %>%
+  group_by(USUBJID) %>%
+  distinct()
+
+# All USUBJID have BASELINE but not all have visits 9 or 13 data
+
+visit9_usubjid <- visit_schedule %>%
+  dplyr::filter(VISITNUM == 9) %>%
+  dplyr::select(USUBJID) %>%
+  distinct() %>%
+  unlist()
+
+visit13_usubjid <- visit_schedule %>%
+  dplyr::filter(VISITNUM == 13) %>%
+  distinct() %>%
+  unlist()
+
+# Create records for one USUBJID ----
+
+create_records_for_one_id <- function(usubjid = "01-701-1015", visitnum = 3,
+                                      fbp_suvr_cb = 1.461, fbb_suvr_com = 1.452, ftp_suvr_icbgm = 1.331) {
+  tibble(
+    STUDYID = rep("CDISCPILOT01", 5),
+    DOMAIN = rep("NV", 5),
+    USUBJID = rep(usubjid, 5),
+    SUBJID = sub(".*-", "", rep(usubjid, 5)),
+    NVTESTCD = c("VR", "SUVR", "SUVR", "VR", "SUVR"),
+    NVTEST = c(
+      "Qualitative Visual Classification",
+      "Standardized Uptake Value Ratio",
+      "Standardized Uptake Value Ratio",
+      "Qualitative Visual Classification",
+      "Standardized Uptake Value Ratio"
+    ),
+    NVCAT = c("FBP", "FBP", "FBB", "FTP", "FTP"),
+    NVORRES = c("Positive", as.character(fbp_suvr_cb), as.character(fbb_suvr_com), "Positive", as.character(ftp_suvr_icbgm)),
+    NVLOC = c(NA, "NEOCORTICAL COMPOSITE", "NEOCORTICAL COMPOSITE", NA, "NEOCORTICAL COMPOSITE"),
+    NVNAM = c("IXICO", "AVID", "BERKELEY", "IXICO", "BERKELEY"),
+    NVMETHOD = c("FBP VISUAL CLASSIFICATION", "AVID FBP SUVR PIPELINE", "BERKELEY FBB SUVR PIPELINE", "FTP VISUAL CLASSIFICATION", "BERKELEY FTP SUVR PIPELINE"),
+    VISITNUM = visitnum
+  )
+}
+
+# Create dataset for visit 3 (baseline) for all ids from dm_neuro ----
+
+# Set the seed for reproducibility
+set.seed(2774)
+
+# Generate the data using lapply
+all_visit3_dat <- dplyr::bind_rows(
+  lapply(dm_neuro$USUBJID, function(id) {
+    # Generate random values for the parameters
+    fbp_suvr_cb <- round(runif(1, 1.25, 2.5), 3)
+    fbb_suvr_com <- round(fbp_suvr_cb - runif(1, min = 0.005, max = 0.01), 3)
+    ftp_suvr_icbgm <- round(fbp_suvr_cb - runif(1, min = 0.1, max = 0.13), 3)
+
+    # Create the dataset using create_records_for_one_id function
+    create_records_for_one_id(
+      usubjid = id,
+      visitnum = 3,
+      fbp_suvr_cb = fbp_suvr_cb,
+      fbb_suvr_com = fbb_suvr_com,
+      ftp_suvr_icbgm = ftp_suvr_icbgm
+    )
+  })
+)
+
+# Create visit 9 dataset for placebo and observational groups ----
+
+pbo_obs_visit9_dat <- all_visit3_dat %>%
+  dplyr::filter(USUBJID %in% c(placebo_group$USUBJID, observation_group$USUBJID)) %>%
+  dplyr::filter(NVTESTCD == "SUVR") %>%
+  dplyr::mutate(
+    VISITNUM = 9,
+    NVORRES = as.character(round(as.numeric(NVORRES) + runif(1, min = 0.1, max = 0.2), 3)),
+    NVORRES
+  )
+
+# Create visit 9 dataset for treatment group ----
+
+treat_visit9_dat <- all_visit3_dat %>%
+  dplyr::filter(USUBJID %in% treatment_group$USUBJID) %>%
+  dplyr::filter(NVTESTCD == "SUVR") %>%
+  dplyr::mutate(
+    VISITNUM = 9,
+    NVORRES = ifelse(NVCAT %in% c("FBP", "FBB"),
+      as.character(round(as.numeric(NVORRES) - runif(1, min = 0.3, max = 0.8), 3)),
+      ifelse(NVCAT == "FTP",
+        as.character(round(as.numeric(NVORRES) - runif(1, min = 0.005, max = 0.01), 3)), NVORRES
+      )
+    )
+  )
+
+# Create visit 13 dataset for placebo and observational groups ----
+
+pbo_obs_visit13_dat <- pbo_obs_visit9_dat %>%
+  dplyr::filter(NVTESTCD == "SUVR") %>%
+  dplyr::mutate(
+    VISITNUM = 13,
+    NVORRES = as.character(round(as.numeric(NVORRES) + runif(1, min = 0.2, max = 0.3), 3)),
+    NVORRES
+  )
+
+# Create visit 13 dataset for treatment group ----
+
+treat_visit13_dat <- treat_visit9_dat %>%
+  # dplyr::filter(USUBJID %in% visit_13_usubjid$USUBJID) %>%
path: data-raw/nv_neuro.R
user: login: Fanny-Gautier
body: Delete unnecessary lines of code
created_at: 2025-04-24T08:38:56Z
author_association: CONTRIBUTOR

PR comments:
user: login: github-actions[bot]
created_at: 2025-04-09T22:57:11Z
body: ![Code Coverage](https://img.shields.io/badge/Code%20Coverage-100%25-success?style=flat)

Package | Line Rate | Health
-------- | --------- | ------
admiralneuro | 100% | ✔
**Summary** | **100%** (3 / 3) | ✔

<!-- Sticky Pull Request Commentcode-coverage -->
author_association: NONE
user: login: Fanny-Gautier
created_at: 2025-04-11T10:50:13Z
body: Should we add the Reference Region in `SUPPNV` as suggested by Chris in #7 ?
![image](https://github.com/user-attachments/assets/9146d0bc-fb62-471e-bd03-107020cc211e)

author_association: CONTRIBUTOR
user: login: Fanny-Gautier
created_at: 2025-04-11T11:04:21Z
body: If we want to add `AG` domain with the Tracer info, we need to add `NVLNKID` in our `NV` domain.
![image](https://github.com/user-attachments/assets/d3e34357-cccb-4bb3-bf5a-f61d197612ce)
![image](https://github.com/user-attachments/assets/ea269ca6-1286-4025-84e5-2aaff1b21044)


author_association: CONTRIBUTOR
user: login: jwang-lilly
created_at: 2025-04-11T21:00:36Z
body: @Fanny-Gautier, @cgpele, any particular reason we couldn't use NVNAM (a subcategory in the context of whole brain as specified in the NVLOC) for reference regions and NVMETHOD for tracer and pipeline? NVMETHOD + NVNAM include all the necessary information needed for deriving Centiloid.
![image](https://github.com/user-attachments/assets/bd59e431-dbf4-4dc9-b98a-ec21b820c776)

Here is the public BioHermes project NV table. 
![{0466C5B0-A20B-46DC-8234-20277B11BC70}](https://github.com/user-attachments/assets/8682c122-c87c-40b5-9168-9fb27ae13fed)

ADNI used NV for PIB and FBP, without involving suppnv. 

author_association: COLLABORATOR
user: login: jwang-lilly
created_at: 2025-04-11T21:31:24Z
body: > If we want to add `AG` domain with the Tracer info, we need to add `NVLNKID` in our `NV` domain. ![image](https://private-user-images.githubusercontent.com/157114584/432728563-d3e34357-cccb-4bb3-bf5a-f61d197612ce.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3NDQ0MDUzMDcsIm5iZiI6MTc0NDQwNTAwNywicGF0aCI6Ii8xNTcxMTQ1ODQvNDMyNzI4NTYzLWQzZTM0MzU3LWNjY2ItNGJiMy1iZjVhLWY2MWQxOTc2MTJjZS5wbmc_WC1BbXotQWxnb3JpdGhtPUFXUzQtSE1BQy1TSEEyNTYmWC1BbXotQ3JlZGVudGlhbD1BS0lBVkNPRFlMU0E1M1BRSzRaQSUyRjIwMjUwNDExJTJGdXMtZWFzdC0xJTJGczMlMkZhd3M0X3JlcXVlc3QmWC1BbXotRGF0ZT0yMDI1MDQxMVQyMDU2NDdaJlgtQW16LUV4cGlyZXM9MzAwJlgtQW16LVNpZ25hdHVyZT0yOTY3OTMwOWVkNDc2ZDc1YWRmZWE4M2Y5MTQ1YWZkNDNlZDU1OTAyNzgyOGE0ZDRjOTU1N2UzZjYyZjUxMzI1JlgtQW16LVNpZ25lZEhlYWRlcnM9aG9zdCJ9.g095B79UngizYf4kfeb66aiA5JYOPN-A6KDuUhMG84A) ![image](https://private-user-images.githubusercontent.com/157114584/432729567-ea269ca6-1286-4025-84e5-2aaff1b21044.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3NDQ0MDUzMDcsIm5iZiI6MTc0NDQwNTAwNywicGF0aCI6Ii8xNTcxMTQ1ODQvNDMyNzI5NTY3LWVhMjY5Y2E2LTEyODYtNDAyNS04NGU1LTJhYWZmMWIyMTA0NC5wbmc_WC1BbXotQWxnb3JpdGhtPUFXUzQtSE1BQy1TSEEyNTYmWC1BbXotQ3JlZGVudGlhbD1BS0lBVkNPRFlMU0E1M1BRSzRaQSUyRjIwMjUwNDExJTJGdXMtZWFzdC0xJTJGczMlMkZhd3M0X3JlcXVlc3QmWC1BbXotRGF0ZT0yMDI1MDQxMVQyMDU2NDdaJlgtQW16LUV4cGlyZXM9MzAwJlgtQW16LVNpZ25hdHVyZT1kYjNjNDY3ZjAyY2IwY2Y5MWJjNDM1NGI1NjQxYTE2NTk3MzZhNDg2YmZhZGZhMGJkZTdjMDk2Yjg4NDhiYzEzJlgtQW16LVNpZ25lZEhlYWRlcnM9aG9zdCJ9.LEjdBlCRixk4Scwbat2EGykGmv6_8gZ3MHtfpKQJV1g)

I think the scanners should have been harmonized using phantom images, so at the stages of SDTM or ADaM, there shouldn't be a need to account for differences among scanners.  
author_association: COLLABORATOR
user: login: cgpele
created_at: 2025-04-16T08:31:55Z
body: @jwang-lilly @meilinjiang  Sorry for the delayed response!  for NVNAM, we typically reserve that for the Vendor name.  I think the  public BioHermes project NV table you referenced also uses it for the vendor, in their case IXICO. I may well be mis-reading your suggestion, but at least at Roche we use NVNAM for the vendor, so I wouldn't suggest repurposing it for reference brain region.

This maybe does promt me to raise a question, probably to @manciniedoardo about the use of the pure SDTM datasets.  Whilst I think if we're creating pure SDTM, the Reference Region should sit in SUPPNV (as demonstrated by @Fanny-Gautier), in reality we (at Roche at least), don't program our ADaMs from pure SDTM (We use NV.NVREFREG in our SDTMv model).  Therefore, is it more important that we align our ADaMs as closely as possible, rather than our SDTM?
author_association: CONTRIBUTOR
user: login: cgpele
created_at: 2025-04-16T09:33:06Z
body: For the tracer information, if I read the SDTM IG correctly, this should also go elsewhere (in AG) - but again I will defer to @manciniedoardo on how aligned our SDTM need to be.  Thinking about the fuction for calculating the centiloids, perhaps it would be more transparent if we seperate out all of the factors needed into their own variables, i.e. for tracer, pipeline, regions etc?
author_association: CONTRIBUTOR
user: login: Fanny-Gautier
created_at: 2025-04-16T15:54:26Z
body: Hi @jwang-lilly ,
Here is the way `AG` and `NV` are linked (using `xxLNKID`) together as per TAUG. Also giving you an example of `AG` domain.
![image](https://github.com/user-attachments/assets/8fe74d8a-d36b-468e-8771-85045380f7bf)

author_association: CONTRIBUTOR
user: login: jwang-lilly
created_at: 2025-04-16T18:43:02Z
body: Tracers are added to AG.  NV is simplified with links to AG.  SUPPNV is used for PET SUVR reference regions.  Thanks everyone for great suggestions.
author_association: COLLABORATOR
user: login: manciniedoardo
created_at: 2025-04-23T09:47:39Z
body: @cgpele @Fanny-Gautier how do @jwang-lilly 's updates look to you?
author_association: COLLABORATOR
user: login: cgpele
created_at: 2025-04-24T09:58:58Z
body: It's looking good to me! thanks a lot! :)
author_association: CONTRIBUTOR