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

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"; 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.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
27 lines

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

PARAMCD is "TTAE" and PARAM is "Time to First Adverse Event" on every record. STARTDT is the subject's 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. 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. ADT has no value when neither an onset date nor an end-of-study date exists. 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, and has no value when either date is missing. For an event, CNSR is 0, EVNTDESC is "AE", SRCDOM is "ADAE", and SRCVAR is "ASTDT". For a censored record, CNSR is 1, EVNTDESC is "END OF STUDY", SRCDOM is "ADSL", and SRCVAR is "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.

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

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

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" or "END OF STUDY". SRCDOM is "ADAE" or "ADSL". SRCVAR is "ASTDT" or "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
9 lines

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

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
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
105 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 subject (from ADSL). The first adverse event with a usableonset date (ASTDT) is the event; subjects without a dated event arecensored at their end-of-study date (EOSDT)."""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"))        eosdt = parse_date(subj.get("EOSDT"))        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)        else:            adt = eosdt            cnsr, evntdesc, srcdom, srcvar = 1, "END OF STUDY", "ADSL", "EOSDT"            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 startdt is not None and adt < startdt:            adt = startdt        if adt is not None and startdt is not None:            aval = str((adt - startdt).days + 1)        else:            aval = ""        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
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;