Bio Clinical Biostatistics Cdisc Data 标志

Bio Clinical Biostatistics Cdisc Data

组织
PKU-YuanGroup
bio-clinical-biostatistics-cdisc-data

读取、验证并整理 CDISC SDTM 和 ADaM 临床试验数据,以供分析使用。涵盖 SDTM 领域数据合并(DM、AE、EX、VS、LB、DS)、具备可追溯性的 ADaM 架构(ADSL、BDS、OCCDS、ADTTE)、治疗期间出现的不良事件惯例、基线推导、SUPPQUAL/NSV 处理、Define-XML 2.1,以及 Pinnacle 21 / CORE 验证。适用于处理 CDISC SDTM/ADaM 格式的临床试验数据集、准备可用于分析的数据,或为监管申报进行验证。

Add to TypingMind

概览

发布者PKU-YuanGroup
代码仓库OpenAI4S
技能名称bio-clinical-biostatistics-cdisc-data
星标数
622
复刻数
72
附带文件
2
许可协议MIT
链接
  • Markdown 格式的指令

    模型按需加载 SKILL.md 文件,因此只有在请求确实与该技能匹配时才会消耗 Token。

  • 兼容任何大语言模型

    AI 技能采用纯 Markdown,而非特定提供商的代码,因此可搭配 GPT、Claude、Gemini、Grok 或本地模型使用。

  • 2 个附带文件

    模型执行任务时可读取的脚本、模板和参考资料。这些文件为只读文件,绝不会被执行。

  • 开源

    由 PKU-YuanGroup 发布于 GitHub。请在安装前查看技能的源文件。

安装

在 TypingMind 中安装 Bio Clinical Biostatistics Cdisc Data AI 技能,即可搭配任意大语言模型使用;也可以将其放入其他支持读取 SKILL.md 的智能体中。

1

安装到 TypingMind

TypingMind 可直接从 GitHub 文件夹安装技能:读取 SKILL.md,打包资源文件,并将结果保存在本地。

  1. 打开应用,前往“插件 → 技能”。
  2. 选择“从 GitHub 安装”。
  3. 粘贴下方的技能文件夹 URL 并确认。
    https://github.com/PKU-YuanGroup/OpenAI4S/tree/main/skills/bioskills/bio-clinical-biostatistics-cdisc-data-handling
  4. 请在每个需要使用该技能的聊天中启用它。
依次选择“插件 → 技能 → 添加技能 → 从 GitHub URL 导入”,然后粘贴文件夹 URL 并点击“继续”。
2

安装到其他智能体

任何支持 Agent Skills 格式的智能体都可以使用此技能,只需将文件夹复制到该智能体的技能目录中。

Claude Code — .claude/skills
git clone --depth 1 https://github.com/PKU-YuanGroup/OpenAI4S.git /tmp/OpenAI4S
mkdir -p .claude/skills
cp -r /tmp/OpenAI4S/skills/bioskills/bio-clinical-biostatistics-cdisc-data-handling .claude/skills/bio-clinical-biostatistics-cdisc-data
复制后,请重启 Claude Code,以加载新技能。

在 TypingMind 中使用此技能

在任意 TypingMind 聊天中启用 Bio Clinical Biostatistics Cdisc Data,后续即可交由模型处理。技能的名称和描述会放在系统提示词中,一旦请求匹配,模型就会自动加载完整指令,无需您手动调用,且在实际使用前不会消耗 Token。

一旦请求与技能匹配,模型就会自动加载 Bio Clinical Biostatistics Cdisc Data。

兼容任何 AI 模型

AI 技能是纯 Markdown 指令,而非特定提供商的代码,因此 Bio Clinical Biostatistics Cdisc Data 不局限于最初适配的模型。只需在 TypingMind 中安装一次,即可搭配 GPT-5、Claude、Gemini、Grok、DeepSeek、Mistral、Llama 或您自行运行的本地模型使用,全程使用您自己的 API 密钥。

  • 仅在需要时加载

    系统提示词中仅包含技能名称和描述。首次遇到匹配的请求时才会加载完整指令,因此技能未使用时,这些指令不会消耗 Token。

  • 在聊天中切换模型

    技能是指令而非代码,因此切换模型不会导致技能失效,新模型会读取同一个 SKILL.md。

技能指令

这是模型会加载的 SKILL.md 内容。请在安装前阅读,因为技能就是模型将遵循的指令。

Version Compatibility

Reference examples tested with: pyreadstat 1.2+, pandas 2.1+, numpy 1.26+. CDISC standards referenced: SDTM 2.0 / SDTMIG 3.4 (SDTM 3.0 / SDTMIG 4.0 in public review through April 2026); ADaMIG v1.3 (2021); OCCDS v1.1 (Nov 2021); BDS-for-TTE v1.0; Define-XML 2.1 (FDA-recommended for studies starting on/after March 15, 2023); Dataset-JSON v1.1 (Dec 2024; FDA Federal Register notice April 2025); Pinnacle 21 Community 4.0+; CORE (CDISC Open Rules Engine, 2021). Define-XML 2.1 FDA support began March 15, 2021 and is required for studies starting on/after March 15, 2023.

