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: emit related-records rows for whole-dataset relationships alongside record-level rows, carrying IDVAR, IDVARVAL, and RELID.

Input: collected tumor identification (TU) records, one per tumor with its own link identifier, and tumor results (TR) records carrying the link identifier of the tumor they measure, plus adverse event (AE) and concomitant medication (CM) records, where an AE and a CM record sharing a link identifier are related. An AE or CM record without a link identifier gets no row.

Variables:

  • USUBJID is empty on a dataset-level row, which relates whole domains rather than subject records; it names the subject on a record-level row.
  • IDVAR names the link variable on a dataset-level row (TULNKID, TRLNKID) and the sequence variable on a record-level row (AESEQ, CMSEQ).
  • IDVARVAL is empty on a dataset-level row and carries the sequence number of the related record as text on a record-level row.
  • RELTYPE carries ONE on the TU row and MANY on the TR row: one tumor identification relates to many tumor results. This is the only use of RELTYPE in SDTM; the record-level AE/CM rows leave it blank.
  • RELID names the relationship the row takes part in; rows sharing a value are related to one another, and every row carries one. The dataset-level rows share 1; each record-level row carries its record's link identifier, so records with different link identifiers land in distinct relationships instead of folding into one.

Note: rows sharing a RELID are related to one another whether they point at whole datasets or single records; a dataset-level row never names a subject or a record value.

Inputs

Under review
4 source files

input/ae.csv

Edit
2 rows
input/ae.csv
STUDYIDUSUBJIDAESEQAETERMAELNKID
YAMAA-011HEADACHEREL-1
YAMAA-012NAUSEAREL-2

input/cm.csv

Edit
2 rows
input/cm.csv
STUDYIDUSUBJIDCMSEQCMTRTCMLNKID
YAMAA-011IBUPROFENREL-1
YAMAA-012ONDANSETRONREL-2

input/tr.csv

Edit
4 rows
input/tr.csv
STUDYIDUSUBJIDTRSEQTRTESTCDTRLNKID
YAMAA-011LDIAMLNK-A
YAMAA-012LDIAMLNK-A
YAMAA-013LDIAMLNK-C
YAMAA-011LDIAMLNK-B

input/tu.csv

Edit
3 rows
input/tu.csv
STUDYIDUSUBJIDTUSEQTUTESTCDTULNKID
YAMAA-011NEWTUMORLNK-A
YAMAA-012NEWTUMORLNK-C
YAMAA-011NEWTUMORLNK-B

Expected output

Under review
6 expected rows

expected/relrec.csv

Edit
6 rows
expected/relrec.csv
STUDYIDUSUBJIDRDOMAINIDVARIDVARVALRELTYPERELID
YAMAA-01—TUTULNKID—ONE1
YAMAA-01—TRTRLNKID—MANY1
YAMAA-01AEAESEQ1—REL-1
YAMAA-01AEAESEQ2—REL-2
YAMAA-01CMCMSEQ1—REL-1
YAMAA-01CMCMSEQ2—REL-2
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
STUDYIDStudy IdentifierCharDerivedSet per constructed row; see the Row construction sheet.SDTM1
USUBJIDUnique Subject IdentifierCharDerivedSet per constructed row; see the Row construction sheet.SDTM2
RDOMAINRelated Domain AbbreviationCharDerivedSet per constructed row; see the Row construction sheet.SDTM3
IDVARIdentifying VariableCharDerivedSet per constructed row; see the Row construction sheet.SDTM4
IDVARVALIdentifying Variable ValueCharDerivedSet per constructed row; see the Row construction sheet.SDTM5
RELTYPERelationship TypeCharDerivedSet per constructed row; see the Row construction sheet.SDTM6
RELIDRelationship IdentifierCharDerivedSet per constructed row; see the Row construction sheet.SDTM7
TemplateInclude whenSTUDYIDUSUBJIDRDOMAINIDVARIDVARVALRELTYPERELID
tu_datasetCopy TU.STUDYIDConstant "None"Constant "TU"Constant "TULNKID"Constant "None"Constant "ONE"Constant "1"
tr_datasetCopy TR.STUDYIDConstant "None"Constant "TR"Constant "TRLNKID"Constant "None"Constant "MANY"Constant "1"
ae_linkAE.AELNKID IS NOT NULLCopy AE.STUDYIDCopy AE.USUBJIDConstant "AE"Constant "AESEQ"Copy AE.AESEQConstant "None"Copy AE.AELNKID
cm_linkCM.CMLNKID IS NOT NULLCopy CM.STUDYIDCopy CM.USUBJIDConstant "CM"Constant "CMSEQ"Copy CM.CMSEQConstant "None"Copy CM.CMLNKID
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-relrec-dataset-level/full.md

