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: give each subject a single end-of-study summary holding EOSDT, EOSDECOD, EOSREAS, EOSSTT, and DCSREAS, plus an independent end-of-treatment summary holding EOTDT, EOTSTT, DCTREAS, and DCSREASP.

Input: demographics rows identifying each subject, plus disposition records (DS) with category (DSCAT), epoch (EPOCH), coded term (DSDECOD), reported term (DSTERM), start date (DSSTDTC), and sequence number (DSSEQ). Records with EPOCH = 'TREATMENT' describe treatment disposition; the study summary reads every other epoch.

Variables:

  • EOSDT is the latest start date (DSSTDTC) among the subject's records whose category (DSCAT) is DISPOSITION EVENT and whose epoch is not TREATMENT; a record without a date never counts, and a subject with no dated disposition record is empty.
  • EOSDECOD is the coded term (DSDECOD) on the subject's last dated study disposition record, the one with the latest start date; empty when the subject has no dated disposition record. The coded term names the specific reason (for example WITHDRAWAL BY SUBJECT), never a generic status.
  • EOSREAS is the reported term (DSTERM) on that same last record; empty when the subject has no dated disposition record.
  • EOSSTT is COMPLETED when the last coded term is COMPLETED, DISCONTINUED for any other recorded term, and ONGOING when the subject has no dated disposition record.
  • DCSREAS repeats the end-of-study reason (EOSREAS) for a subject whose status is DISCONTINUED; empty otherwise.
  • EOTDT is the latest start date among the subject's dated treatment disposition records (EPOCH = 'TREATMENT'); empty when the subject has none.
  • EOTSTT is COMPLETED when the last treatment coded term is COMPLETED, DISCONTINUED for any other recorded term, and ONGOING when the subject has no dated treatment record.
  • DCTREAS is the reported term on the last treatment record for a subject whose treatment status is DISCONTINUED; empty otherwise.
  • DCSREASP carries that reported term again when the coded treatment term is OTHER - the specify text; empty otherwise.

Note: date, term, and reason come from a single last event, so the three always describe the same event: when two events share the latest date, the higher sequence number (DSSEQ) decides. Records in other categories, such as protocol milestones, and records without a date never count, so a subject whose disposition record has no date is ONGOING. The study and treatment tracks are independent: a subject who stops treatment but completes the study is DISCONTINUED for treatment and COMPLETED for study.

Inputs

Under review
2 source files

input/dm.csv

Edit
7 rows
input/dm.csv
STUDYIDUSUBJID
YAMAA-01
YAMAA-01
YAMAA-01
YAMAA-01
YAMAA-01
YAMAA-01
YAMAA-01

input/ds.csv

Edit
16 rows
input/ds.csv
STUDYIDUSUBJIDDSSEQDSCATEPOCHDSDECODDSTERMDSSTDTC
YAMAA-011PROTOCOL MILESTONESCREENINGRANDOMIZEDRandomized2024-03-04
YAMAA-012DISPOSITION EVENTTREATMENTCOMPLETEDCompleted per protocol2024-10-01
YAMAA-013DISPOSITION EVENTFOLLOW-UPCOMPLETEDCompleted per protocol2024-11-18
YAMAA-011PROTOCOL MILESTONESCREENINGRANDOMIZEDRandomized2024-03-06
YAMAA-012DISPOSITION EVENTTREATMENTOTHERRelocated; treatment unavailable2024-08-30
YAMAA-013DISPOSITION EVENTFOLLOW-UPWITHDRAWAL BY SUBJECTSubject withdrew consent2024-08-30
YAMAA-014DISPOSITION EVENTFOLLOW-UPADVERSE EVENTNausea too severe2024-08-30
YAMAA-015DISPOSITION EVENTFOLLOW-UPLOST TO FOLLOW-UPCould not reach subject—
YAMAA-011DISPOSITION EVENTSCREENINGSCREEN FAILUREDid not meet inclusion criterion 32024-02-15
YAMAA-011PROTOCOL MILESTONESCREENINGRANDOMIZEDRandomized2024-04-01
YAMAA-012DISPOSITION EVENTTREATMENTDEATHDeath2024-09-27
YAMAA-013DISPOSITION EVENTFOLLOW-UPDEATHDeath2024-09-27
YAMAA-011DISPOSITION EVENTFOLLOW-UPWITHDRAWAL BY SUBJECTSubject relocated out of state—
YAMAA-011PROTOCOL MILESTONESCREENINGRANDOMIZEDRandomized2024-05-01
YAMAA-012DISPOSITION EVENTTREATMENTADVERSE EVENTPersistent rash2024-06-15
YAMAA-013DISPOSITION EVENTFOLLOW-UPCOMPLETEDCompleted per protocol2024-11-20

