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: build one TTAE (Time to First Adverse Event) record per subject, counting the days from treatment start to the first adverse event, or to the end of the study when no event with a usable onset date exists.

Input: one row per subject with treatment start (TRTSDT) and end-of-study (EOSDT) dates, plus adverse event records carrying onset dates (ASTDT).

Variables:

  • STARTDT: treatment start date; blank when the subject never started treatment.
  • ADT: the earliest adverse event onset date, or the end-of-study date when no event carries a usable onset date. A date before treatment start is moved up to it; blank when neither source date exists.
  • AVAL: whole days from STARTDT through ADT, counting both endpoints; blank when either date is missing.
  • CNSR: 0 when the record marks an event, 1 when the subject is censored at end of study.
  • EVNTDESC: AE for an event, END OF STUDY for a censored record.
  • SRCDOM: ADAE for an event, ADSL for a censored record.
  • SRCVAR: ASTDT for an event, EOSDT for a censored record.
  • SRCSEQ: the chosen event's sequence number: the lower number when several events share the earliest onset date; blank for a censored record.

Note: an event with no onset date cannot start the clock: it is passed over when a dated event exists, and when it is the only event the subject is censored at the end of study. Moving a date up to the treatment start changes only the date: the record keeps its event-or-censoring status and source, and the day count is 1.

Inputs

Under review
2 source files

input/adae.csv

Edit
10 rows
input/adae.csv
STUDYIDUSUBJIDASTDTAESEQAEDECOD
YAMAA-012026-01-101HEADACHE
YAMAA-012026-02-042NAUSEA
YAMAA-012025-12-151HEADACHE
YAMAA-012026-12-311COUGH
YAMAA-012026-01-151HEADACHE
YAMAA-012026-01-152NAUSEA
YAMAA-01—3RASH
YAMAA-012026-01-101HEADACHE
YAMAA-01—1HEADACHE
YAMAA-012026-03-011NAUSEA

input/adsl.csv

Edit
10 rows
input/adsl.csv
STUDYIDUSUBJIDTRTSDTEOSDT
YAMAA-012026-01-012026-12-31
YAMAA-012026-01-012026-12-31
YAMAA-012026-01-012026-12-31
YAMAA-012026-12-312026-12-31
YAMAA-012026-01-012026-12-31
YAMAA-012026-01-01—
YAMAA-012026-06-012026-05-01
YAMAA-01—2026-12-31
YAMAA-012026-01-012026-12-31
YAMAA-012026-03-012026-12-31

Expected output

Under review
10 expected rows

expected/adtte.csv

Edit
10 rows
expected/adtte.csv
STUDYIDUSUBJIDPARAMCDPARAMSTARTDTADTAVALCNSREVNTDESCSRCDOMSRCVARSRCSEQ
YAMAA-01TTAETime to First Adverse Event2026-01-012026-01-10100AEADAEASTDT1
YAMAA-01TTAETime to First Adverse Event2026-01-012026-12-313651END OF STUDYADSLEOSDT—
YAMAA-01TTAETime to First Adverse Event2026-01-012026-01-0110AEADAEASTDT1
YAMAA-01TTAETime to First Adverse Event2026-12-312026-12-3110AEADAEASTDT1
YAMAA-01TTAETime to First Adverse Event2026-01-012026-01-15150AEADAEASTDT1
YAMAA-01TTAETime to First Adverse Event2026-01-01——1END OF STUDYADSLEOSDT—
YAMAA-01TTAETime to First Adverse Event2026-06-012026-06-0111END OF STUDYADSLEOSDT—
YAMAA-01TTAETime to First Adverse Event—2026-01-10—0AEADAEASTDT1
YAMAA-01TTAETime to First Adverse Event2026-01-012026-12-313651END OF STUDYADSLEOSDT—
YAMAA-01TTAETime to First Adverse Event2026-03-012026-03-0110AEADAEASTDT1
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
ADTTESTUDYIDStudy IdentifiercharacterCopy value from ADSL.STUDYID.Predecessor
ADTTEUSUBJIDUnique Subject IdentifiercharacterCopy value from ADSL.USUBJID.Predecessor
ADTTEPARAMCDParameter CodecharacterSet constant value "TTAE".Assigned
ADTTEPARAMParametercharacterSet constant value "Time to First Adverse Event".Assigned
ADTTESTARTDTTime-to-Event Origin DatenumericISO 8601Copy value from ADSL.TRTSDT.Predecessor
ADTTEADTAnalysis DatenumericISO 8601If STARTDT > RAWDT then "STARTDT"; otherwise "RAWDT".Derived
ADTTEAVALAnalysis ValuenumericWhole days from STARTDT to ADT, counting both endpoints.Derived
ADTTECNSRCensornumericIf AEDT IS NOT NULL then "0"; otherwise "1".Derived
ADTTEEVNTDESCEvent or Censoring DescriptioncharacterIf AEDT IS NOT NULL then "AE"; otherwise "END OF STUDY".Derived
ADTTESRCDOMSource DatacharacterIf AEDT IS NOT NULL then "ADAE"; otherwise "ADSL".Derived
ADTTESRCVARSource VariablecharacterIf AEDT IS NOT NULL then "ASTDT"; otherwise "EOSDT".Derived
ADTTESRCSEQSource Sequence NumbernumericIf AEDT IS NOT NULL then "AE_REC.AESEQ"; otherwise blank.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-adtte-first-ae/full.md