Before using code patterns, verify installed versions match. If versions differ:

  • Python: pip show <package> then help(module.function) to check signatures
  • R packages cited (essential for ADaM derivation): admiral (Roche/openpharma), metacore, metatools, xportr

If code throws ImportError, AttributeError, or TypeError, introspect the installed package and adapt the example to match the actual API rather than retrying.

CDISC SDTM and ADaM Data Handling

"Load clinical trial data" -> Parse CDISC SDTM domain files; build or consume ADaM analysis-ready datasets; preserve subject-level and event-level structure; respect traceability and validation expectations for regulatory submission.

  • Python: pyreadstat.read_xport(), pd.read_sas(), pd.merge()
  • R: haven::read_xpt(), admiral for ADaM derivation, Pinnacle21 or CORE for validation

Aggregation Strategy Taxonomy -- Choose the Right Question

StrategyScientific question answeredExample endpointFails when
Any event (binary)Does treatment change probability of experiencing the event at all?Had any serious AE: Yes/NoTreatment changes event burden but not anyone-event probability
Event countDoes treatment change burden of events per patient?Total AE count per subjectSubjects with 1 vs 10 events treated equivalently
Maximum severityDoes treatment shift patients toward more severe manifestations?Worst AESEV per subjectConfounded with event count (more events -> higher chance of severe)
First event + timeDoes treatment delay onset of the event?Time to first serious AE (TTE)Multiple events per subject ignored
Rate (events per person-time)What is the per-time-unit rate?AEs per subject-yearRequires exposure-time tracking; differential dropout biases rates
Composite (per ICH E9 R1)Event becomes part of endpoint definitionDeath = treatment failureDirection of components conflict; needs hierarchy

These are NOT interchangeable. A drug might not change the proportion with AEs (binary: no effect) but increase events per patient (count: harmful). The choice must be pre-specified in the SAP based on the scientific question, not analytic convenience.

Decision Tree by Scenario

ScenarioRecommended aggregationWhy
Primary safety endpoint, single SAE eventAny event (binary); analyse with logisticStandard regulatory; cite FDA Safety Reporting Guidance
Total adverse-event burden across studyEvent count per subject; analyse with Poisson or negative binomialCaptures all events; sandwich SE recommended
Toxicity grade comparison across armsMax severity per subject; ordinal logistic with PO checkPreserves grade ordering; cite Brant test for PO
Time-to-first AE (Kaplan-Meier visualisation)First event + time; censor non-eventsSee clinical-biostatistics/survival-analysis
Rate of exacerbations per patient-yearRate via negative binomial with offset for exposure timeStandard in COPD/asthma trials
Composite endpoint (e.g., MACE)Component-level definition with hierarchyPre-specify per ICH E9(R1) composite strategy
Stratification factor extractionUse STRATA1, STRATA2 from RANDB or DM SUPPMust appear in analysis (Kahan-Morris 2012)
Baseline value derivationVSBLFL='Y' / LBBLFL='Y'; derive latest pre-dose only if flag missingTrust SDTM flag when present

SDTM vs ADaM -- The Regulatory Layer Cake

LayerStandardPurposeGranularityExamples
Source CRFEDC systemRaw data captureForm/pageRave, Medidata, Veeva
SDTMSDTM 2.0 / SDTMIG 3.4Tabulation; "what happened"One row per observationDM, AE, EX, VS, LB, DS
ADaMADaMIG v1.3 (2021); v3.0 in developmentAnalysis-ready; "one-PROC-away from CSR table"Subject (ADSL), parameter-timepoint (BDS), occurrence (OCCDS)ADSL, ADAE, ADLB, ADTTE, ADRS
TLFSponsor SAS / R / PythonTables, listings, figures for CSROutputStatistical methods section, demographic table, primary efficacy

The ADaM Fundamental Principles (the "ROT" document):

  1. Analysis-ready (one procedure call -> the analysis result)
  2. Traceability (every value links back to SDTM via metadata)
  3. Clear/unambiguous communication via Define-XML
  4. Naming conventions (PARAM, PARAMCD, AVAL, AVALC, BASE, CHG, PCHG, ABLFL, ANL01FL, ...)
  5. Structural rules (ADSL one row per subject; BDS one row per subject/parameter/timepoint/analysis flag)

Postdoc reading: the ADaM IG v1.3 PDF (cdisc.org), ADaM ROT, FDA Study Data Technical Conformance Guide (current 2024 version), Pinnacle 21 validation rule catalog, PHUSE Connect 2023-2025 conference proceedings.

SDTM Domain Overview