Edit
31 lines

Following CDISC SDTM standards, use the provided AE, CM, TR, and TU datasets to create a RELREC dataset with one record per linked record or related dataset.

The output dataset should contain the following columns in this order: STUDYID, USUBJID, RDOMAIN, IDVAR, IDVARVAL, RELTYPE, RELID

Each TU record identifies one tumor by its own link identifier, and each TR record carries the link identifier of the tumor it measures. The TU dataset gives one dataset-level row and the TR dataset gives one dataset-level row; the two rows relate the datasets as a whole. RDOMAIN is "TU" on the TU row, "TR" on the TR row, "AE" on a row for an adverse event record, and "CM" on a row for a concomitant medication record. USUBJID has no value on a dataset-level row and names the subject on a record-level row. IDVAR is "TULNKID" on the TU row and "TRLNKID" on the TR row. IDVAR is "AESEQ" on an adverse event row and "CMSEQ" on a concomitant medication row. IDVARVAL has no value on a dataset-level row and is the sequence number of the related record, as text, on a record-level row. RELTYPE is "ONE" on the TU row and "MANY" on the TR row, because one tumor identification relates to many tumor results. RELTYPE has no value on a record-level row. The dataset-level rows share RELID "1". Each AE record that carries a link identifier gives one row, and each CM record that carries a link identifier gives one row. An AE or CM record without a link identifier gives no row. On a record-level row RELID is the record's own link identifier, so an AE record and a CM record that share a link identifier are related to one another, and records with different link identifiers are in different relationships. Rows that share a RELID are related to one another, whether they point at whole datasets or at single records.

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

prompts/sdtm-relrec-dataset-level/conventions.md

Edit
13 lines

Following CDISC SDTM standards, use the provided AE, CM, TR, and TU datasets to create a RELREC dataset with one record per linked record or related dataset.

The output dataset should contain the following columns in this order: STUDYID, USUBJID, RDOMAIN, IDVAR, IDVARVAL, RELTYPE, RELID

RDOMAIN is "TU", "TR", "AE", or "CM". IDVAR is "TULNKID", "TRLNKID", "AESEQ", or "CMSEQ". IDVARVAL is the sequence number of the related record, as text, or has no value. RELTYPE is "ONE" or "MANY", or has no value. The dataset-level rows share RELID "1".

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

prompts/sdtm-relrec-dataset-level/brief.md

Edit
8 lines

Following CDISC SDTM standards, use the provided AE, CM, TR, and TU datasets to create a RELREC dataset with one record per linked record or related dataset.

The output dataset should contain the following columns in this order: STUDYID, USUBJID, RDOMAIN, IDVAR, IDVARVAL, RELTYPE, RELID

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

yamaa code

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

R

Edit
3 lines
library(yamaa)yamaa_spec("spec.yaml")$run()$output

Python

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

Solution without yamaa

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

solutions/sdtm-relrec-dataset-level/result.R

