Review ask

As a clinical trial statistician or programmer, challenge anything in this benchmark: describe a problem in Comments, or propose a fix with the Edit button on any source file.

  1. Task: Would a real study need this derivation, specified this way? Does it follow CDISC SDTM: variable names, controlled terms, record structure? Flag any rule that is ambiguous or that a sponsor would handle differently.
  2. Inputs: Do they look like data collected in a real trial, and do they include the situations you would expect to meet in one?
  3. Expected output: Would independent QC programming reproduce every value from these inputs and rules?

The other tabs beside Comments are background for assessment, not under review.

Summary

Lifecycle: reviewedEditUnder review
What this benchmark means
README.md

Goal: build one DM record per subject carrying SITEID, AGE, AGEU, SEX, and COUNTRY.

Input: one row per subject carrying SITEID, AGE, SEX, and COUNTRY.

Variables:

  • USUBJID joins the study, site, and subject identifiers with hyphens; an identifier longer than 30 characters stops the run rather than being shortened.
  • SITEID is the collected site identifier.
  • AGE is the collected age in whole years, between 0 and 120; missing when not collected.
  • AGEU is fixed to YEARS, since age is collected in whole years.
  • SEX is the collected sex, one of F, M, or U.
  • COUNTRY is the collected three-letter country code.

Note: the dataset and its variables carry the description, labels, provenance, lengths, terminology, class, structure, and standard version a review needs. The same declarations produce the data-definition document beside the data and the exchange file dm.json, which carries the rows and the column metadata together and is the file the document points at.

Inputs

Under review
1 source file

input/dm_raw.csv

Edit
3 rows
input/dm_raw.csv
STUDYIDSUBJIDSITEIDAGESEXCOUNTRY
CATH0001UCSD34FUSA
CATH0002UCSD67MUSA
CATH0003MCGILL52FCAN

Expected output

Under review
3 expected rows

expected/define.xml

