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: draftEditUnder review
What this benchmark means
README.md

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

Goal: give each subject an end-of-period status and a discontinuation reason for both periods of a two-period study: EOP01STT, DCP01RS, EOP02STT, and DCP02RS.

Input: demographics rows identifying each subject, exposure records (EX) carrying the epoch (EPOCH) of each dose, and disposition records (DS) with category (DSCAT), epoch, reported term (DSTERM), coded term (DSDECOD), and date (DSSTDTC). Period 1 is the TREATMENT 1 epoch and period 2 the TREATMENT 2 epoch.

Variables:

  • EOP01STT reads the subject's period 1 disposition event, the record whose category is DISPOSITION EVENT and whose epoch is TREATMENT 1: COMPLETED when its coded term is COMPLETED, DISCONTINUED for any other coded term, ONGOING when the subject received a dose in period 1 but has no such event yet, and empty when the subject never received a dose in period 1.
  • DCP01RS is the coded term of that event, such as LOST TO FOLLOW-UP, when EOP01STT is DISCONTINUED; never the reported text; empty otherwise.
  • EOP02STT and DCP02RS are the same for period 2, read from the TREATMENT 2 epoch.

Note: the epoch alone places an event in a period; its date, complete or partial, plays no part. Records in other categories, such as a site transfer, and events in other epochs, such as a withdrawal during the washout or the end-of-study event, never set a period's status. Two disposition events for one period, or one for a period the subject never received a dose in, stop the run.

Inputs

Under review
3 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
11 rows
input/ds.csv
STUDYIDUSUBJIDDSSEQDSCATEPOCHDSTERMDSDECODDSSTDTC
YAMAA-011DISPOSITION EVENTTREATMENT 1COMPLETEDCOMPLETED2025-03-16
YAMAA-012DISPOSITION EVENTTREATMENT 2COMPLETEDCOMPLETED2025-04-13
YAMAA-011DISPOSITION EVENTTREATMENT 1COMPLETEDCOMPLETED2025-03-18
YAMAA-012DISPOSITION EVENTTREATMENT 2Itchy rash on both forearmsADVERSE EVENT2025-04-08
YAMAA-013DISPOSITION EVENTFOLLOW-UPCOMPLETEDCOMPLETED2025-04-22
YAMAA-011DISPOSITION EVENTTREATMENT 1COMPLETEDCOMPLETED2025-03-23
YAMAA-012DISPOSITION EVENTWASHOUTMoved abroad; cannot attend period 2 visitsWITHDRAWAL BY SUBJECT2025-03-30
YAMAA-011DISPOSITION EVENTTREATMENT 1COMPLETEDCOMPLETED2025-03-25
YAMAA-012OTHER EVENTTREATMENT 2Transferred to another siteSITE TRANSFER2025-04-14
YAMAA-011DISPOSITION EVENTTREATMENT 1did not return after day 9; calls unansweredLOST TO FOLLOW-UP2025-03
YAMAA-011DISPOSITION EVENTSCREENINGChanged mind before first doseWITHDRAWAL BY SUBJECT2025-05-07

input/ex.csv

Edit
9 rows
input/ex.csv
STUDYIDUSUBJIDEXSEQEPOCHEXTRTEXSTDTC
YAMAA-011TREATMENT 1VITAMIN C2025-03-03
YAMAA-012TREATMENT 2PLACEBO2025-03-31
YAMAA-011TREATMENT 1PLACEBO2025-03-05
YAMAA-012TREATMENT 2VITAMIN C2025-04-02
YAMAA-011TREATMENT 1VITAMIN C2025-03-10
YAMAA-011TREATMENT 1PLACEBO2025-03-12
YAMAA-012TREATMENT 2VITAMIN C2025-04-09
YAMAA-011TREATMENT 1VITAMIN C2025-03-17
YAMAA-011TREATMENT 1PLACEBO2025-05-05

Expected output

Under review
7 expected rows

expected/adsl.csv