Edit
64 lines
# Reference solution for the yamaa benchmark sdtm-relrec-dataset-level (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)ae <- read_csv(  "/app/input/ae.csv",  col_types = cols(.default = col_character()))cm <- read_csv(  "/app/input/cm.csv",  col_types = cols(.default = col_character()))tr <- read_csv(  "/app/input/tr.csv",  col_types = cols(.default = col_character()))# AE can be empty after subject removal; the dataset relationship remains.studyid <- if (nrow(ae) > 0) ae$STUDYID[[1]] else tr$STUDYID[[1]]# Whole domains rather than subject records: one tumor identification# relates to many tumor results.dataset_rows <- tibble(  STUDYID = studyid,  USUBJID = NA_character_,  RDOMAIN = c("TU", "TR"),  IDVAR = c("TULNKID", "TRLNKID"),  IDVARVAL = NA_character_,  RELTYPE = c("ONE", "MANY"),  RELID = c("1", "1"))ae_rows <- ae |>  filter(!is.na(AELNKID) & trimws(AELNKID) != "") |>  mutate(    RDOMAIN = "AE",    IDVAR = "AESEQ",    IDVARVAL = trimws(AESEQ),    RELTYPE = NA_character_,    RELID = trimws(AELNKID)  ) |>  select(STUDYID, USUBJID, RDOMAIN, IDVAR, IDVARVAL, RELTYPE, RELID)cm_rows <- cm |>  filter(!is.na(CMLNKID) & trimws(CMLNKID) != "") |>  mutate(    RDOMAIN = "CM",    IDVAR = "CMSEQ",    IDVARVAL = trimws(CMSEQ),    RELTYPE = NA_character_,    RELID = trimws(CMLNKID)  ) |>  select(STUDYID, USUBJID, RDOMAIN, IDVAR, IDVARVAL, RELTYPE, RELID)relrec <- bind_rows(dataset_rows, ae_rows, cm_rows) |>  select(STUDYID, USUBJID, RDOMAIN, IDVAR, IDVARVAL, RELTYPE, RELID)dir.create("/app/output", showWarnings = FALSE)write_csv(relrec, "/app/output/relrec.csv", na = "")

solutions/sdtm-relrec-dataset-level/result.py

Edit
98 lines
# Reference solution for the yamaa benchmark sdtm-relrec-dataset-level (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.import csvimport osINPUT_DIR = "/app/input"OUTPUT_DIR = "/app/output"COLUMNS = ["STUDYID", "USUBJID", "RDOMAIN", "IDVAR", "IDVARVAL",           "RELTYPE", "RELID"]def read_rows(name):    with open(os.path.join(INPUT_DIR, name), newline="") as f:        return list(csv.DictReader(f))def clean(value):    return "" if value is None else value.strip()def main():    ae = read_rows("ae.csv")    cm = read_rows("cm.csv")    tr = read_rows("tr.csv")    tu = read_rows("tu.csv")    rows = []    # Dataset-level rows: the TU and TR datasets relate as a whole.    # One tumor identification (TU) relates to many tumor results (TR).    studyid = ""    if tu:        studyid = tu[0]["STUDYID"]    elif tr:        studyid = tr[0]["STUDYID"]    rows.append({        "STUDYID": studyid,        "USUBJID": "",        "RDOMAIN": "TU",        "IDVAR": "TULNKID",        "IDVARVAL": "",        "RELTYPE": "ONE",        "RELID": "1",    })    rows.append({        "STUDYID": studyid,        "USUBJID": "",        "RDOMAIN": "TR",        "IDVAR": "TRLNKID",        "IDVARVAL": "",        "RELTYPE": "MANY",        "RELID": "1",    })    # Record-level rows: one per AE record carrying a link identifier.    for rec in ae:        lnkid = clean(rec.get("AELNKID"))        if not lnkid:            continue        rows.append({            "STUDYID": rec["STUDYID"],            "USUBJID": rec["USUBJID"],            "RDOMAIN": "AE",            "IDVAR": "AESEQ",            "IDVARVAL": clean(rec["AESEQ"]),            "RELTYPE": "",            "RELID": lnkid,        })    # Record-level rows: one per CM record carrying a link identifier.    for rec in cm:        lnkid = clean(rec.get("CMLNKID"))        if not lnkid:            continue        rows.append({            "STUDYID": rec["STUDYID"],            "USUBJID": rec["USUBJID"],            "RDOMAIN": "CM",            "IDVAR": "CMSEQ",            "IDVARVAL": clean(rec["CMSEQ"]),            "RELTYPE": "",            "RELID": lnkid,        })    os.makedirs(OUTPUT_DIR, exist_ok=True)    with open(os.path.join(OUTPUT_DIR, "relrec.csv"), "w", newline="") as f:        writer = csv.DictWriter(f, fieldnames=COLUMNS)        writer.writeheader()        writer.writerows(rows)if __name__ == "__main__":    main()