Edit
<?xml version="1.0" encoding="UTF-8"?>
<ODM xmlns="http://www.cdisc.org/ns/odm/v1.3" xmlns:def="http://www.cdisc.org/ns/def/v2.1" xmlns:xlink="http://www.w3.org/1999/xlink" ODMVersion="1.3.2" FileType="Snapshot" FileOID="www.example.org/STUDY01/1/Define-XML_2.1" CreationDateTime="2026-09-11T00:00:00" Originator="Example Sponsor" SourceSystem="yamaa" SourceSystemVersion="1.0" def:Context="Submission">
  <Study OID="STDY.STUDY01">
    <GlobalVariables>
      <StudyName>STUDY01</StudyName>
      <StudyDescription>Example study demonstrating the Define-XML metadata contract</StudyDescription>
      <ProtocolName>STUDY-01</ProtocolName>
    </GlobalVariables>
    <MetaDataVersion OID="MDV.STUDY01.1" Name="Study STUDY01, Data Definitions" Description="Tabulation data definitions for STUDY01" def:DefineVersion="2.1.11">
      <def:Standards>
        <def:Standard OID="STD.SDTMIG" Name="SDTMIG" Type="IG" Version="3.4" Status="Final"/>
        <def:Standard OID="STD.CT_SDTM" Name="CDISC/NCI" Type="CT" PublishingSet="SDTM" Version="2023-12-15" Status="Final"/>
      </def:Standards>
      <def:AnnotatedCRF>
        <def:DocumentRef leafID="LF.acrf"/>
      </def:AnnotatedCRF>
      <def:SupplementalDoc>
        <def:DocumentRef leafID="LF.csdrg"/>
      </def:SupplementalDoc>
      <ItemGroupDef OID="IG.DM" Name="DM" Domain="DM" Purpose="Tabulation" SASDatasetName="DM" Repeating="No" IsReferenceData="No" def:Structure="One record per subject" def:ArchiveLocationID="LF.DM" def:StandardOID="STD.SDTMIG" def:CommentOID="COM.DM">
        <Description>
          <TranslatedText xml:lang="en">Demographics</TranslatedText>
        </Description>
        <ItemRef ItemOID="IT.DM.DOMAIN" OrderNumber="1" Mandatory="Yes" Role="Identifier"/>
        <ItemRef ItemOID="IT.DM.STUDYID" OrderNumber="2" Mandatory="Yes" KeySequence="1" Role="Identifier"/>
        <ItemRef ItemOID="IT.DM.USUBJID" OrderNumber="3" Mandatory="Yes" KeySequence="2" Role="Identifier" MethodOID="MT.DM.USUBJID"/>
        <ItemRef ItemOID="IT.DM.SUBJID" OrderNumber="4" Mandatory="Yes" Role="Topic"/>
        <ItemRef ItemOID="IT.DM.SITEID" OrderNumber="5" Mandatory="Yes" Role="Record Qualifier"/>
        <ItemRef ItemOID="IT.DM.AGE" OrderNumber="6" Mandatory="No" Role="Record Qualifier"/>
        <ItemRef ItemOID="IT.DM.AGEU" OrderNumber="7" Mandatory="No" Role="Variable Qualifier"/>
        <ItemRef ItemOID="IT.DM.SEX" OrderNumber="8" Mandatory="Yes" Role="Record Qualifier"/>
        <ItemRef ItemOID="IT.DM.COUNTRY" OrderNumber="9" Mandatory="Yes" Role="Record Qualifier"/>
        <def:Class Name="SPECIAL PURPOSE"/>
        <def:leaf ID="LF.DM" xlink:href="dm.json">
          <def:title>dm.json</def:title>
        </def:leaf>
      </ItemGroupDef>
      <ItemDef OID="IT.DM.DOMAIN" Name="DOMAIN" DataType="text" Length="2" SASFieldName="DOMAIN">
        <Description>
          <TranslatedText xml:lang="en">Domain Abbreviation</TranslatedText>
        </Description>
        <CodeListRef CodeListOID="CL.DOMAIN"/>
        <def:Origin Type="Assigned" Source="Sponsor"/>
      </ItemDef>
      <ItemDef OID="IT.DM.STUDYID" Name="STUDYID" DataType="text" Length="20" SASFieldName="STUDYID">
        <Description>
          <TranslatedText xml:lang="en">Study Identifier</TranslatedText>
        </Description>
        <def:Origin Type="Protocol" Source="Sponsor"/>
      </ItemDef>
      <ItemDef OID="IT.DM.USUBJID" Name="USUBJID" DataType="text" Length="30" SASFieldName="USUBJID">
        <Description>
          <TranslatedText xml:lang="en">Unique Subject Identifier</TranslatedText>
        </Description>
        <def:Origin Type="Derived" Source="Sponsor"/>
      </ItemDef>
      <ItemDef OID="IT.DM.SUBJID" Name="SUBJID" DataType="text" Length="10" SASFieldName="SUBJID">
        <Description>
          <TranslatedText xml:lang="en">Subject Identifier for the Study</TranslatedText>
        </Description>
        <def:Origin Type="Collected" Source="Investigator">
          <def:DocumentRef leafID="LF.acrf">
            <def:PDFPageRef PageRefs="1" Type="PhysicalRef"/>
          </def:DocumentRef>
        </def:Origin>
      </ItemDef>
      <ItemDef OID="IT.DM.SITEID" Name="SITEID" DataType="text" Length="10" SASFieldName="SITEID">
        <Description>
          <TranslatedText xml:lang="en">Study Site Identifier</TranslatedText>
        </Description>
        <def:Origin Type="Collected" Source="Investigator">
          <def:DocumentRef leafID="LF.acrf"/>
        </def:Origin>
      </ItemDef>
      <ItemDef OID="IT.DM.AGE" Name="AGE" DataType="integer" Length="3" SASFieldName="AGE">
        <Description>
          <TranslatedText xml:lang="en">Age</TranslatedText>
        </Description>
        <def:Origin Type="Collected" Source="Investigator">
          <def:DocumentRef leafID="LF.acrf">
            <def:PDFPageRef PageRefs="1" Type="PhysicalRef"/>
          </def:DocumentRef>
        </def:Origin>
      </ItemDef>
      <ItemDef OID="IT.DM.AGEU" Name="AGEU" DataType="text" Length="5" SASFieldName="AGEU" def:CommentOID="COM.DM.AGEU">
        <Description>
          <TranslatedText xml:lang="en">Age Units</TranslatedText>
        </Description>
        <CodeListRef CodeListOID="CL.AGEU"/>
        <def:Origin Type="Assigned" Source="Sponsor"/>
      </ItemDef>
      <ItemDef OID="IT.DM.SEX" Name="SEX" DataType="text" Length="1" SASFieldName="SEX">
        <Description>
          <TranslatedText xml:lang="en">Sex</TranslatedText>
        </Description>
        <CodeListRef CodeListOID="CL.SEX"/>
        <def:Origin Type="Collected" Source="Investigator">
          <def:DocumentRef leafID="LF.acrf">
            <def:PDFPageRef PageRefs="1" Type="PhysicalRef"/>
          </def:DocumentRef>
        </def:Origin>
      </ItemDef>
      <ItemDef OID="IT.DM.COUNTRY" Name="COUNTRY" DataType="text" Length="3" SASFieldName="COUNTRY">
        <Description>
          <TranslatedText xml:lang="en">Country</TranslatedText>
        </Description>
        <CodeListRef CodeListOID="CL.COUNTRY"/>
        <def:Origin Type="Collected" Source="Investigator">
          <def:DocumentRef leafID="LF.acrf">
            <def:PDFPageRef PageRefs="1" Type="PhysicalRef"/>
          </def:DocumentRef>
        </def:Origin>
      </ItemDef>
      <CodeList OID="CL.DOMAIN" Name="Domain Abbreviation (DM)" DataType="text" def:StandardOID="STD.CT_SDTM" SASFormatName="$DMDOMAI">
        <CodeListItem CodedValue="DM">
          <Decode>
            <TranslatedText xml:lang="en">Demographics</TranslatedText>
          </Decode>
          <Alias Context="nci:ExtCodeID" Name="C49572"/>
        </CodeListItem>
        <Alias Context="nci:ExtCodeID" Name="C66734"/>
      </CodeList>
      <CodeList OID="CL.AGEU" Name="Age Unit" DataType="text" def:StandardOID="STD.CT_SDTM">
        <EnumeratedItem CodedValue="YEARS">
          <Alias Context="nci:ExtCodeID" Name="C29848"/>
        </EnumeratedItem>
        <Alias Context="nci:ExtCodeID" Name="C66781"/>
      </CodeList>
      <CodeList OID="CL.SEX" Name="Sex" DataType="text" def:StandardOID="STD.CT_SDTM" SASFormatName="$SEX">
        <CodeListItem CodedValue="F">
          <Decode>
            <TranslatedText xml:lang="en">Female</TranslatedText>
          </Decode>
          <Alias Context="nci:ExtCodeID" Name="C16576"/>
        </CodeListItem>
        <CodeListItem CodedValue="M">
          <Decode>
            <TranslatedText xml:lang="en">Male</TranslatedText>
          </Decode>
          <Alias Context="nci:ExtCodeID" Name="C20197"/>
        </CodeListItem>
        <CodeListItem CodedValue="U">
          <Decode>
            <TranslatedText xml:lang="en">Unknown</TranslatedText>
          </Decode>
          <Alias Context="nci:ExtCodeID" Name="C17998"/>
        </CodeListItem>
        <Alias Context="nci:ExtCodeID" Name="C66731"/>
      </CodeList>
      <CodeList OID="CL.COUNTRY" Name="Country Codes" DataType="text" def:StandardOID="STD.CT_SDTM">
        <ExternalCodeList Dictionary="ISO 3166" Version="2020" href="https://www.iso.org/iso-3166-country-codes.html"/>
      </CodeList>
      <MethodDef OID="MT.DM.USUBJID" Name="DM.USUBJID" Type="Computation">
        <Description>
          <TranslatedText xml:lang="en">Study identifier, site identifier, and subject identifier joined by hyphens.</TranslatedText>
        </Description>
      </MethodDef>
      <def:CommentDef OID="COM.DM">
        <Description>
          <TranslatedText xml:lang="en">Demographics are described in section 2.1 of the reviewer's guide.</TranslatedText>
        </Description>
        <def:DocumentRef leafID="LF.csdrg"/>
      </def:CommentDef>
      <def:CommentDef OID="COM.DM.AGEU">
        <Description>
          <TranslatedText xml:lang="en">Defaulted to YEARS because age is collected in whole years.</TranslatedText>
        </Description>
      </def:CommentDef>
      <def:leaf ID="LF.acrf" xlink:href="acrf.pdf">
        <def:title>Annotated Case Report Form</def:title>
      </def:leaf>
      <def:leaf ID="LF.csdrg" xlink:href="csdrg.pdf">
        <def:title>Study Data Reviewer's Guide</def:title>
      </def:leaf>
    </MetaDataVersion>
  </Study>
