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: derive AGE in completed years at the sponsor's reference date (informed consent, RFICDTC) from the collected birth date, keeping BRTHDTC at its collected precision.

Input: electronic data capture (EDC) output in long form, one row per collected item; each subject carries a birth date item (IT.DM.BRTHDT, as collected) and an informed consent date item (IT.DM.RFICDTC).

Variables:

  • BRTHDTC is the birth date exactly as collected, as ISO 8601 text cut off at the collected precision: 1985-03-10 (day), 1985-03 (month), or 1985 (year).
  • AGE is the whole calendar years between the birth date and the informed consent date: one year fewer when the birthday falls after the consent date's month and day. A February 29 birthday has its anniversary on February 28 in a common year. A year-month or year-only birth date cannot give completed years, so AGE stays missing.
  • AGEU is YEARS whenever AGE is present, missing otherwise.

Note: a missing birth date leaves BRTHDTC, AGE, and AGEU missing.

Inputs

Under review
1 source file

input/odm.csv

Edit
9 rows
input/odm.csv
StudyOIDMetaDataVersionOIDSubjectKeyStudyEventOIDStudyEventRepeatKeyItemGroupOIDItemGroupRepeatKeyItemOIDValue
STUDY01MDV.1001SCREENING1IG.DM1IT.DM.BRTHDT1985-03-10
STUDY01MDV.1001SCREENING1IG.DM1IT.DM.RFICDTC2025-06-15
STUDY01MDV.1002SCREENING1IG.DM1IT.DM.BRTHDT1985-09-10
STUDY01MDV.1002SCREENING1IG.DM1IT.DM.RFICDTC2025-06-15
STUDY01MDV.1003SCREENING1IG.DM1IT.DM.BRTHDT1985-03
STUDY01MDV.1003SCREENING1IG.DM1IT.DM.RFICDTC2025-06-15
STUDY01MDV.1004SCREENING1IG.DM1IT.DM.BRTHDT1985
STUDY01MDV.1004SCREENING1IG.DM1IT.DM.RFICDTC2025-06-15
STUDY01MDV.1005SCREENING1IG.DM1IT.DM.RFICDTC2025-06-15

Expected output

Under review
5 expected rows

expected/dm.csv

Edit
5 rows
expected/dm.csv
DOMAINSTUDYIDUSUBJIDRFICDTCBRTHDTCAGEAGEU
DMSTUDY012025-06-151985-03-1040YEARS
DMSTUDY012025-06-151985-09-1039YEARS
DMSTUDY012025-06-151985-03——
DMSTUDY012025-06-151985——
DMSTUDY012025-06-15———
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 ODM.StudyOID.SDTM2
USUBJIDUnique Subject IdentifierCharCollectedCopy value from ODM.SubjectKey.SDTM3
RFICDTCDate/Time of Informed ConsentCharISO 8601CollectedCopy value from ODM.Value where ODM.ItemOID = 'IT.DM.RFICDTC'.SDTM4
BRTHDTCDate/Time of BirthCharCollectedCopy value from ODM.Value where ODM.ItemOID = 'IT.DM.BRTHDT'.SDTM5
AGEAge in AGEU at RFICDTCNumDerivedIf BRTH_PREC = 'day' then whole years from BRTHDT to RFICDTC, counting the end date but not the start; otherwise "None".SDTM6
AGEUAge UnitsCharDerivedIf AGE IS NOT NULL then "YEARS"; otherwise "None".SDTM7
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-age/full.md

Edit
22 lines

Following CDISC SDTM standards, use the provided ODM dataset to create a DM dataset with one record per subject.

The output dataset should contain the following columns in this order: DOMAIN, STUDYID, USUBJID, RFICDTC, BRTHDTC, AGE, AGEU

STUDYID is the study OID and USUBJID is the subject key, each as given in ODM. RFICDTC is the subject's date of informed consent, the value of the IT.DM.RFICDTC item, and BRTHDTC is the subject's birth date, the value of the IT.DM.BRTHDT item. BRTHDTC is the birth date exactly as collected, as ISO 8601 text cut off at the collected precision: a full date, a year and month, or a year alone. AGE is the whole calendar years between the birth date and the informed consent date: one year fewer when the birthday falls after the consent date's month and day. A February 29 birthday has its anniversary on February 28 in a common year. A birth date collected only to the month or the year cannot give completed years, so AGE has no value. AGEU is "YEARS" whenever AGE has a value, and has no value otherwise. A subject with no birth date has no value for BRTHDTC, AGE, and AGEU.

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