solutions/sdtm-relrec-dataset-level/result.sas

Edit
41 lines
/* opensas reference solution for the yamaa benchmark sdtm-relrec-dataset-level.   Reads the benchmark inputs and derives the requested output.   Execute with the existing opensas runtime: opensas /app/output/result.sas. */data ae;  length STUDYID USUBJID AETERM AELNKID $1024;  infile "/app/input/ae.csv" dsd dlm="," firstobs=2 truncover lrecl=32767;  input STUDYID : $char1024. USUBJID : $char1024. AESEQ AETERM : $char1024. AELNKID : $char1024.;run;data cm;  length STUDYID USUBJID CMTRT CMLNKID $1024;  infile "/app/input/cm.csv" dsd dlm="," firstobs=2 truncover lrecl=32767;  input STUDYID : $char1024. USUBJID : $char1024. CMSEQ CMTRT : $char1024. CMLNKID : $char1024.;run;data tr;  length STUDYID USUBJID TRTESTCD TRLNKID $1024;  infile "/app/input/tr.csv" dsd dlm="," firstobs=2 truncover lrecl=32767;  input STUDYID : $char1024. USUBJID : $char1024. TRSEQ TRTESTCD : $char1024. TRLNKID : $char1024.;run;data tu;  length STUDYID USUBJID TUTESTCD TULNKID $1024;  infile "/app/input/tu.csv" dsd dlm="," firstobs=2 truncover lrecl=32767;  input STUDYID : $char1024. USUBJID : $char1024. TUSEQ TUTESTCD : $char1024. TULNKID : $char1024.;run;data aelinks; set ae; length RDOMAIN IDVAR IDVARVAL RELTYPE RELID $1024; RDOMAIN='AE'; IDVAR='AESEQ'; IDVARVAL=strip(put(AESEQ,best32.)); RELTYPE='';if not missing(AELNKID) then do; RELID=AELNKID; output; end;run;data cmlinks; set cm; length RDOMAIN IDVAR IDVARVAL RELTYPE RELID $1024; RDOMAIN='CM'; IDVAR='CMSEQ'; IDVARVAL=strip(put(CMSEQ,best32.)); RELTYPE='';if not missing(CMLNKID) then do; RELID=CMLNKID; output; end;run;proc sql; create table studies as select distinct STUDYID from tu union select distinct STUDYID from tr; quit;data datasets; set studies; length USUBJID RDOMAIN IDVAR IDVARVAL RELTYPE RELID $1024; USUBJID=''; IDVARVAL=''; RELID='1'; RDOMAIN='TU'; IDVAR='TULNKID'; RELTYPE='ONE'; output; RDOMAIN='TR'; IDVAR='TRLNKID'; RELTYPE='MANY'; output; run;data result; set datasets aelinks cmlinks; run;proc sql;  create table final as select STUDYID, USUBJID, RDOMAIN, IDVAR, IDVARVAL, RELTYPE, RELID from result;quit;proc export data=final outfile="/app/output/relrec.csv" dbms=csv replace; run;