Edit
33 lines

Following CDISC ADaM standards, use the provided ADSL and ADAE datasets to create an ADTTE dataset for time to first adverse event, with one record per subject.

The output dataset should contain the following columns in this order: STUDYID, USUBJID, PARAMCD, PARAM, STARTDT, ADT, AVAL, CNSR, EVNTDESC, SRCDOM, SRCVAR, SRCSEQ

Use PARAMCD "TTAE" and PARAM "Time to First Adverse Event".

STARTDT is the treatment start date, and has no value when the subject never started treatment.

ADT is the earliest adverse event onset date, or the end-of-study date when no event carries a usable onset date. A date before treatment start is moved up to it, keeping its event-or-censoring status and source; with no treatment start the date is kept as it is. ADT has no value when neither source date exists.

AVAL is the number of days from STARTDT to ADT, counting both days; it has no value when either date has none.

CNSR is 0 for an event and 1 for a censored record. Describe each record with EVNTDESC AE or END OF STUDY, from SRCDOM ADAE with SRCVAR ASTDT or from SRCDOM ADSL with SRCVAR EOSDT. SRCSEQ is the chosen event's sequence number, the lower number when several events share the earliest onset date, and has no value for a censored record.

An event with no onset date is passed over when a dated event exists; when it is the only event the subject is censored at the end of study.

Read the source datasets from /app/input and save the completed dataset as /app/output/adtte.csv.

prompts/adam-adtte-first-ae/conventions.md

Edit
18 lines

Following CDISC ADaM standards, use the provided ADSL and ADAE datasets to create an ADTTE dataset for time to first adverse event, with one record per subject.

The output dataset should contain the following columns in this order: STUDYID, USUBJID, PARAMCD, PARAM, STARTDT, ADT, AVAL, CNSR, EVNTDESC, SRCDOM, SRCVAR, SRCSEQ

Use PARAMCD "TTAE" and PARAM "Time to First Adverse Event".

AVAL counts both STARTDT and ADT.

CNSR is 0 for an event and 1 for a censored record. Describe each record with EVNTDESC AE or END OF STUDY, from SRCDOM ADAE with SRCVAR ASTDT or from SRCDOM ADSL with SRCVAR EOSDT.

Read the source datasets from /app/input and save the completed dataset as /app/output/adtte.csv.

prompts/adam-adtte-first-ae/brief.md

Edit
10 lines

Following CDISC ADaM standards, use the provided ADSL and ADAE datasets to create an ADTTE dataset for time to first adverse event, with one record per subject.

The output dataset should contain the following columns in this order: STUDYID, USUBJID, PARAMCD, PARAM, STARTDT, ADT, AVAL, CNSR, EVNTDESC, SRCDOM, SRCVAR, SRCSEQ

Read the source datasets from /app/input and save the completed dataset as /app/output/adtte.csv.

yamaa code

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

run.R

