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: Keep the actual start and end of each visit, including an unplanned visit.

Input: Collected visit names, numbers, dates and reasons from a visit form.

Variables:

  • VISITNUM and VISIT identify the visit; fractional visit numbers retain unplanned visits between scheduled ones.
  • SVSTDTC and SVENDTC retain the visit dates, including visits spanning more than one day.
  • SVUPDES explains an unplanned visit and is absent for planned visits.

Note: project.yaml declares SDTMIG 3.3. The data-definition document records that guide and points to the SAS Transport version 5 dataset.

Inputs

Under review
1 source file

input/visits.csv

Edit
3 rows
input/visits.csv
STUDYIDUSUBJIDVISITNONAMESTARTENDREASON
CATH1SCREENING2025-01-032025-01-04—
CATH2DAY 12025-01-082025-01-08—
CATH2.5UNSCHEDULED2025-01-102025-01-10REPEAT LAB

Expected output

Under review
3 expected rows

expected/define.xml

Edit
Define-XML

Define-XML 2.1.11: CATH

Subject Visits; CATH-01; SDTMIG 3.3

Datasets
DatasetDescriptionClassStructurePurposeKeysDocumentationLocation
SVSubject VisitsSPECIAL PURPOSEOne record per subject per visitTabulationSTUDYID, USUBJID, VISITNUMsv.xpt

SV

SV variables
VariableLabel / DescriptionTypeRoleLength or Display FormatControlled Terms or ISO FormatOrigin / Source / Method / Comment
DOMAINDomain AbbreviationtextIdentifier2Assigned; Sponsor
STUDYIDStudy IdentifiertextIdentifier4Protocol; Sponsor
USUBJIDUnique Subject IdentifiertextIdentifier7Assigned; Sponsor
VISITNUMVisit NumberfloatTopic8Collected; Investigator; Annotated Case Report Form (acrf.pdf); pages 1
VISITVisit NametextTiming11Collected; Investigator; Annotated Case Report Form (acrf.pdf); pages 1
SVSTDTCStart Date/Time of VisitdateTimingISO 8601Collected; Investigator; Annotated Case Report Form (acrf.pdf); pages 1
SVENDTCEnd Date/Time of VisitdateTimingISO 8601Collected; Investigator; Annotated Case Report Form (acrf.pdf); pages 1
SVUPDESDescription of Unplanned VisittextSynonym Qualifier10Collected; Investigator; Annotated Case Report Form (acrf.pdf); pages 1
Original source
<?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="CATH.sdtm.Define-XML_2.1" CreationDateTime="2026-09-11T00:00:00" SourceSystem="yamaa" SourceSystemVersion="1.0" def:Context="Submission">
  <Study OID="STDY.CATH">
    <GlobalVariables>
      <StudyName>CATH</StudyName>
      <StudyDescription>Subject Visits</StudyDescription>
      <ProtocolName>CATH-01</ProtocolName>
    </GlobalVariables>
    <MetaDataVersion OID="MDV.CATH.sdtm" Name="CATH sdtm metadata" def:DefineVersion="2.1.11">
      <def:Standards>
        <def:Standard OID="STD.SDTMIG" Name="SDTMIG" Type="IG" Version="3.3" Status="Final"/>
      </def:Standards>
      <def:AnnotatedCRF>
        <def:DocumentRef leafID="LF.acrf"/>
      </def:AnnotatedCRF>
      <ItemGroupDef OID="IG.SV" Name="SV" Domain="SV" Purpose="Tabulation" SASDatasetName="SV" Repeating="Yes" IsReferenceData="No" def:Structure="One record per subject per visit" def:ArchiveLocationID="LF.SV" def:StandardOID="STD.SDTMIG">
        <Description>
          <TranslatedText xml:lang="en">Subject Visits</TranslatedText>
        </Description>
        <ItemRef ItemOID="IT.SV.DOMAIN" OrderNumber="1" Mandatory="Yes" Role="Identifier"/>
        <ItemRef ItemOID="IT.SV.STUDYID" OrderNumber="2" Mandatory="Yes" KeySequence="1" Role="Identifier"/>
        <ItemRef ItemOID="IT.SV.USUBJID" OrderNumber="3" Mandatory="Yes" KeySequence="2" Role="Identifier"/>
        <ItemRef ItemOID="IT.SV.VISITNUM" OrderNumber="4" Mandatory="Yes" KeySequence="3" Role="Topic"/>
        <ItemRef ItemOID="IT.SV.VISIT" OrderNumber="5" Mandatory="No" Role="Timing"/>
        <ItemRef ItemOID="IT.SV.SVSTDTC" OrderNumber="6" Mandatory="No" Role="Timing"/>
        <ItemRef ItemOID="IT.SV.SVENDTC" OrderNumber="7" Mandatory="No" Role="Timing"/>
        <ItemRef ItemOID="IT.SV.SVUPDES" OrderNumber="8" Mandatory="No" Role="Synonym Qualifier"/>
        <def:Class Name="SPECIAL PURPOSE"/>
        <def:leaf ID="LF.SV" xlink:href="sv.xpt">
          <def:title>sv.xpt</def:title>
        </def:leaf>
      </ItemGroupDef>
      <ItemDef OID="IT.SV.DOMAIN" Name="DOMAIN" DataType="text" Length="2" SASFieldName="DOMAIN">
        <Description>
          <TranslatedText xml:lang="en">Domain Abbreviation</TranslatedText>
        </Description>
        <def:Origin Type="Assigned" Source="Sponsor"/>
      </ItemDef>
      <ItemDef OID="IT.SV.STUDYID" Name="STUDYID" DataType="text" Length="4" SASFieldName="STUDYID">
        <Description>
          <TranslatedText xml:lang="en">Study Identifier</TranslatedText>
        </Description>
        <def:Origin Type="Protocol" Source="Sponsor"/>
      </ItemDef>
      <ItemDef OID="IT.SV.USUBJID" Name="USUBJID" DataType="text" Length="7" SASFieldName="USUBJID">
        <Description>
          <TranslatedText xml:lang="en">Unique Subject Identifier</TranslatedText>
        </Description>
        <def:Origin Type="Assigned" Source="Sponsor"/>
      </ItemDef>
      <ItemDef OID="IT.SV.VISITNUM" Name="VISITNUM" DataType="float" Length="8" SignificantDigits="1" SASFieldName="VISITNUM">
        <Description>
          <TranslatedText xml:lang="en">Visit Number</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.SV.VISIT" Name="VISIT" DataType="text" Length="11" SASFieldName="VISIT">
        <Description>
          <TranslatedText xml:lang="en">Visit Name</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.SV.SVSTDTC" Name="SVSTDTC" DataType="date" SASFieldName="SVSTDTC">
        <Description>
          <TranslatedText xml:lang="en">Start Date/Time of Visit</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.SV.SVENDTC" Name="SVENDTC" DataType="date" SASFieldName="SVENDTC">
        <Description>
          <TranslatedText xml:lang="en">End Date/Time of Visit</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.SV.SVUPDES" Name="SVUPDES" DataType="text" Length="10" SASFieldName="SVUPDES">
        <Description>
          <TranslatedText xml:lang="en">Description of Unplanned Visit</TranslatedText>
        </Description>
        <def:Origin Type="Collected" Source="Investigator">
          <def:DocumentRef leafID="LF.acrf">
            <def:PDFPageRef PageRefs="1" Type="PhysicalRef"/>
          </def:DocumentRef>
        </def:Origin>
      </ItemDef>
      <def:leaf ID="LF.acrf" xlink:href="acrf.pdf">
        <def:title>Annotated Case Report Form</def:title>
      </def:leaf>
    </MetaDataVersion>
  </Study>