Expected output

Under review
7 expected rows

expected/adsl.csv

Edit
7 rows
expected/adsl.csv
STUDYIDUSUBJIDEOSDTEOSDECODEOSREASEOSSTTDCSREASEOTDTEOTSTTDCTREASDCSREASP
YAMAA-012024-11-18COMPLETEDCompleted per protocolCOMPLETED—2024-10-01COMPLETED——
YAMAA-012024-08-30ADVERSE EVENTNausea too severeDISCONTINUEDNausea too severe2024-08-30DISCONTINUEDRelocated; treatment unavailableRelocated; treatment unavailable
YAMAA-01———ONGOING——ONGOING——
YAMAA-012024-02-15SCREEN FAILUREDid not meet inclusion criterion 3DISCONTINUEDDid not meet inclusion criterion 3—ONGOING——
YAMAA-012024-09-27DEATHDeathDISCONTINUEDDeath2024-09-27DISCONTINUEDDeath—
YAMAA-01———ONGOING——ONGOING——
YAMAA-012024-11-20COMPLETEDCompleted per protocolCOMPLETED—2024-06-15DISCONTINUEDPersistent rash—
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
ADSLSTUDYIDStudy IdentifiercharacterCopy value from DM.STUDYID.Predecessor
ADSLUSUBJIDUnique Subject IdentifiercharacterCopy value from DM.USUBJID.Predecessor
ADSLEOSDTEnd of Study DatenumericISO 8601Aggregate MAX(DS.DSSTDTC) over records matching on the shared output keys, where DS.DSCAT = 'DISPOSITION EVENT' AND DS.EPOCH <> 'TREATMENT' AND DS.DSSTDTC IS NOT NULL.Derived
ADSLEOSDECODEnd of Study Decoded TermcharacterCopy value from DS.DSDECOD where DS.DSCAT = 'DISPOSITION EVENT' AND DS.EPOCH <> 'TREATMENT' AND DS.DSSTDTC IS NOT NULL, keeping the last ordered by DS.DSSTDTC then DS.DSSEQ.Predecessor
ADSLEOSREASEnd of Study ReasoncharacterCopy value from DS.DSTERM where DS.DSCAT = 'DISPOSITION EVENT' AND DS.EPOCH <> 'TREATMENT' AND DS.DSSTDTC IS NOT NULL, keeping the last ordered by DS.DSSTDTC then DS.DSSEQ.Predecessor
ADSLEOSSTTEnd of Study StatuscharacterCOMPLETED, DISCONTINUED, ONGOINGIf EOSDECOD = 'COMPLETED' then "COMPLETED"; If EOSDECOD IS NOT NULL then "DISCONTINUED"; otherwise "ONGOING".Derived
ADSLDCSREASReason for DiscontinuationcharacterIf EOSSTT = 'DISCONTINUED' then "EOSREAS"; otherwise blank.Derived
ADSLEOTDTEnd of Treatment DatenumericISO 8601Aggregate MAX(DS.DSSTDTC) over records matching on the shared output keys, where DS.DSCAT = 'DISPOSITION EVENT' AND DS.EPOCH = 'TREATMENT' AND DS.DSSTDTC IS NOT NULL.Derived
ADSLEOTSTTEnd of Treatment StatuscharacterCOMPLETED, DISCONTINUED, ONGOINGIf DSDECOD = 'COMPLETED', with DSDECOD taken from the last DS record matching on STUDYID and USUBJID, where DS.DSCAT = 'DISPOSITION EVENT' AND DS.EPOCH = 'TREATMENT' AND DS.DSSTDTC IS NOT NULL, ordered by DS.DSSTDTC then DS.DSSEQ, and no match yields blank then "COMPLETED"; If EOTDT IS NOT NULL then "DISCONTINUED"; otherwise "ONGOING".Derived
ADSLDCTREASReason for Discontinuation of TreatmentcharacterIf EOTSTT = 'DISCONTINUED' then "LASTTRT.DSTERM"; otherwise blank.Derived
ADSLDCSREASPSpecify Text for Discontinuation of TreatmentcharacterIf EOTSTT = 'DISCONTINUED' AND DSDECOD = 'OTHER', with DSDECOD taken from the last DS record matching on STUDYID and USUBJID, where DS.DSCAT = 'DISPOSITION EVENT' AND DS.EPOCH = 'TREATMENT' AND DS.DSSTDTC IS NOT NULL, ordered by DS.DSSTDTC then DS.DSSEQ, and no match yields blank then "LASTTRT.DSTERM"; otherwise blank.Derived
VariablePermitted values
EOSSTTCOMPLETED, DISCONTINUED, ONGOING
EOTSTTCOMPLETED, DISCONTINUED, ONGOING
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-adsl-disposition/full.md