DomainLevelDescriptionKey Variables
DMSubjectDemographics (one row per subject)USUBJID, ARM, ARMCD, ACTARM, ACTARMCD, AGE, SEX, RACE, RFSTDTC, RFXSTDTC, RFENDTC
AEEventAdverse events (multiple per subject)USUBJID, AETERM, AEDECOD, AEBODSYS, AESEV, AESER, AESTDTC, AEENDTC
EXEventDrug exposure/dosingUSUBJID, EXTRT, EXDOSE, EXSTDTC, EXENDTC
VSEventVital signsUSUBJID, VSTESTCD, VSSTRESN, VSBLFL, VISIT
LBEventLab resultsUSUBJID, LBTESTCD, LBSTRESN, LBSTRESC, LBORRES, LBBLFL, LBSPEC
DSEventDispositionUSUBJID, DSDECOD, DSSTDTC
SEEventSubject elements (treatment epochs)USUBJID, ETCD, SESTDTC, SEENDTC
MHEventMedical historyUSUBJID, MHDECOD, MHCAT
CMEventConcomitant medicationsUSUBJID, CMDECOD, CMSTDTC, CMENDTC

USUBJID = STUDYID-SITEID-SUBJID is the universal merge key. Subject-level domains (DM) have one row per USUBJID; event-level domains have multiple.

ARM vs ACTARM: ARM is planned treatment from randomisation; ACTARM is actual treatment received. In crossover designs, ARM differs from ACTARM by definition; in parallel-arm trials, they diverge when subjects are randomised to one arm but receive another (per-protocol violations). Primary analyses use ARM (ITT); safety uses ACTARM.

RFSTDTC vs RFXSTDTC: RFSTDTC is "first study activity date" (typically screening start); RFXSTDTC is "first treatment date." For treatment-emergent adverse event (TEAE) calculations, ALWAYS use RFXSTDTC (per ICH E2A) — RFSTDTC includes screening AEs which are not treatment-emergent.

Reading .xpt Files

python
import pyreadstat
import pandas as pd

# pyreadstat (recommended -- handles SAS metadata)
dm, meta = pyreadstat.read_xport('dm.xpt')
# meta.column_names, meta.column_labels, meta.variable_value_labels

# pandas built-in (SAS XPORT v5)
dm = pd.read_sas('dm.xpt', format='xport', encoding='utf-8')

# CSV fallback (common in academic datasets)
dm = pd.read_csv('DM.csv')

When pyreadstat is available, the metadata object provides column labels, value labels, and format information lost with other readers. Critical for analysis-dataset derivation: the metadata carries the controlled-terminology codelist, essential for handling values like AESEV ('MILD'/'MODERATE'/'SEVERE') with semantic ordering.

SAS XPT v5 vs Dataset-JSON -- The 2025-2026 Transition

SAS XPT v5 is the current FDA submission format but dates to 1995, with constraints:

  • 8-character variable names (so LBSTRESN is a max-length name)
  • 200-character text values
  • No UTF-8 (ASCII only) -> problematic for multilingual trials
  • Single dataset per file

Dataset-JSON v1.1 (CDISC, December 2024; FDA Federal Register notice April 2025) is the modern replacement. PHUSE-CDISC-FDA pilot has demonstrated drop-in feasibility. FDA adoption timeline pending as of mid-2026; EMA and PMDA exploring in parallel.

Pragmatic position: for the next ~2 years, SAS XPT v5 will remain the de facto submission format; sponsors should architect for Dataset-JSON migration but maintain XPT compliance.

Joining Domains -- The Right Way

python
import pandas as pd

dm = pd.read_csv('DM.csv')
ae = pd.read_csv('AE.csv')

# WRONG: merging event-level directly onto subject-level inflates rows
# RIGHT: aggregate first, then merge
any_serious = ae.groupby('USUBJID')['AESER'].apply(lambda x: (x == 'Y').any()).reset_index()
any_serious.columns = ['USUBJID', 'HAD_SERIOUS_AE']

analysis = dm.merge(any_serious, on='USUBJID', how='left')
analysis['HAD_SERIOUS_AE'] = analysis['HAD_SERIOUS_AE'].fillna(False)

Always use how='left' when merging onto DM to preserve all randomised subjects, even those with no events. Fill missing event indicators with 0 or False.

Aggregation strategy must follow the scientific question

StrategyScientific questionExample
Any event (binary)Does treatment increase probability of experiencing the event at all?Had any serious AE: yes/no
Event countDoes treatment increase event burden per patient?Total AE count per subject
Maximum severityDoes treatment shift toward more severe manifestations?Worst AESEV per subject
First event + timeDoes treatment delay onset?Time to first serious AE
Rate (events per person-time)What is the per-time-unit rate?AEs per subject-year

These are NOT interchangeable. A drug might not change the proportion with AEs (binary: no effect) but increase events per patient (count: harmful). The choice must follow the SAP, not analytic convenience.

