As a clinical trial statistician or programmer, answer three short questions in Your review: the task, the inputs and outputs, and the AI-assisted review. Agreeing with all three approves this benchmark; disagreeing with any needs a comment. Propose a fix with the Edit button on any source file, or add it to your comments.
We suggest spending no more than 5 minutes on a review. The other tabs beside Your review are background for assessment, not under review.
Summary
README.mdPublic entries: Python and R. Passing coverage requires an installed inventory.
Goal: create a trial summary (TS) record for each protocol parameter,
with its value (TSVAL), controlled term code (TSVALCD) and reference
terminology (TSVCDREF).
Input: a protocol-authoring system export, with a study identifier, trial title, phase, randomization decision and planned enrollment.
Variables:
TSSEQorders the parameters: title, phase, randomization, then planned enrollment.TSPARMCDandTSPARMidentify and name each parameter.TSVALholds the protocol title, the standard phase term,Yfor a randomized trial orNotherwise, or the planned enrollment as text.TSVALCDholds the NCI concept code for phase and randomization; it is empty for the title and planned enrollment.TSVCDREFisCDISCfor those controlled terms and empty for uncoded values.
Note: a missing protocol parameter stops the run. Each value fits in one trial summary record.
Inputs
Under review1 source fileinput/protocol.csv
Edit1 row| Study | Title | Phase | Randomized | PlannedSubjects |
|---|---|---|---|---|
| PK201 | A randomized phase II study of ZX-201 | Phase 2 | Yes | 48 |
Expected output
Under review4 expected rowsexpected/ts.csv
Edit4 rows| DOMAIN | STUDYID | TSSEQ | TSPARMCD | TSPARM | TSVAL | TSVALCD | TSVCDREF |
|---|---|---|---|---|---|---|---|
| TS | PK201 | 1 | TITLE | Trial Title | A randomized phase II study of ZX-201 | — | — |
| TS | PK201 | 2 | TPHASE | Trial Phase Classification | PHASE II TRIAL | C15601 | CDISC |
| TS | PK201 | 3 | RANDOM | Trial is Randomized | Y | C49488 | CDISC |
| TS | PK201 | 4 | PLANSUB | Planned Number of Subjects | 48 | — | — |
Human review and assessment
| Variable Name | Variable Label | Type | Length | Controlled Terms or Format | Origin | Core | Conversion Definition | Variable Type | Variable Order | Comments for Define |
|---|---|---|---|---|---|---|---|---|---|---|
| DOMAIN | Domain Abbreviation | Char | Assigned | Set constant value "TS". | SDTM | 1 | ||||
| STUDYID | Study Identifier | Char | Collected | Copy value from PROTOCOL.Study. | SDTM | 2 | ||||
| TSSEQ | Sequence Number | Num | Derived | Set per constructed row; see the Row construction sheet. | SDTM | 3 | ||||
| TSPARMCD | Trial Summary Parameter Short Name | Char | Derived | Set per constructed row; see the Row construction sheet. | SDTM | 4 | ||||
| TSPARM | Trial Summary Parameter Name | Char | Derived | Set per constructed row; see the Row construction sheet. | SDTM | 5 | ||||
| TSVAL | Parameter Value | Char | Derived | Set per constructed row; see the Row construction sheet. | SDTM | 6 | ||||
| TSVALCD | Parameter Value Code | Char | Derived | Set per constructed row; see the Row construction sheet. | SDTM | 7 | ||||
| TSVCDREF | Name of the Reference Terminology | Char | Derived | Set per constructed row; see the Row construction sheet. | SDTM | 8 |
| Template | Include when | TSSEQ | TSPARMCD | TSPARM | TSVAL | TSVALCD | TSVCDREF |
|---|---|---|---|---|---|---|---|
| title | Constant "1" | Constant "TITLE" | Constant "Trial Title" | Copy PROTOCOL.Title | Constant "None" | Constant "None" | |
| phase | Constant "2" | Constant "TPHASE" | Constant "Trial Phase Classification" | Recode PROTOCOL.Phase: "Phase 2" → "PHASE II TRIAL"; missing values stay missing; unlisted values are errors | Recode PROTOCOL.Phase: "Phase 2" → "C15601"; missing values stay missing; unlisted values are errors | Constant "CDISC" | |
| randomized | Constant "3" | Constant "RANDOM" | Constant "Trial is Randomized" | Recode PROTOCOL.Randomized: "Yes" → "Y", "No" → "N"; missing values stay missing; unlisted values are errors | Recode PROTOCOL.Randomized: "Yes" → "C49488", "No" → "C49487"; missing values stay missing; unlisted values are errors | Constant "CDISC" | |
| planned-enrollment | Constant "4" | Constant "PLANSUB" | Constant "Planned Number of Subjects" | Copy PROTOCOL.PlannedSubjects | Constant "None" | Constant "None" |
| Version | Date | Author | Description | Reviewer | Sign-off |
|---|---|---|---|---|---|
| 1.7 | 2026-10-20 | yamaa docs build | Read a specification in the 1.0 surface as its 0.5 counterpart; state that missing values stay missing where a mapping declares no missing handler, and leave out a declared missing answer that restates a handler's default | ||
| 1.6 | 2026-10-17 | yamaa docs build | Describe collected date parts written as ISO 8601 date text and times of day counted in seconds since midnight | ||
| 1.5 | 2026-10-17 | yamaa docs build | Name collected precision in words instead of letter codes; state imputation fallbacks, minimum source precision, bounds ignored outside the collected period, and invalid text with no handler as an error; describe date and datetime shifts, imputation flag codes, and partial text giving no date part | ||
| 1.4 | 2026-10-15 | yamaa docs build | State datetime precision codes through the hour and minute, and complete only the time parts a collected datetime lacks | ||
| 1.3 | 2026-09-29 | yamaa docs build | Show study codelist names, external dictionaries, and ISO 8601 formats in variable rows; list the document's codelist values and metadata | ||
| 1.2 | 2026-09-29 | yamaa docs build | Classify ADaM copies from a declared input as Predecessor and recodes as Derived, and SDTM recodes of locally derived columns as Derived | ||
| 1.1 | 2026-09-29 | yamaa docs build | Resolve lookups into the donor record they select, and give every derivation shape a plain-language rule instead of its raw YAML | ||
| 1.0 | yamaa docs build | Initial generation from spec.yaml |
prompts/sdtm-ts-trial-summary/full.md
Edit23 linesFollowing CDISC SDTM standards, use the provided PROTOCOL dataset to create a TS dataset with one record per protocol parameter per study.
The output dataset should contain the following columns in this order: DOMAIN, STUDYID, TSSEQ, TSPARMCD, TSPARM, TSVAL, TSVALCD, TSVCDREF
DOMAIN is "TS", and STUDYID is the protocol Study identifier. For title, TSSEQ is 1, TSPARMCD is "TITLE", TSPARM is "Trial Title", and TSVAL is the protocol Title. For phase, TSSEQ is 2, TSPARMCD is "TPHASE", and TSPARM is "Trial Phase Classification"; Phase "Phase 2" has TSVAL "PHASE II TRIAL" and TSVALCD "C15601". For randomization, TSSEQ is 3, TSPARMCD is "RANDOM", and TSPARM is "Trial is Randomized"; Randomized "Yes" has TSVAL "Y" and TSVALCD "C49488". For planned enrollment, TSSEQ is 4, TSPARMCD is "PLANSUB", and TSPARM is "Planned Number of Subjects"; TSVAL is PlannedSubjects as integer text with no decimal point. TSVCDREF is "CDISC" for phase and randomization. For title and planned enrollment, TSVALCD has no value, and TSVCDREF has no value.
Read the source datasets from /app/input and save the completed dataset as /app/output/ts.csv.
prompts/sdtm-ts-trial-summary/conventions.md
Edit15 linesFollowing CDISC SDTM standards, use the provided PROTOCOL dataset to create a TS dataset with one record per protocol parameter per study.
The output dataset should contain the following columns in this order: DOMAIN, STUDYID, TSSEQ, TSPARMCD, TSPARM, TSVAL, TSVALCD, TSVCDREF
DOMAIN is "TS". TSPARMCD and TSPARM are "TITLE" and "Trial Title", "TPHASE" and "Trial Phase Classification", "RANDOM" and "Trial is Randomized", or "PLANSUB" and "Planned Number of Subjects". TSVALCD is "C15601" for "PHASE II TRIAL", "C49488" for "Y", or has no value. TSVCDREF is "CDISC" or has no value. For planned enrollment, TSVAL is integer text with no decimal point.
Read the source datasets from /app/input and save the completed dataset as /app/output/ts.csv.
prompts/sdtm-ts-trial-summary/brief.md
Edit8 linesFollowing CDISC SDTM standards, use the provided PROTOCOL dataset to create a TS dataset with one record per protocol parameter per study.
The output dataset should contain the following columns in this order: DOMAIN, STUDYID, TSSEQ, TSPARMCD, TSPARM, TSVAL, TSVALCD, TSVCDREF
Read the source datasets from /app/input and save the completed dataset as /app/output/ts.csv.
R
Edit3 lineslibrary(yamaa)yamaa_spec("spec.yaml")$run()$outputPython
Edit3 linesimport yamaayamaa.spec("spec.yaml").run().outputsolutions/sdtm-ts-trial-summary/result.R
Edit23 linesprotocol <- read.csv("/app/input/protocol.csv", stringsAsFactors = FALSE, check.names = FALSE)rows <- lapply(seq_len(nrow(protocol)), function(i) { p <- protocol[i, ] data.frame( DOMAIN = rep("TS", 4), STUDYID = rep(p$Study, 4), TSSEQ = 1:4, TSPARMCD = c("TITLE", "TPHASE", "RANDOM", "PLANSUB"), TSPARM = c("Trial Title", "Trial Phase Classification", "Trial is Randomized", "Planned Number of Subjects"), TSVAL = c(p$Title, if (p$Phase == "Phase 2") "PHASE II TRIAL" else NA_character_, if (p$Randomized == "Yes") "Y" else NA_character_, as.character(as.integer(p$PlannedSubjects))), TSVALCD = c(NA_character_, if (p$Phase == "Phase 2") "C15601" else NA_character_, if (p$Randomized == "Yes") "C49488" else NA_character_, NA_character_), TSVCDREF = c(NA_character_, "CDISC", "CDISC", NA_character_), stringsAsFactors = FALSE )})ts <- do.call(rbind, rows)write.csv(ts, "/app/output/ts.csv", row.names = FALSE, na = "")stopifnot(identical(names(ts), c("DOMAIN", "STUDYID", "TSSEQ", "TSPARMCD", "TSPARM", "TSVAL", "TSVALCD", "TSVCDREF")), nrow(ts) == 4L * nrow(protocol))solutions/sdtm-ts-trial-summary/result.py
Edit41 linesimport csvfrom decimal import Decimalfrom pathlib import Pathinput_dir = Path("/app/input")output_dir = Path("/app/output")output_dir.mkdir(exist_ok=True)columns = [ "DOMAIN", "STUDYID", "TSSEQ", "TSPARMCD", "TSPARM", "TSVAL", "TSVALCD", "TSVCDREF",]with (input_dir / "protocol.csv").open(newline="", encoding="utf-8-sig") as source: protocols = list(csv.DictReader(source))rows = []for protocol in protocols: study = protocol["Study"] phase_value, phase_code = {"Phase 2": ("PHASE II TRIAL", "C15601")}[ protocol["Phase"] ] random_value, random_code = {"Yes": ("Y", "C49488")}[protocol["Randomized"]] planned = Decimal(protocol["PlannedSubjects"]) if planned != planned.to_integral_value(): raise ValueError("PlannedSubjects must be an integer") parameters = [ (1, "TITLE", "Trial Title", protocol["Title"], "", ""), (2, "TPHASE", "Trial Phase Classification", phase_value, phase_code, "CDISC"), (3, "RANDOM", "Trial is Randomized", random_value, random_code, "CDISC"), (4, "PLANSUB", "Planned Number of Subjects", str(int(planned)), "", ""), ] for parameter in parameters: rows.append(["TS", study, *parameter])with (output_dir / "ts.csv").open("w", newline="", encoding="utf-8") as target: writer = csv.writer(target) writer.writerow(columns) writer.writerows(rows)solutions/sdtm-ts-trial-summary/result.sas
Edit46 linesproc import datafile='/app/input/protocol.csv' out=protocol dbms=csv replace; getnames=yes;run;data ts; length DOMAIN $2 STUDYID $200 TSSEQ 8 TSPARMCD $8 TSPARM $40 TSVAL $1000 TSVALCD $20 TSVCDREF $20; set protocol; DOMAIN='TS'; STUDYID=Study; TSSEQ=1; TSPARMCD='TITLE'; TSPARM='Trial Title'; TSVAL=Title; TSVALCD=''; TSVCDREF=''; output; TSSEQ=2; TSPARMCD='TPHASE'; TSPARM='Trial Phase Classification'; if Phase='Phase 2' then do; TSVAL='PHASE II TRIAL'; TSVALCD='C15601'; end; TSVCDREF='CDISC'; output; TSSEQ=3; TSPARMCD='RANDOM'; TSPARM='Trial is Randomized'; if Randomized='Yes' then do; TSVAL='Y'; TSVALCD='C49488'; end; TSVCDREF='CDISC'; output; TSSEQ=4; TSPARMCD='PLANSUB'; TSPARM='Planned Number of Subjects'; TSVAL=strip(put(PlannedSubjects, 12.)); TSVALCD=''; TSVCDREF=''; output; keep DOMAIN STUDYID TSSEQ TSPARMCD TSPARM TSVAL TSVALCD TSVCDREF;run;proc export data=ts outfile='/app/output/ts.csv' dbms=csv replace;run;
yamaa