Review ask

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.

  1. 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.
  2. Inputs: Do they look like data collected in a real trial, and do they include the situations you would expect to meet in one?
  3. 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

Lifecycle: reviewedEditUnder review
What this benchmark means
README.md

Goal: 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:

  • 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 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 review
2 source files

input/ex.csv

Edit
12 rows
input/ex.csv
STUDYIDUSUBJIDEXTRTEXSEQEXDOSE
YAMAA-01Pembrolizumab1200
YAMAA-01Pembrolizumab2—
YAMAA-01Pembrolizumab3200
YAMAA-01Pemetrexed4500
YAMAA-01Pemetrexed5450
YAMAA-01Pemetrexed6500
YAMAA-01Saline placebo10
YAMAA-01Saline placebo20
YAMAA-01Saline placebo30
YAMAA-01Nivolumab1240
YAMAA-01Nivolumab1240
YAMAA-01Daratumumab1900

input/subject_treatment.csv

Edit
6 rows
input/subject_treatment.csv
STUDYIDUSUBJIDEXTRTEXDOSUPLANDOSEPLANCYC
YAMAA-01Pembrolizumabmg2003
YAMAA-01Pemetrexedmg/m25003
YAMAA-01Saline placebomg03
YAMAA-01Nivolumabmg2402
YAMAA-01Trastuzumabmg6001
YAMAA-01Daratumumabmg18001

Expected output

Under review
6 expected rows

expected/adex.csv

Edit
6 rows
expected/adex.csv
STUDYIDUSUBJIDEXTRTEXDOSUDOSECUMNCYCLESRDI
YAMAA-01Pembrolizumabmg400366.66666666666667
YAMAA-01Pemetrexedmg/m21450396.66666666666667
YAMAA-01Saline placebomg03—
YAMAA-01Nivolumabmg4802100
YAMAA-01Trastuzumabmg———
YAMAA-01Daratumumabmg900150
Shaded columns are derived— = missing value

Comments and assessment materials

Comments

Signed in with GitHub; saved in repository Discussions

Mapping spec

Generated from the benchmark YAML; do not edit by hand

Dataset NameVariable NameVariable LabelTypeCodelist/Controlled TermsCoreComputational MethodOrigin
ADEXSTUDYIDStudy IdentifiercharacterCopy value from TRT.STUDYID.Predecessor
ADEXUSUBJIDUnique Subject IdentifiercharacterCopy value from TRT.USUBJID.Predecessor
ADEXEXTRTName of TreatmentcharacterCopy value from TRT.EXTRT.Predecessor
ADEXEXDOSUDose UnitscharacterCopy value from TRT.EXDOSU.Predecessor
ADEXDOSECUMCumulative DosenumericAggregate SUM(EX.EXDOSE) over records matching on the shared output keys.Derived
ADEXNCYCLESNumber of Treatment CyclesnumericAggregate COUNT(EX.EXSEQ) over records matching on the shared output keys.Derived
ADEXRDIRelative Dose IntensitynumericCompute 100 * DOSECUM / NULLIF(PLANDOSE * PLANCYC, 0).Derived
VersionDateAuthorDescriptionReviewerSign-off
1.32026-09-29yamaa docs buildShow study codelist names, external dictionaries, and ISO 8601 formats in variable rows; list the document's codelist values and metadata
1.22026-09-29yamaa docs buildClassify ADaM copies from a declared input as Predecessor and recodes as Derived, and SDTM recodes of locally derived columns as Derived
1.12026-09-29yamaa docs buildResolve lookups into the donor record they select, and give every derivation shape a plain-language rule instead of its raw YAML
1.0yamaa docs buildInitial generation from spec.yaml

Agent prompt

The request an agent receives with the input files; each tier states no more than the one above

prompts/adam-adex-cumulative-dose/full.md

Edit
21 lines

Following 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

Edit
10 lines

Following 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

Edit
8 lines

Following 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.

yamaa code

Runs the yamaa specification; its result must match the expected output

run.R

Edit
4 lines
library(yamaa)adex <- yamaa_domain("spec.yaml")$outputadex

run.py

Edit
4 lines
import yamaaadex = yamaa.yamaa_domain("spec.yaml").outputadex

Solution without yamaa

Written from the full prompt and the inputs alone; CI checks it reproduces the expected output

solutions/adam-adex-cumulative-dose/result.R

Edit
47 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

Edit
44 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

Edit
25 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;