Edit
7 rows
expected/adsl.csv
STUDYIDUSUBJIDEOP01STTDCP01RSEOP02STTDCP02RS
YAMAA-01COMPLETED—COMPLETED—
YAMAA-01COMPLETED—DISCONTINUEDADVERSE EVENT
YAMAA-01COMPLETED———
YAMAA-01COMPLETED—ONGOING—
YAMAA-01DISCONTINUEDLOST TO FOLLOW-UP——
YAMAA-01ONGOING———
YAMAA-01————
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
ADSLEOP01STTEnd of Period 01 StatuscharacterCOMPLETED, DISCONTINUED, ONGOINGIf P01EXN IS NOT NULL AND P01DECOD = 'COMPLETED' then "COMPLETED"; If P01EXN IS NOT NULL AND P01DECOD IS NOT NULL then "DISCONTINUED"; If P01EXN IS NOT NULL then "ONGOING"; otherwise blank.Derived
ADSLDCP01RSReason for Discont from Period 01characterIf EOP01STT = 'DISCONTINUED' then "P01DECOD"; otherwise blank.Derived
ADSLEOP02STTEnd of Period 02 StatuscharacterCOMPLETED, DISCONTINUED, ONGOINGIf P02EXN IS NOT NULL AND P02DECOD = 'COMPLETED' then "COMPLETED"; If P02EXN IS NOT NULL AND P02DECOD IS NOT NULL then "DISCONTINUED"; If P02EXN IS NOT NULL then "ONGOING"; otherwise blank.Derived
ADSLDCP02RSReason for Discont from Period 02characterIf EOP02STT = 'DISCONTINUED' then "P02DECOD"; otherwise blank.Derived
VariablePermitted values
EOP01STTCOMPLETED, DISCONTINUED, ONGOING
EOP02STTCOMPLETED, 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-period-status/full.md

Edit
29 lines

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

The output dataset should contain the following columns in this order: STUDYID, USUBJID, EOP01STT, DCP01RS, EOP02STT, DCP02RS

Period 1 is the "TREATMENT 1" epoch and period 2 is the "TREATMENT 2" epoch. A period's status reads the subject's disposition event for that period, the DS record with category "DISPOSITION EVENT" in that period's epoch. The epoch alone places an event in a period; its date, complete or partial, plays no part. Records in other categories, such as a site transfer, and events in other epochs, such as a withdrawal during the washout or the end-of-study event, never set a period's status. EOP01STT is "COMPLETED" when the coded term of the period 1 event is "COMPLETED", "DISCONTINUED" when its coded term is any other value, "ONGOING" when the subject received a dose in period 1 but has no such event, and has no value when the subject never received a dose in period 1. DCP01RS is the coded term of the period 1 event, never its reported term, when EOP01STT is "DISCONTINUED", and has no value otherwise. EOP02STT is "COMPLETED" when the coded term of the period 2 event is "COMPLETED", "DISCONTINUED" when its coded term is any other value, "ONGOING" when the subject received a dose in period 2 but has no such event, and has no value when the subject never received a dose in period 2. DCP02RS is the coded term of the period 2 event, never its reported term, when EOP02STT is "DISCONTINUED", and has no value otherwise.

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

prompts/adam-adsl-period-status/conventions.md

Edit
14 lines

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

The output dataset should contain the following columns in this order: STUDYID, USUBJID, EOP01STT, DCP01RS, EOP02STT, DCP02RS

Period 1 is the "TREATMENT 1" epoch and period 2 is the "TREATMENT 2" epoch. EOP01STT is "COMPLETED", "DISCONTINUED", "ONGOING", or has no value. DCP01RS is the coded term of the period 1 event, or has no value. EOP02STT is "COMPLETED", "DISCONTINUED", "ONGOING", or has no value. DCP02RS is the coded term of the period 2 event, or has no value.

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

prompts/adam-adsl-period-status/brief.md

Edit
8 lines

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

The output dataset should contain the following columns in this order: STUDYID, USUBJID, EOP01STT, DCP01RS, EOP02STT, DCP02RS

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-period-status/result.R

