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: one row per adverse event (AE) with the collected start and end kept at the precision they were collected (AESTDTC, AEENDTC), and the study day (AESTDY, AEENDY) filled only when the date is complete.

Input: long-form Operational Data Model (ODM) data (input/odm.csv) with one row per collected item, carrying the collection form (FormOID), the form repeat (FormRepeatKey, the AE number within the subject), the item (ItemOID), and the stored value (Value). Each adverse event is one FO.AE form instance holding the reported term (IT.AE.AETERM) and the collected start and end as separate year, month, and day items (IT.AE.AESTYR / IT.AE.AESTMO / IT.AE.AESTDY, IT.AE.AEENYR / IT.AE.AEENMO / IT.AE.AEENDY); a part that was not collected has no row. Demographics (input/dm.csv) supplies the subject reference start date (RFSTDTC), empty when the subject has no usable reference date.

Variables:

  • AESTDTC / AEENDTC are the collected dates written as ISO 8601 text at the precision collected: a full date (2026-03-15), a year and month (2026-03), or a year alone (2026). The text stops before the first part that was not collected, so a day collected without its month keeps the year alone, and a date without a collected year stays empty. Nothing is imputed, and a part that is not written as its digits stops the run.
  • AESTDY / AEENDY are the study days counted from RFSTDTC: day 1 is the reference start date, the day before it is -1, and there is no day zero. Only a complete date gets a study day: a partial date has none even when the reference date is known, and no date has one when the reference date is unknown.

Inputs

Under review
2 source files

input/dm.csv

Edit
3 rows
input/dm.csv
STUDYIDUSUBJIDRFSTDTC
YAMAA-012026-01-10
YAMAA-012026-02-01
YAMAA-01—

input/odm.csv

Edit
32 rows
input/odm.csv
StudyOIDMetaDataVersionOIDSubjectKeyStudyEventOIDStudyEventRepeatKeyFormOIDFormRepeatKeyItemGroupOIDItemGroupRepeatKeyItemOIDValue
YAMAA-01MDV.1YAMAA-01-001TREATMENT1FO.AE1IG.AE1IT.AE.AETERMHeadache
YAMAA-01MDV.1YAMAA-01-001TREATMENT1FO.AE1IG.AE1IT.AE.AESTYR2026
YAMAA-01MDV.1YAMAA-01-001TREATMENT1FO.AE1IG.AE1IT.AE.AESTMO03
YAMAA-01MDV.1YAMAA-01-001TREATMENT1FO.AE1IG.AE1IT.AE.AESTDY15
YAMAA-01MDV.1YAMAA-01-001TREATMENT1FO.AE1IG.AE1IT.AE.AEENYR2026
YAMAA-01MDV.1YAMAA-01-001TREATMENT1FO.AE1IG.AE1IT.AE.AEENMO03
YAMAA-01MDV.1YAMAA-01-001TREATMENT1FO.AE1IG.AE1IT.AE.AEENDY20
YAMAA-01MDV.1YAMAA-01-001TREATMENT1FO.AE2IG.AE1IT.AE.AETERMNausea
YAMAA-01MDV.1YAMAA-01-001TREATMENT1FO.AE2IG.AE1IT.AE.AESTYR2026
YAMAA-01MDV.1YAMAA-01-001TREATMENT1FO.AE2IG.AE1IT.AE.AESTMO03
YAMAA-01MDV.1YAMAA-01-001TREATMENT1FO.AE2IG.AE1IT.AE.AEENYR2026
YAMAA-01MDV.1YAMAA-01-001TREATMENT1FO.AE2IG.AE1IT.AE.AEENMO04
YAMAA-01MDV.1YAMAA-01-001TREATMENT1FO.AE2IG.AE1IT.AE.AEENDY02
YAMAA-01MDV.1YAMAA-01-001TREATMENT1FO.AE3IG.AE1IT.AE.AETERMFatigue
YAMAA-01MDV.1YAMAA-01-001TREATMENT1FO.AE3IG.AE1IT.AE.AESTYR2026
YAMAA-01MDV.1YAMAA-01-002TREATMENT1FO.AE1IG.AE1IT.AE.AETERMDizziness
YAMAA-01MDV.1YAMAA-01-002TREATMENT1FO.AE1IG.AE1IT.AE.AESTYR2026
YAMAA-01MDV.1YAMAA-01-002TREATMENT1FO.AE1IG.AE1IT.AE.AESTMO01
YAMAA-01MDV.1YAMAA-01-002TREATMENT1FO.AE1IG.AE1IT.AE.AESTDY28
YAMAA-01MDV.1YAMAA-01-002TREATMENT1FO.AE1IG.AE1IT.AE.AEENYR2026
YAMAA-01MDV.1YAMAA-01-002TREATMENT1FO.AE1IG.AE1IT.AE.AEENMO02
YAMAA-01MDV.1YAMAA-01-002TREATMENT1FO.AE2IG.AE1IT.AE.AETERMRash
YAMAA-01MDV.1YAMAA-01-002TREATMENT1FO.AE2IG.AE1IT.AE.AEENYR2026
YAMAA-01MDV.1YAMAA-01-002TREATMENT1FO.AE2IG.AE1IT.AE.AEENMO02
YAMAA-01MDV.1YAMAA-01-002TREATMENT1FO.AE2IG.AE1IT.AE.AEENDY10
YAMAA-01MDV.1YAMAA-01-003TREATMENT1FO.AE1IG.AE1IT.AE.AETERMHeadache
YAMAA-01MDV.1YAMAA-01-003TREATMENT1FO.AE1IG.AE1IT.AE.AESTYR2026
YAMAA-01MDV.1YAMAA-01-003TREATMENT1FO.AE1IG.AE1IT.AE.AESTMO05
YAMAA-01MDV.1YAMAA-01-003TREATMENT1FO.AE1IG.AE1IT.AE.AESTDY01
YAMAA-01MDV.1YAMAA-01-003TREATMENT1FO.AE1IG.AE1IT.AE.AEENYR2026
YAMAA-01MDV.1YAMAA-01-003TREATMENT1FO.AE1IG.AE1IT.AE.AEENMO05
YAMAA-01MDV.1YAMAA-01-003TREATMENT1FO.AE1IG.AE1IT.AE.AEENDY05