Edit
4 lines
library(yamaa)adtte <- yamaa_domain("spec.yaml")$outputadtte

run.py

Edit
4 lines
import yamaaadtte = yamaa.yamaa_domain("spec.yaml").outputadtte

Solution without yamaa

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

solutions/adam-adtte-first-ae/result.R

Edit
58 lines
# Reference solution for the yamaa benchmark adam-adtte-first-ae (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)adsl <- read_csv(  "/app/input/adsl.csv",  col_types = cols(TRTSDT = col_date(), EOSDT = col_date(), .default = col_character()))adae <- read_csv(  "/app/input/adae.csv",  col_types = cols(AESEQ = col_integer(), ASTDT = col_date(), .default = col_character()))# The subject's first adverse event by onset date, ties to the lower# sequence; an event with no onset sorts last, so it is passed over when# a dated event exists.first_ae <- adae |>  filter(!is.na(ASTDT)) |>  arrange(STUDYID, USUBJID, ASTDT, AESEQ) |>  distinct(STUDYID, USUBJID, .keep_all = TRUE) |>  select(STUDYID, USUBJID, AEDT = ASTDT, AESEQ)adtte <- adsl |>  left_join(first_ae, by = c("STUDYID", "USUBJID")) |>  mutate(    STARTDT = TRTSDT,    # The earliest onset, or the end of study when no event carries    # a usable onset date.    RAWDT = coalesce(AEDT, EOSDT),    # A date before treatment start is moved up to it, keeping its    # event-or-censoring status and source; with no treatment start    # the date is kept as it is.    ADT = case_when(      !is.na(STARTDT) & !is.na(RAWDT) & STARTDT > RAWDT ~ STARTDT,      .default = RAWDT    ),    AVAL = as.integer(ADT - STARTDT) + 1L,    CNSR = if_else(!is.na(AEDT), 0L, 1L),    EVNTDESC = if_else(!is.na(AEDT), "AE", "END OF STUDY"),    SRCDOM = if_else(!is.na(AEDT), "ADAE", "ADSL"),    SRCVAR = if_else(!is.na(AEDT), "ASTDT", "EOSDT"),    SRCSEQ = if_else(!is.na(AEDT), AESEQ, NA_integer_),    PARAMCD = "TTAE",    PARAM = "Time to First Adverse Event"  ) |>  select(    STUDYID, USUBJID, PARAMCD, PARAM, STARTDT, ADT, AVAL, CNSR,    EVNTDESC, SRCDOM, SRCVAR, SRCSEQ  ) |>  arrange(USUBJID)dir.create("/app/output", showWarnings = FALSE)write_csv(adtte, "/app/output/adtte.csv", na = "")

solutions/adam-adtte-first-ae/result.py

