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
README.mdPublic 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 fromSTARTDTthroughADT, counting both endpoints; blank when either date is missing.CNSR:0when the record marks an event,1when the subject is censored at end of study.EVNTDESC:AEfor an event,END OF STUDYfor a censored record.SRCDOM:ADAEfor an event,ADSLfor a censored record.SRCVAR:ASTDTfor an event,EOSDTfor 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 review2 source filesinput/adae.csv
Edit10 rows| STUDYID | USUBJID | ASTDT | AESEQ | AEDECOD |
|---|---|---|---|---|
| YAMAA-01 | 2026-01-10 | 1 | HEADACHE | |
| YAMAA-01 | 2026-02-04 | 2 | NAUSEA | |
| YAMAA-01 | 2025-12-15 | 1 | HEADACHE | |
| YAMAA-01 | 2026-12-31 | 1 | COUGH | |
| YAMAA-01 | 2026-01-15 | 1 | HEADACHE | |
| YAMAA-01 | 2026-01-15 | 2 | NAUSEA | |
| YAMAA-01 | — | 3 | RASH | |
| YAMAA-01 | 2026-01-10 | 1 | HEADACHE | |
| YAMAA-01 | — | 1 | HEADACHE | |
| YAMAA-01 | 2026-03-01 | 1 | NAUSEA |
input/adsl.csv
Edit10 rows| STUDYID | USUBJID | TRTSDT | EOSDT |
|---|---|---|---|
| YAMAA-01 | 2026-01-01 | 2026-12-31 | |
| YAMAA-01 | 2026-01-01 | 2026-12-31 | |
| YAMAA-01 | 2026-01-01 | 2026-12-31 | |
| YAMAA-01 | 2026-12-31 | 2026-12-31 | |
| YAMAA-01 | 2026-01-01 | 2026-12-31 | |
| YAMAA-01 | 2026-01-01 | — | |
| YAMAA-01 | 2026-06-01 | 2026-05-01 | |
| YAMAA-01 | — | 2026-12-31 | |
| YAMAA-01 | 2026-01-01 | 2026-12-31 | |
| YAMAA-01 | 2026-03-01 | 2026-12-31 |
Expected output
Under review10 expected rowsexpected/adtte.csv
Edit10 rows| STUDYID | USUBJID | PARAMCD | PARAM | STARTDT | ADT | AVAL | CNSR | EVNTDESC | SRCDOM | SRCVAR | SRCSEQ |
|---|---|---|---|---|---|---|---|---|---|---|---|
| YAMAA-01 | TTAE | Time to First Adverse Event | 2026-01-01 | 2026-01-10 | 10 | 0 | AE | ADAE | ASTDT | 1 | |
| YAMAA-01 | TTAE | Time to First Adverse Event | 2026-01-01 | 2026-12-31 | 365 | 1 | END OF STUDY | ADSL | EOSDT | — | |
| YAMAA-01 | TTAE | Time to First Adverse Event | 2026-01-01 | 2026-01-01 | 1 | 0 | AE | ADAE | ASTDT | 1 | |
| YAMAA-01 | TTAE | Time to First Adverse Event | 2026-12-31 | 2026-12-31 | 1 | 0 | AE | ADAE | ASTDT | 1 | |
| YAMAA-01 | TTAE | Time to First Adverse Event | 2026-01-01 | 2026-01-15 | 15 | 0 | AE | ADAE | ASTDT | 1 | |
| YAMAA-01 | TTAE | Time to First Adverse Event | 2026-01-01 | — | — | 1 | END OF STUDY | ADSL | EOSDT | — | |
| YAMAA-01 | TTAE | Time to First Adverse Event | 2026-06-01 | 2026-06-01 | 1 | 1 | END OF STUDY | ADSL | EOSDT | — | |
| YAMAA-01 | TTAE | Time to First Adverse Event | — | 2026-01-10 | — | 0 | AE | ADAE | ASTDT | 1 | |
| YAMAA-01 | TTAE | Time to First Adverse Event | 2026-01-01 | 2026-12-31 | 365 | 1 | END OF STUDY | ADSL | EOSDT | — | |
| YAMAA-01 | TTAE | Time to First Adverse Event | 2026-03-01 | 2026-03-01 | 1 | 0 | AE | ADAE | ASTDT | 1 |
Human review and assessment
| Dataset Name | Variable Name | Variable Label | Type | Codelist/Controlled Terms | Core | Computational Method | Origin |
|---|---|---|---|---|---|---|---|
| ADTTE | STUDYID | Study Identifier | character | Copy value from ADSL.STUDYID. | Predecessor | ||
| ADTTE | USUBJID | Unique Subject Identifier | character | Copy value from ADSL.USUBJID. | Predecessor | ||
| ADTTE | PARAMCD | Parameter Code | character | Set constant value "TTAE". | Assigned | ||
| ADTTE | PARAM | Parameter | character | Set constant value "Time to First Adverse Event". | Assigned | ||
| ADTTE | STARTDT | Time-to-Event Origin Date | numeric | ISO 8601 | Copy value from ADSL.TRTSDT. | Predecessor | |
| ADTTE | ADT | Analysis Date | numeric | ISO 8601 | If STARTDT > RAWDT then "STARTDT"; otherwise "RAWDT". | Derived | |
| ADTTE | AVAL | Analysis Value | numeric | Whole days from STARTDT to ADT, counting both endpoints. | Derived | ||
| ADTTE | CNSR | Censor | numeric | If AEDT IS NOT NULL then "0"; otherwise "1". | Derived | ||
| ADTTE | EVNTDESC | Event or Censoring Description | character | If AEDT IS NOT NULL then "AE"; otherwise "END OF STUDY". | Derived | ||
| ADTTE | SRCDOM | Source Data | character | If AEDT IS NOT NULL then "ADAE"; otherwise "ADSL". | Derived | ||
| ADTTE | SRCVAR | Source Variable | character | If AEDT IS NOT NULL then "ASTDT"; otherwise "EOSDT". | Derived | ||
| ADTTE | SRCSEQ | Source Sequence Number | numeric | If AEDT IS NOT NULL then "AE_REC.AESEQ"; otherwise blank. | Derived |
| Version | Date | Author | Description | Reviewer | Sign-off |
|---|---|---|---|---|---|
| 1.7 | 2026-10-20 | yamaa docs build | Read 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.6 | 2026-10-17 | yamaa docs build | Describe collected date parts written as ISO 8601 date text and times of day counted in seconds since midnight | ||
| 1.5 | 2026-10-17 | yamaa docs build | Name 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.4 | 2026-10-15 | yamaa docs build | State datetime precision codes through the hour and minute, and complete only the time parts a collected datetime lacks | ||
| 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-adtte-first-ae/full.md
Edit27 linesFollowing 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
Edit14 linesFollowing 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
Edit9 linesFollowing 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.
R
Edit3 lineslibrary(yamaa)yamaa_spec("spec.yaml")$run()$outputPython
Edit3 linesimport yamaayamaa.spec("spec.yaml").run().outputsolutions/adam-adtte-first-ae/result.R
Edit58 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
Edit105 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
Edit34 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;
yamaa