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 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:
BRTHDTCis the birth date exactly as collected, as ISO 8601 text cut off at the collected precision:1985-03-10(day),1985-03(month), or1985(year).AGEis 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, soAGEstays missing.AGEUisYEARSwheneverAGEis present, missing otherwise.
Note: a missing birth date leaves BRTHDTC, AGE, and AGEU
missing.
Inputs
Under review1 source fileinput/odm.csv
Edit9 rows| StudyOID | MetaDataVersionOID | SubjectKey | StudyEventOID | StudyEventRepeatKey | ItemGroupOID | ItemGroupRepeatKey | ItemOID | Value |
|---|---|---|---|---|---|---|---|---|
| STUDY01 | MDV.1 | 001 | SCREENING | 1 | IG.DM | 1 | IT.DM.BRTHDT | 1985-03-10 |
| STUDY01 | MDV.1 | 001 | SCREENING | 1 | IG.DM | 1 | IT.DM.RFICDTC | 2025-06-15 |
| STUDY01 | MDV.1 | 002 | SCREENING | 1 | IG.DM | 1 | IT.DM.BRTHDT | 1985-09-10 |
| STUDY01 | MDV.1 | 002 | SCREENING | 1 | IG.DM | 1 | IT.DM.RFICDTC | 2025-06-15 |
| STUDY01 | MDV.1 | 003 | SCREENING | 1 | IG.DM | 1 | IT.DM.BRTHDT | 1985-03 |
| STUDY01 | MDV.1 | 003 | SCREENING | 1 | IG.DM | 1 | IT.DM.RFICDTC | 2025-06-15 |
| STUDY01 | MDV.1 | 004 | SCREENING | 1 | IG.DM | 1 | IT.DM.BRTHDT | 1985 |
| STUDY01 | MDV.1 | 004 | SCREENING | 1 | IG.DM | 1 | IT.DM.RFICDTC | 2025-06-15 |
| STUDY01 | MDV.1 | 005 | SCREENING | 1 | IG.DM | 1 | IT.DM.RFICDTC | 2025-06-15 |
Expected output
Under review5 expected rowsexpected/dm.csv
Edit5 rows| DOMAIN | STUDYID | USUBJID | RFICDTC | BRTHDTC | AGE | AGEU |
|---|---|---|---|---|---|---|
| DM | STUDY01 | 2025-06-15 | 1985-03-10 | 40 | YEARS | |
| DM | STUDY01 | 2025-06-15 | 1985-09-10 | 39 | YEARS | |
| DM | STUDY01 | 2025-06-15 | 1985-03 | — | — | |
| DM | STUDY01 | 2025-06-15 | 1985 | — | — | |
| DM | STUDY01 | 2025-06-15 | — | — | — |
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 ODM.StudyOID. | SDTM | 2 | ||||
| USUBJID | Unique Subject Identifier | Char | Collected | Copy value from ODM.SubjectKey. | SDTM | 3 | ||||
| RFICDTC | Date/Time of Informed Consent | Char | ISO 8601 | Collected | Copy value from ODM.Value where ODM.ItemOID = 'IT.DM.RFICDTC'. | SDTM | 4 | |||
| BRTHDTC | Date/Time of Birth | Char | Collected | Copy value from ODM.Value where ODM.ItemOID = 'IT.DM.BRTHDT'. | SDTM | 5 | ||||
| AGE | Age in AGEU at RFICDTC | Num | Derived | If BRTH_PREC = 'day' then whole years from BRTHDT to RFICDTC, counting the end date but not the start; otherwise "None". | SDTM | 6 | ||||
| AGEU | Age Units | Char | Derived | If AGE IS NOT NULL then "YEARS"; otherwise "None". | SDTM | 7 |
| 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-age/full.md
Edit22 linesFollowing 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
Edit15 linesFollowing 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
Edit8 linesFollowing 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.
R
Edit3 lineslibrary(yamaa)yamaa_spec("spec.yaml")$run()$outputPython
Edit3 linesimport yamaayamaa.spec("spec.yaml").run().outputsolutions/sdtm-dm-age/result.R
Edit63 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
Edit110 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
Edit30 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;
yamaa