python
# Count events per subject
ae_counts = ae.groupby('USUBJID').size().reset_index(name='AE_COUNT')

# Maximum severity per subject (map to numeric first -- string max is unreliable)
severity_map = {'MILD': 1, 'MODERATE': 2, 'SEVERE': 3}
ae['AESEV_NUM'] = ae['AESEV'].map(severity_map)
max_severity = ae.groupby('USUBJID')['AESEV_NUM'].max().reset_index()

# Specific event: COVID-19 adverse event
covid_ae = ae[ae['AEDECOD'] == 'COVID-19']
covid_ae['AESEV_NUM'] = covid_ae['AESEV'].map(severity_map)
had_covid = covid_ae.groupby('USUBJID')['AESEV_NUM'].max().reset_index()
had_covid.columns = ['USUBJID', 'COVID_SEVERITY']

analysis = dm.merge(had_covid, on='USUBJID', how='left')
analysis['HAD_COVID'] = analysis['COVID_SEVERITY'].notna().astype(int)

ADaM Architecture -- The Postdoc Deep Dive

ADSL (Subject-Level) -- The Spine

Exactly one row per subject. Every other ADaM dataset must merge to ADSL on USUBJID. Standard variables:

  • USUBJID -- universal subject ID
  • TRT01A / TRT01P / ACTARMCD / ARMCD -- planned and actual treatment, period 1
  • TRTSDT / TRTEDT -- treatment start/end dates (derived from EX, not SDTM)
  • AGE, SEX, RACE, ETHNIC -- demographics from DM
  • RANDDT -- randomisation date
  • DCSREAS / DCSREASP / DCSREASCD -- discontinuation reason (coded + verbatim)
  • Population flags: ITTFL, FASFL, SAFFL, PPROTFL, EFFFL (Y/N flags for analysis populations)
  • Stratification factors: STRATA1, STRATA2 (from randomisation)
  • Baseline covariates that will be used as model covariates downstream

BDS (Basic Data Structure) -- Long Format Analysis Data

One row per subject per parameter per analysis timepoint per analysis flag. Used for ADVS, ADLB, ADEFF, ADQS, ADTTE.

Required variables:

  • USUBJID, STUDYID -- merge keys
  • PARAM, PARAMCD, PARAMN -- parameter name, code, number
  • AVISIT, AVISITN -- analysis visit name, number
  • ADT, ADY -- analysis date, analysis day (relative to TRTSDT)
  • AVAL, AVALC -- analysis value (numeric, character)
  • BASE -- baseline value (replicated per subject/parameter)
  • CHG, PCHG -- change from baseline, percent change
  • ABLFL -- 'Y' for the baseline record
  • ANL01FL, ANL02FL -- analysis flags for primary/secondary analyses
  • DTYPE -- derivation type ('LOCF', 'WOCF', 'AVERAGE', 'BOCF', or null for original)
  • BASETYPE -- when multiple baselines per subject/parameter (crossover)
  • EPOCH -- study period (SCREENING, TREATMENT, FOLLOW-UP)
python
# Example: derive ADLB BDS structure from LB SDTM
import pandas as pd

lb = pd.read_csv('LB.csv')
adsl = pd.read_csv('ADSL.csv')

# Filter to active tests
adlb = lb[lb['LBTESTCD'].isin(['ALT', 'AST', 'CREAT', 'HGB'])].copy()
adlb['AVAL'] = adlb['LBSTRESN']
adlb['PARAM'] = adlb['LBTEST']
adlb['PARAMCD'] = adlb['LBTESTCD']

# Merge subject-level treatment from ADSL
adlb = adlb.merge(adsl[['USUBJID', 'TRT01A', 'TRTSDT']], on='USUBJID')

# Compute analysis day
adlb['ADT'] = pd.to_datetime(adlb['LBDTC'], errors='coerce')
adlb['TRTSDT'] = pd.to_datetime(adlb['TRTSDT'], errors='coerce')
adlb['ADY'] = (adlb['ADT'] - adlb['TRTSDT']).dt.days + 1  # Day 1 = first dose

# Set ABLFL from LBBLFL
adlb['ABLFL'] = (adlb['LBBLFL'] == 'Y').map({True: 'Y', False: None})

# Derive BASE per subject/parameter
baselines = adlb[adlb['ABLFL'] == 'Y'][['USUBJID', 'PARAMCD', 'AVAL']]
baselines.columns = ['USUBJID', 'PARAMCD', 'BASE']
adlb = adlb.merge(baselines, on=['USUBJID', 'PARAMCD'], how='left')

# Compute CHG and PCHG
adlb['CHG'] = adlb['AVAL'] - adlb['BASE']
adlb['PCHG'] = 100 * adlb['CHG'] / adlb['BASE']

OCCDS (Occurrence Data Structure) -- One Row per Event