Edit
36 lines

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

The output dataset should contain the following columns in this order: STUDYID, USUBJID, EOSDT, EOSDECOD, EOSREAS, EOSSTT, DCSREAS, EOTDT, EOTSTT, DCTREAS, DCSREASP

Only DS records with DSCAT "DISPOSITION EVENT" count; records in any other category never count. The end-of-study summary reads the subject's disposition records whose EPOCH is not "TREATMENT", and the end-of-treatment summary reads those whose EPOCH is "TREATMENT", and the two summaries are independent. A disposition record with no DSSTDTC never counts for either summary. The last record of a summary is the subject's counted record with the latest DSSTDTC, and when two counted records share that date, the one with the higher DSSEQ is the last record.

EOSDT is the DSSTDTC of the last record of the study summary, and EOSDECOD and EOSREAS are the DSDECOD and DSTERM on that same record. EOSDT, EOSDECOD, and EOSREAS have no value when the subject has no dated study disposition record. EOSSTT is "COMPLETED" when EOSDECOD is "COMPLETED", "DISCONTINUED" when EOSDECOD is any other recorded term, and "ONGOING" when the subject has no dated study disposition record. DCSREAS is EOSREAS when EOSSTT is "DISCONTINUED"; it has no value otherwise.

EOTDT is the DSSTDTC of the last record of the treatment summary; it has no value when the subject has no dated treatment disposition record. EOTSTT is "COMPLETED" when the DSDECOD on the last record of the treatment summary is "COMPLETED", "DISCONTINUED" when it is any other recorded term, and "ONGOING" when the subject has no dated treatment disposition record. DCTREAS is the DSTERM on the last record of the treatment summary when EOTSTT is "DISCONTINUED"; it has no value otherwise. DCSREASP is that same DSTERM when the DSDECOD on the last record of the treatment summary is "OTHER"; it has no value otherwise.

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

prompts/adam-adsl-disposition/conventions.md

Edit
12 lines

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

The output dataset should contain the following columns in this order: STUDYID, USUBJID, EOSDT, EOSDECOD, EOSREAS, EOSSTT, DCSREAS, EOTDT, EOTSTT, DCTREAS, DCSREASP

EOSSTT is "COMPLETED", "DISCONTINUED", or "ONGOING". EOTSTT is "COMPLETED", "DISCONTINUED", or "ONGOING".

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

prompts/adam-adsl-disposition/brief.md

Edit
9 lines

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

The output dataset should contain the following columns in this order: STUDYID, USUBJID, EOSDT, EOSDECOD, EOSREAS, EOSSTT, DCSREAS, EOTDT, EOTSTT, DCTREAS, DCSREASP

Read the source datasets from /app/input and save the completed dataset as /app/output/adsl.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-adsl-disposition/result.R

