Skip to content

crf-cdash

Derive an eCRF specification from a protocol schedule of activities, with forms per visit mapped to CDASH variables and controlled terminology codes with codelist ids. Use when building or reviewing eCRF specifications for EDC set-up.

Stage Clinical development
Tier 1 (deterministic tool)
Standards CDASHIG, CDASH model, CDISC CT, SDTMIG 3.4
Minimum pharmaskills 0.3.0
Inputs protocol soa, draft field lists, ct package
Outputs crf spec xlsx, crf spec json, crf spec notes md
Verified by cdash map, cdash build-spec, ct lookup, ct codelist

Draft for qualified review. Not a validated system and not 21 CFR Part 11 compliant.

Install only this skill: pharmaskills skills install --agent claude-code --skill crf-cdash (see Install).

Purpose

Give a clinical data manager an eCRF specification draft that is anchored in the protocol: which forms are collected at which visit, which CDASH variable each field is, which controlled terminology codelist applies, and which fields or values are not recognised. Mapping and terminology resolution are deterministic pharmaskills calls; you draft the field lists, interpret the flags and leave unknowns visible.

When to use / when not to use

Use when a protocol schedule of activities exists and an EDC build or CRF review needs a specification aligned to CDASH, or when a draft CRF should be checked against CDASH names and CT.

Do not use for: EDC system configuration, edit-check programming, SDTM mapping (use sdtm-mapper), forms outside the supported set (AE, CM, DM, VS, LB, EX) beyond flagging them, or any claim of CDASHIG conformance. The authored variable metadata is a working subset.

Inputs

Required: the protocol schedule of activities as soa.csv (wide layout of protocol-m11). Ask once for anything missing, then proceed with stated assumptions and [DATA NEEDED: ...] placeholders. Typical gaps: the draft field list per form, the CT version, sponsor standards for assessments outside the supported forms.

Optional: a CDISC CT package (pharmaskills ct sync, or --ct-file). Without CT the tool still maps variables and reports values as unresolved.

If pharmaskills is not installed, tell the user to run uv tool install pharmaskills, then produce a template-only specification from templates/crf-spec.md marked unverified, with no codelist ids. Check pharmaskills --version is at least min_pharmaskills.

Workflow

  1. State assumptions. CDASHIG and CT versions (or "not available"), region (CDASH is global; say regional items such as race and ethnicity depend on regulation). Read references/cdash-forms.md.
  2. Forms per visit. Read soa.csv; each procedure row maps to a form by keyword (references/forms-from-soa.md). Procedures with no supported form are listed, never forced into a form.
  3. Field lists. For each supported form write fields/<form>.csv with columns label and optional values (semicolon separated collected values). Use the wording the site will see. Look up an unfamiliar term with pharmaskills ct lookup "<term>" --codelist <name> and a codelist with pharmaskills ct codelist <C-code or name>.
  4. Map. pharmaskills cdash map --form AE --fields fields/ae.csv [--ct-file ct.txt] --out out/cdash_ae.json. Exit 2 means unknown fields or unresolved values: fix the label, correct the value, or keep the item flagged and explain it.
  5. Build. pharmaskills cdash build-spec --soa soa.csv --fields AE=fields/ae.csv --fields CM=fields/cm.csv ... --xlsx out/crf_spec.xlsx --out out/crf_spec.json.
  6. Notes. Write out/crf_spec_notes.md from templates/crf-spec.md: assumptions, forms per visit, mapping counts, items needing a person. Then pharmaskills docs banner --apply out/crf_spec_notes.md and edit the provenance block.
  7. Report unknown fields, unresolved values, uncertain variables and unmapped procedures.

Output contract

Under out/:

File Content
crf_spec.xlsx Sheets About (banner), Forms by visit, Unmapped procedures, one per form
crf_spec.json Report: forms by visit, unknown fields, unresolved values, CT version
crf_spec_notes.md Narrative with banner and provenance

Each form sheet lists field label, CDASH variable, core designation (HR, RC, O), codelist name, collected value, CT submission value, term code and codelist C-code, and a flag column.

Verification

Report pass or fail: every AE field maps to a CDASH AE variable; unknown fields are flagged and not renamed to fit; every collected value with a codelist resolves to a term code with its codelist C-code, or is listed as unresolved; the CT version used is stated; every SoA procedure is either on a form or on the unmapped sheet; banner present. Fix and rerun up to three times.

Guardrails

  • Never fabricate CDASH variables, controlled terminology codes or codelist ids; a field with no match is flagged unknown and left for a human.
  • Region: CDASH is region-independent and used for FDA, EMA and PMDA submissions; state the region assumed (FDA with ICH by default) for any regional field.
  • Insert the draft banner and provenance block; the output is a specification draft and not a CDASHIG-conformant, validated or EDC-ready design.
  • Never invent a CDASH variable name, core designation, codelist id or term code. An unmatched field is flagged "unknown"; a value outside the codelist is flagged, not replaced.
  • Fuzzy matches are suggestions to confirm, not mappings. Uncertain variable metadata keeps its flag in the sheet.
  • Do not paste controlled terminology beyond the values the form needs; CT is public CDISC content but the package is used from the cache or --ct-file, not retyped.
  • State the region assumed and the CT version. Do not expand into forms the tool does not cover without saying the variable metadata there is [DATA NEEDED].

References

  • references/cdash-forms.md - supported forms, core designations, codelists, caveats
  • references/forms-from-soa.md - how procedures map to forms and what stays unmapped
  • Public sources: CDASH model and CDASHIG (https://www.cdisc.org/standards/foundational/cdash), CDISC Controlled Terminology (NCI EVS), SDTMIG 3.4 for the SDTM targets.

Templates: templates/crf-spec.md, templates/fields.csv. Scripts: scripts/build_spec.sh (thin wrapper around pharmaskills cdash build-spec).

Examples

Worked example: examples/clinical/crf-cdash/. Synthetic SoA, field lists and CT subset: skills/crf-cdash/evals/fixtures/.

Worked example

Committed example with inputs and outputs: examples/clinical/crf-cdash/.

Synthetic study PSK-201-DM2-01. Schedule of activities from the protocol-m11 example.

Inputs

All in skills/crf-cdash/evals/fixtures/:

  • soa.csv: copy of examples/clinical/protocol-m11/out/soa.csv.
  • fields/*.csv: draft eCRF field lists per form (AE, CM, DM, VS, LB, EX), authored for this example, and fields/ae_with_unknown.csv with deliberately unmatched fields.
  • ct_subset.txt: the CDISC controlled terminology subset already committed for sdtm-mapper (public CDISC content, subset of codelists).

No personal data.

Outputs (out/)

File How it was made
crf_spec.xlsx, crf_spec.json Real output of pharmaskills cdash build-spec
cdash_ae.json, cdash_ae.csv Real output of pharmaskills cdash map --form AE
cdash_ae_unknown.json Real output on ae_with_unknown.csv (exit code 2)
crf_spec_notes.md Drafted from those outputs following templates/crf-spec.md
refusal_invent_variables.md Sample correct response to a request to invent variables

Reproduce

F=skills/crf-cdash/evals/fixtures
pharmaskills cdash build-spec --soa $F/soa.csv --ct-file $F/ct_subset.txt \
  --fields AE=$F/fields/ae.csv --fields CM=$F/fields/cm.csv --fields VS=$F/fields/vs.csv \
  --fields LB=$F/fields/lb.csv --fields EX=$F/fields/ex.csv --fields DM=$F/fields/dm.csv \
  --xlsx crf_spec.xlsx --out crf_spec.json

Skill source: skills/crf-cdash/SKILL.md