OCCDS v1.1 (Nov 2021) handles AE, CM, MH. Variables: AEDECOD, AEBODSYS, AESEV, AESER, ASTDT (analysis start date), AENDT, TRTEMFL.

OCCDS v1.1 added TRTEM01FL through TRTEM##FL for multi-period treatment-emergent flags — essential for crossover and multi-phase studies where a single TRTEMFL is ambiguous.

ADTTE (Time-to-Event) -- The CNSR Convention Trap

The ADaM BDS for TTE v1.0 uses BDS structure with extra variables for survival analysis:

  • STARTDT -- time origin (typically TRTSDT for OS; RANDDT for PFS; response date for DOR)
  • ADT -- analysis date (event date if event, censoring date if censored)
  • AVAL = ADT - STARTDT (+1 if "first day = day 1" convention)
  • AVALU = 'DAYS' (or 'MONTHS' for some endpoints)
  • CNSR -- censoring indicator. CONVENTION: CNSR = 0 for events; positive integers for censoring, integer encodes censoring reason
  • EVNTDESC -- text description ('Death due to disease', 'Last alive contact')
  • CNSDTDSC, SRCDOM, SRCVAR, SRCSEQ -- traceability back to SDTM source

The CNSR convention is OPPOSITE to most statistical packages, which use 1 = event. R survival::Surv(time, event) expects event=1; SAS PROC LIFETEST takes CENSORED= statement that's opposite to CNSR convention. This is a perpetual bug source. When passing ADTTE to analysis:

python
# Convert CDISC ADTTE CNSR to R/Python statistical convention
adtte['event'] = (adtte['CNSR'] == 0).astype(int)  # 1 = event for survival packages

Define-XML 2.1

Every ADaM dataset requires variable-level metadata in Define-XML 2.1 (FDA-required for studies starting on/after March 15, 2023; support began March 15, 2021). Fields per variable:

  • Origin -- CRF, derived, predecessor SDTM variable
  • Derivation rule -- free text or controlled algorithm
  • Codelist -- linked controlled terminology
  • Length, datatype, label

The FDA reviewer's Analysis Data Reviewer's Guide (ADRG) is now expected in every NDA/BLA — walks reviewer through how each analysis dataset was built.

Two-level traceability expectation: SDTM raw -> ADaM analysis-ready, with no orphan derivations. FDA reviewers explicitly trace AE counts in CSR table -> ADAE rows -> AE SDTM rows. Any break is a flag.

Treatment-Emergent AE -- The Convention Variation

ICH E2A (1995) defines an AE generically. TEAE is sponsor-defined:

TRTEMFL = 'Y' if AE.ASTDT >= TRTSDT AND AE.ASTDT <= TRTEDT + X days

X = post-treatment follow-up window. Common values:

  • Small molecules: 28 or 30 days
  • Biologics with extended half-life: longer (e.g., 60-90 days for mAbs)
  • Cell/gene therapy: indefinite (lifelong monitoring expected)

Sponsor variation:

  • Day-of-first-dose AE included as TEAE (FDA preference) vs excluded (some EMA reviewers)
  • Partial-date imputation: impute day 15 if only month/year known, vs censor as missing
  • Worsening of pre-existing AE: flagged via SEV change vs requires new PT (preferred term)

MedDRA SOC/PT hierarchy: AEs coded to MedDRA Preferred Terms (PT), grouped by System Organ Class (SOC). Clinically related PTs (e.g., 'Diarrhea' / 'Frequent bowel movements' / 'Loose stools') often combined via Standardized MedDRA Queries (SMQs) or sponsor-defined groupings. ADAE typically carries both AEDECOD (PT) and SMQ/group flags.

Baseline Derivation

ABLFL = 'Y' marks the record whose AVAL becomes BASE for all other records of the same subject/parameter.

Standard rule: last non-missing assessment on or before first dose (TRTSDT). If protocol mandates a specific baseline visit ('Day 1 pre-dose'), that visit's record is flagged.

python
# Derive ABLFL when SDTM baseline flag is missing/inconsistent
import pandas as pd

vs['VSDTC_dt'] = pd.to_datetime(vs['VSDTC'], errors='coerce')
vs = vs.merge(adsl[['USUBJID', 'TRTSDT']], on='USUBJID')
vs['is_pre_treatment'] = vs['VSDTC_dt'] <= pd.to_datetime(vs['TRTSDT'])

# Latest pre-treatment value per subject/parameter
baseline_records = (vs[vs['is_pre_treatment'] & vs['VSSTRESN'].notna()]
                    .sort_values('VSDTC_dt')
                    .groupby(['USUBJID', 'VSTESTCD'])
                    .tail(1))
baseline_records['derived_ABLFL'] = 'Y'

Critical detail: filter on VSBLFL='Y' (or LBBLFL='Y') as the primary source. Only fall back to derivation when the flag is missing. Trust the SDTM flag when present; CRF-level baseline designation embeds clinical judgement the analyst cannot reconstruct.

