As a clinical trial statistician or programmer, challenge anything in this benchmark: describe a problem in Comments, or propose a fix with the Edit button on any source file.
- Task: Would a real study need this derivation, specified this way? Does it follow CDISC ADaM: variable names, controlled terms, record structure? Flag any rule that is ambiguous or that a sponsor would handle differently.
- Inputs: Do they look like data collected in a real trial, and do they include the situations you would expect to meet in one?
- Expected output: Would independent QC programming reproduce every value from these inputs and rules?
The other tabs beside Comments are background for assessment, not under review.
Summary
README.mdGoal: summarize exposure for each planned subject-treatment,
carrying EXTRT (treatment name) and EXDOSU (dose units) through
and adding DOSECUM (cumulative dose), NCYCLES (cycle count), and
RDI (relative dose intensity).
Input: planned treatments with dose units and planned totals, plus exposure records holding administered doses.
Variables:
DOSECUMis the total administered dose across the subject's exposure records for the treatment. A record with no collected dose adds nothing; a planned treatment with no exposure records has an empty total.NCYCLESis the number of exposure records for the treatment. Every record counts, even one with a zero or missing dose. A planned treatment with no exposure records has an empty count.RDIis cumulative dose as a percentage of the planned total dose across its cycles. It is empty when the planned total is zero or when there is no cumulative dose to compare.
Note: an administered zero dose adds nothing to the total but its record still counts, so a treatment given only as zero doses has a zero total alongside a nonzero count. A duplicated exposure record counts once per entry, so its dose enters the total twice.
Inputs
Under review2 source filesinput/ex.csv
Edit12 rows| STUDYID | USUBJID | EXTRT | EXSEQ | EXDOSE |
|---|---|---|---|---|
| YAMAA-01 | Pembrolizumab | 1 | 200 | |
| YAMAA-01 | Pembrolizumab | 2 | — | |
| YAMAA-01 | Pembrolizumab | 3 | 200 | |
| YAMAA-01 | Pemetrexed | 4 | 500 | |
| YAMAA-01 | Pemetrexed | 5 | 450 | |
| YAMAA-01 | Pemetrexed | 6 | 500 | |
| YAMAA-01 | Saline placebo | 1 | 0 | |
| YAMAA-01 | Saline placebo | 2 | 0 | |
| YAMAA-01 | Saline placebo | 3 | 0 | |
| YAMAA-01 | Nivolumab | 1 | 240 | |
| YAMAA-01 | Nivolumab | 1 | 240 | |
| YAMAA-01 | Daratumumab | 1 | 900 |
input/subject_treatment.csv
Edit6 rows| STUDYID | USUBJID | EXTRT | EXDOSU | PLANDOSE | PLANCYC |
|---|---|---|---|---|---|
| YAMAA-01 | Pembrolizumab | mg | 200 | 3 | |
| YAMAA-01 | Pemetrexed | mg/m2 | 500 | 3 | |
| YAMAA-01 | Saline placebo | mg | 0 | 3 | |
| YAMAA-01 | Nivolumab | mg | 240 | 2 | |
| YAMAA-01 | Trastuzumab | mg | 600 | 1 | |
| YAMAA-01 | Daratumumab | mg | 1800 | 1 |
Expected output
Under review6 expected rowsexpected/adex.csv
Edit6 rows| STUDYID | USUBJID | EXTRT | EXDOSU | DOSECUM | NCYCLES | RDI |
|---|---|---|---|---|---|---|
| YAMAA-01 | Pembrolizumab | mg | 400 | 3 | 66.66666666666667 | |
| YAMAA-01 | Pemetrexed | mg/m2 | 1450 | 3 | 96.66666666666667 | |
| YAMAA-01 | Saline placebo | mg | 0 | 3 | — | |
| YAMAA-01 | Nivolumab | mg | 480 | 2 | 100 | |
| YAMAA-01 | Trastuzumab | mg | — | — | — | |
| YAMAA-01 | Daratumumab | mg | 900 | 1 | 50 |
Comments and assessment materials
| Dataset Name | Variable Name | Variable Label | Type | Codelist/Controlled Terms | Core | Computational Method | Origin |
|---|---|---|---|---|---|---|---|
| ADEX | STUDYID | Study Identifier | character | Copy value from TRT.STUDYID. | Predecessor | ||
| ADEX | USUBJID | Unique Subject Identifier | character | Copy value from TRT.USUBJID. | Predecessor | ||
| ADEX | EXTRT | Name of Treatment | character | Copy value from TRT.EXTRT. | Predecessor | ||
| ADEX | EXDOSU | Dose Units | character | Copy value from TRT.EXDOSU. | Predecessor | ||
| ADEX | DOSECUM | Cumulative Dose | numeric | Aggregate SUM(EX.EXDOSE) over records matching on the shared output keys. | Derived | ||
| ADEX | NCYCLES | Number of Treatment Cycles | numeric | Aggregate COUNT(EX.EXSEQ) over records matching on the shared output keys. | Derived | ||
| ADEX | RDI | Relative Dose Intensity | numeric | Compute 100 * DOSECUM / NULLIF(PLANDOSE * PLANCYC, 0). | Derived |
| Version | Date | Author | Description | Reviewer | Sign-off |
|---|---|---|---|---|---|
| 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/adam-adex-cumulative-dose/full.md
Edit21 linesFollowing CDISC ADaM standards, use the provided TRT and EX datasets to create an ADEX dataset with one record per subject per treatment.
The output dataset should contain the following columns in this order: STUDYID, USUBJID, EXTRT, EXDOSU, DOSECUM, NCYCLES, RDI
DOSECUM is the total administered dose across the subject's exposure records for the treatment. A record with no collected dose adds nothing; a planned treatment with no exposure records has an empty total. NCYCLES is the number of exposure records for the treatment. Every record counts, even one with a zero or missing dose. A planned treatment with no exposure records has an empty count. RDI is cumulative dose as a percentage of the planned total dose, the planned dose per cycle times the planned number of cycles, and is not rounded. It has no value when the planned total is zero or when there is no cumulative dose to compare. An administered zero dose adds nothing to the total but its record still counts. A duplicated exposure record counts once per entry, so its dose enters the total twice.
Read the source datasets from /app/input and save the completed dataset as /app/output/adex.csv.
prompts/adam-adex-cumulative-dose/conventions.md
Edit10 linesFollowing CDISC ADaM standards, use the provided TRT and EX datasets to create an ADEX dataset with one record per subject per treatment.
The output dataset should contain the following columns in this order: STUDYID, USUBJID, EXTRT, EXDOSU, DOSECUM, NCYCLES, RDI
RDI is not rounded.
Read the source datasets from /app/input and save the completed dataset as /app/output/adex.csv.
prompts/adam-adex-cumulative-dose/brief.md
Edit8 linesFollowing CDISC ADaM standards, use the provided TRT and EX datasets to create an ADEX dataset with one record per subject per treatment.
The output dataset should contain the following columns in this order: STUDYID, USUBJID, EXTRT, EXDOSU, DOSECUM, NCYCLES, RDI
Read the source datasets from /app/input and save the completed dataset as /app/output/adex.csv.
run.R
Edit4 lineslibrary(yamaa)adex <- yamaa_domain("spec.yaml")$outputadexrun.py
Edit4 linesimport yamaaadex = yamaa.yamaa_domain("spec.yaml").outputadexsolutions/adam-adex-cumulative-dose/result.R
Edit47 lines# Reference solution for the yamaa benchmark adam-adex-cumulative-dose (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 <- read_csv( "/app/input/ex.csv", col_types = cols(EXSEQ = col_integer(), .default = col_character()))trt <- read_csv( "/app/input/subject_treatment.csv", col_types = cols( PLANDOSE = col_double(), PLANCYC = col_integer(), .default = col_character() ))# Every exposure record counts, even one with a zero or missing dose; a# missing dose adds nothing. A duplicated record counts once per entry.doses <- ex |> mutate(EXDOSE_NUM = suppressWarnings(as.numeric(EXDOSE))) |> group_by(USUBJID, EXTRT) |> summarise( DOSECUM = sum(EXDOSE_NUM, na.rm = TRUE), NCYCLES = n(), .groups = "drop" )adex <- trt |> left_join(doses, by = c("USUBJID", "EXTRT")) |> mutate( PLANTOT = PLANDOSE * PLANCYC, # Not rounded; no value when the planned total is zero or when there is # no cumulative dose to compare. RDI = case_when( is.na(DOSECUM) ~ NA_real_, is.na(PLANTOT) | PLANTOT == 0 ~ NA_real_, .default = DOSECUM / PLANTOT * 100 ) ) |> select(STUDYID, USUBJID, EXTRT, EXDOSU, DOSECUM, NCYCLES, RDI)dir.create("/app/output", showWarnings = FALSE)write_csv(adex, "/app/output/adex.csv", na = "")solutions/adam-adex-cumulative-dose/result.py
Edit44 lines# Reference solution for the yamaa benchmark adam-adex-cumulative-dose (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.from pathlib import Pathimport polars as plex = pl.read_csv("/app/input/ex.csv", infer_schema=False)trt = pl.read_csv("/app/input/subject_treatment.csv", infer_schema=False).with_columns( pl.col("PLANDOSE").cast(pl.Float64, strict=False), pl.col("PLANCYC").cast(pl.Int64, strict=False),)# Every exposure record counts, even one with a zero or missing dose; a# missing dose adds nothing. A duplicated record counts once per entry.doses = ( ex.with_columns(EXDOSE_NUM=pl.col("EXDOSE").cast(pl.Float64, strict=False)) .group_by(["USUBJID", "EXTRT"]) .agg( DOSECUM=pl.col("EXDOSE_NUM").sum(), NCYCLES=pl.len().cast(pl.Int64), ))adex = ( trt.join(doses, on=["USUBJID", "EXTRT"], how="left") .with_columns(PLANTOT=pl.col("PLANDOSE") * pl.col("PLANCYC")) # Not rounded; no value when the planned total is zero or when there is # no cumulative dose to compare. .with_columns( RDI=pl.when(pl.col("DOSECUM").is_null()) .then(None) .when(pl.col("PLANTOT").is_null() | (pl.col("PLANTOT") == 0)) .then(None) .otherwise(pl.col("DOSECUM") / pl.col("PLANTOT") * 100) ) .select("STUDYID", "USUBJID", "EXTRT", "EXDOSU", "DOSECUM", "NCYCLES", "RDI"))Path("/app/output").mkdir(exist_ok=True)adex.write_csv("/app/output/adex.csv")solutions/adam-adex-cumulative-dose/result.sas
Edit25 lines/* opensas reference solution for the yamaa benchmark adam-adex-cumulative-dose. Reads the benchmark inputs and derives the requested output. Execute with the existing opensas runtime: opensas /app/output/result.sas. */data ex; length STUDYID USUBJID EXTRT $1024; infile "/app/input/ex.csv" dsd dlm="," firstobs=2 truncover lrecl=32767; input STUDYID : $char1024. USUBJID : $char1024. EXTRT : $char1024. EXSEQ EXDOSE;run;data subject_treatment; length STUDYID USUBJID EXTRT EXDOSU $1024; infile "/app/input/subject_treatment.csv" dsd dlm="," firstobs=2 truncover lrecl=32767; input STUDYID : $char1024. USUBJID : $char1024. EXTRT : $char1024. EXDOSU : $char1024. PLANDOSE PLANCYC;run;proc sql; create table totals as select STUDYID,USUBJID,EXTRT,sum(EXDOSE) as DOSECUM,count(*) as NCYCLES from ex group by STUDYID,USUBJID,EXTRT; create table result as select a.*,b.DOSECUM,b.NCYCLES,case when a.PLANDOSE*a.PLANCYC ne 0 then 100*b.DOSECUM/(a.PLANDOSE*a.PLANCYC) else . end as RDI from subject_treatment as a left join totals as b on a.STUDYID=b.STUDYID and a.USUBJID=b.USUBJID and a.EXTRT=b.EXTRT;quit;proc sql; create table final as select STUDYID, USUBJID, EXTRT, EXDOSU, DOSECUM, NCYCLES, RDI from result;quit;proc export data=final outfile="/app/output/adex.csv" dbms=csv replace; run;
yamaa
Comments
Signed in with GitHub; saved in repository Discussions