Edit
66 lines
# Reference solution for the yamaa benchmark adam-adsl-period-status (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()))ex <- read_csv(  "/app/input/ex.csv",  col_types = cols(EXSEQ = col_integer(), .default = col_character()))ds <- read_csv(  "/app/input/ds.csv",  col_types = cols(DSSEQ = col_integer(), .default = col_character()))# A subject entered a period when it has an exposure record in that# period's epoch; its disposition event is the DISPOSITION EVENT record# in the same epoch.entered1 <- ex |>  filter(EPOCH %in% "TREATMENT 1") |>  distinct(STUDYID, USUBJID) |>  mutate(P01EX = 1L)entered2 <- ex |>  filter(EPOCH %in% "TREATMENT 2") |>  distinct(STUDYID, USUBJID) |>  mutate(P02EX = 1L)event1 <- ds |>  filter(DSCAT %in% "DISPOSITION EVENT", EPOCH %in% "TREATMENT 1") |>  transmute(STUDYID, USUBJID, P01DECOD = DSDECOD)event2 <- ds |>  filter(DSCAT %in% "DISPOSITION EVENT", EPOCH %in% "TREATMENT 2") |>  transmute(STUDYID, USUBJID, P02DECOD = DSDECOD)adsl <- dm |>  left_join(entered1, by = c("STUDYID", "USUBJID")) |>  left_join(entered2, by = c("STUDYID", "USUBJID")) |>  left_join(event1, by = c("STUDYID", "USUBJID")) |>  left_join(event2, by = c("STUDYID", "USUBJID")) |>  mutate(    EOP01STT = case_when(      !is.na(P01EX) & !is.na(P01DECOD) & P01DECOD == "COMPLETED" ~ "COMPLETED",      !is.na(P01EX) & !is.na(P01DECOD) ~ "DISCONTINUED",      !is.na(P01EX) ~ "ONGOING",      .default = NA_character_    ),    DCP01RS = if_else(EOP01STT %in% "DISCONTINUED", P01DECOD, NA_character_),    EOP02STT = case_when(      !is.na(P02EX) & !is.na(P02DECOD) & P02DECOD == "COMPLETED" ~ "COMPLETED",      !is.na(P02EX) & !is.na(P02DECOD) ~ "DISCONTINUED",      !is.na(P02EX) ~ "ONGOING",      .default = NA_character_    ),    DCP02RS = if_else(EOP02STT %in% "DISCONTINUED", P02DECOD, NA_character_)  ) |>  select(STUDYID, USUBJID, EOP01STT, DCP01RS, EOP02STT, DCP02RS)dir.create("/app/output", showWarnings = FALSE)write_csv(adsl, "/app/output/adsl.csv", na = "")

solutions/adam-adsl-period-status/result.py

Edit
70 lines
# Reference solution for the yamaa benchmark adam-adsl-period-status (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 csvimport osINPUT_DIR = "/app/input"OUTPUT_DIR = "/app/output"PERIODS = ["TREATMENT 1", "TREATMENT 2"]def read_csv(name):    with open(os.path.join(INPUT_DIR, name), newline="", encoding="utf-8") as f:        return list(csv.DictReader(f))def main():    dm = read_csv("dm.csv")    ds = read_csv("ds.csv")    ex = read_csv("ex.csv")    # Dosed periods per subject: any EX record in the period's epoch.    dosed = {}    for row in ex:        dosed.setdefault(row["USUBJID"], set()).add(row["EPOCH"])    # Disposition event per subject and period: DS record with category    # "DISPOSITION EVENT" in the period's epoch; keep its coded term.    event = {}    for row in ds:        if row["DSCAT"] == "DISPOSITION EVENT" and row["EPOCH"] in PERIODS:            event[(row["USUBJID"], row["EPOCH"])] = row["DSDECOD"]    rows = []    for subj in dm:        usubjid = subj["USUBJID"]        out = {"STUDYID": subj["STUDYID"], "USUBJID": usubjid}        for i, epoch in enumerate(PERIODS, start=1):            status_col = f"EOP0{i}STT"            reason_col = f"DCP0{i}RS"            decod = event.get((usubjid, epoch))            if decod is not None:                if decod == "COMPLETED":                    out[status_col] = "COMPLETED"                    out[reason_col] = ""                else:                    out[status_col] = "DISCONTINUED"                    out[reason_col] = decod            elif epoch in dosed.get(usubjid, set()):                out[status_col] = "ONGOING"                out[reason_col] = ""            else:                out[status_col] = ""                out[reason_col] = ""        rows.append(out)    fieldnames = ["STUDYID", "USUBJID", "EOP01STT", "DCP01RS", "EOP02STT", "DCP02RS"]    os.makedirs(OUTPUT_DIR, exist_ok=True)    with open(os.path.join(OUTPUT_DIR, "adsl.csv"), "w", newline="", encoding="utf-8") as f:        writer = csv.DictWriter(f, fieldnames=fieldnames)        writer.writeheader()        writer.writerows(rows)if __name__ == "__main__":    main()