BASETYPE required when more than one baseline exists per subject/parameter (crossover studies, multi-period trials). Distinguishes "Period 1 Baseline" vs "Period 2 Baseline."

DTYPE values per CDISC controlled terminology: 'LOCF' (last observation carried forward), 'WOCF' (worst), 'AVERAGE', 'BOCF' (baseline observation carried forward), null for original. Pinnacle 21 flags any DTYPE value not in CT.

SUPPQUAL and the NSV Transition

SUPPQUAL (supplemental qualifiers) is the legacy mechanism for sponsor-defined variables that don't fit standard SDTM domain columns. Long-format QNAM/QVAL pairs:

python
supp = pd.read_sas('suppae.xpt', format='xport', encoding='utf-8')
supp_pivot = supp.pivot_table(
    index='USUBJID', columns='QNAM', values='QVAL', aggfunc='first'
).reset_index()
ae_enriched = ae.merge(supp_pivot, on='USUBJID', how='left')

For record-level SUPPQUAL (where IDVAR and IDVARVAL identify specific rows):

python
supp_record = supp[supp['IDVAR'] == 'AESEQ'].copy()
supp_record['AESEQ'] = supp_record['IDVARVAL'].astype(float)
supp_pivot_record = supp_record.pivot_table(
    index=['USUBJID', 'AESEQ'], columns='QNAM', values='QVAL', aggfunc='first'
).reset_index()
ae_enriched = ae.merge(supp_pivot_record, on=['USUBJID', 'AESEQ'], how='left')

The 2024-2026 SUPP transition: Therapeutic Area User Guides (TAUGs) increasingly use NS-- domain extensions or Non-Standard Variables (NSV) Registry-listed variables directly in the parent domain, instead of QNAM/QVAL pairs in SUPP--. Not a hard deprecation but the direction is clear. The Non-Standard Variables Registry at cdisc.org is the new canonical place to look up sponsor-extension variables.

Date Handling -- The Partial-Date Reality

python
dm['RFSTDT'] = pd.to_datetime(dm['RFSTDTC'], errors='coerce')
ae['AESTDT'] = pd.to_datetime(ae['AESTDTC'], errors='coerce')
ae['AEENDT'] = pd.to_datetime(ae['AEENDTC'], errors='coerce')

# Days from randomization to AE onset
ae_with_ref = ae.merge(dm[['USUBJID', 'RFSTDT']], on='USUBJID')
ae_with_ref['AE_ONSET_DAY'] = (ae_with_ref['AESTDT'] - ae_with_ref['RFSTDT']).dt.days

SDTM dates are ISO 8601 strings. Partial dates (e.g., '2023-03' without day) are common. errors='coerce' converts these to NaT rather than raising errors. For analysis requiring complete dates, CDISC conventions impute missing day as the 1st for start dates and the last day of the month for end dates, but imputation rules should match the SAP.

SDTM records include EPOCH (SCREENING, TREATMENT, FOLLOW-UP). For TEAEs, filter AEs to onset during or after the treatment epoch. Including pre-treatment AEs confounds the treatment effect estimate.

Validation -- Pinnacle 21 and CORE

Pinnacle 21 (Certara, formerly OpenCDISC) is the de facto FDA submission validation standard. Validates against FDA Validation Rules + CDISC IG conformance + Define-XML schema. Severity tiers:

  • Reject -- submission will not be accepted
  • Error -- must justify
  • Warning -- should investigate

FDA Validation Rules are published quarterly by FDA Office of Translational Sciences; Pinnacle 21 wraps these into its rule engine.

CORE (CDISC Open Rules Engine, 2021) is a newer open-source alternative using YAML-defined rules from the CDISC Rules Catalog. Gaining traction but not yet at Pinnacle-21 parity for confirmatory submissions.

bash
# Pinnacle 21 Community (free; appropriate for non-pivotal trials)
p21-community validate --rules sdtmig-3.4 --output-dir validation_output study_data/

Population Flags

FlagSourcePurpose
ITTFLDM all randomisedPrimary efficacy population (ICH E9 default)
FASFLITT minus eligibility failures + no post-baselinePractical primary (FAS = Full Analysis Set)
SAFFLEX (received at least one dose)Safety analysis (AE reporting)
PPROTFLSE + DS + protocol-violation listPer-protocol; sensitivity only
EFFFLSponsor-definedModified ITT variants

FAS vs ITT subtlety: FAS may exclude post-randomisation subjects (ineligibility, no post-baseline efficacy); ITT cannot. Many SAPs equate them; FDA may insist on stricter ITT at submission. Pre-specify both with explicit FAS exclusion criteria in the protocol.

Missing Data Considerations -- The Clinical Reasoning Layer