Expected output

Under review
6 expected rows

expected/ae.csv

Edit
6 rows
expected/ae.csv
DOMAINSTUDYIDUSUBJIDAESEQAETERMAESTDTCAEENDTCAESTDYAEENDY
AEYAMAA-011Headache2026-03-152026-03-206570
AEYAMAA-012Nausea2026-032026-04-02—83
AEYAMAA-013Fatigue2026———
AEYAMAA-011Dizziness2026-01-282026-02-4—
AEYAMAA-012Rash—2026-02-10—10
AEYAMAA-011Headache2026-05-012026-05-05——
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 "AE".SDTM1
STUDYIDStudy IdentifierCharCollectedCopy value from ODM.StudyOID.SDTM2
USUBJIDUnique Subject IdentifierCharCollectedCopy value from ODM.SubjectKey.SDTM3
AESEQSequence NumberNumCollectedCopy value from ODM.FormRepeatKey.SDTM4
AETERMReported Term for the Adverse EventCharCollectedCopy value from ODM.Value where ODM.ItemOID = 'IT.AE.AETERM'.SDTM5
AESTDTCStart Date/Time of Adverse EventCharDerivedWrite the collected year AEST_YR, month AEST_MO, day AEST_DY as ISO 8601 date text, stopping before the first blank part; blank when the year is blank; a part that is not its digits is an error.SDTM6
AEENDTCEnd Date/Time of Adverse EventCharDerivedWrite the collected year AEEN_YR, month AEEN_MO, day AEEN_DY as ISO 8601 date text, stopping before the first blank part; blank when the year is blank; a part that is not its digits is an error.SDTM7
AESTDYStudy Day of Start of Adverse EventNumDerivedCDISC study day of AESTDT against RFSTDTC as day 1; there is no day zero.SDTM8
AEENDYStudy Day of End of Adverse EventNumDerivedCDISC study day of AEENDT against RFSTDTC as day 1; there is no day zero.SDTM9
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-ae-partial-dates/full.md

Edit
21 lines

Following CDISC SDTM standards, use the provided DM and ODM datasets to create an AE dataset with one record per adverse event.

The output dataset should contain the following columns in this order: DOMAIN, STUDYID, USUBJID, AESEQ, AETERM, AESTDTC, AEENDTC, AESTDY, AEENDY