prompts/sdtm-dm-age/conventions.md

Edit
15 lines

Following CDISC SDTM standards, use the provided ODM dataset to create a DM dataset with one record per subject.

The output dataset should contain the following columns in this order: DOMAIN, STUDYID, USUBJID, RFICDTC, BRTHDTC, AGE, AGEU

BRTHDTC is the birth date exactly as collected, as ISO 8601 text cut off at the collected precision: a full date, a year and month, or a year alone. AGE is the whole calendar years between the birth date and the informed consent date: one year fewer when the birthday falls after the consent date's month and day. A February 29 birthday has its anniversary on February 28 in a common year.

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

prompts/sdtm-dm-age/brief.md

Edit
8 lines

Following CDISC SDTM standards, use the provided ODM dataset to create a DM dataset with one record per subject.

The output dataset should contain the following columns in this order: DOMAIN, STUDYID, USUBJID, RFICDTC, BRTHDTC, AGE, AGEU

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

Edit
63 lines
# Reference solution for the yamaa benchmark sdtm-dm-age (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()))is_leap <- function(year) {  year %% 4 == 0 & (year %% 100 != 0 | year %% 400 == 0)}whole_years <- function(birth, consent) {  full <- str_detect(birth, "^\\d{4}-\\d{2}-\\d{2}$") &    str_detect(consent, "^\\d{4}-\\d{2}-\\d{2}$")  by <- as.integer(str_sub(birth, 1, 4))  bm <- as.integer(str_sub(birth, 6, 7))  bd <- as.integer(str_sub(birth, 9, 10))  cy <- as.integer(str_sub(consent, 1, 4))  cm <- as.integer(str_sub(consent, 6, 7))  cd <- as.integer(str_sub(consent, 9, 10))  # A February 29 birthday has its anniversary on February 28 in a  # common year. A year-month or year-only birth date has no age.  ann_m <- if_else(bm == 2 & bd == 29 & !is_leap(cy), 2L, bm)  ann_d <- if_else(bm == 2 & bd == 29 & !is_leap(cy), 28L, bd)  age <- cy - by - if_else(    cm < ann_m | (cm == ann_m & cd < ann_d), 1L, 0L  )  if_else(full, age, NA_integer_)}# Whole calendar years between the birth date and the consent date. A# missing birth date leaves the birth date, age, and units empty.dm <- odm |>  filter(ItemGroupOID == "IG.DM") |>  pivot_wider(    id_cols = c(StudyOID, SubjectKey),    names_from = ItemOID,    values_from = Value,    values_fn = first  ) |>  mutate(    DOMAIN = "DM",    STUDYID = StudyOID,    USUBJID = SubjectKey,    RFICDTC = na_if(`IT.DM.RFICDTC`, ""),    BRTHDTC = na_if(`IT.DM.BRTHDT`, ""),    AGE = whole_years(BRTHDTC, RFICDTC),    AGEU = if_else(is.na(AGE), NA_character_, "YEARS")  ) |>  arrange(USUBJID) |>  select(DOMAIN, STUDYID, USUBJID, RFICDTC, BRTHDTC, AGE, AGEU)dir.create("/app/output", showWarnings = FALSE)write_csv(dm, "/app/output/dm.csv", na = "")

solutions/sdtm-dm-age/result.py

