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: derive date/time of death (DTHDTC) and death flag (DTHFL) for
each demographics subject.
Input: demographics subjects, disposition records with status and start date, and adverse events with outcome and end date.
Variables:
DTHDTCis the latest disposition death date, or the latest fatal adverse event end date when disposition has no death; empty when neither source records a death.DTHFLisYwhen either source supplies a death date; empty otherwise.
Note: when the sources record different death dates, the disposition date wins. An undated death or fatal event cannot displace a dated one.
Inputs
Under review3 source filesinput/ae.csv
Edit6 rows| STUDYID | USUBJID | AESEQ | AETERM | AEOUT | AEENDTC |
|---|---|---|---|---|---|
| CATH | 1 | HEADACHE | RECOVERED | 2025-01-10 | |
| CATH | 1 | CARDIAC ARREST | FATAL | 2025-02-15 | |
| CATH | 1 | RESPIRATORY FAILURE | FATAL | 2025-03-22 | |
| CATH | 1 | NAUSEA | RECOVERED | 2025-04-10 | |
| CATH | 1 | MYOCARDIAL INFARCTION | FATAL | 2025-05-25 | |
| CATH | 2 | CARDIAC ARREST | FATAL | — |
input/dm_raw.csv
Edit5 rows| STUDYID | USUBJID |
|---|---|
| CATH | |
| CATH | |
| CATH | |
| CATH | |
| CATH |
input/ds.csv
Edit6 rows| STUDYID | USUBJID | DSSEQ | DSDECOD | DSCAT | DSSTDTC |
|---|---|---|---|---|---|
| CATH | 1 | DEATH | DISPOSITION EVENT | 2025-01-15 | |
| CATH | 1 | COMPLETED | DISPOSITION EVENT | 2025-02-20 | |
| CATH | 1 | DEATH | DISPOSITION EVENT | 2025-03-20 | |
| CATH | 1 | COMPLETED | DISPOSITION EVENT | 2025-04-20 | |
| CATH | 1 | DEATH | DISPOSITION EVENT | 2025-05-25 | |
| CATH | 2 | DEATH | DISPOSITION EVENT | — |
Expected output
Under review5 expected rowsexpected/dm.csv
Edit5 rows| DOMAIN | STUDYID | USUBJID | DTHDTC | DTHFL |
|---|---|---|---|---|
| DM | CATH | 2025-01-15 | Y | |
| DM | CATH | 2025-02-15 | Y | |
| DM | CATH | 2025-03-20 | Y | |
| DM | CATH | — | — | |
| DM | CATH | 2025-05-25 | Y |
Human review and assessment
| Variable Name | Variable Label | Type | Length | Controlled Terms or Format | Origin | Core | Conversion Definition | Variable Type | Variable Order | Comments for Define |
|---|---|---|---|---|---|---|---|---|---|---|
| DOMAIN | Domain Abbreviation | Char | Assigned | Set constant value "DM". | SDTM | 1 | ||||
| STUDYID | Study Identifier | Char | Collected | Copy value from DM_RAW.STUDYID. | SDTM | 2 | ||||
| USUBJID | Unique Subject Identifier | Char | Collected | Copy value from DM_RAW.USUBJID. | SDTM | 3 | ||||
| DTHDTC | Date/Time of Death | Char | ISO 8601 | Derived | First non-missing of DSDTHDT and AEDTHDT. | SDTM | 4 | |||
| DTHFL | Subject Death Flag | Char | Y | Derived | "Y" when DSDTHDT IS NOT NULL OR AEDTHDT IS NOT NULL; blank otherwise. | SDTM | 5 |
| Variable | Permitted values |
|---|---|
| DTHFL | Y |
| 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/sdtm-dm-death/full.md
Edit16 linesFollowing CDISC SDTM standards, use the provided AE, DM_RAW, and DS datasets to create a DM dataset with one record per subject.
The output dataset should contain the following columns in this order: DOMAIN, STUDYID, USUBJID, DTHDTC, DTHFL
DOMAIN is "DM". DTHDTC is the latest start date among the subject's disposition records with decoded term "DEATH" that carry a start date. When the subject has no such disposition record, DTHDTC is the latest end date among the subject's adverse events with outcome "FATAL" that carry an end date. When neither source records a death date for the subject, DTHDTC has no value. DTHFL is "Y" when either source supplies a death date for the subject, and has no value otherwise.
Read the source datasets from /app/input and save the completed dataset as /app/output/dm.csv.
prompts/sdtm-dm-death/conventions.md
Edit10 linesFollowing CDISC SDTM standards, use the provided AE, DM_RAW, and DS datasets to create a DM dataset with one record per subject.
The output dataset should contain the following columns in this order: DOMAIN, STUDYID, USUBJID, DTHDTC, DTHFL
DOMAIN is "DM". DTHFL is "Y" or has no value.
Read the source datasets from /app/input and save the completed dataset as /app/output/dm.csv.
prompts/sdtm-dm-death/brief.md
Edit8 linesFollowing CDISC SDTM standards, use the provided AE, DM_RAW, and DS datasets to create a DM dataset with one record per subject.
The output dataset should contain the following columns in this order: DOMAIN, STUDYID, USUBJID, DTHDTC, DTHFL
Read the source datasets from /app/input and save the completed dataset as /app/output/dm.csv.
R
Edit3 lineslibrary(yamaa)yamaa_spec("spec.yaml")$run()$outputPython
Edit3 linesimport yamaayamaa.spec("spec.yaml").run().outputsolutions/sdtm-dm-death/result.R
Edit48 lines# Reference solution for the yamaa benchmark sdtm-dm-death (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_raw <- read_csv( "/app/input/dm_raw.csv", col_types = cols(.default = col_character()))ds <- read_csv( "/app/input/ds.csv", col_types = cols(.default = col_character()))ae <- read_csv( "/app/input/ae.csv", col_types = cols(.default = col_character()))ds_death <- ds |> filter(DSDECOD == "DEATH") |> mutate(DSSTDTC = suppressWarnings(as.Date(DSSTDTC))) |> filter(!is.na(DSSTDTC)) |> group_by(STUDYID, USUBJID) |> summarise(DS_DTH = max(DSSTDTC), .groups = "drop")ae_fatal <- ae |> filter(AEOUT == "FATAL") |> mutate(AEENDTC = suppressWarnings(as.Date(AEENDTC))) |> filter(!is.na(AEENDTC)) |> group_by(STUDYID, USUBJID) |> summarise(AE_DTH = max(AEENDTC), .groups = "drop")dm <- dm_raw |> left_join(ds_death, by = c("STUDYID", "USUBJID")) |> left_join(ae_fatal, by = c("STUDYID", "USUBJID")) |> mutate( DOMAIN = "DM", DTHDTC = coalesce(DS_DTH, AE_DTH), DTHFL = ifelse(!is.na(DTHDTC), "Y", NA_character_) ) |> select(DOMAIN, STUDYID, USUBJID, DTHDTC, DTHFL)dir.create("/app/output", showWarnings = FALSE)write_csv(dm, "/app/output/dm.csv", na = "")solutions/sdtm-dm-death/result.py
Edit77 lines# Reference solution for the yamaa benchmark sdtm-dm-death (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 the SDTM DM dataset with death date and death flag.One record per subject (from DM_RAW). DTHDTC is the latest start dateamong the subject's disposition records with decoded term "DEATH"that carry a start date; if the subject has no such record, it is thelatest end date among the subject's adverse events with outcome"FATAL" that carry an end date. DTHFL is "Y" when either sourcesupplies a death date, and blank otherwise."""import csvfrom collections import OrderedDictfrom pathlib import PathINPUT_DIR = Path("/app/input")OUTPUT_DIR = Path("/app/output")def read_rows(name): with open(INPUT_DIR / name, newline="", encoding="utf-8") as handle: return list(csv.DictReader(handle))def latest_date(dates): """Latest non-blank ISO date string, or "" when none is present.""" present = [d.strip() for d in dates if d and d.strip()] return max(present) if present else ""def main(): subjects = read_rows("dm_raw.csv") ds_rows = read_rows("ds.csv") ae_rows = read_rows("ae.csv") ds_death_dates = {} for row in ds_rows: if row["DSDECOD"] == "DEATH": ds_death_dates.setdefault(row["USUBJID"], []).append(row["DSSTDTC"]) ae_fatal_dates = {} for row in ae_rows: if row["AEOUT"] == "FATAL": ae_fatal_dates.setdefault(row["USUBJID"], []).append(row["AEENDTC"]) out_rows = [] for subject in subjects: usubjid = subject["USUBJID"] dthdtc = latest_date(ds_death_dates.get(usubjid, [])) if not dthdtc: dthdtc = latest_date(ae_fatal_dates.get(usubjid, [])) out_rows.append( OrderedDict( DOMAIN="DM", STUDYID=subject["STUDYID"], USUBJID=usubjid, DTHDTC=dthdtc, DTHFL="Y" if dthdtc else "", ) ) OUTPUT_DIR.mkdir(parents=True, exist_ok=True) with open(OUTPUT_DIR / "dm.csv", "w", newline="", encoding="utf-8") as handle: writer = csv.DictWriter( handle, fieldnames=["DOMAIN", "STUDYID", "USUBJID", "DTHDTC", "DTHFL"] ) writer.writeheader() writer.writerows(out_rows)if __name__ == "__main__": main()solutions/sdtm-dm-death/result.sas
Edit31 lines/* opensas reference solution for the yamaa benchmark sdtm-dm-death. Reads the benchmark inputs and derives the requested output. Execute with the existing opensas runtime: opensas /app/output/result.sas. */data ae; length STUDYID USUBJID AETERM AEOUT AEENDTC $1024; infile "/app/input/ae.csv" dsd dlm="," firstobs=2 truncover lrecl=32767; input STUDYID : $char1024. USUBJID : $char1024. AESEQ AETERM : $char1024. AEOUT : $char1024. AEENDTC : $char1024.;run;data dm_raw; length STUDYID USUBJID $1024; infile "/app/input/dm_raw.csv" dsd dlm="," firstobs=2 truncover lrecl=32767; input STUDYID : $char1024. USUBJID : $char1024.;run;data ds; length STUDYID USUBJID DSDECOD DSCAT DSSTDTC $1024; infile "/app/input/ds.csv" dsd dlm="," firstobs=2 truncover lrecl=32767; input STUDYID : $char1024. USUBJID : $char1024. DSSEQ DSDECOD : $char1024. DSCAT : $char1024. DSSTDTC : $char1024.;run;proc sql;create table dsdeath as select STUDYID,USUBJID,max(DSSTDTC) as DSDATE from ds where DSDECOD='DEATH' and not missing(DSSTDTC) group by STUDYID,USUBJID;create table aedeath as select STUDYID,USUBJID,max(AEENDTC) as AEDATE from ae where AEOUT='FATAL' and not missing(AEENDTC) group by STUDYID,USUBJID;create table joined as select a.*,b.DSDATE,c.AEDATE from dm_raw a left join dsdeath b on a.STUDYID=b.STUDYID and a.USUBJID=b.USUBJID left join aedeath c on a.STUDYID=c.STUDYID and a.USUBJID=c.USUBJID; quit;data result; set joined; length DOMAIN $2 DTHDTC $1024 DTHFL $1; DOMAIN='DM'; DTHDTC=coalescec(DSDATE,AEDATE); if not missing(DTHDTC) then DTHFL='Y'; run;proc sql; create table final as select DOMAIN, STUDYID, USUBJID, DTHDTC, DTHFL from result;quit;proc export data=final outfile="/app/output/dm.csv" dbms=csv replace; run;
yamaa