Edit
58 lines
# Reference solution for the yamaa benchmark adam-adsl-disposition (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)dm <- read_csv(  "/app/input/dm.csv",  col_types = cols(.default = col_character()))ds <- read_csv(  "/app/input/ds.csv",  col_types = cols(DSSEQ = col_integer(), DSSTDTC = col_date(), .default = col_character()))# The last dated disposition event per track: latest date, highest sequence# on a tie. The study track reads every epoch but TREATMENT; the treatment# track reads only TREATMENT.last_study <- ds |>  filter(DSCAT %in% "DISPOSITION EVENT", EPOCH != "TREATMENT", !is.na(DSSTDTC)) |>  arrange(STUDYID, USUBJID, desc(DSSTDTC), desc(DSSEQ)) |>  distinct(STUDYID, USUBJID, .keep_all = TRUE) |>  transmute(STUDYID, USUBJID, EOSDT = DSSTDTC, EOSDECOD = DSDECOD, EOSREAS = DSTERM)last_trt <- ds |>  filter(DSCAT %in% "DISPOSITION EVENT", EPOCH %in% "TREATMENT", !is.na(DSSTDTC)) |>  arrange(STUDYID, USUBJID, desc(DSSTDTC), desc(DSSEQ)) |>  distinct(STUDYID, USUBJID, .keep_all = TRUE) |>  transmute(STUDYID, USUBJID, EOTDT = DSSTDTC, EOTDECOD = DSDECOD, EOTREAS = DSTERM)adsl <- dm |>  left_join(last_study, by = c("STUDYID", "USUBJID")) |>  left_join(last_trt, by = c("STUDYID", "USUBJID")) |>  mutate(    EOSSTT = case_when(      EOSDECOD == "COMPLETED" ~ "COMPLETED",      !is.na(EOSDECOD) ~ "DISCONTINUED",      .default = "ONGOING"    ),    DCSREAS = if_else(EOSSTT == "DISCONTINUED", EOSREAS, NA_character_),    EOTSTT = case_when(      EOTDECOD == "COMPLETED" ~ "COMPLETED",      !is.na(EOTDT) ~ "DISCONTINUED",      .default = "ONGOING"    ),    DCTREAS = if_else(EOTSTT == "DISCONTINUED", EOTREAS, NA_character_),    DCSREASP = if_else(EOTDECOD %in% "OTHER", EOTREAS, NA_character_)  ) |>  select(    STUDYID, USUBJID, EOSDT, EOSDECOD, EOSREAS, EOSSTT, DCSREAS,    EOTDT, EOTSTT, DCTREAS, DCSREASP  )dir.create("/app/output", showWarnings = FALSE)write_csv(adsl, "/app/output/adsl.csv", na = "")

solutions/adam-adsl-disposition/result.py

Edit
100 lines
# Reference solution for the yamaa benchmark adam-adsl-disposition (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.import csvINPUT_DIR = "/app/input"OUTPUT_DIR = "/app/output"OUTPUT_FILE = OUTPUT_DIR + "/adsl.csv"def read_csv(path):    with open(path, newline="") as f:        return list(csv.DictReader(f))def last_record(records):    """Last record: latest DSSTDTC, ties broken by higher DSSEQ."""    if not records:        return None    return max(records, key=lambda r: (r["DSSTDTC"], float(r["DSSEQ"])))def main():    dm = read_csv(INPUT_DIR + "/dm.csv")    ds = read_csv(INPUT_DIR + "/ds.csv")    # Only DISPOSITION EVENT records with a date ever count.    counted = {}    for row in ds:        if row["DSCAT"] != "DISPOSITION EVENT":            continue        if not row["DSSTDTC"]:            continue        counted.setdefault(row["USUBJID"], []).append(row)    fieldnames = [        "STUDYID", "USUBJID", "EOSDT", "EOSDECOD", "EOSREAS", "EOSSTT",        "DCSREAS", "EOTDT", "EOTSTT", "DCTREAS", "DCSREASP",    ]    out_rows = []    for subj in dm:        usubjid = subj["USUBJID"]        records = counted.get(usubjid, [])        study = [r for r in records if r["EPOCH"] != "TREATMENT"]        treat = [r for r in records if r["EPOCH"] == "TREATMENT"]        last_study = last_record(study)        last_treat = last_record(treat)        # End-of-study summary.        if last_study is None:            eosdt = eosdecod = eosreas = ""            eosstt = "ONGOING"        else:            eosdt = last_study["DSSTDTC"]            eosdecod = last_study["DSDECOD"]            eosreas = last_study["DSTERM"]            eosstt = "COMPLETED" if eosdecod == "COMPLETED" else "DISCONTINUED"        dcsreas = eosreas if eosstt == "DISCONTINUED" else ""        # End-of-treatment summary.        if last_treat is None:            eotdt = ""            eotstt = "ONGOING"            treat_term = ""            treat_decod = ""        else:            eotdt = last_treat["DSSTDTC"]            treat_decod = last_treat["DSDECOD"]            treat_term = last_treat["DSTERM"]            eotstt = "COMPLETED" if treat_decod == "COMPLETED" else "DISCONTINUED"        dctreas = treat_term if eotstt == "DISCONTINUED" else ""        dcsreasp = treat_term if treat_decod == "OTHER" else ""        out_rows.append({            "STUDYID": subj["STUDYID"],            "USUBJID": usubjid,            "EOSDT": eosdt,            "EOSDECOD": eosdecod,            "EOSREAS": eosreas,            "EOSSTT": eosstt,            "DCSREAS": dcsreas,            "EOTDT": eotdt,            "EOTSTT": eotstt,            "DCTREAS": dctreas,            "DCSREASP": dcsreasp,        })    with open(OUTPUT_FILE, "w", newline="") as f:        writer = csv.DictWriter(f, fieldnames=fieldnames)        writer.writeheader()        writer.writerows(out_rows)if __name__ == "__main__":    main()