</ODM>

expected/sv.csv

Edit
3 rows
expected/sv.csv
DOMAINSTUDYIDUSUBJIDVISITNUMVISITSVSTDTCSVENDTCSVUPDES
SVCATH1SCREENING2025-01-032025-01-04—
SVCATH2DAY 12025-01-082025-01-08—
SVCATH2.5UNSCHEDULED2025-01-102025-01-10REPEAT LAB
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 AbbreviationChar80AssignedReqSet constant value "SV".SDTM1
STUDYIDStudy IdentifierChar80ProtocolReqCopy value from VISITS.STUDYID.SDTM2
USUBJIDUnique Subject IdentifierChar80AssignedReqCopy value from VISITS.USUBJID.SDTM3
VISITNUMVisit NumberNum8CollectedReqCopy value from VISITS.VISITNO.SDTM4
VISITVisit NameChar80CollectedPermCopy value from VISITS.NAME.SDTM5
SVSTDTCStart Date/Time of VisitCharISO 8601CollectedExpCopy value from VISITS.START.SDTM6
SVENDTCEnd Date/Time of VisitCharISO 8601CollectedExpCopy value from VISITS.END.SDTM7
SVUPDESDescription of Unplanned VisitChar80CollectedPermCopy value from VISITS.REASON.SDTM8
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-sv-sdtmig33/full.md

Edit
14 lines

Following CDISC SDTM standards, use the provided VISITS dataset to create an SV dataset with one record per subject per visit.

The output dataset should contain the following columns in this order: DOMAIN, STUDYID, USUBJID, VISITNUM, VISIT, SVSTDTC, SVENDTC, SVUPDES

Use SDTMIG 3.3. DOMAIN is "SV". Include planned and unplanned visits, with fractional VISITNUM values identifying unplanned visits between scheduled visits. Visits spanning more than one day have their actual start and end dates. SVUPDES explains an unplanned visit and has no value for planned visits.

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

prompts/sdtm-sv-sdtmig33/conventions.md

Edit
10 lines

Following CDISC SDTM standards, use the provided VISITS dataset to create an SV dataset with one record per subject per visit.

The output dataset should contain the following columns in this order: DOMAIN, STUDYID, USUBJID, VISITNUM, VISIT, SVSTDTC, SVENDTC, SVUPDES