Edit
82 lines
# Reference solution for the yamaa benchmark adam-adtte-first-ae (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 pladsl = pl.read_csv("/app/input/adsl.csv", infer_schema=False, null_values="").with_columns(    pl.col("TRTSDT").str.to_date(strict=False),    pl.col("EOSDT").str.to_date(strict=False),)adae = pl.read_csv("/app/input/adae.csv", infer_schema=False, null_values="").with_columns(    pl.col("AESEQ").cast(pl.Int64, strict=False),    pl.col("ASTDT").str.to_date(strict=False),)# The subject's first adverse event by onset date, ties to the lower# sequence; an event with no onset sorts last, so it is passed over when# a dated event exists.first_ae = (    adae.filter(pl.col("ASTDT").is_not_null())    .sort(["STUDYID", "USUBJID", "ASTDT", "AESEQ"])    .unique(["STUDYID", "USUBJID"], keep="first", maintain_order=True)    .select("STUDYID", "USUBJID", AEDT="ASTDT", AESEQ="AESEQ"))adtte = (    adsl.join(first_ae, on=["STUDYID", "USUBJID"], how="left", maintain_order="left")    .with_columns(        STARTDT=pl.col("TRTSDT"),        # The earliest onset, or the end of study when no event carries        # a usable onset date.        RAWDT=pl.coalesce("AEDT", "EOSDT"),    )    .with_columns(        # A date before treatment start is moved up to it, keeping its        # event-or-censoring status and source; with no treatment start        # the date is kept as it is.        ADT=pl.when(pl.col("STARTDT") > pl.col("RAWDT"))        .then(pl.col("STARTDT"))        .otherwise(pl.col("RAWDT")),    )    .with_columns(        AVAL=(pl.col("ADT") - pl.col("STARTDT")).dt.total_days() + 1,        CNSR=pl.when(pl.col("AEDT").is_not_null()).then(0).otherwise(1),        EVNTDESC=pl.when(pl.col("AEDT").is_not_null())        .then(pl.lit("AE"))        .otherwise(pl.lit("END OF STUDY")),        SRCDOM=pl.when(pl.col("AEDT").is_not_null())        .then(pl.lit("ADAE"))        .otherwise(pl.lit("ADSL")),        SRCVAR=pl.when(pl.col("AEDT").is_not_null())        .then(pl.lit("ASTDT"))        .otherwise(pl.lit("EOSDT")),        SRCSEQ=pl.when(pl.col("AEDT").is_not_null())        .then(pl.col("AESEQ"))        .otherwise(None),        PARAMCD=pl.lit("TTAE"),        PARAM=pl.lit("Time to First Adverse Event"),    )    .select(        "STUDYID",        "USUBJID",        "PARAMCD",        "PARAM",        "STARTDT",        "ADT",        "AVAL",        "CNSR",        "EVNTDESC",        "SRCDOM",        "SRCVAR",        "SRCSEQ",    )    .sort("USUBJID"))Path("/app/output").mkdir(parents=True, exist_ok=True)adtte.write_csv("/app/output/adtte.csv", null_value="")

solutions/adam-adtte-first-ae/result.sas

Edit
34 lines
/* opensas reference solution for the yamaa benchmark adam-adtte-first-ae.   Reads the benchmark inputs and derives the requested output.   Execute with the existing opensas runtime: opensas /app/output/result.sas. */data adae;  length STUDYID USUBJID ASTDT AEDECOD $1024;  infile "/app/input/adae.csv" dsd dlm="," firstobs=2 truncover lrecl=32767;  input STUDYID : $char1024. USUBJID : $char1024. ASTDT : $char1024. AESEQ AEDECOD : $char1024.;run;data adsl;  length STUDYID USUBJID TRTSDT EOSDT $1024;  infile "/app/input/adsl.csv" dsd dlm="," firstobs=2 truncover lrecl=32767;  input STUDYID : $char1024. USUBJID : $char1024. TRTSDT : $char1024. EOSDT : $char1024.;run;proc sort data=adae(where=(ASTDT ne '')) out=events; by STUDYID USUBJID ASTDT AESEQ; run;data firstevent; set events; by STUDYID USUBJID; if first.USUBJID; run;proc sql; create table joined as select a.*,b.ASTDT,b.AESEQ from adsl as a left join firstevent as b on a.STUDYID=b.STUDYID and a.USUBJID=b.USUBJID; quit;data result;  length PARAMCD $8 PARAM $40 STARTDT ADT $10 EVNTDESC $20 SRCDOM $4 SRCVAR $16;  set joined; PARAMCD='TTAE'; PARAM='Time to First Adverse Event'; STARTDT=TRTSDT;  if not missing(ASTDT) then do; ADT=ASTDT; CNSR=0; EVNTDESC='AE'; SRCDOM='ADAE'; SRCVAR='ASTDT'; SRCSEQ=AESEQ; end;  else do; ADT=EOSDT; CNSR=1; EVNTDESC='END OF STUDY'; SRCDOM='ADSL'; SRCVAR='EOSDT'; end;  if not missing(STARTDT) and not missing(ADT) then do;    if ADT<STARTDT then ADT=STARTDT;    AVAL=input(ADT,yymmdd10.)-input(STARTDT,yymmdd10.)+1;  end;run;proc sql;  create table final as select STUDYID, USUBJID, PARAMCD, PARAM, STARTDT, ADT, AVAL, CNSR, EVNTDESC, SRCDOM, SRCVAR, SRCSEQ from result;quit;proc export data=final outfile="/app/output/adtte.csv" dbms=csv replace; run;