adam-derive

Generates admiral-based R code templates for creating ADaM analysis datasets from SDTM inputs.

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

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? Clinical data staff without R programming experience struggle to write ADaM derivation code from scratch. This Skill turns a natural-language description of a target analysis dataset into working admiral framework code, covering ADSL, ADAE, ADVS, ADTTE and other common ADaM datasets. ## Core Features & Use Cases - Dataset Templates: Provides ready-to-adapt R code templates for ADSL, ADAE, and ADTTE built on admiral, dplyr, pharmaversesdtm, and xportr. - Derivation Function Reference: Includes a lookup table of derive_* functions (derive_vars_dt, derive_vars_merged, derive_var_trtemfl, derive_param_tte, and more) with typical use scenarios. - Pitfall Guidance: Documents real-world errors such as duplicate baseline records, non-unique BDS ordering, and derive_param_tte pipeline misuse, with concrete fixes. - Use Case: A clinical data manager asks for an ADAE dataset flagging treatment-emergent adverse events; the Skill produces code merging ADSL treatment dates, deriving ASTDT/AENDT, and setting TRTEMFL. ## Quick Start Ask the assistant to generate an ADSL dataset from SDTM DM and EX domains using admiral, deriving treatment groups and start/end dates.

Frequently Asked Questions about adam-derive

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

FAQPage Schema
How do I create an ADSL dataset with admiral in R?

Start from the SDTM DM domain, filter screen failures, map ARM to TRT01P and ACTARM to TRT01A, then use derive_vars_dt to convert RFSTDTC and RFENDTC into TRTSDT and TRTEDT. Export the result with xportr_write to an XPT file.

How to flag treatment-emergent adverse events in ADAE?

Use derive_var_trtemfl after merging TRTSDT and TRTEDT from ADSL with derive_vars_merged and deriving ASTDT and AENDT from AESTDTC and AEENDTC. The function sets TRTEMFL to Y when the AE falls within the treatment period.

Can I practice ADaM derivation without real SDTM data?

Yes, install the pharmaversesdtm and pharmaverseadam packages and use their built-in test datasets such as pharmaversesdtm::dm and pharmaversesdtm::ae. All templates run against this data without needing real study files.

Why does derive_var_base fail with duplicate baseline records?

The SDTM baseline flag such as LBBLFL may mark multiple records per subject and parameter, triggering a signal_duplicate_records error. Fix it by first deriving a unique last-record flag with derive_var_extreme_flag, then calling derive_var_base filtered on that flag.

Why does derive_param_tte report PARAMCD is missing?

derive_param_tte expects the input dataset to already contain PARAMCD for duplicate-endpoint checks. When creating the first endpoint such as OS, call it without piping a dataset in, then pipe subsequent endpoints onto the result.