STUDYID is the study OID and USUBJID is the subject key, each as given in ODM. AESEQ is the adverse event's number within the subject, the repeat key of its AE form in ODM. AESTDTC and AEENDTC are the collected start and end dates, their year, month, and day collected as separate items in ODM, written as ISO 8601 text at the precision collected: a full date (2026-03-15), a year and month (2026-03) when no day was collected, or a year alone (2026) when no month was collected. Nothing is imputed, and a date with no part collected has no value. AESTDY and AEENDY are the study days of the start and end dates counted from the subject's reference start date, RFSTDTC in DM. Only a complete date gets a study day: a partial date has no study day even when the reference date is known, and neither date has a study day when the subject's RFSTDTC has no value.

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

prompts/sdtm-ae-partial-dates/conventions.md

Edit
15 lines

Following CDISC SDTM standards, use the provided DM and ODM datasets to create an AE dataset with one record per adverse event.

The output dataset should contain the following columns in this order: DOMAIN, STUDYID, USUBJID, AESEQ, AETERM, AESTDTC, AEENDTC, AESTDY, AEENDY

AESTDTC and AEENDTC are the collected start and end dates, written as ISO 8601 text at the precision collected: a full date (2026-03-15), a year and month (2026-03) when no day was collected, or a year alone (2026) when no month was collected. AESTDY and AEENDY are the study days of the start and end dates counted from the subject's reference start date, RFSTDTC in DM.

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

prompts/sdtm-ae-partial-dates/brief.md

Edit
8 lines

Following CDISC SDTM standards, use the provided DM and ODM datasets to create an AE dataset with one record per adverse event.

The output dataset should contain the following columns in this order: DOMAIN, STUDYID, USUBJID, AESEQ, AETERM, AESTDTC, AEENDTC, AESTDY, AEENDY

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

Edit
87 lines
# Reference solution for the yamaa benchmark sdtm-ae-partial-dates (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)library(tidyr)library(stringr)odm <- read_csv(  "/app/input/odm.csv",  col_types = cols(.default = col_character()))dm <- read_csv(  "/app/input/dm.csv",  col_types = cols(.default = col_character()))compose_dtc <- function(yr, mo, dy) {  ifelse(    is.na(yr) | yr == "", NA_character_,    ifelse(      is.na(mo) | mo == "", yr,      ifelse(        is.na(dy) | dy == "", paste0(yr, "-", str_pad(mo, 2, pad = "0")),        paste0(yr, "-", str_pad(mo, 2, pad = "0"), "-", str_pad(dy, 2, pad = "0"))      )    )  )}study_day <- function(adt, ref) {  diff <- as.integer(as.Date(adt) - as.Date(ref))  ifelse(is.na(diff), NA_integer_, ifelse(diff >= 0L, diff + 1L, diff))}# One record per form repeat; the repeat number is the sequence number.# Dates stay at the precision collected: nothing is imputed.ae <- odm |>  filter(ItemGroupOID == "IG.AE") |>  pivot_wider(    id_cols = c(StudyOID, SubjectKey, FormRepeatKey),    names_from = ItemOID,    values_from = Value,    values_fn = first  ) |>  mutate(    AESEQ = as.integer(FormRepeatKey),    AETERM = `IT.AE.AETERM`,    AESTDTC = compose_dtc(`IT.AE.AESTYR`, `IT.AE.AESTMO`, `IT.AE.AESTDY`),    AEENDTC = compose_dtc(`IT.AE.AEENYR`, `IT.AE.AEENMO`, `IT.AE.AEENDY`),    START_FULL = !is.na(`IT.AE.AESTYR`) & `IT.AE.AESTYR` != "" &      !is.na(`IT.AE.AESTMO`) & `IT.AE.AESTMO` != "" &      !is.na(`IT.AE.AESTDY`) & `IT.AE.AESTDY` != "",    END_FULL = !is.na(`IT.AE.AEENYR`) & `IT.AE.AEENYR` != "" &      !is.na(`IT.AE.AEENMO`) & `IT.AE.AEENMO` != "" &      !is.na(`IT.AE.AEENDY`) & `IT.AE.AEENDY` != ""  ) |>  left_join(    dm |> select(USUBJID, RFSTDTC),    by = c("SubjectKey" = "USUBJID")  ) |>  # Only a complete date gets a study day, and only when the reference  # start date is known. Day 1 is the reference date; there is no day 0.  mutate(    AESTDY = if_else(      START_FULL & !is.na(RFSTDTC) & RFSTDTC != "",      study_day(AESTDTC, RFSTDTC), NA_integer_    ),    AEENDY = if_else(      END_FULL & !is.na(RFSTDTC) & RFSTDTC != "",      study_day(AEENDTC, RFSTDTC), NA_integer_    ),    DOMAIN = "AE",    STUDYID = StudyOID,    USUBJID = SubjectKey  ) |>  arrange(USUBJID, AESEQ) |>  select(    DOMAIN, STUDYID, USUBJID, AESEQ, AETERM,    AESTDTC, AEENDTC, AESTDY, AEENDY  )dir.create("/app/output", showWarnings = FALSE)write_csv(ae, "/app/output/ae.csv", na = "")

