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: 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:
VISITNUMandVISITidentify the visit; fractional visit numbers retain unplanned visits between scheduled ones.SVSTDTCandSVENDTCretain the visit dates, including visits spanning more than one day.SVUPDESexplains 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 review1 source fileinput/visits.csv
Edit3 rows| STUDYID | USUBJID | VISITNO | NAME | START | END | REASON |
|---|---|---|---|---|---|---|
| CATH | 1 | SCREENING | 2025-01-03 | 2025-01-04 | — | |
| CATH | 2 | DAY 1 | 2025-01-08 | 2025-01-08 | — | |
| CATH | 2.5 | UNSCHEDULED | 2025-01-10 | 2025-01-10 | REPEAT LAB |
Expected output
Under review3 expected rowsexpected/define.xml
EditDefine-XMLDefine-XML 2.1.11: CATH
Subject Visits; CATH-01; SDTMIG 3.3
| Dataset | Description | Class | Structure | Purpose | Keys | Documentation | Location |
|---|---|---|---|---|---|---|---|
| SV | Subject Visits | SPECIAL PURPOSE | One record per subject per visit | Tabulation | STUDYID, USUBJID, VISITNUM | sv.xpt |
SV
| Variable | Label / Description | Type | Role | Length or Display Format | Controlled Terms or ISO Format | Origin / Source / Method / Comment |
|---|---|---|---|---|---|---|
| DOMAIN | Domain Abbreviation | text | Identifier | 2 | Assigned; Sponsor | |
| STUDYID | Study Identifier | text | Identifier | 4 | Protocol; Sponsor | |
| USUBJID | Unique Subject Identifier | text | Identifier | 7 | Assigned; Sponsor | |
| VISITNUM | Visit Number | float | Topic | 8 | Collected; Investigator; Annotated Case Report Form (acrf.pdf); pages 1 | |
| VISIT | Visit Name | text | Timing | 11 | Collected; Investigator; Annotated Case Report Form (acrf.pdf); pages 1 | |
| SVSTDTC | Start Date/Time of Visit | date | Timing | ISO 8601 | Collected; Investigator; Annotated Case Report Form (acrf.pdf); pages 1 | |
| SVENDTC | End Date/Time of Visit | date | Timing | ISO 8601 | Collected; Investigator; Annotated Case Report Form (acrf.pdf); pages 1 | |
| SVUPDES | Description of Unplanned Visit | text | Synonym Qualifier | 10 | Collected; 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
Edit3 rows| DOMAIN | STUDYID | USUBJID | VISITNUM | VISIT | SVSTDTC | SVENDTC | SVUPDES |
|---|---|---|---|---|---|---|---|
| SV | CATH | 1 | SCREENING | 2025-01-03 | 2025-01-04 | — | |
| SV | CATH | 2 | DAY 1 | 2025-01-08 | 2025-01-08 | — | |
| SV | CATH | 2.5 | UNSCHEDULED | 2025-01-10 | 2025-01-10 | REPEAT LAB |
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 | 80 | Assigned | Req | Set constant value "SV". | SDTM | 1 | ||
| STUDYID | Study Identifier | Char | 80 | Protocol | Req | Copy value from VISITS.STUDYID. | SDTM | 2 | ||
| USUBJID | Unique Subject Identifier | Char | 80 | Assigned | Req | Copy value from VISITS.USUBJID. | SDTM | 3 | ||
| VISITNUM | Visit Number | Num | 8 | Collected | Req | Copy value from VISITS.VISITNO. | SDTM | 4 | ||
| VISIT | Visit Name | Char | 80 | Collected | Perm | Copy value from VISITS.NAME. | SDTM | 5 | ||
| SVSTDTC | Start Date/Time of Visit | Char | ISO 8601 | Collected | Exp | Copy value from VISITS.START. | SDTM | 6 | ||
| SVENDTC | End Date/Time of Visit | Char | ISO 8601 | Collected | Exp | Copy value from VISITS.END. | SDTM | 7 | ||
| SVUPDES | Description of Unplanned Visit | Char | 80 | Collected | Perm | Copy value from VISITS.REASON. | 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-sv-sdtmig33/full.md
Edit14 linesFollowing 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
Edit10 linesFollowing 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
Edit8 linesFollowing 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.
R
Edit3 lineslibrary(yamaa)yamaa_project("project.yaml")$spec("SV")$run()$outputPython
Edit3 linesimport yamaayamaa.project("project.yaml").spec("SV").run().outputsolutions/sdtm-sv-sdtmig33/result.R
Edit24 linesvisits <- 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
Edit53 linesfrom 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
Edit25 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;
yamaa