Before any imputation/complete-case decision, examine the DS (Disposition) domain to tabulate reasons for discontinuation by treatment arm. If discontinuation rates or reasons differ between arms, missing data is likely informative (MNAR) and standard MMRM-MAR is questionable.

python
ds = pd.read_csv('DS.csv')
dropouts = ds[ds['DSDECOD'] != 'COMPLETED']
dropouts_by_arm = dropouts.merge(adsl[['USUBJID', 'ARM']], on='USUBJID')
discontinuation_reasons = dropouts_by_arm.groupby(['ARM', 'DSDECOD']).size().unstack(fill_value=0)

This is the data-quality precursor to choosing the estimand strategy in trial-reporting (see ICH E9(R1)) — missing patterns informed by DS drive the choice between treatment-policy, hypothetical, or composite ICE strategies.

Common Pitfalls

PitfallSymptomSolution
Event-level merged onto subject-level without aggregationRow count inflates after mergeAggregate first, then merge
First chronological record used as baselineMisclassified baselineFilter on VSBLFL='Y' / LBBLFL='Y'; derive only if missing
Character (xxORRES) used for analysisInconsistent numeric coercionUse xxSTRESN (numeric standardised); missing xxSTRESN with present xxORRES means 'NOT DONE' or '<LLOQ'
ARM used in safety analysisCrossover or actual-treatment differsUse ACTARM for safety; ARM for ITT efficacy
RFSTDTC used as TEAE referenceIncludes screening AEsUse RFXSTDTC (first treatment); cite ICH E2A
ADTTE CNSR confused with stat-pkg conventionWrong event/censoring assignmentCDISC: CNSR=0 means event; convert: event = (CNSR == 0).astype(int)
Partial date parsing errorNaT in date columnpd.to_datetime(..., errors='coerce')
SUPPQUAL granularity confusionWrong rows mergedCheck IDVAR before choosing subject vs record-level merge
Non-standard column names treated as standard SDTMMissing variablesInspect actual columns; map to semantic roles
Pinnacle 21 not run before submissionFDA rejectAlways validate against current SDTMIG and FDA Validation Rules before submission

Common non-standard column mappings

Standard SDTMCommon alternativesRole
ARM / ARMCDTRTGRP, TRT01P, treatment, groupTreatment assignment
AEDECODAEPT, ae_term, preferred_termAE preferred term
AESEV (text)AESEV (numeric 1-4), severity, AETOXGRSeverity / toxicity grade
USUBJIDSUBJID, subject_id, patient_idSubject identifier
RFXSTDTCtrt_start, first_dose_dateFirst treatment date
LBSTRESNlab_value_num, result_numericLab numeric result

Quantitative Thresholds and Conventions

Threshold/ConventionSourceRationale
TEAE window: 28-30 days post-treatment for small moleculesICH E2A; sponsor conventionMode of action, half-life inform window
RFXSTDTC for TEAE reference (not RFSTDTC)ICH E2ARFSTDTC includes screening; TEAE is post-treatment
ABLFL='Y' for last non-missing pre-doseCDISC ADaM IG v1.3Standard baseline definition; trust SDTM flag
ARM (planned) for ITT efficacy; ACTARM for safetyICH E9Crossover/PP-violation handling
Pinnacle 21 validation before submissionFDA Study Data Technical Conformance GuideStandard quality gate; reject errors block acceptance
Define-XML 2.1 for studies starting >=March 15, 2023FDA Study Data Standards CatalogOlder 2.0 still accepted for prior studies
Dataset-JSON v1.1 (Dec 2024; FDA notice April 2025)CDISC + FDA Federal RegisterModern replacement for XPT v5; timeline pending
CNSR=0 for events, positive integers for censoringADaM BDS-for-TTE v1.0OPPOSITE of R survival and most stat packages

Anticipated Reviewer Pushback

PushbackResponse
"RFXSTDTC or RFSTDTC for TEAE?"RFXSTDTC per ICH E2A; RFSTDTC would include screening AEs
"Baseline from VSBLFL or derived?"VSBLFL when present; documented derivation rule when missing
"Pinnacle 21 errors?"All errors resolved or justified; warnings reviewed and documented
"Define-XML 2.1 ADRG provided?"Yes — analysis dataset traceability documented to variable level
"ITT vs FAS reconciliation?"Pre-specified in protocol with explicit FAS exclusion criteria
"OCCDS v1.1 multi-period flags?"TRTEM01FL...TRTEM##FL pre-specified for crossover periods
"ADTTE CNSR convention conversion documented?"Explicit: CDISC CNSR=0 means event; convert to event=1 for downstream R/Python