</ODM>

expected/dm.csv

Edit
3 rows
expected/dm.csv
DOMAINSTUDYIDUSUBJIDSUBJIDSITEIDAGEAGEUSEXCOUNTRY
DMCATH0001UCSD34YEARSFUSA
DMCATH0002UCSD67YEARSMUSA
DMCATH0003MCGILL52YEARSFCAN

expected/dm.json

Edit
{
  "datasetJSONCreationDateTime": "2026-09-11T00:00:00",
  "datasetJSONVersion": "1.1.0",
  "fileOID": "www.example.org/STUDY01/1/Define-XML_2.1.DM",
  "originator": "Example Sponsor",
  "sourceSystem": {"name": "yamaa", "version": "1.0"},
  "studyOID": "STDY.STUDY01",
  "metaDataVersionOID": "MDV.STUDY01.1",
  "metaDataRef": "define.xml",
  "itemGroupOID": "IG.DM",
  "records": 3,
  "name": "DM",
  "label": "Demographics",
  "columns": [
    {"itemOID": "IT.DM.DOMAIN", "name": "DOMAIN", "label": "Domain Abbreviation", "dataType": "string", "length": 2},
    {"itemOID": "IT.DM.STUDYID", "name": "STUDYID", "label": "Study Identifier", "dataType": "string", "length": 20, "keySequence": 1},
    {"itemOID": "IT.DM.USUBJID", "name": "USUBJID", "label": "Unique Subject Identifier", "dataType": "string", "length": 30, "keySequence": 2},
    {"itemOID": "IT.DM.SUBJID", "name": "SUBJID", "label": "Subject Identifier for the Study", "dataType": "string", "length": 10},
    {"itemOID": "IT.DM.SITEID", "name": "SITEID", "label": "Study Site Identifier", "dataType": "string", "length": 10},
    {"itemOID": "IT.DM.AGE", "name": "AGE", "label": "Age", "dataType": "integer", "length": 3},
    {"itemOID": "IT.DM.AGEU", "name": "AGEU", "label": "Age Units", "dataType": "string", "length": 5},
    {"itemOID": "IT.DM.SEX", "name": "SEX", "label": "Sex", "dataType": "string", "length": 1},
    {"itemOID": "IT.DM.COUNTRY", "name": "COUNTRY", "label": "Country", "dataType": "string", "length": 3}
  ],
  "rows": [
    ["DM", "CATH", "CATH-UCSD-0001", "0001", "UCSD", 34, "YEARS", "F", "USA"],
    ["DM", "CATH", "CATH-UCSD-0002", "0002", "UCSD", 67, "YEARS", "M", "USA"],
    ["DM", "CATH", "CATH-MCGILL-0003", "0003", "MCGILL", 52, "YEARS", "F", "CAN"]
  ]
}
Shaded columns are derived— = missing value

