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: 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:
USUBJIDis empty on a dataset-level row, which relates whole domains rather than subject records; it names the subject on a record-level row.IDVARnames the link variable on a dataset-level row (TULNKID,TRLNKID) and the sequence variable on a record-level row (AESEQ,CMSEQ).IDVARVALis empty on a dataset-level row and carries the sequence number of the related record as text on a record-level row.RELTYPEcarriesONEon the TU row andMANYon the TR row: one tumor identification relates to many tumor results. This is the only use ofRELTYPEin SDTM; the record-level AE/CM rows leave it blank.RELIDnames 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 share1; 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 review4 source filesinput/ae.csv
Edit2 rows| STUDYID | USUBJID | AESEQ | AETERM | AELNKID |
|---|---|---|---|---|
| YAMAA-01 | 1 | HEADACHE | REL-1 | |
| YAMAA-01 | 2 | NAUSEA | REL-2 |
input/cm.csv
Edit2 rows| STUDYID | USUBJID | CMSEQ | CMTRT | CMLNKID |
|---|---|---|---|---|
| YAMAA-01 | 1 | IBUPROFEN | REL-1 | |
| YAMAA-01 | 2 | ONDANSETRON | REL-2 |
input/tr.csv
Edit4 rows| STUDYID | USUBJID | TRSEQ | TRTESTCD | TRLNKID |
|---|---|---|---|---|
| YAMAA-01 | 1 | LDIAM | LNK-A | |
| YAMAA-01 | 2 | LDIAM | LNK-A | |
| YAMAA-01 | 3 | LDIAM | LNK-C | |
| YAMAA-01 | 1 | LDIAM | LNK-B |
input/tu.csv
Edit3 rows| STUDYID | USUBJID | TUSEQ | TUTESTCD | TULNKID |
|---|---|---|---|---|
| YAMAA-01 | 1 | NEWTUMOR | LNK-A | |
| YAMAA-01 | 2 | NEWTUMOR | LNK-C | |
| YAMAA-01 | 1 | NEWTUMOR | LNK-B |
Expected output
Under review6 expected rowsexpected/relrec.csv
Edit6 rows| STUDYID | USUBJID | RDOMAIN | IDVAR | IDVARVAL | RELTYPE | RELID |
|---|---|---|---|---|---|---|
| YAMAA-01 | — | TU | TULNKID | — | ONE | 1 |
| YAMAA-01 | — | TR | TRLNKID | — | MANY | 1 |
| YAMAA-01 | AE | AESEQ | 1 | — | REL-1 | |
| YAMAA-01 | AE | AESEQ | 2 | — | REL-2 | |
| YAMAA-01 | CM | CMSEQ | 1 | — | REL-1 | |
| YAMAA-01 | CM | CMSEQ | 2 | — | REL-2 |
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 |
|---|---|---|---|---|---|---|---|---|---|---|
| STUDYID | Study Identifier | Char | Derived | Set per constructed row; see the Row construction sheet. | SDTM | 1 | ||||
| USUBJID | Unique Subject Identifier | Char | Derived | Set per constructed row; see the Row construction sheet. | SDTM | 2 | ||||
| RDOMAIN | Related Domain Abbreviation | Char | Derived | Set per constructed row; see the Row construction sheet. | SDTM | 3 | ||||
| IDVAR | Identifying Variable | Char | Derived | Set per constructed row; see the Row construction sheet. | SDTM | 4 | ||||
| IDVARVAL | Identifying Variable Value | Char | Derived | Set per constructed row; see the Row construction sheet. | SDTM | 5 | ||||
| RELTYPE | Relationship Type | Char | Derived | Set per constructed row; see the Row construction sheet. | SDTM | 6 | ||||
| RELID | Relationship Identifier | Char | Derived | Set per constructed row; see the Row construction sheet. | SDTM | 7 |
| Template | Include when | STUDYID | USUBJID | RDOMAIN | IDVAR | IDVARVAL | RELTYPE | RELID |
|---|---|---|---|---|---|---|---|---|
| tu_dataset | Copy TU.STUDYID | Constant "None" | Constant "TU" | Constant "TULNKID" | Constant "None" | Constant "ONE" | Constant "1" | |
| tr_dataset | Copy TR.STUDYID | Constant "None" | Constant "TR" | Constant "TRLNKID" | Constant "None" | Constant "MANY" | Constant "1" | |
| ae_link | AE.AELNKID IS NOT NULL | Copy AE.STUDYID | Copy AE.USUBJID | Constant "AE" | Constant "AESEQ" | Copy AE.AESEQ | Constant "None" | Copy AE.AELNKID |
| cm_link | CM.CMLNKID IS NOT NULL | Copy CM.STUDYID | Copy CM.USUBJID | Constant "CM" | Constant "CMSEQ" | Copy CM.CMSEQ | Constant "None" | Copy CM.CMLNKID |
| 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-relrec-dataset-level/full.md
Edit31 linesFollowing 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
Edit13 linesFollowing 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
Edit8 linesFollowing 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.
R
Edit3 lineslibrary(yamaa)yamaa_spec("spec.yaml")$run()$outputPython
Edit3 linesimport yamaayamaa.spec("spec.yaml").run().outputsolutions/sdtm-relrec-dataset-level/result.R
Edit64 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
Edit98 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
Edit41 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;
yamaa