solutions/sdtm-ae-partial-dates/result.py

Edit
129 lines
# Reference solution for the yamaa benchmark sdtm-ae-partial-dates (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."""Build the SDTM AE dataset from DM and ODM long-format inputs.One record per adverse event (one AE form repeat per subject). Start andend dates are assembled from their separately collected year, month, andday items and written as ISO 8601 text at the precision collected; nothingis imputed. Study days are computed only for complete dates and only whenthe subject has a reference start date (RFSTDTC) in DM."""import csvfrom datetime import dateINPUT_DIR = "/app/input"OUTPUT_PATH = "/app/output/ae.csv"COLUMNS = [    "DOMAIN",    "STUDYID",    "USUBJID",    "AESEQ",    "AETERM",    "AESTDTC",    "AEENDTC",    "AESTDY",    "AEENDY",]def read_csv(path):    with open(path, newline="", encoding="utf-8") as handle:        return list(csv.DictReader(handle))def assemble_date(parts, prefix):    """Join collected year/month/day items at the precision collected."""    year = parts.get(prefix + "YR", "").strip()    if not year:        return ""    month = parts.get(prefix + "MO", "").strip()    if not month:        return year    day = parts.get(prefix + "DY", "").strip()    if not day:        return f"{year}-{int(month):02d}"    return f"{year}-{int(month):02d}-{int(day):02d}"def parse_full_date(text):    """Return a date for a complete ISO date string, else None."""    if len(text) != 10:        return None    try:        year, month, day = (int(piece) for piece in text.split("-"))        return date(year, month, day)    except ValueError:        return Nonedef study_day(date_text, ref_start):    """SDTM study day of a complete date relative to the reference start.    The reference start date itself is day 1; the day before it is day -1    (there is no day 0). Partial dates and missing reference dates have    no study day.    """    value = parse_full_date(date_text)    if value is None or ref_start is None:        return ""    delta = (value - ref_start).days    return str(delta + 1 if delta >= 0 else delta)def main():    dm_rows = read_csv(f"{INPUT_DIR}/dm.csv")    ref_start_by_subject = {}    for row in dm_rows:        ref = parse_full_date((row.get("RFSTDTC") or "").strip())        ref_start_by_subject[row["USUBJID"]] = ref    odm_rows = read_csv(f"{INPUT_DIR}/odm.csv")    # Group the AE form items by subject and form repeat key (AESEQ),    # keeping first-appearance order of subjects and events.    events = {}    order = []    for row in odm_rows:        if row["FormOID"] != "FO.AE":            continue        key = (row["StudyOID"], row["SubjectKey"], row["FormRepeatKey"])        if key not in events:            events[key] = {}            order.append(key)        item = row["ItemOID"].rsplit(".", 1)[-1]        events[key][item] = row["Value"]    out_rows = []    for study_oid, subject_key, repeat_key in order:        items = events[(study_oid, subject_key, repeat_key)]        start_dtc = assemble_date(items, "AEST")        end_dtc = assemble_date(items, "AEEN")        ref_start = ref_start_by_subject.get(subject_key)        out_rows.append(            {                "DOMAIN": "AE",                "STUDYID": study_oid,                "USUBJID": subject_key,                "AESEQ": repeat_key,                "AETERM": items.get("AETERM", ""),                "AESTDTC": start_dtc,                "AEENDTC": end_dtc,                "AESTDY": study_day(start_dtc, ref_start),                "AEENDY": study_day(end_dtc, ref_start),            }        )    with open(OUTPUT_PATH, "w", newline="", encoding="utf-8") as handle:        writer = csv.DictWriter(handle, fieldnames=COLUMNS)        writer.writeheader()        writer.writerows(out_rows)if __name__ == "__main__":    main()

