Review ask

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

Lifecycle: reviewedEditUnder review
What this benchmark means
README.md

Public entries: Python and R. Passing coverage requires an installed inventory.

Goal: build one TTAE (Time to First Adverse Event) record for each treated subject, counting the days from treatment start to the first adverse event, or to the censoring date when no event with a usable onset date exists.

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

Variables:

  • STARTDT: treatment start date.
  • ADT: the earliest adverse event onset date. When no event carries a usable onset date, it is the end-of-study date, or the last known alive date for a subject who has not ended the study. A date before treatment start is moved up to it.
  • AVAL: whole days from STARTDT through ADT, counting both endpoints.
  • CNSR: 0 when the record marks an event, 1 when the subject is censored.
  • EVNTDESC: AE for an event; END OF STUDY or LAST KNOWN ALIVE for a censored record, naming the date it is censored at.
  • SRCDOM: ADAE for an event, ADSL for a censored record.
  • SRCVAR: ASTDT for an event, and EOSDT or LSTALVDT 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: a subject who never started treatment has no record, so every record has a day count. 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. 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
STUDYIDUSUBJIDTRTSDTEOSDTLSTALVDT
YAMAA-012026-01-012026-12-312026-12-31
YAMAA-012026-01-012026-12-312026-12-31
YAMAA-012026-01-012026-12-312026-12-31
YAMAA-012026-12-312026-12-312026-12-31
YAMAA-012026-01-012026-12-312026-12-31
YAMAA-012026-01-01—2026-09-15
YAMAA-012026-06-012026-05-012026-06-01
YAMAA-01—2026-12-312026-12-31
YAMAA-012026-01-012026-12-312026-12-31
YAMAA-012026-03-012026-12-312026-12-31

Expected output

Under review
9 expected rows

expected/adtte.csv

Edit
9 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-012026-09-152581LAST KNOWN ALIVEADSLLSTALVDT—
YAMAA-01TTAETime to First Adverse Event2026-06-012026-06-0111END OF STUDYADSLEOSDT—
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

Human review and assessment

Your review

3 questions and your comments · View benchmark 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"; If ADSL.EOSDT IS NOT NULL then "END OF STUDY"; otherwise "LAST KNOWN ALIVE".Derived
ADTTESRCDOMSource DatacharacterIf AEDT IS NOT NULL then "ADAE"; otherwise "ADSL".Derived
ADTTESRCVARSource VariablecharacterIf AEDT IS NOT NULL then "ASTDT"; If ADSL.EOSDT IS NOT NULL then "EOSDT"; otherwise "LSTALVDT".Derived
ADTTESRCSEQSource Sequence NumbernumericIf AEDT IS NOT NULL then "AE_REC.AESEQ"; otherwise blank.Derived
VersionDateAuthorDescriptionReviewerSign-off
1.82026-11-19yamaa docs buildState open and closed range endpoints, including bounds of zero
1.72026-10-20yamaa docs buildRead 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.62026-10-17yamaa docs buildDescribe collected date parts written as ISO 8601 date text and times of day counted in seconds since midnight
1.52026-10-17yamaa docs buildName 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.42026-10-15yamaa docs buildState datetime precision codes through the hour and minute, and complete only the time parts a collected datetime lacks
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
29 lines

Following CDISC ADaM standards, use the provided ADAE and ADSL datasets to create an ADTTE dataset with one record per treated subject.

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

PARAMCD is "TTAE" and PARAM is "Time to First Adverse Event" on every record. A subject who never started treatment, with no TRTSDT, has no record. STARTDT is the subject's treatment start date. ADT is the earliest adverse event onset date. When no event carries a usable onset date, the subject is censored: ADT is the end-of-study date (EOSDT), or the last known alive date (LSTALVDT) when the subject has no end-of-study date. 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. A date before the treatment start is moved up to the treatment start; the record keeps its event or censoring status and source, and its day count is 1. AVAL is the number of whole days from STARTDT through ADT, counting both endpoints. For an event, CNSR is 0, EVNTDESC is "AE", SRCDOM is "ADAE", and SRCVAR is "ASTDT". For a record censored at the end of study, CNSR is 1, EVNTDESC is "END OF STUDY", SRCDOM is "ADSL", and SRCVAR is "EOSDT". For a record censored at the last known alive date, CNSR is 1, EVNTDESC is "LAST KNOWN ALIVE", SRCDOM is "ADSL", and SRCVAR is "LSTALVDT". 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.

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
15 lines

Following CDISC ADaM standards, use the provided ADAE and ADSL datasets to create an ADTTE dataset with one record per treated subject.

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

PARAMCD is "TTAE" and PARAM is "Time to First Adverse Event" on every record. AVAL is the number of whole days from STARTDT through ADT, counting both endpoints. CNSR is 0 or 1. EVNTDESC is "AE", "END OF STUDY" or "LAST KNOWN ALIVE". SRCDOM is "ADAE" or "ADSL". SRCVAR is "ASTDT", "EOSDT" or "LSTALVDT".

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
9 lines

Following CDISC ADaM standards, use the provided ADAE and ADSL datasets to create an ADTTE dataset with one record per treated 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

Public calls generated from benchmark.yaml; results must match the expected output

R

Edit
3 lines
library(yamaa)yamaa_spec("spec.yaml")$run()$output

Python