Comments and assessment materials

Comments

Signed in with GitHub; saved in repository 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 AbbreviationChar2Domain Abbreviation (DM)AssignedReqSet constant value "DM".SDTM1
STUDYIDStudy IdentifierChar20ProtocolReqCopy value from DM_RAW.STUDYID.SDTM2
USUBJIDUnique Subject IdentifierCharDerivedReqStudy identifier, site identifier, and subject identifier joined by hyphens.SDTM3
SUBJIDSubject Identifier for the StudyChar10CollectedReqCopy value from DM_RAW.SUBJID.SDTM4
SITEIDStudy Site IdentifierChar10CollectedReqCopy value from DM_RAW.SITEID.SDTM5
AGEAgeNum3CollectedExpCopy value from DM_RAW.AGE.SDTM6
AGEUAge UnitsChar5Age UnitAssignedExpSet constant value "YEARS".SDTM7Defaulted to YEARS because age is collected in whole years.
SEXSexChar1SexCollectedReqCopy value from DM_RAW.SEX.SDTM8
COUNTRYCountryChar3Country Codes (ISO 3166, version 2020)CollectedReqCopy value from DM_RAW.COUNTRY.SDTM9
Codelist IDNameValueDecodeCodelist NCI aliasValue NCI aliasExtensibleExtended valueSAS formatDictionaryVersion
DOMAINDomain Abbreviation (DM)DMDemographicsC66734C49572No$DMDOMAI
AGEUAge UnitYEARSC66781C29848No
SEXSexFFemaleC66731C16576No$SEX
SEXSexMMaleC66731C20197No$SEX
SEXSexUUnknownC66731C17998No$SEX
COUNTRYCountry CodesNoISO 31662020
VersionDateAuthorDescriptionReviewerSign-off
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-metadata/full.md

