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: build one Demographics (DM) record per subject with the birth date
(BRTHDTC), age (AGE, AGEU) and sex (SEX) collected on the
demographics form.
Input: the electronic data capture (EDC) system's export as an Operational Data Model (ODM) 1.3 XML file, saved as a snapshot: the current value of every collected item, with the audit trail of each change, the investigator's electronic signature and the site's comments kept beside the data.
Variables:
SUBJIDis the subject's key in the export, andUSUBJIDjoins the study identifier and that key with a hyphen.BRTHDTCis the birth date as far as it was collected: a year and month when the day was unknown, and missing when the form records the date as not collected.AGEis the collected age in whole years, andAGEUisYEARSwheneverAGEis present.SEXis the collected sex code,ForM, as the form holds it now: a value corrected after it was first entered gives the corrected value.
Note: each variable reads the subject's current answer on the form. The audit trail, the signature and the comments describe the data and add no answers, so a corrected answer is read once, as it now stands.
Inputs
Under review1 source fileinput/odm.xml
Edit<?xml version="1.0" encoding="UTF-8"?>
<ODM xmlns="http://www.cdisc.org/ns/odm/v1.3"
ODMVersion="1.3.2"
FileType="Snapshot"
FileOID="STUDY01.EXPORT.20260302"
CreationDateTime="2026-03-02T09:15:00+00:00">
<Study OID="STUDY01">
<GlobalVariables>
<StudyName>STUDY01</StudyName>
<StudyDescription>An invented study for this benchmark</StudyDescription>
<ProtocolName>STUDY01</ProtocolName>
</GlobalVariables>
<MetaDataVersion OID="MDV.1" Name="Version 1">
<Protocol>
<StudyEventRef StudyEventOID="SE.SCREENING" Mandatory="Yes"/>
</Protocol>
<StudyEventDef OID="SE.SCREENING" Name="Screening" Repeating="No"
Type="Scheduled">
<FormRef FormOID="F.DM" Mandatory="Yes"/>
</StudyEventDef>
<FormDef OID="F.DM" Name="Demographics" Repeating="No">
<ItemGroupRef ItemGroupOID="IG.DM" Mandatory="Yes"/>
</FormDef>
<ItemGroupDef OID="IG.DM" Name="Demographics" Repeating="No">
<ItemRef ItemOID="IT.DM.BRTHDAT" Mandatory="No"/>
<ItemRef ItemOID="IT.DM.AGE" Mandatory="Yes"/>
<ItemRef ItemOID="IT.DM.SEX" Mandatory="Yes"/>
</ItemGroupDef>
<ItemDef OID="IT.DM.BRTHDAT" Name="Date of birth" DataType="partialDate">
<Question><TranslatedText xml:lang="en">Date of birth</TranslatedText></Question>
</ItemDef>
<ItemDef OID="IT.DM.AGE" Name="Age" DataType="integer" Length="3">
<Question><TranslatedText xml:lang="en">Age in years</TranslatedText></Question>
</ItemDef>
<ItemDef OID="IT.DM.SEX" Name="Sex" DataType="text" Length="1">
<Question><TranslatedText xml:lang="en">Sex</TranslatedText></Question>
<CodeListRef CodeListOID="CL.SEX"/>
</ItemDef>
<CodeList OID="CL.SEX" Name="Sex" DataType="text">
<CodeListItem CodedValue="F">
<Decode><TranslatedText xml:lang="en">Female</TranslatedText></Decode>
</CodeListItem>
<CodeListItem CodedValue="M">
<Decode><TranslatedText xml:lang="en">Male</TranslatedText></Decode>
</CodeListItem>
</CodeList>
</MetaDataVersion>
</Study>
<AdminData StudyOID="STUDY01">
<User OID="USR.CRC">
<FullName>Study coordinator</FullName>
</User>
<User OID="USR.PI">
<FullName>Principal investigator</FullName>
</User>
<Location OID="LOC.01" Name="Site 01">
<MetaDataVersionRef StudyOID="STUDY01" MetaDataVersionOID="MDV.1"
EffectiveDate="2026-01-01"/>
</Location>
<SignatureDef OID="SIG.PI" Methodology="Electronic">
<Meaning>Approval of the case report form</Meaning>
<LegalReason>I approve the data on this form</LegalReason>
</SignatureDef>
</AdminData>
<ClinicalData StudyOID="STUDY01" MetaDataVersionOID="MDV.1">
<SubjectData SubjectKey="101">
<SiteRef LocationOID="LOC.01"/>
<StudyEventData StudyEventOID="SE.SCREENING">
<FormData FormOID="F.DM">
<Signature>
<UserRef UserOID="USR.PI"/>
<LocationRef LocationOID="LOC.01"/>
<SignatureRef SignatureOID="SIG.PI"/>
<DateTimeStamp>2026-02-20T16:40:00+00:00</DateTimeStamp>
</Signature>
<ItemGroupData ItemGroupOID="IG.DM" TransactionType="Insert">
<ItemData ItemOID="IT.DM.BRTHDAT" Value="1958-07-21"/>
<ItemData ItemOID="IT.DM.AGE" Value="67"/>
<ItemData ItemOID="IT.DM.SEX" Value="F"/>
</ItemGroupData>
</FormData>
</StudyEventData>
</SubjectData>
<SubjectData SubjectKey="102">
<SiteRef LocationOID="LOC.01"/>
<StudyEventData StudyEventOID="SE.SCREENING">
<FormData FormOID="F.DM">
<ItemGroupData ItemGroupOID="IG.DM" TransactionType="Update">
<ItemData ItemOID="IT.DM.BRTHDAT" Value="1990-02"/>
<ItemData ItemOID="IT.DM.AGE" Value="36"/>
<ItemData ItemOID="IT.DM.SEX" Value="M">
<AuditRecord>
<UserRef UserOID="USR.CRC"/>
<LocationRef LocationOID="LOC.01"/>
<DateTimeStamp>2026-02-24T11:05:00+00:00</DateTimeStamp>
<ReasonForChange>Entered as F in error; corrected from the source document</ReasonForChange>
<SourceID>QUERY.0042</SourceID>
</AuditRecord>
</ItemData>
</ItemGroupData>
</FormData>
</StudyEventData>
</SubjectData>
<SubjectData SubjectKey="103">
<SiteRef LocationOID="LOC.01"/>
<StudyEventData StudyEventOID="SE.SCREENING">
<FormData FormOID="F.DM">
<ItemGroupData ItemGroupOID="IG.DM">
<ItemData ItemOID="IT.DM.BRTHDAT" IsNull="Yes">
<Annotation SeqNum="1">
<Comment>The subject declined to give the date of birth</Comment>
</Annotation>
</ItemData>
<ItemData ItemOID="IT.DM.AGE" Value="45"/>
<ItemData ItemOID="IT.DM.SEX" Value="F"/>
</ItemGroupData>
</FormData>
</StudyEventData>
</SubjectData>
</ClinicalData>
</ODM>
Expected output
Under review3 expected rowsexpected/dm.csv
Edit3 rows| DOMAIN | STUDYID | USUBJID | SUBJID | BRTHDTC | AGE | AGEU | SEX |
|---|---|---|---|---|---|---|---|
| DM | STUDY01 | 101 | 1958-07-21 | 67 | YEARS | F | |
| DM | STUDY01 | 102 | 1990-02 | 36 | YEARS | M | |
| DM | STUDY01 | 103 | — | 45 | YEARS | F |
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 | Derived | Fill the template "{ODM.StudyOID}-{ODM.SubjectKey}". | SDTM | 3 | ||||
| SUBJID | Subject Identifier for the Study | Char | Collected | Copy value from ODM.SubjectKey. | SDTM | 4 | ||||
| BRTHDTC | Date/Time of Birth | Char | Collected | Read collected ODM item IT.DM.BRTHDAT; no identified record yields blank. | SDTM | 5 | ||||
| AGE | Age | Num | Collected | Read collected ODM item IT.DM.AGE; no identified record yields blank. | SDTM | 6 | ||||
| AGEU | Age Units | Char | Derived | If AGE IS NOT NULL then "YEARS"; otherwise "None". | SDTM | 7 | ||||
| SEX | Sex | Char | Collected | Read collected ODM item IT.DM.SEX; no identified record yields blank. | SDTM | 8 |
| 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-odm-snapshot/full.md
Edit18 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, SUBJID, BRTHDTC, AGE, AGEU, SEX
The ODM dataset is an ODM 1.3 XML snapshot export: the current value of every collected item, with audit records, signatures and comments kept beside the data, which add no values. STUDYID is the study OID and SUBJID is the subject key, each as given, and USUBJID is the study OID and the subject key joined by a hyphen. BRTHDTC is the IT.DM.BRTHDAT item's value as collected, a year and month when the day is unknown, and has no value when the item is recorded as null. AGE is the IT.DM.AGE item's value, and AGEU is "YEARS" whenever AGE has a value. SEX is the IT.DM.SEX item's value.
Read the source datasets from /app/input and save the completed dataset as /app/output/dm.csv.
prompts/sdtm-dm-odm-snapshot/conventions.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, SUBJID, BRTHDTC, AGE, AGEU, SEX
Read the source datasets from /app/input and save the completed dataset as /app/output/dm.csv.
prompts/sdtm-dm-odm-snapshot/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, SUBJID, BRTHDTC, AGE, AGEU, SEX
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-odm-snapshot/result.R
Edit49 lines# Reference solution for the yamaa benchmark sdtm-dm-odm-snapshot (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(xml2)odm <- read_xml("/app/input/odm.xml")# The snapshot's elements are in the ODM 1.3 default namespace; strip it so# the paths below name the elements plainly.xml_ns_strip(odm)# One subject's current value of one item. An item recorded as null has no# value; audit records, signatures and comments hold no items.item_value <- function(subject, oid) { item <- xml_find_first(subject, sprintf(".//ItemData[@ItemOID='%s']", oid)) if (inherits(item, "xml_missing")) { return(NA_character_) } is_null <- xml_attr(item, "IsNull") if (!is.na(is_null) && tolower(is_null) %in% c("yes", "true", "1")) { return(NA_character_) } xml_attr(item, "Value")}rows <- lapply( xml_find_all(odm, "/ODM/ClinicalData/SubjectData"), function(subject) { study <- xml_attr(xml_parent(subject), "StudyOID") key <- xml_attr(subject, "SubjectKey") age <- item_value(subject, "IT.DM.AGE") data.frame( DOMAIN = "DM", STUDYID = study, USUBJID = paste0(study, "-", key), SUBJID = key, BRTHDTC = item_value(subject, "IT.DM.BRTHDAT"), AGE = as.integer(age), AGEU = if (is.na(age)) NA_character_ else "YEARS", SEX = item_value(subject, "IT.DM.SEX"), stringsAsFactors = FALSE ) })dm <- do.call(rbind, rows)write.csv(dm, "/app/output/dm.csv", row.names = FALSE, na = "")solutions/sdtm-dm-odm-snapshot/result.py
Edit64 lines# Reference solution for the yamaa benchmark sdtm-dm-odm-snapshot (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 from the EDC's ODM 1.3 XML snapshot.One record per subject, with columns:DOMAIN, STUDYID, USUBJID, SUBJID, BRTHDTC, AGE, AGEU, SEX"""import csvimport xml.etree.ElementTree as ETINPUT_PATH = "/app/input/odm.xml"OUTPUT_PATH = "/app/output/dm.csv"ODM = "{http://www.cdisc.org/ns/odm/v1.3}"COLUMNS = ["DOMAIN", "STUDYID", "USUBJID", "SUBJID", "BRTHDTC", "AGE", "AGEU", "SEX"]def current_values(subject): """Each item's current value by its OID. An item recorded as null has no value; audit records, signatures and comments hold no items.""" values = {} for item in subject.iter(f"{ODM}ItemData"): if item.get("IsNull", "").lower() in ("yes", "true", "1"): values[item.get("ItemOID")] = "" else: values[item.get("ItemOID")] = item.get("Value", "") return valuesdef main(): root = ET.parse(INPUT_PATH).getroot() rows = [] for clinical in root.iter(f"{ODM}ClinicalData"): study = clinical.get("StudyOID") for subject in clinical.iter(f"{ODM}SubjectData"): key = subject.get("SubjectKey") values = current_values(subject) age = values.get("IT.DM.AGE", "") rows.append( { "DOMAIN": "DM", "STUDYID": study, "USUBJID": f"{study}-{key}", "SUBJID": key, "BRTHDTC": values.get("IT.DM.BRTHDAT", ""), "AGE": age, "AGEU": "YEARS" if age else "", "SEX": values.get("IT.DM.SEX", ""), } ) with open(OUTPUT_PATH, "w", newline="", encoding="utf-8") as fh: writer = csv.DictWriter(fh, fieldnames=COLUMNS) writer.writeheader() writer.writerows(rows)if __name__ == "__main__": main()solutions/sdtm-dm-odm-snapshot/result.sas
Edit47 lines/* opensas reference solution for the yamaa benchmark sdtm-dm-odm-snapshot. Reads the benchmark inputs and derives the requested output. Execute with the existing opensas runtime: opensas /app/output/result.sas. *//* opensas v0.7.1 reads no XML. The runner must stage odm.xml as odm.csv, one row per collected item in file order, without deriving any values: the item's study OID, subject key, item OID and value, and IsNull as true or false. Audit records, signatures and comments give no rows. */data items; length StudyOID SubjectKey ItemOID Value IsNull $1024; infile '/app/input/odm.csv' dsd dlm=',' firstobs=2 truncover lrecl=32767; input StudyOID : $char1024. SubjectKey : $char1024. ItemOID : $char1024. Value : $char1024. IsNull : $char1024.;run;data dm; length DOMAIN $2 STUDYID USUBJID SUBJID BRTHDTC AGEU SEX $1024; retain BRTHDTC AGE SEX; set items; by StudyOID SubjectKey notsorted; if first.SubjectKey then do; BRTHDTC = ''; AGE = .; SEX = ''; end; if IsNull ne 'true' then do; if ItemOID = 'IT.DM.BRTHDAT' then BRTHDTC = Value; if ItemOID = 'IT.DM.AGE' then AGE = input(Value, best32.); if ItemOID = 'IT.DM.SEX' then SEX = Value; end; if last.SubjectKey then do; DOMAIN = 'DM'; STUDYID = StudyOID; USUBJID = catx('-', StudyOID, SubjectKey); SUBJID = SubjectKey; if missing(AGE) then AGEU = ''; else AGEU = 'YEARS'; output; end; keep DOMAIN STUDYID USUBJID SUBJID BRTHDTC AGE AGEU SEX;run;proc sql; create table final as select DOMAIN, STUDYID, USUBJID, SUBJID, BRTHDTC, AGE, AGEU, SEX from dm;quit;proc export data=final outfile='/app/output/dm.csv' dbms=csv replace; run;
yamaa