admiral-bds

Generates R code deriving ADaM BDS datasets ADVS and ADLB from SDTM domains using admiral.

13|6|Updated Aug 9, 2026
One-click install
npx skills add https://github.com/kaipingyang/CDISC_training --skill admiral-bds-kaipingyang
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: admiral-bds
Source: https://github.com/kaipingyang/CDISC_training/tree/main/.claude/skills/admiral/admiral-bds
Command: npx skills add https://github.com/kaipingyang/CDISC_training --skill admiral-bds-kaipingyang

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill requires admiral, dplyr, lubridate, pharmaversesdtm, metacore, xportr, and includes references (resource) components.

What problem does it solve? Clinical programmers must manually write complex, CDISC-conformant R code to derive ADaM BDS findings datasets (ADVS, ADLB) from SDTM domains, including baseline flagging, change-from-baseline calculations, and visit mapping — a repetitive, error-prone process requiring deep knowledge of admiral function idioms. ## Core Features & Use Cases - BDS Derivation Workflow: Generates step-by-step R code for parameter assignment, date derivation (ADT, ADY), visit mapping (AVISIT, AVISITN), baseline flagging (ABLFL), and change from baseline (CHG, PCHG) using idiomatic admiral functions. - ADLB-Specific Logic: Derives normal range variables (ANRLO, ANRHI, ANRIND, BNRIND) and supports CTCAE toxicity grade carry-through for laboratory datasets. - QC-Ready Output: Produces code with # REVIEW: annotations at protocol-specific decision points, uniqueness assertions, and required-variable checks for regulatory traceability. - Use Case: Given SDTM VS data, a completed ADSL, and an ADaM spec, generate a complete ADVS derivation program with baseline flags, change from baseline, and analysis flags ready for human QC review. ## Quick Start Ask the agent to derive an ADVS dataset from the SDTM VS domain using the study's ADaM BDS specification and the completed ADSL dataset.

Frequently Asked Questions about admiral-bds

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I derive an ADVS dataset from SDTM VS using admiral in R?

Merge ADSL treatment dates and flags into VS, map VSTESTCD to PARAMCD via derive_vars_merged_lookup(), derive ADT and ADY with derive_vars_dt() and derive_vars_dy(), then flag baseline with restrict_derivation() plus derive_var_extreme_flag() and compute BASE, CHG, and PCHG.

How do I flag baseline records (ABLFL) in ADaM BDS datasets?

Use restrict_derivation() combined with derive_var_extreme_flag() scoped to records on or before TRTSDT with non-missing AVAL. Avoid manual mutate() or filter() logic, which can leave incorrect flags on complex pre-treatment histories.

What is the difference between derive_vars_merged() and derive_vars_merged_lookup() in admiral?

derive_vars_merged() is used for ADSL backbone merges, while derive_vars_merged_lookup() is required for parameter code mappings like PARAMCD/PARAM/PARAMN. The lookup variant retains unmatched records so they can be filtered via filter(!is.na(PARAMCD)).

Does this skill support ADaM datasets beyond ADVS and ADLB?

No. The initial release covers only ADVS and ADLB. ADEG, ADRS, ADEF, ADAE, and ADTTE are explicitly out of scope and planned as separate follow-on skills, as are date-driven visit windowing and multiple BASETYPE definitions.

What inputs are required before deriving a BDS dataset?

You need the SDTM source domain (VS or LB), a completed ADSL containing TRTSDT, TRTEDT, and population flags, an ADaM BDS specification with parameter lists and visit maps, and study context such as the baseline window and ANL01FL criteria from the SAP.

Why should AVISIT not be passed through directly from SDTM VISIT?

AVISIT is an ADaM-defined analysis grouping that may consolidate or rename multiple SDTM visits. Direct passthrough silently produces incorrect results in dose-titration or extension studies, so AVISIT must be assigned from a spec-driven visit lookup table.