solutions/adam-adsl-period-status/result.sas

Edit
63 lines
/* opensas reference solution for the yamaa benchmark adam-adsl-period-status.   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 ex;  length STUDYID USUBJID EPOCH EXTRT EXSTDTC $1024;  infile "/app/input/ex.csv" dsd dlm="," firstobs=2 truncover lrecl=32767;  input STUDYID : $char1024. USUBJID : $char1024. EXSEQ EPOCH : $char1024. EXTRT : $char1024. EXSTDTC : $char1024.;run;data ds;  length STUDYID USUBJID DSCAT EPOCH DSTERM DSDECOD DSSTDTC $1024;  infile "/app/input/ds.csv" dsd dlm="," firstobs=2 truncover lrecl=32767;  input STUDYID : $char1024. USUBJID : $char1024. DSSEQ DSCAT : $char1024. EPOCH : $char1024. DSTERM : $char1024. DSDECOD : $char1024. DSSTDTC : $char1024.;run;proc sql;  create table entered1 as    select distinct STUDYID, USUBJID, 1 as P01EX from ex    where EPOCH = 'TREATMENT 1';  create table entered2 as    select distinct STUDYID, USUBJID, 1 as P02EX from ex    where EPOCH = 'TREATMENT 2';  create table event1 as    select STUDYID, USUBJID, DSDECOD as P01DECOD from ds    where DSCAT = 'DISPOSITION EVENT' and EPOCH = 'TREATMENT 1';  create table event2 as    select STUDYID, USUBJID, DSDECOD as P02DECOD from ds    where DSCAT = 'DISPOSITION EVENT' and EPOCH = 'TREATMENT 2';  create table joined as    select a.STUDYID, a.USUBJID, b.P01EX, c.P02EX, d.P01DECOD, e.P02DECOD    from dm as a    left join entered1 as b on a.STUDYID = b.STUDYID and a.USUBJID = b.USUBJID    left join entered2 as c on a.STUDYID = c.STUDYID and a.USUBJID = c.USUBJID    left join event1 as d on a.STUDYID = d.STUDYID and a.USUBJID = d.USUBJID    left join event2 as e on a.STUDYID = e.STUDYID and a.USUBJID = e.USUBJID;quit;data result;  length EOP01STT $12 DCP01RS $1024 EOP02STT $12 DCP02RS $1024;  set joined;  if missing(P01EX) then EOP01STT = '';  else if P01DECOD = 'COMPLETED' then EOP01STT = 'COMPLETED';  else if not missing(P01DECOD) then EOP01STT = 'DISCONTINUED';  else EOP01STT = 'ONGOING';  if EOP01STT = 'DISCONTINUED' then DCP01RS = P01DECOD;  if missing(P02EX) then EOP02STT = '';  else if P02DECOD = 'COMPLETED' then EOP02STT = 'COMPLETED';  else if not missing(P02DECOD) then EOP02STT = 'DISCONTINUED';  else EOP02STT = 'ONGOING';  if EOP02STT = 'DISCONTINUED' then DCP02RS = P02DECOD;run;proc sql;  create table final as select STUDYID, USUBJID, EOP01STT, DCP01RS, EOP02STT, DCP02RS from result;quit;proc export data=final outfile="/app/output/adsl.csv" dbms=csv replace; run;