solutions/adam-adsl-disposition/result.sas

Edit
52 lines
/* opensas reference solution for the yamaa benchmark adam-adsl-disposition.   Reads the benchmark inputs and derives the requested output.   Execute with the existing opensas runtime: opensas /app/output/result.sas. */data dm;  length STUDYID USUBJID $1024;  infile "/app/input/dm.csv" dsd dlm="," firstobs=2 truncover lrecl=32767;  input STUDYID : $char1024. USUBJID : $char1024.;run;data ds;  length STUDYID USUBJID DSCAT EPOCH DSDECOD DSTERM DSSTDTC $1024;  infile "/app/input/ds.csv" dsd dlm="," firstobs=2 truncover lrecl=32767;  input STUDYID : $char1024. USUBJID : $char1024. DSSEQ DSCAT : $char1024. EPOCH : $char1024. DSDECOD : $char1024. DSTERM : $char1024. DSSTDTC : $char1024.;run;proc sort data=ds(where=(DSCAT='DISPOSITION EVENT' and EPOCH ne 'TREATMENT' and DSSTDTC ne '')) out=ordered_study;  by STUDYID USUBJID descending DSSTDTC descending DSSEQ;run;data lastds; set ordered_study; by STUDYID USUBJID; if first.USUBJID; run;proc sort data=ds(where=(DSCAT='DISPOSITION EVENT' and EPOCH='TREATMENT' and DSSTDTC ne '')) out=ordered_trt;  by STUDYID USUBJID descending DSSTDTC descending DSSEQ;run;data lasttrt; set ordered_trt; by STUDYID USUBJID; if first.USUBJID; keep STUDYID USUBJID DSSTDTC DSDECOD DSTERM; run;proc sql;  create table joined as    select a.*, b.DSSTDTC as EOSDT, b.DSDECOD as EOSDECOD, b.DSTERM as EOSREAS,           c.DSSTDTC as EOTDT, c.DSDECOD as EOTDECOD, c.DSTERM as EOTREAS    from dm as a    left join lastds as b on a.STUDYID=b.STUDYID and a.USUBJID=b.USUBJID    left join lasttrt as c on a.STUDYID=c.STUDYID and a.USUBJID=c.USUBJID;quit;data result;  length EOSSTT $12 DCSREAS $1024 EOTSTT $12 DCTREAS $1024 DCSREASP $1024;  set joined;  if missing(EOSDT) then EOSSTT='ONGOING';  else if EOSDECOD='COMPLETED' then EOSSTT='COMPLETED';  else EOSSTT='DISCONTINUED';  if EOSSTT='DISCONTINUED' then DCSREAS=EOSREAS;  if missing(EOTDT) then EOTSTT='ONGOING';  else if EOTDECOD='COMPLETED' then EOTSTT='COMPLETED';  else EOTSTT='DISCONTINUED';  if EOTSTT='DISCONTINUED' then DCTREAS=EOTREAS;  if EOTDECOD='OTHER' then DCSREASP=EOTREAS;run;proc sql;  create table final as select STUDYID, USUBJID, EOSDT, EOSDECOD, EOSREAS, EOSSTT, DCSREAS, EOTDT, EOTSTT, DCTREAS, DCSREASP from result;quit;proc export data=final outfile="/app/output/adsl.csv" dbms=csv replace; run;