References

  • CDISC. 2021. Analysis Data Model Implementation Guide (ADaMIG) v1.3.
  • CDISC. 2021. Occurrence Data Structure (OCCDS) v1.1.
  • CDISC. 2012. ADaM Basic Data Structure for Time-to-Event Analyses v1.0.
  • CDISC. 2024. Dataset-JSON v1.1.
  • FDA. 2024. Study Data Technical Conformance Guide.
  • FDA Federal Register Notice. April 2025. Dataset-JSON Pilot Comment Request.
  • ICH. 1995. E2A: Clinical Safety Data Management -- Definitions and Standards for Expedited Reporting.
  • ICH. 1998. E9: Statistical Principles for Clinical Trials.
  • ICH. 2019. E9(R1) Addendum on Estimands and Sensitivity Analysis.
  • Pinnacle 21 (Certara). 2024. Community Edition Validation Rules.
  • PHUSE/CDISC. 2024. Dataset-JSON Pilot Reports.

Related Skills

  • clinical-biostatistics/logistic-regression - Model binary outcomes from prepared ADaM/SDTM data
  • clinical-biostatistics/trial-reporting - Use prepared analysis datasets for ICH E9(R1) estimands and CONSORT 2025 reporting
  • clinical-biostatistics/missing-data-sensitivity - DS-domain reasoning informs estimand choice
  • clinical-biostatistics/survival-analysis - ADTTE CNSR convention; time-to-event preparation
  • expression-matrix/metadata-joins - General metadata joining patterns

附带文件

技能加载后,模型会按需读取这些文件。它们仅作为可读文件提供,绝不会被执行。

常见问题

Bio Clinical Biostatistics Cdisc Data AI 技能有什么作用?

读取、验证并整理 CDISC SDTM 和 ADaM 临床试验数据,以供分析使用。涵盖 SDTM 领域数据合并(DM、AE、EX、VS、LB、DS)、具备可追溯性的 ADaM 架构(ADSL、BDS、OCCDS、ADTTE)、治疗期间出现的不良事件惯例、基线推导、SUPPQUAL/NSV 处理、Define-XML 2.1,以及 Pinnacle 21 / CORE 验证。适用于处理 CDISC SDTM/ADaM 格式的临床试验数据集、准备可用于分析的数据,或为监管申报进行验证。

为什么在 TypingMind 中使用 Bio Clinical Biostatistics Cdisc Data?

因为您只需安装一次,就能搭配任何模型使用。Bio Clinical Biostatistics Cdisc Data 采用纯 Markdown 格式,而非特定提供商专用的代码,因此同一技能可用于 GPT-5、Claude、Gemini、Grok 或本地模型。您甚至可以在聊天中途切换模型,而不会影响技能的正常使用。TypingMind 使用您自己的 API 密钥,因此您直接向提供商付费,而不是按席位订阅;您的技能和聊天记录也都保留在您自己的存储空间中。

如何在 TypingMind 中安装 Bio Clinical Biostatistics Cdisc Data?

在 TypingMind 中打开“插件 → 技能 → 从 GitHub 安装”,然后粘贴 https://github.com/PKU-YuanGroup/OpenAI4S/tree/main/skills/bioskills/bio-clinical-biostatistics-cdisc-data-handling。TypingMind 会读取其中的 SKILL.md,打包相关文件,并将其安装为技能,供您在各个聊天中按需启用。

哪些 AI 模型可以使用 Bio Clinical Biostatistics Cdisc Data?

您在 TypingMind 中连接的任何模型都可以。AI 技能采用纯 Markdown 指令,而非特定提供商专用的代码,因此 GPT、Claude、Gemini、Grok 和本地模型都能在请求匹配时加载此技能。

Bio Clinical Biostatistics Cdisc Data 可以搭配多少个 AI 模型使用?

数量不限。只要模型支持技能,您就可以将它与 Bio Clinical Biostatistics Cdisc Data 搭配使用。GPT、Claude、Gemini、Grok、DeepSeek、Mistral、Llama 等模型都可以通过您自己的 API 密钥接入 TypingMind。

Bio Clinical Biostatistics Cdisc Data AI 技能免费吗?

是的。PKU-YuanGroup 已在 GitHub 上根据 MIT 许可证发布了该技能。您只需向自己的 AI 提供商支付所用 Token 的费用。

什么是 AI 技能?

AI 技能是一组可复用的指令,用于教会 AI 模型完成某项特定任务。它遵循开放的 Agent Skills 格式:包含名称和描述的 SKILL.md 文件,以及模型可能需要的脚本、模板或参考文件。模型仅在您的请求与技能匹配时才会读取这些指令,因此已安装的技能在使用前不会产生任何费用。

AI 技能与插件或 MCP 服务器有何不同?

插件或 MCP 服务器为模型提供可调用的新工具,也就是在某处运行并返回结果的代码。AI 技能则为模型提供知识和流程:如何处理任务、遵循哪些步骤,以及怎样的输出才算优质。技能采用纯 Markdown 格式,因此不需要服务器、API 密钥或运行时环境,并且适用于任何模型。

查看全部

立即创建您自己的 AI 工作区

订阅我们的电子简报,获取新功能和后续赠奖活动的通知 👇