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: write each administration's collected duration as EXDUR.
Input: collected exposure records, one per administration (EXSEQ),
with the treatment (EXTRT), the start date (EXSTDTC) and, where the
case report form collected it, the duration in whole minutes.
Variables:
EXDURis the collected duration as ISO 8601 duration text:P, then the days, thenTand the hours and minutes, each part that is zero left out, so 120 minutes isPT2H, 90 minutesPT1H30Mand 45 minutesPT45M. A day is the largest part, so a 46-hour continuous infusion isP1DT22H, neverPT46H. A bolus injection recorded as zero minutes isPT0S. Empty when the duration was not collected; it is never computed from the start date.
Inputs
Under review1 source fileinput/ex_raw.csv
Edit6 rows| STUDYID | USUBJID | EXSEQ | EXTRT | EXSTDTC | EXDURMIN |
|---|---|---|---|---|---|
| YAMAA-01 | 1 | OXALIPLATIN | 2025-03-04 | 120 | |
| YAMAA-01 | 2 | FLUOROURACIL | 2025-03-04 | 0 | |
| YAMAA-01 | 3 | FLUOROURACIL | 2025-03-04 | 2760 | |
| YAMAA-01 | 1 | OXALIPLATIN | 2025-03-05 | 90 | |
| YAMAA-01 | 2 | FLUOROURACIL | 2025-03-05 | — | |
| YAMAA-01 | 1 | OXALIPLATIN | 2025-03-06 | 45 |
Expected output
Under review6 expected rowsexpected/ex.csv
Edit6 rows| DOMAIN | STUDYID | USUBJID | EXSEQ | EXTRT | EXSTDTC | EXDUR |
|---|---|---|---|---|---|---|
| EX | YAMAA-01 | 1 | OXALIPLATIN | 2025-03-04 | PT2H | |
| EX | YAMAA-01 | 2 | FLUOROURACIL | 2025-03-04 | PT0S | |
| EX | YAMAA-01 | 3 | FLUOROURACIL | 2025-03-04 | P1DT22H | |
| EX | YAMAA-01 | 1 | OXALIPLATIN | 2025-03-05 | PT1H30M | |
| EX | YAMAA-01 | 2 | FLUOROURACIL | 2025-03-05 | — | |
| EX | YAMAA-01 | 1 | OXALIPLATIN | 2025-03-06 | PT45M |
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 "EX". | SDTM | 1 | ||||
| STUDYID | Study Identifier | Char | Collected | Copy value from EX_RAW.STUDYID. | SDTM | 2 | ||||
| USUBJID | Unique Subject Identifier | Char | Collected | Copy value from EX_RAW.USUBJID. | SDTM | 3 | ||||
| EXSEQ | Sequence Number | Num | Collected | Copy value from EX_RAW.EXSEQ. | SDTM | 4 | ||||
| EXTRT | Name of Treatment | Char | Collected | Copy value from EX_RAW.EXTRT. | SDTM | 5 | ||||
| EXSTDTC | Start Date/Time of Treatment | Char | Collected | Copy value from EX_RAW.EXSTDTC. | SDTM | 6 | ||||
| EXDUR | Duration of Treatment | Char | Derived | Write EX_RAW.EXDURMIN, a number of minutes, as ISO 8601 duration text with days as the largest unit. | SDTM | 7 |
| 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-ex-infusion-duration/full.md
Edit19 linesFollowing CDISC SDTM standards, use the provided EX_RAW dataset to create an EX dataset with one record per administration, that is, per subject per EXSEQ.
The output dataset should contain the following columns in this order: DOMAIN, STUDYID, USUBJID, EXSEQ, EXTRT, EXSTDTC, EXDUR
DOMAIN is "EX". Records are keyed by STUDYID, USUBJID and EXSEQ, where EXSEQ is the sequence number EX_RAW gives each administration.
EXDUR is the duration collected in EXDURMIN, a whole number of minutes, written as ISO 8601 duration text: "P", then the days, then "T" and the hours and minutes, each part that is zero left out. So 120 minutes is "PT2H", 90 minutes is "PT1H30M" and 45 minutes is "PT45M". A day of 24 hours is the largest part, so a 46-hour continuous infusion is "P1DT22H", never "PT46H". A bolus injection recorded as zero minutes is "PT0S". EXDUR has no value when EXDURMIN is empty; it is never computed from the start date.
Read the source datasets from /app/input and save the completed dataset as /app/output/ex.csv.
prompts/sdtm-ex-infusion-duration/conventions.md
Edit14 linesFollowing CDISC SDTM standards, use the provided EX_RAW dataset to create an EX dataset with one record per administration, that is, per subject per EXSEQ.
The output dataset should contain the following columns in this order: DOMAIN, STUDYID, USUBJID, EXSEQ, EXTRT, EXSTDTC, EXDUR
DOMAIN is "EX". EXDUR is ISO 8601 duration text: "P", then the days, then "T" and the hours and minutes, each part that is zero left out. So 90 minutes is "PT1H30M", and a day of 24 hours is the largest part, so a 46-hour continuous infusion is "P1DT22H", never "PT46H". Zero minutes is "PT0S", or EXDUR has no value.
Read the source datasets from /app/input and save the completed dataset as /app/output/ex.csv.
prompts/sdtm-ex-infusion-duration/brief.md
Edit8 linesFollowing CDISC SDTM standards, use the provided EX_RAW dataset to create an EX dataset with one record per administration, that is, per subject per EXSEQ.
The output dataset should contain the following columns in this order: DOMAIN, STUDYID, USUBJID, EXSEQ, EXTRT, EXSTDTC, EXDUR
Read the source datasets from /app/input and save the completed dataset as /app/output/ex.csv.
R
Edit3 lineslibrary(yamaa)yamaa_spec("spec.yaml")$run()$outputPython
Edit3 linesimport yamaayamaa.spec("spec.yaml").run().outputsolutions/sdtm-ex-infusion-duration/result.R
Edit43 lines# Reference solution for the yamaa benchmark sdtm-ex-infusion-duration (R track).## Written from the benchmark's full prompt and its inputs alone, as an agent# would write it. Harbor's oracle agent runs it to check that the prompt can# be solved and that the grader scores a correct answer 1.library(dplyr, warn.conflicts = FALSE)library(readr)ex_raw <- read_csv( "/app/input/ex_raw.csv", col_types = cols(.default = col_character()))# Whole minutes as ISO 8601 duration text, a day the largest part and every# part that is zero left out; zero minutes is PT0S.duration_text <- function(minutes) { vapply(minutes, function(m) { if (is.na(m)) return(NA_character_) if (m == 0L) return("PT0S") days <- m %/% 1440L hours <- (m %% 1440L) %/% 60L mins <- m %% 60L text <- "P" if (days > 0L) text <- paste0(text, days, "D") if (hours > 0L || mins > 0L) { text <- paste0(text, "T") if (hours > 0L) text <- paste0(text, hours, "H") if (mins > 0L) text <- paste0(text, mins, "M") } text }, character(1), USE.NAMES = FALSE)}ex <- ex_raw |> mutate( DOMAIN = "EX", EXDUR = duration_text(as.integer(EXDURMIN)) ) |> select(DOMAIN, STUDYID, USUBJID, EXSEQ, EXTRT, EXSTDTC, EXDUR)dir.create("/app/output", showWarnings = FALSE)write_csv(ex, "/app/output/ex.csv", na = "")solutions/sdtm-ex-infusion-duration/result.py
Edit67 lines# Reference solution for the yamaa benchmark sdtm-ex-infusion-duration (Python track).## Written from the benchmark's full prompt and its inputs alone, as an agent# would write it. Harbor's oracle agent runs it to check that the prompt can# be solved and that the grader scores a correct answer 1."""Build the SDTM EX dataset from EX_RAW.One record per administration. EXDUR writes the collected duration in wholeminutes as ISO 8601 duration text, with a day as the largest part and everypart that is zero left out."""import csvINPUT_PATH = "/app/input/ex_raw.csv"OUTPUT_PATH = "/app/output/ex.csv"COLUMNS = ["DOMAIN", "STUDYID", "USUBJID", "EXSEQ", "EXTRT", "EXSTDTC", "EXDUR"]def duration_text(minutes): """Whole minutes as ISO 8601 duration text: zero minutes is PT0S.""" if minutes == 0: return "PT0S" days, rest = divmod(minutes, 24 * 60) hours, mins = divmod(rest, 60) text = "P" if days: text += f"{days}D" if hours or mins: text += "T" if hours: text += f"{hours}H" if mins: text += f"{mins}M" return textdef main(): with open(INPUT_PATH, newline="", encoding="utf-8") as f: raw_rows = list(csv.DictReader(f)) out_rows = [] for row in raw_rows: collected = (row["EXDURMIN"] or "").strip() out_rows.append( { "DOMAIN": "EX", "STUDYID": row["STUDYID"], "USUBJID": row["USUBJID"], "EXSEQ": row["EXSEQ"], "EXTRT": row["EXTRT"], "EXSTDTC": row["EXSTDTC"], # No collected duration leaves EXDUR without a value. "EXDUR": duration_text(int(collected)) if collected else "", } ) with open(OUTPUT_PATH, "w", newline="", encoding="utf-8") as f: writer = csv.DictWriter(f, fieldnames=COLUMNS) writer.writeheader() writer.writerows(out_rows)if __name__ == "__main__": main()solutions/sdtm-ex-infusion-duration/result.sas
Edit38 lines/* opensas reference solution for the yamaa benchmark sdtm-ex-infusion-duration. Reads the benchmark inputs and derives the requested output. Execute with the existing opensas runtime: opensas /app/output/result.sas. */data ex_raw; length STUDYID USUBJID EXTRT EXSTDTC $1024; infile "/app/input/ex_raw.csv" dsd dlm="," firstobs=2 truncover lrecl=32767; input STUDYID : $char1024. USUBJID : $char1024. EXSEQ EXTRT : $char1024. EXSTDTC : $char1024. EXDURMIN;run;/* EXDUR: the collected whole minutes as ISO 8601 duration text, a day the largest part and every part that is zero left out; zero minutes is PT0S. */data result; set ex_raw; length DOMAIN $2 EXDUR $64; DOMAIN = 'EX'; EXDUR = ''; if not missing(EXDURMIN) then do; if EXDURMIN = 0 then EXDUR = 'PT0S'; else do; days = floor(EXDURMIN / 1440); hours = floor((EXDURMIN - days * 1440) / 60); mins = EXDURMIN - days * 1440 - hours * 60; EXDUR = 'P'; if days > 0 then EXDUR = cats(EXDUR, strip(put(days, 12.)), 'D'); if hours > 0 or mins > 0 then do; EXDUR = cats(EXDUR, 'T'); if hours > 0 then EXDUR = cats(EXDUR, strip(put(hours, 12.)), 'H'); if mins > 0 then EXDUR = cats(EXDUR, strip(put(mins, 12.)), 'M'); end; end; end;run;proc sql; create table final as select DOMAIN, STUDYID, USUBJID, EXSEQ, EXTRT, EXSTDTC, EXDUR from result;quit;proc export data=final outfile="/app/output/ex.csv" dbms=csv replace; run;
yamaa