solutions/sdtm-ae-partial-dates/result.sas

Edit
48 lines
/* opensas reference solution for the yamaa benchmark sdtm-ae-partial-dates.   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 RFSTDTC $1024;  infile "/app/input/dm.csv" dsd dlm="," firstobs=2 truncover lrecl=32767;  input STUDYID : $char1024. USUBJID : $char1024. RFSTDTC : $char1024.;run;data odm;  length StudyOID MetaDataVersionOID SubjectKey StudyEventOID StudyEventRepeatKey FormOID FormRepeatKey ItemGroupOID ItemGroupRepeatKey ItemOID Value $1024;  infile "/app/input/odm.csv" dsd dlm="," firstobs=2 truncover lrecl=32767;  input StudyOID : $char1024. MetaDataVersionOID : $char1024. SubjectKey : $char1024. StudyEventOID : $char1024. StudyEventRepeatKey : $char1024. FormOID : $char1024. FormRepeatKey : $char1024. ItemGroupOID : $char1024. ItemGroupRepeatKey : $char1024. ItemOID : $char1024. Value : $char1024.;run;proc sort data=odm out=ordered; by StudyOID SubjectKey FormRepeatKey; run;data wide;  length AETERM AESTYR AESTMO AEENYR AEENMO STARTDAY ENDDAY $1024;  retain AETERM AESTYR AESTMO AEENYR AEENMO STARTDAY ENDDAY;  set ordered;  where ItemGroupOID='IG.AE';  by StudyOID SubjectKey FormRepeatKey;  if first.FormRepeatKey then do;    AETERM=''; AESTYR=''; AESTMO=''; AEENYR=''; AEENMO=''; STARTDAY=''; ENDDAY='';  end;    if ItemOID='IT.AE.AETERM' then AETERM=Value;  if ItemOID='IT.AE.AESTYR' then AESTYR=Value;  if ItemOID='IT.AE.AESTMO' then AESTMO=Value;  if ItemOID='IT.AE.AEENYR' then AEENYR=Value;  if ItemOID='IT.AE.AEENMO' then AEENMO=Value;  if ItemOID='IT.AE.AESTDY' then STARTDAY=Value;  if ItemOID='IT.AE.AEENDY' then ENDDAY=Value;  if last.FormRepeatKey then output;run;data dates; set wide; length DOMAIN $2 STUDYID USUBJID AESTDTC AEENDTC $1024;DOMAIN='AE'; STUDYID=StudyOID; USUBJID=SubjectKey; AESEQ=input(FormRepeatKey,best32.);AESTDTC=''; AEENDTC='';if not missing(AESTYR) then do; AESTDTC=AESTYR; if not missing(AESTMO) then do; AESTDTC=catx('-',AESTDTC,AESTMO); if not missing(STARTDAY) then AESTDTC=catx('-',AESTDTC,STARTDAY); end; end;if not missing(AEENYR) then do; AEENDTC=AEENYR; if not missing(AEENMO) then do; AEENDTC=catx('-',AEENDTC,AEENMO); if not missing(ENDDAY) then AEENDTC=catx('-',AEENDTC,ENDDAY); end; end; run;proc sql; create table joined as select a.*,b.RFSTDTC from dates a left join dm b on a.STUDYID=b.STUDYID and a.USUBJID=b.USUBJID; quit;data result; set joined; AESTDY=.; AEENDY=.; if lengthn(RFSTDTC)=10 then do;if lengthn(AESTDTC)=10 then do; AESTDY=input(AESTDTC,yymmdd10.)-input(RFSTDTC,yymmdd10.); if AESTDY>=0 then AESTDY+1; end;if lengthn(AEENDTC)=10 then do; AEENDY=input(AEENDTC,yymmdd10.)-input(RFSTDTC,yymmdd10.); if AEENDY>=0 then AEENDY+1; end; end; run;proc sql;  create table final as select DOMAIN, STUDYID, USUBJID, AESEQ, AETERM, AESTDTC, AEENDTC, AESTDY, AEENDY from result;quit;proc export data=final outfile="/app/output/ae.csv" dbms=csv replace; run;