Use SDTMIG 3.3. DOMAIN is "SV". SVUPDES may have no value.

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

prompts/sdtm-sv-sdtmig33/brief.md

Edit
8 lines

Following CDISC SDTM standards, use the provided VISITS dataset to create an SV dataset with one record per subject per visit.

The output dataset should contain the following columns in this order: DOMAIN, STUDYID, USUBJID, VISITNUM, VISIT, SVSTDTC, SVENDTC, SVUPDES

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

yamaa code

Public calls generated from benchmark.yaml; results must match the expected output

R

Edit
3 lines
library(yamaa)yamaa_project("project.yaml")$spec("SV")$run()$output

Python

Edit
3 lines
import yamaayamaa.project("project.yaml").spec("SV").run().output

Solution without yamaa

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

solutions/sdtm-sv-sdtmig33/result.R

Edit
24 lines
visits <- read.csv("/app/input/visits.csv", stringsAsFactors = FALSE,                   na.strings = c("", "NA"), check.names = FALSE)# The source visit numbers already distinguish scheduled and intercurrent visits.visitnum <- as.numeric(visits$VISITNO)unplanned <- (!is.na(visitnum) & visitnum != floor(visitnum)) |             grepl("UNSCHEDULED|UNPLANNED", visits$NAME, ignore.case = TRUE)reason <- rep(NA_character_, nrow(visits))reason[unplanned] <- visits$REASON[unplanned]sv <- data.frame(  DOMAIN = rep("SV", nrow(visits)),  STUDYID = visits$STUDYID,  USUBJID = visits$USUBJID,  VISITNUM = visitnum,  VISIT = visits$NAME,  SVSTDTC = visits$START,  SVENDTC = visits$END,  SVUPDES = reason,  stringsAsFactors = FALSE)sv <- sv[order(sv$STUDYID, sv$USUBJID, sv$VISITNUM), , drop = FALSE]stopifnot(!anyDuplicated(sv[c("STUDYID", "USUBJID", "VISITNUM")]))write.csv(sv, "/app/output/sv.csv", row.names = FALSE, na = "")

solutions/sdtm-sv-sdtmig33/result.py

Edit
53 lines
from pathlib import Pathimport pandas as pddef main():    input_path = Path("/app/input") / "visits.csv"    output_path = Path("/app/output") / "sv.csv"    visits = pd.read_csv(input_path, dtype=str, keep_default_na=False)    records = []    for (studyid, usubjid, visitno), rows in visits.groupby(        ["STUDYID", "USUBJID", "VISITNO"], sort=False, dropna=False    ):        visitnum = float(visitno)        name = rows["NAME"].iloc[0]        unplanned = (            not visitnum.is_integer()            or "UNSCHEDULED" in name.upper()            or "UNPLANNED" in name.upper()        )        starts = rows.loc[rows["START"].ne(""), "START"]        ends = rows.loc[rows["END"].ne(""), "END"]        reasons = list(dict.fromkeys(reason for reason in rows["REASON"] if reason))        records.append(            {                "DOMAIN": "SV",                "STUDYID": studyid,                "USUBJID": usubjid,                "VISITNUM": visitnum,                "VISIT": name,                "SVSTDTC": starts.min() if len(starts) else "",                "SVENDTC": ends.max() if len(ends) else "",                "SVUPDES": "; ".join(reasons) if unplanned else "",            }        )    columns = [        "DOMAIN",        "STUDYID",        "USUBJID",        "VISITNUM",        "VISIT",        "SVSTDTC",        "SVENDTC",        "SVUPDES",    ]    sv = pd.DataFrame(records, columns=columns)    sv = sv.sort_values(["STUDYID", "USUBJID", "VISITNUM"], kind="stable")    output_path.parent.mkdir(parents=True, exist_ok=True)    sv.to_csv(output_path, index=False, float_format="%g")if __name__ == "__main__":    main()

solutions/sdtm-sv-sdtmig33/result.sas

Edit
25 lines
/* SDTMIG 3.3 Subject Visits: preserve actual date ranges and visit numbers. */proc import datafile="/app/input/visits.csv" out=visits dbms=csv replace;  getnames=yes;  guessingrows=max;run;data sv;  length DOMAIN $2 STUDYID $200 USUBJID $200 VISITNUM 8         VISIT $200 SVSTDTC $10 SVENDTC $10 SVUPDES $200;  set visits(rename=(VISITNO=VISITNUM NAME=VISIT REASON=SVUPDES));  DOMAIN="SV";  /* IMPORT reads ISO dates as SAS dates; SV dates use ISO 8601 text. */  SVSTDTC=put(START,yymmdd10.);  SVENDTC=put(END,yymmdd10.);  /* Integer visit numbers identify planned visits in this source. */  if VISITNUM=int(VISITNUM) then SVUPDES="";  keep DOMAIN STUDYID USUBJID VISITNUM VISIT SVSTDTC SVENDTC SVUPDES;run;proc sort data=sv;  by STUDYID USUBJID VISITNUM;run;proc export data=sv outfile="/app/output/sv.csv" dbms=csv replace;run;