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: 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:

  • DTHDTC is 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.
  • DTHFL is Y when 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 review
3 source files

input/ae.csv

Edit
6 rows
input/ae.csv
STUDYIDUSUBJIDAESEQAETERMAEOUTAEENDTC
CATH1HEADACHERECOVERED2025-01-10
CATH1CARDIAC ARRESTFATAL2025-02-15
CATH1RESPIRATORY FAILUREFATAL2025-03-22
CATH1NAUSEARECOVERED2025-04-10
CATH1MYOCARDIAL INFARCTIONFATAL2025-05-25
CATH2CARDIAC ARRESTFATAL—

input/dm_raw.csv

Edit
5 rows
input/dm_raw.csv
STUDYIDUSUBJID
CATH
CATH
CATH
CATH
CATH

input/ds.csv

Edit
6 rows
input/ds.csv
STUDYIDUSUBJIDDSSEQDSDECODDSCATDSSTDTC
CATH1DEATHDISPOSITION EVENT2025-01-15
CATH1COMPLETEDDISPOSITION EVENT2025-02-20
CATH1DEATHDISPOSITION EVENT2025-03-20
CATH1COMPLETEDDISPOSITION EVENT2025-04-20
CATH1DEATHDISPOSITION EVENT2025-05-25
CATH2DEATHDISPOSITION EVENT—

Expected output

Under review
5 expected rows

expected/dm.csv

Edit
5 rows
expected/dm.csv
DOMAINSTUDYIDUSUBJIDDTHDTCDTHFL
DMCATH2025-01-15Y
DMCATH2025-02-15Y
DMCATH2025-03-20Y
DMCATH——
DMCATH2025-05-25Y
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

Variable NameVariable LabelTypeLengthControlled Terms or FormatOriginCoreConversion DefinitionVariable TypeVariable OrderComments for Define
DOMAINDomain AbbreviationCharAssignedSet constant value "DM".SDTM1
STUDYIDStudy IdentifierCharCollectedCopy value from DM_RAW.STUDYID.SDTM2
USUBJIDUnique Subject IdentifierCharCollectedCopy value from DM_RAW.USUBJID.SDTM3
DTHDTCDate/Time of DeathCharISO 8601DerivedFirst non-missing of DSDTHDT and AEDTHDT.SDTM4
DTHFLSubject Death FlagCharYDerived"Y" when DSDTHDT IS NOT NULL OR AEDTHDT IS NOT NULL; blank otherwise.SDTM5
VariablePermitted values
DTHFLY
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/sdtm-dm-death/full.md

Edit
16 lines

Following 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

Edit
10 lines

Following 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

Edit
8 lines

Following 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.

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/sdtm-dm-death/result.R

Edit
48 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

Edit
77 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

Edit
31 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;