Edit
110 lines
# Reference solution for the yamaa benchmark sdtm-dm-age (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 DM dataset (one record per subject) from the ODM extract.Reads /app/input/odm.csv (long format: one row per collected item) andwrites /app/output/dm.csv with columnsDOMAIN, STUDYID, USUBJID, RFICDTC, BRTHDTC, AGE, AGEU."""import csvimport osfrom calendar import isleapINPUT_DIR = "/app/input"OUTPUT_DIR = "/app/output"BIRTH_ITEM = "IT.DM.BRTHDT"CONSENT_ITEM = "IT.DM.RFICDTC"def parse_full_date(text):    """Return (year, month, day) if text is a full ISO date, else None."""    if not text:        return None    parts = text.strip().split("-")    if len(parts) != 3:        return None    try:        year, month, day = (int(p) for p in parts)    except ValueError:        return None    return year, month, daydef completed_years(birth, consent):    """Whole calendar years between birth and consent dates.    One year fewer when the birthday falls after the consent date's    month and day. A February 29 birthday has its anniversary on    February 28 in a common year.    """    by, bm, bd = birth    cy, cm, cd = consent    if (bm, bd) == (2, 29) and not isleap(cy):        anniversary = (2, 28)    else:        anniversary = (bm, bd)    years = cy - by    if anniversary > (cm, cd):        years -= 1    return yearsdef main():    with open(os.path.join(INPUT_DIR, "odm.csv"), newline="", encoding="utf-8") as f:        rows = list(csv.DictReader(f))    subjects = {}    order = []    for row in rows:        key = (row["StudyOID"], row["SubjectKey"])        if key not in subjects:            subjects[key] = {"RFICDTC": "", "BRTHDTC": ""}            order.append(key)        item = row["ItemOID"]        value = (row["Value"] or "").strip()        if item == CONSENT_ITEM and not subjects[key]["RFICDTC"]:            subjects[key]["RFICDTC"] = value        elif item == BIRTH_ITEM and not subjects[key]["BRTHDTC"]:            subjects[key]["BRTHDTC"] = value    out_rows = []    for study_oid, subject_key in order:        vals = subjects[(study_oid, subject_key)]        rficdtc = vals["RFICDTC"]        brthdtc = vals["BRTHDTC"]        age = ""        birth = parse_full_date(brthdtc)        consent = parse_full_date(rficdtc)        if birth is not None and consent is not None:            age = str(completed_years(birth, consent))        ageu = "YEARS" if age else ""        out_rows.append(            {                "DOMAIN": "DM",                "STUDYID": study_oid,                "USUBJID": subject_key,                "RFICDTC": rficdtc,                "BRTHDTC": brthdtc,                "AGE": age,                "AGEU": ageu,            }        )    os.makedirs(OUTPUT_DIR, exist_ok=True)    fieldnames = ["DOMAIN", "STUDYID", "USUBJID", "RFICDTC", "BRTHDTC", "AGE", "AGEU"]    with open(os.path.join(OUTPUT_DIR, "dm.csv"), "w", newline="", encoding="utf-8") as f:        writer = csv.DictWriter(f, fieldnames=fieldnames)        writer.writeheader()        writer.writerows(out_rows)if __name__ == "__main__":    main()

solutions/sdtm-dm-age/result.sas

Edit
30 lines
/* opensas reference solution for the yamaa benchmark sdtm-dm-age.   Reads the benchmark inputs and derives the requested output.   Execute with the existing opensas runtime: opensas /app/output/result.sas. */data odm;  length StudyOID MetaDataVersionOID SubjectKey StudyEventOID StudyEventRepeatKey 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. ItemGroupOID : $char1024. ItemGroupRepeatKey : $char1024. ItemOID : $char1024. Value : $char1024.;run;proc sort data=odm out=ordered; by StudyOID SubjectKey; run;data wide;  length BRTHDTC RFICDTC $1024;  retain BRTHDTC RFICDTC;  set ordered;  by StudyOID SubjectKey;  if first.SubjectKey then do;    BRTHDTC=''; RFICDTC='';  end;    if ItemOID='IT.DM.BRTHDT' then BRTHDTC=Value;  if ItemOID='IT.DM.RFICDTC' then RFICDTC=Value;  if last.SubjectKey then output;run;data result; set wide; length DOMAIN $2 STUDYID USUBJID $1024 AGEU $8; DOMAIN='DM'; STUDYID=StudyOID; USUBJID=SubjectKey;if lengthn(BRTHDTC)=10 and lengthn(RFICDTC)=10 then do; AGE=intck('year',input(BRTHDTC,yymmdd10.),input(RFICDTC,yymmdd10.),'continuous'); AGEU='YEARS'; end; run;proc sql;  create table final as select DOMAIN, STUDYID, USUBJID, RFICDTC, BRTHDTC, AGE, AGEU from result;quit;proc export data=final outfile="/app/output/dm.csv" dbms=csv replace; run;