Skip to content

Commit 1c6242f

Browse files
authored
Merge branch 'main' into 106-improve-test-covergae
2 parents 0e926d8 + 14ac83e commit 1c6242f

34 files changed

+568
-798
lines changed

DESCRIPTION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
Type: Package
22
Package: admiralneuro
33
Title: Neuroscience Extension Package for ADaM in 'R' Asset Library
4-
Version: 0.1.0.9005
4+
Version: 0.1.0.9009
55
Authors@R: c(
66
person("Jian", "Wang", , "wang_jian_wj@lilly.com", role = c("aut", "cre"),
77
comment = c(ORCID = "0009-0002-4677-3781")),

NAMESPACE

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
# Generated by roxygen2: do not edit by hand
22

33
export(compute_centiloid)
4+
export(compute_upsit_percentile)
45
importFrom(admiral,derive_vars_dy)
56
importFrom(admiraldev,assert_character_scalar)
67
importFrom(admiraldev,assert_character_vector)

NEWS.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,15 @@
33
## Updates of Existing Functions
44

55
- Improved test coverage in `compute_centiloid()` function when invalid tracer combination is provided. (#106)
6+
## New features
7+
8+
## Documentation
9+
10+
## Template programs
11+
12+
## Various
13+
14+
- Moved test SDTM datasets `dm_neuro`, `nv_neuro`, `suppnv_neuro` and `ag_neuro` from `{admiralneuro}` to `{pharmaversesdtm}`. (#92)
615

716
# admiralneuro 0.1.0
817

R/compute_upsit_percentile.R

Lines changed: 94 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,94 @@
1+
#' Compute UPSIT Percentile Based on Age, Sex, and Score
2+
#'
3+
#' This function computes the UPSIT (University of Pennsylvania Smell
4+
#' Identification Test) percentile for a given subject based on their age,
5+
#' sex, and UPSIT raw score. The percentile is determined by looking up the
6+
#' corresponding value in a normative reference table.
7+
#'
8+
#' @md
9+
#'
10+
#' @param sex Sex of the subject. Must be either "M" or "F"
11+
#' A character string of either "M" or "F" is expected
12+
#'
13+
#' @permitted [char_scalar]
14+
#'
15+
#' @param age Age of the subject in years.
16+
#'
17+
#' @permitted [num_scalar]
18+
#'
19+
#' @param upsit_score The UPSIT ranging from 0 to 40.
20+
#' Higher scores indicate better olfactory function.
21+
#'
22+
#' @permitted [num_scalar]
23+
#'
24+
#' @details
25+
#' The function uses an internal lookup table (`upsit_lookup`) that contains
26+
#' normative percentile data stratified by sex, age range, and UPSIT score.
27+
#' The lookup table is based on published normative data.
28+
#'
29+
#' Age ranges in the lookup table include:
30+
#' \itemize{
31+
#' \item 50-54 years
32+
#' \item 55-59 years
33+
#' \item 60-64 years
34+
#' \item 65-69 years
35+
#' \item 70-74 years
36+
#' \item 75-79 years
37+
#' \item 80+ years (no upper limit)
38+
#' }
39+
#'
40+
#' The function is designed to work efficiently in vectorized operations
41+
#' within data processing pipelines (e.g., with `dplyr::mutate()`)
42+
#'
43+
#' @references
44+
#' Brumm MC, et. al., Updated Percentiles for the University of
45+
#' Pennsylvania Smell Identification Test in Adults 50 Years of Age and Older.
46+
#' \doi{10.1212/WNL.0000000000201463}
47+
#'
48+
#' @return A numeric percentile value.
49+
#' The UPSIT percentile value corresponding to the input
50+
#' parameters. Returns `NA_real_` if no matching entry is found in the
51+
#' lookup table.
52+
#'
53+
#' @keywords com_bds_findings
54+
#' @family com_bds_findings
55+
#'
56+
#' @export
57+
#'
58+
#' @examplesx
59+
#' @caption Look up for male percentile
60+
#' @info A 52 years old male with upsit raw score of 25
61+
#' @code compute_upsit_percentile(sex = "M", age = 52, upsit_score = 25)
62+
#'
63+
#' @caption Look up for female percentile
64+
#' @info A 81 years old female with upsit raw score of 30
65+
#' @code compute_upsit_percentile(sex = "F", age = 81, upsit_score = 30)
66+
#'
67+
#' @caption Returns NA
68+
#' @info Minimal age is 50 and score of 0 and 40, return NA if no match found
69+
#' @code compute_upsit_percentile(sex = "M", age = 45, upsit_score = 25)
70+
#'
71+
compute_upsit_percentile <- function(sex, age, upsit_score) {
72+
# Vectorized implementation
73+
n <- length(sex)
74+
result <- rep(NA_real_, n)
75+
76+
# Process each element
77+
for (i in seq_len(n)) {
78+
# Find matching row in lookup table
79+
# Handle age_high = NA for "80+" cases
80+
idx <- which(
81+
upsit_lookup$sex == sex[i] &
82+
upsit_lookup$upsit == upsit_score[i] &
83+
age[i] >= upsit_lookup$age_low &
84+
(is.na(upsit_lookup$age_high) | age[i] <= upsit_lookup$age_high)
85+
)
86+
87+
# Assign percentile if match found
88+
if (length(idx) > 0) {
89+
result[i] <- upsit_lookup$upsit_pctl[idx[1]]
90+
}
91+
}
92+
93+
result
94+
}

R/data.R

Lines changed: 0 additions & 109 deletions
Original file line numberDiff line numberDiff line change
@@ -1,112 +1,3 @@
1-
#' Demographic Dataset - Neuro
2-
#'
3-
#' An updated SDTM DM dataset subset with age appropriate Alzheimer's Disease patients
4-
#' @keywords datasets
5-
#' @family datasets
6-
"dm_neuro"
7-
8-
# This file is automatically generated by data-raw/nv_neuro.R.
9-
# Please rerun nv_enuro.R to create it again.
10-
# Manual edits are not recommended, as changes may be overwritten.
11-
#' Nervous System Findings Dataset
12-
#'
13-
#' 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
14-
#' @keywords datasets
15-
#' @family datasets
16-
#'
17-
#' @name nv_neuro
18-
#' @title Nervous System Findings Dataset
19-
#' @description A SDTM NV domain dataset containing nervous system findings and measurements
20-
#' @docType data
21-
#' @format A data frame with 20 columns:
22-
#' \describe{
23-
#' \item{STUDYID}{Study Identifier}
24-
#' \item{DOMAIN}{Domain Abbreviation}
25-
#' \item{USUBJID}{Unique Subject Identifier}
26-
#' \item{NVSEQ}{Sequence Number}
27-
#' \item{NVLNKID}{Link ID}
28-
#' \item{NVTESTCD}{Short Name of Nervous System Test}
29-
#' \item{NVTEST}{Name of Nervous System Test}
30-
#' \item{NVCAT}{Category for Nervous System Test}
31-
#' \item{NVLOC}{Location Used for the Measurement}
32-
#' \item{NVMETHOD}{Method of Test or Examination}
33-
#' \item{NVNAM}{Vendor Name}
34-
#' \item{NVORRES}{Result or Finding in Original Units}
35-
#' \item{NVORRESU}{Original Units}
36-
#' \item{NVSTRESC}{Character Result/Finding in Std Format}
37-
#' \item{NVSTRESN}{Numeric Result/Finding in Standard Units}
38-
#' \item{NVSTRESU}{Standard Units}
39-
#' \item{VISITNUM}{Visit Number}
40-
#' \item{VISIT}{Visit Name}
41-
#' \item{NVDTC}{Date/Time of Collection}
42-
#' \item{NVDY}{Study Day of Collection}
43-
#' \item{NVLOBXFL}{Last Observation Before Exposure Flag}
44-
#' }
45-
#'
46-
#' @source Constructed using `dm_neuro` from `{admiralneuro}` package for USUBJID and cohort information, `vs` from `{pharmaversesdtm}` for visit schedule such as VISIT, NVDTC, NVDY
47-
"nv_neuro"
48-
49-
# This file is automatically generated by data-raw/suppnv_neuro.R
50-
# Please rerun suppnv_neuro.R to create it again.
51-
# Manual edits are not recommended, as changes may be overwritten.
52-
#' Supplemental Nervous System Findings Dataset
53-
#'
54-
#' A SDTM SUPPNV domain dataset
55-
#' @keywords datasets
56-
#' @family datasets
57-
#'
58-
#' @name suppnv_neuro
59-
#' @title Supplemental Nervous System Findings Dataset
60-
#' @description A SDTM SUPPNV domain dataset containing reference regions used for SUVR calculation
61-
#' @docType data
62-
#' @format A data frame with 8 columns:
63-
#' \describe{
64-
#' \item{STUDYID}{Study Identifier}
65-
#' \item{RDOMAIN}{Related Domain Abbreviation}
66-
#' \item{USUBJID}{Unique Subject Identifier}
67-
#' \item{IDVAR}{Identifying Variable}
68-
#' \item{IDVARVAL}{Identifying Variable Value}
69-
#' \item{QNAM}{Qualifier Variable Name}
70-
#' \item{QLABEL}{Qualifier Variable Label}
71-
#' \item{QVAL}{Data Value}
72-
#' \item{QORIG}{Origin}
73-
#' \item{QEVAL}{Evaluator}
74-
#' }
75-
#' @source Constructed using `nv_neuro` from `{admiralneuro}` package
76-
"suppnv_neuro"
77-
78-
# This file is automatically generated by data-raw/ag_neuro.R
79-
# Please rerun ag_neuro.R to create it again.
80-
# Manual edits are not recommended, as changes may be overwritten.
81-
#' Procedure Agents for Nervous System Dataset
82-
#'
83-
#' A SDTM AG domain dataset
84-
#' @keywords datasets
85-
#' @family datasets
86-
#'
87-
#' @name ag_neuro
88-
#' @title Procedure Agents for Nervous System Dataset
89-
#' @description A SDTM AG domain dataset containing procedure agents for nervous system
90-
#' @docType data
91-
#' @format A data frame with 12 columns:
92-
#' \describe{
93-
#' \item{STUDYID}{Study Identifier}
94-
#' \item{DOMAIN}{Domain Abbreviation}
95-
#' \item{USUBJID}{Unique Subject Identifier}
96-
#' \item{AGSEQ}{Sequence Number}
97-
#' \item{AGTRT}{Reported Agent Name}
98-
#' \item{AGCAT}{Category for Category}
99-
#' \item{AGDOSE}{Dose per Administration}
100-
#' \item{AGDOSEU}{Dose Units}
101-
#' \item{AGROUTE}{Route of Administration}
102-
#' \item{AGLNKID}{Link ID}
103-
#' \item{VISITNUM}{Visit Number}
104-
#' \item{VISIT}{Visit Name}
105-
#' \item{AGSTDTC}{Start Date/Time of Agent}
106-
#' }
107-
#' @source Constructed using `nv_neuro` from `{admiralneuro}` package
108-
"ag_neuro"
109-
1101
#' Amyloid PET Scan Analysis Dataset - Neuro
1112
#'
1123
#' An updated ADaM ADAPET dataset using NV, AG, SUPPNV, ADSL

R/sysdata.rda

1.09 KB
Binary file not shown.

README.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,9 @@
55

66
Neuroscience extension package for ADaM in R Asset Library `{admiral}`
77

8+
*Explore all the other packages in the [{admiral} ecosystem](https://pharmaverse.org/e2eclinical/adam/)
9+
to learn more about ADaM programming in R.*
10+
811
## Purpose
912

1013
To provide a complementary (to `{admiral}`) toolbox that enables users

_pkgdown.yml

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,26 @@ template:
55
math-rendering: mathjax
66
params:
77
bootswatch: flatly
8+
includes:
9+
in_header: |
10+
<script
11+
async
12+
src="https://widget.kapa.ai/kapa-widget.bundle.js"
13+
data-website-id="2c7249cc-f1dc-4a63-8674-6ecbcb34d95c"
14+
data-project-name="admiral"
15+
data-project-color="#2c3e50"
16+
data-project-logo="https://pharmaverse.github.io/admiralneuro/logo.png"
17+
data-consent-required="true"
18+
data-user-analytics-cookie-enabled="true"
19+
data-consent-screen-title="Help us improve our AI assistant"
20+
data-consent-screen-disclaimer="By clicking 'Allow tracking', you consent to anonymous user tracking which helps us improve our service. We don't collect any personally identifiable information."
21+
data-consent-screen-accept-button-text="Allow tracking"
22+
data-consent-screen-reject-button-text="No, thanks"
23+
data-modal-example-questions="Tell me a little about the {admiralneuro} package., What are some important {admiralneuro} functions and what do they do?"
24+
data-modal-z-index="9999"
25+
></script>
26+
search:
27+
exclude: ['news/index.html']
828
repo:
929
url:
1030
home: https://github.com/pharmaverse/admiralneuro

data-raw/ag_neuro.R

Lines changed: 0 additions & 73 deletions
This file was deleted.

0 commit comments

Comments
 (0)