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: 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:
EOP01STTreads the subject's period 1 disposition event, the record whose category isDISPOSITION EVENTand whose epoch isTREATMENT 1:COMPLETEDwhen its coded term isCOMPLETED,DISCONTINUEDfor any other coded term,ONGOINGwhen 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.DCP01RSis the coded term of that event, such asLOST TO FOLLOW-UP, whenEOP01STTisDISCONTINUED; never the reported text; empty otherwise.EOP02STTandDCP02RSare the same for period 2, read from theTREATMENT 2epoch.
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 review3 source filesinput/dm.csv
Edit7 rows| STUDYID | USUBJID |
|---|---|
| YAMAA-01 | |
| YAMAA-01 | |
| YAMAA-01 | |
| YAMAA-01 | |
| YAMAA-01 | |
| YAMAA-01 | |
| YAMAA-01 |
input/ds.csv
Edit11 rows| STUDYID | USUBJID | DSSEQ | DSCAT | EPOCH | DSTERM | DSDECOD | DSSTDTC |
|---|---|---|---|---|---|---|---|
| YAMAA-01 | 1 | DISPOSITION EVENT | TREATMENT 1 | COMPLETED | COMPLETED | 2025-03-16 | |
| YAMAA-01 | 2 | DISPOSITION EVENT | TREATMENT 2 | COMPLETED | COMPLETED | 2025-04-13 | |
| YAMAA-01 | 1 | DISPOSITION EVENT | TREATMENT 1 | COMPLETED | COMPLETED | 2025-03-18 | |
| YAMAA-01 | 2 | DISPOSITION EVENT | TREATMENT 2 | Itchy rash on both forearms | ADVERSE EVENT | 2025-04-08 | |
| YAMAA-01 | 3 | DISPOSITION EVENT | FOLLOW-UP | COMPLETED | COMPLETED | 2025-04-22 | |
| YAMAA-01 | 1 | DISPOSITION EVENT | TREATMENT 1 | COMPLETED | COMPLETED | 2025-03-23 | |
| YAMAA-01 | 2 | DISPOSITION EVENT | WASHOUT | Moved abroad; cannot attend period 2 visits | WITHDRAWAL BY SUBJECT | 2025-03-30 | |
| YAMAA-01 | 1 | DISPOSITION EVENT | TREATMENT 1 | COMPLETED | COMPLETED | 2025-03-25 | |
| YAMAA-01 | 2 | OTHER EVENT | TREATMENT 2 | Transferred to another site | SITE TRANSFER | 2025-04-14 | |
| YAMAA-01 | 1 | DISPOSITION EVENT | TREATMENT 1 | did not return after day 9; calls unanswered | LOST TO FOLLOW-UP | 2025-03 | |
| YAMAA-01 | 1 | DISPOSITION EVENT | SCREENING | Changed mind before first dose | WITHDRAWAL BY SUBJECT | 2025-05-07 |
input/ex.csv
Edit9 rows| STUDYID | USUBJID | EXSEQ | EPOCH | EXTRT | EXSTDTC |
|---|---|---|---|---|---|
| YAMAA-01 | 1 | TREATMENT 1 | VITAMIN C | 2025-03-03 | |
| YAMAA-01 | 2 | TREATMENT 2 | PLACEBO | 2025-03-31 | |
| YAMAA-01 | 1 | TREATMENT 1 | PLACEBO | 2025-03-05 | |
| YAMAA-01 | 2 | TREATMENT 2 | VITAMIN C | 2025-04-02 | |
| YAMAA-01 | 1 | TREATMENT 1 | VITAMIN C | 2025-03-10 | |
| YAMAA-01 | 1 | TREATMENT 1 | PLACEBO | 2025-03-12 | |
| YAMAA-01 | 2 | TREATMENT 2 | VITAMIN C | 2025-04-09 | |
| YAMAA-01 | 1 | TREATMENT 1 | VITAMIN C | 2025-03-17 | |
| YAMAA-01 | 1 | TREATMENT 1 | PLACEBO | 2025-05-05 |
Expected output
Under review7 expected rowsexpected/adsl.csv
Edit7 rows| STUDYID | USUBJID | EOP01STT | DCP01RS | EOP02STT | DCP02RS |
|---|---|---|---|---|---|
| YAMAA-01 | COMPLETED | — | COMPLETED | — | |
| YAMAA-01 | COMPLETED | — | DISCONTINUED | ADVERSE EVENT | |
| YAMAA-01 | COMPLETED | — | — | — | |
| YAMAA-01 | COMPLETED | — | ONGOING | — | |
| YAMAA-01 | DISCONTINUED | LOST TO FOLLOW-UP | — | — | |
| YAMAA-01 | ONGOING | — | — | — | |
| YAMAA-01 | — | — | — | — |
Human review and assessment
| Dataset Name | Variable Name | Variable Label | Type | Codelist/Controlled Terms | Core | Computational Method | Origin |
|---|---|---|---|---|---|---|---|
| ADSL | STUDYID | Study Identifier | character | Copy value from DM.STUDYID. | Predecessor | ||
| ADSL | USUBJID | Unique Subject Identifier | character | Copy value from DM.USUBJID. | Predecessor | ||
| ADSL | EOP01STT | End of Period 01 Status | character | COMPLETED, DISCONTINUED, ONGOING | If 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 | |
| ADSL | DCP01RS | Reason for Discont from Period 01 | character | If EOP01STT = 'DISCONTINUED' then "P01DECOD"; otherwise blank. | Derived | ||
| ADSL | EOP02STT | End of Period 02 Status | character | COMPLETED, DISCONTINUED, ONGOING | If 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 | |
| ADSL | DCP02RS | Reason for Discont from Period 02 | character | If EOP02STT = 'DISCONTINUED' then "P02DECOD"; otherwise blank. | Derived |
| Variable | Permitted values |
|---|---|
| EOP01STT | COMPLETED, DISCONTINUED, ONGOING |
| EOP02STT | COMPLETED, DISCONTINUED, ONGOING |
| 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-adsl-period-status/full.md
Edit29 linesFollowing 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
Edit14 linesFollowing 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
Edit8 linesFollowing 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.
R
Edit3 lineslibrary(yamaa)yamaa_spec("spec.yaml")$run()$outputPython
Edit3 linesimport yamaayamaa.spec("spec.yaml").run().outputsolutions/adam-adsl-period-status/result.R
Edit66 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
Edit70 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
Edit63 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;
yamaa