Edit
3 lines
import yamaayamaa.spec("spec.yaml").run().output

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
71 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(), LSTALVDT = 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)# Only treated subjects have a record.adtte <- adsl |>  filter(!is.na(TRTSDT)) |>  left_join(first_ae, by = c("STUDYID", "USUBJID")) |>  mutate(    STARTDT = TRTSDT,    # The earliest onset; with no event carrying a usable onset date,    # the end of study, or the last known alive date for a subject who    # has not ended the study.    RAWDT = coalesce(AEDT, EOSDT, LSTALVDT),    # A date before treatment start is moved up to it, keeping its    # event-or-censoring status and source.    ADT = case_when(      !is.na(RAWDT) & STARTDT > RAWDT ~ STARTDT,      .default = RAWDT    ),    AVAL = as.integer(ADT - STARTDT) + 1L,    CNSR = if_else(!is.na(AEDT), 0L, 1L),    EVNTDESC = case_when(      !is.na(AEDT) ~ "AE",      !is.na(EOSDT) ~ "END OF STUDY",      .default = "LAST KNOWN ALIVE"    ),    SRCDOM = if_else(!is.na(AEDT), "ADAE", "ADSL"),    SRCVAR = case_when(      !is.na(AEDT) ~ "ASTDT",      !is.na(EOSDT) ~ "EOSDT",      .default = "LSTALVDT"    ),    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
111 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."""Create an ADTTE dataset (time to first adverse event) from ADAE and ADSL.One record per treated subject (from ADSL, with a TRTSDT). The first adverseevent with a usable onset date (ASTDT) is the event; subjects without adated event are censored at their end-of-study date (EOSDT), or at theirlast known alive date (LSTALVDT) when they have not ended the study."""import csvfrom datetime import dateINPUT_DIR = "/app/input"OUTPUT_DIR = "/app/output"def parse_date(value):    """Parse an ISO date string, returning None for blank values."""    value = (value or "").strip()    if not value:        return None    return date.fromisoformat(value)def fmt_date(value):    return value.isoformat() if value is not None else ""def read_rows(path):    with open(path, newline="", encoding="utf-8") as handle:        return list(csv.DictReader(handle))def main():    adsl = read_rows(f"{INPUT_DIR}/adsl.csv")    adae = read_rows(f"{INPUT_DIR}/adae.csv")    events_by_subject = {}    for row in adae:        events_by_subject.setdefault(row["USUBJID"], []).append(row)    records = []    for subj in adsl:        startdt = parse_date(subj.get("TRTSDT"))        if startdt is None:            # A subject who never started treatment has no record.            continue        eosdt = parse_date(subj.get("EOSDT"))        lstalvdt = parse_date(subj.get("LSTALVDT"))        dated_events = []        for event in events_by_subject.get(subj["USUBJID"], []):            onset = parse_date(event.get("ASTDT"))            if onset is not None:                dated_events.append((onset, int(event["AESEQ"])))        if dated_events:            # Earliest onset date; lowest sequence number breaks ties.            adt, srcseq = min(dated_events)            cnsr, evntdesc, srcdom, srcvar = 0, "AE", "ADAE", "ASTDT"            srcseq_text = str(srcseq)        elif eosdt is not None:            adt = eosdt            cnsr, evntdesc, srcdom, srcvar = 1, "END OF STUDY", "ADSL", "EOSDT"            srcseq_text = ""        else:            adt = lstalvdt            cnsr, evntdesc, srcdom, srcvar = 1, "LAST KNOWN ALIVE", "ADSL", "LSTALVDT"            srcseq_text = ""        # A date before the treatment start is moved up to the treatment        # start; the record keeps its event or censoring status.        if adt is not None and adt < startdt:            adt = startdt        aval = str((adt - startdt).days + 1) if adt is not None else ""        records.append(            {                "STUDYID": subj["STUDYID"],                "USUBJID": subj["USUBJID"],                "PARAMCD": "TTAE",                "PARAM": "Time to First Adverse Event",                "STARTDT": fmt_date(startdt),                "ADT": fmt_date(adt),                "AVAL": aval,                "CNSR": str(cnsr),                "EVNTDESC": evntdesc,                "SRCDOM": srcdom,                "SRCVAR": srcvar,                "SRCSEQ": srcseq_text,            }        )    fieldnames = [        "STUDYID", "USUBJID", "PARAMCD", "PARAM", "STARTDT", "ADT",        "AVAL", "CNSR", "EVNTDESC", "SRCDOM", "SRCVAR", "SRCSEQ",    ]    with open(f"{OUTPUT_DIR}/adtte.csv", "w", newline="", encoding="utf-8") as handle:        writer = csv.DictWriter(handle, fieldnames=fieldnames)        writer.writeheader()        writer.writerows(records)if __name__ == "__main__":    main()

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

Edit
37 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 LSTALVDT $1024;  infile "/app/input/adsl.csv" dsd dlm="," firstobs=2 truncover lrecl=32767;  input STUDYID : $char1024. USUBJID : $char1024. TRTSDT : $char1024. EOSDT : $char1024. LSTALVDT : $char1024.;  /* Only treated subjects have a record. */  if not missing(TRTSDT);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 if not missing(EOSDT) then do; ADT=EOSDT; CNSR=1; EVNTDESC='END OF STUDY'; SRCDOM='ADSL'; SRCVAR='EOSDT'; end;  else do; ADT=LSTALVDT; CNSR=1; EVNTDESC='LAST KNOWN ALIVE'; SRCDOM='ADSL'; SRCVAR='LSTALVDT'; 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;