sdtm-oak

Generates R code deriving CDISC SDTM domains from raw EDC data using sdtm.oak.

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

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill requires sdtm.oak, dplyr, tibble, and includes references (resource) components.

What problem does it solve? Mapping raw EDC/eCRF clinical data to CDISC SDTM domains requires choosing the correct derivation algorithm per variable, applying controlled terminology recoding, and producing ISO 8601 dates — mistakes like wrong codelists or manual date parsing silently corrupt submission data. This Skill produces executable, traceable R code following the sdtm.oak algorithm framework with built-in QC review annotations. ## Core Features & Use Cases - Algorithm selection guidance: Chooses among assign_no_ct(), assign_ct(), hardcode_ct(), hardcode_no_ct(), assign_datetime(), and condition_add() based on whether each variable has controlled terminology and whether values come from raw data or are hardcoded. - Full domain workflow: Covers Events (AE, CM, MH), Interventions (EX), Findings (VS, LB, EG with per-test stacking), and SUPP-- supplemental domains, including sequence numbers, study day derivation, and baseline flags. - QC traceability: Places # REVIEW: annotations at every protocol-specific decision point (date formats, codelist selection, baseline visit definitions) and enforces an output checklist with required-variable and duplicate-SEQ checks. - Use Case: Given a raw adverse events dataset and a CT specification CSV, generate a complete AE domain derivation script with AETERM, AESEV, AESTDTC, AESEQ, and AESTDY, ready for QC review. ## Quick Start Ask the assistant to derive an SDTM AE domain from your raw adverse events dataset using sdtm.oak, providing the raw data and controlled terminology specification.

Frequently Asked Questions about sdtm-oak

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

FAQPage Schema
How do I map raw clinical data to SDTM domains in R?

Use the sdtm.oak package workflow: call generate_oak_id_vars() on the raw dataset first, then pipe through assign_no_ct(), assign_ct(), or hardcode_ct() per variable depending on controlled terminology, and finish with derive_seq() and derive_study_day(). Always inspect raw column names before writing derivations.

How do I convert raw dates to SDTM ISO 8601 DTC variables?

Use assign_datetime() with a raw_fmt string matching the source format, such as "d-m-y" or c("y-m-d", "H:M") for combined date-time columns. Never use as.Date() or string manipulation, since only assign_datetime() handles partial dates and unknown placeholders like "UN" or "UNK".

What is the difference between assign_ct and assign_no_ct in sdtm.oak?

assign_ct() recodes raw values against a CDISC controlled terminology codelist via ct_spec and ct_clst, used for variables like AESEV or AESER. assign_no_ct() carries raw free-text values directly, used for variables like AETERM or VSORRES with no codelist.

Why does assign_ct return uppercased raw values instead of recoded terms?

This happens when the ct_clst name does not match the codelist_code column in the CT specification, or when raw values have no matching term. No error is raised, so always validate the CT spec with assert_ct_spec() and check output frequency tables after derivation.

How do I build SDTM findings domains like VS or LB with sdtm.oak?

Derive each test parameter separately with its own generate_oak_id_vars() and hardcode_ct() block for TESTCD, then stack all parameter blocks with bind_rows(). Add common variables like DOMAIN, USUBJID, study day, and VSBLFL only after stacking.

What R packages are required to run sdtm.oak SDTM derivations?

The workflow requires R with sdtm.oak version 0.2.0 or higher, plus dplyr and tibble. You also need raw EDC/eCRF data, a controlled terminology specification CSV, and the DM domain when deriving study days or baseline flags.