Edit
14 lines

Following CDISC SDTM standards, use the provided DM_RAW 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, SITEID, AGE, AGEU, SEX, COUNTRY

USUBJID is the study, site, and subject identifiers with hyphens between them. SITEID is the collected site identifier, and SUBJID and COUNTRY are as collected, SUBJID keeping its leading zeros. AGE is the collected age in whole years, with no value when not collected. AGEU is fixed to YEARS. SEX is the collected sex, one of F, M, or U.

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

prompts/sdtm-dm-metadata/conventions.md

Edit
10 lines

Following CDISC SDTM standards, use the provided DM_RAW 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, SITEID, AGE, AGEU, SEX, COUNTRY

SEX is one of F, M, or U.

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

prompts/sdtm-dm-metadata/brief.md

Edit
8 lines

Following CDISC SDTM standards, use the provided DM_RAW 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, SITEID, AGE, AGEU, SEX, COUNTRY

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

yamaa code

Runs the yamaa specification; its result must match the expected output

run.R

Edit
4 lines
library(yamaa)dm <- yamaa_domain("spec.yaml")$outputdm

run.py

Edit
4 lines
import yamaadm = yamaa.yamaa_domain("spec.yaml").outputdm

Solution without yamaa

Written from the full prompt and the inputs alone; CI checks it reproduces the expected output

solutions/sdtm-dm-metadata/result.R

Edit
25 lines
# Reference solution for the yamaa benchmark sdtm-dm-metadata (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()))dm <- dm_raw |>  mutate(    DOMAIN = "DM",    USUBJID = paste(STUDYID, SITEID, SUBJID, sep = "-"),    AGE = suppressWarnings(as.integer(AGE)),    AGEU = "YEARS"  ) |>  select(DOMAIN, STUDYID, USUBJID, SUBJID, SITEID, AGE, AGEU, SEX, COUNTRY)dir.create("/app/output", showWarnings = FALSE)write_csv(dm, "/app/output/dm.csv", na = "")

solutions/sdtm-dm-metadata/result.py

Edit
34 lines
# Reference solution for the yamaa benchmark sdtm-dm-metadata (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.from pathlib import Pathimport polars as pldm_raw = pl.read_csv("/app/input/dm_raw.csv", infer_schema=False)dm = (    dm_raw.with_columns(        DOMAIN=pl.lit("DM"),        USUBJID=pl.col("STUDYID") + pl.lit("-") + pl.col("SITEID") + pl.lit("-") + pl.col("SUBJID"),        AGE=pl.col("AGE").cast(pl.Int64, strict=False),        AGEU=pl.lit("YEARS"),    )    .select(        "DOMAIN",        "STUDYID",        "USUBJID",        "SUBJID",        "SITEID",        "AGE",        "AGEU",        "SEX",        "COUNTRY",    ))Path("/app/output").mkdir(exist_ok=True)dm.write_csv("/app/output/dm.csv")

solutions/sdtm-dm-metadata/result.sas

Edit
15 lines
/* opensas reference solution for the yamaa benchmark sdtm-dm-metadata.   Reads the benchmark inputs and derives the requested output.   Execute with the existing opensas runtime: opensas /app/output/result.sas. */data dm_raw;  length STUDYID SUBJID SITEID SEX COUNTRY $1024;  infile "/app/input/dm_raw.csv" dsd dlm="," firstobs=2 truncover lrecl=32767;  input STUDYID : $char1024. SUBJID : $char1024. SITEID : $char1024. AGE SEX : $char1024. COUNTRY : $char1024.;run;data result; set dm_raw; length DOMAIN $2 USUBJID $1024 AGEU $8; DOMAIN='DM'; USUBJID=catx('-',STUDYID,SITEID,SUBJID); AGEU='YEARS'; run;proc sql;  create table final as select DOMAIN, STUDYID, USUBJID, SUBJID, SITEID, AGE, AGEU, SEX, COUNTRY from result;quit;proc export data=final outfile="/app/output/dm.csv" dbms=csv replace; run;