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: reviewedEditUnder review
What this benchmark means
README.md

Public entries: Python and R. Passing coverage requires an installed inventory.

Goal: create one supplemental record per collected qualifier, carrying IDVARVAL, QLABEL, QVAL, QORIG, and QEVAL.

Input: two tables sharing study and subject identifiers: a parent medical history (MH) table with one record per condition, and a qualifier table with one record per condition carrying the two collected qualifiers.

Variables:

  • IDVARVAL is the parent sequence number as text, matched on subject and condition term.
  • QLABEL is the qualifier label: Family History for MHFAMHX, Confirmed by Medical Records for MHCONF.
  • QVAL is the collected answer, Y or N.
  • QORIG is the origin, always Collected (Define-XML 2.1) for collected values.
  • QEVAL is blank, since a collected value is not an assessment.

Note: a qualifier that finds no parent record is an error rather than a record with an empty link, so every supplemental record points at a real parent. A parent record with no collected qualifiers simply contributes nothing.

Inputs

Under review
2 source files

input/mh.csv

Edit
5 rows
input/mh.csv
STUDYIDUSUBJIDMHSEQMHTERM
CATH1ASTHMA
CATH2ECZEMA
CATH1HYPERTENSION
CATH2ASTHMA
CATH1DIABETES

input/mh_supp_raw.csv

Edit
4 rows
input/mh_supp_raw.csv
STUDYIDUSUBJIDMHTERMMHFAMHXMHCONF
CATHASTHMAYY
CATHECZEMAN—
CATHASTHMAYN
CATHDIABETESNY

Expected output

Under review
7 expected rows

expected/suppmh.csv

Edit
7 rows
expected/suppmh.csv
STUDYIDRDOMAINUSUBJIDIDVARIDVARVALQNAMQLABELQVALQORIGQEVAL
CATHMHMHSEQ1MHFAMHXFamily HistoryYCollected—
CATHMHMHSEQ2MHFAMHXFamily HistoryNCollected—
CATHMHMHSEQ2MHFAMHXFamily HistoryYCollected—
CATHMHMHSEQ1MHFAMHXFamily HistoryNCollected—
CATHMHMHSEQ1MHCONFConfirmed by Medical RecordsYCollected—
CATHMHMHSEQ2MHCONFConfirmed by Medical RecordsNCollected—
CATHMHMHSEQ1MHCONFConfirmed by Medical RecordsYCollected—
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 IdentifierCharCollectedCopy value from MH_SUPP_RAW.STUDYID.SUPP1
RDOMAINRelated Domain AbbreviationCharAssignedSet constant value "MH".SUPP2
USUBJIDUnique Subject IdentifierCharCollectedCopy value from MH_SUPP_RAW.USUBJID.SUPP3
IDVARIdentifying VariableCharAssignedSet constant value "MHSEQ".SUPP4
IDVARVALIdentifying Variable ValueCharDerivedTake MHSEQ from the MH record whose USUBJID equals MH_SUPP_RAW.USUBJID and MHTERM equals MH_SUPP_RAW.MHTERM, and a row with no match is an error.SUPP5
QNAMQualifier Variable NameCharMHFAMHX, MHCONFDerivedSet per constructed row; see the Row construction sheet.SUPP6
QLABELQualifier LabelCharDerivedSet per constructed row; see the Row construction sheet.SUPP7
QVALData ValueCharY, NDerivedSet per constructed row; see the Row construction sheet.SUPP8
QORIGOriginCharAssignedSet constant value "Collected".SUPP9
QEVALEvaluatorCharAssignedSet constant value "None".SUPP10
TemplateInclude whenQNAMQLABELQVAL
family_historyMH_SUPP_RAW.MHFAMHX IS NOT NULLConstant "MHFAMHX"Constant "Family History"Copy MH_SUPP_RAW.MHFAMHX
medical_record_confirmationMH_SUPP_RAW.MHCONF IS NOT NULLConstant "MHCONF"Constant "Confirmed by Medical Records"Copy MH_SUPP_RAW.MHCONF
VariablePermitted values
QNAMMHFAMHX, MHCONF
QVALY, N
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-suppmh-linkage/full.md

Edit
21 lines

Following CDISC SDTM standards, use the provided MH and MH_SUPP_RAW datasets to create a SUPPMH dataset with one record per collected qualifier.

The output dataset should contain the following columns in this order: STUDYID, RDOMAIN, USUBJID, IDVAR, IDVARVAL, QNAM, QLABEL, QVAL, QORIG, QEVAL

RDOMAIN is "MH" and IDVAR is "MHSEQ" on every record. Each collected qualifier on a condition gives one record, so a condition with both qualifiers collected gives two records and a condition with only one gives one. A qualifier whose answer is blank is not collected and gives no record. IDVARVAL is the parent MH record's sequence number as text, for the parent record with the same subject and the same condition term as the qualifier. A parent MH condition with no collected qualifiers gives no record. The family history qualifier has QNAM "MHFAMHX" and QLABEL "Family History". The medical record confirmation qualifier has QNAM "MHCONF" and QLABEL "Confirmed by Medical Records". QVAL is the collected answer, "Y" or "N". QORIG is "Collected" on every record. QEVAL has no value on every record.

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

prompts/sdtm-suppmh-linkage/conventions.md

Edit
14 lines

Following CDISC SDTM standards, use the provided MH and MH_SUPP_RAW datasets to create a SUPPMH dataset with one record per collected qualifier.

The output dataset should contain the following columns in this order: STUDYID, RDOMAIN, USUBJID, IDVAR, IDVARVAL, QNAM, QLABEL, QVAL, QORIG, QEVAL

RDOMAIN is "MH" and IDVAR is "MHSEQ" on every record. The family history qualifier has QNAM "MHFAMHX" and QLABEL "Family History". The medical record confirmation qualifier has QNAM "MHCONF" and QLABEL "Confirmed by Medical Records". QVAL is "Y" or "N". QORIG is "Collected" on every record. QEVAL has no value on every record.

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

prompts/sdtm-suppmh-linkage/brief.md

Edit
8 lines

Following CDISC SDTM standards, use the provided MH and MH_SUPP_RAW datasets to create a SUPPMH dataset with one record per collected qualifier.

The output dataset should contain the following columns in this order: STUDYID, RDOMAIN, USUBJID, IDVAR, IDVARVAL, QNAM, QLABEL, QVAL, QORIG, QEVAL

Read the source datasets from /app/input and save the completed dataset as /app/output/suppmh.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-suppmh-linkage/result.R

Edit
48 lines
# Reference solution for the yamaa benchmark sdtm-suppmh-linkage (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)library(tidyr)mh <- read_csv(  "/app/input/mh.csv",  col_types = cols(.default = col_character()))raw <- read_csv(  "/app/input/mh_supp_raw.csv",  col_types = cols(.default = col_character()))# The parent sequence number, matched on subject and condition term.parents <- mh |> select(STUDYID, USUBJID, MHSEQ, MHTERM)suppmh <- raw |>  pivot_longer(    cols = c(MHFAMHX, MHCONF),    names_to = "QNAM",    values_to = "QVAL"  ) |>  filter(!is.na(QVAL) & QVAL != "") |>  inner_join(parents, by = c("STUDYID", "USUBJID", "MHTERM")) |>  mutate(    RDOMAIN = "MH",    IDVAR = "MHSEQ",    IDVARVAL = MHSEQ,    QLABEL = case_when(      QNAM == "MHFAMHX" ~ "Family History",      QNAM == "MHCONF" ~ "Confirmed by Medical Records"    ),    QORIG = "Collected",    QEVAL = NA_character_  ) |>  arrange(USUBJID, suppressWarnings(as.integer(MHSEQ)), QNAM) |>  select(    STUDYID, RDOMAIN, USUBJID, IDVAR, IDVARVAL, QNAM, QLABEL, QVAL, QORIG, QEVAL  )dir.create("/app/output", showWarnings = FALSE)write_csv(suppmh, "/app/output/suppmh.csv", na = "")

solutions/sdtm-suppmh-linkage/result.py

Edit
77 lines
# Reference solution for the yamaa benchmark sdtm-suppmh-linkage (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."""Build SUPPMH from MH and MH_SUPP_RAW.One SUPPMH record per collected qualifier on a condition. The parent MHrecord is found by subject and condition term; its sequence number iscarried as text in IDVARVAL."""import csvimport osINPUT = "/app/input"OUTPUT = "/app/output"QUALIFIERS = [    ("MHFAMHX", "MHFAMHX", "Family History"),    ("MHCONF", "MHCONF", "Confirmed by Medical Records"),]COLUMNS = [    "STUDYID", "RDOMAIN", "USUBJID", "IDVAR", "IDVARVAL",    "QNAM", "QLABEL", "QVAL", "QORIG", "QEVAL",]def read_csv(path):    with open(path, newline="", encoding="utf-8") as handle:        return list(csv.DictReader(handle))def main():    mh = read_csv(os.path.join(INPUT, "mh.csv"))    raw = read_csv(os.path.join(INPUT, "mh_supp_raw.csv"))    mhseq_by_key = {}    for row in mh:        key = (row["STUDYID"], row["USUBJID"], row["MHTERM"])        mhseq_by_key[key] = row["MHSEQ"]    records = []    for row in raw:        key = (row["STUDYID"], row["USUBJID"], row["MHTERM"])        mhseq = mhseq_by_key.get(key)        if mhseq is None:            continue        for source, qnam, qlabel in QUALIFIERS:            answer = (row.get(source) or "").strip()            if not answer:                continue            records.append({                "STUDYID": row["STUDYID"],                "RDOMAIN": "MH",                "USUBJID": row["USUBJID"],                "IDVAR": "MHSEQ",                "IDVARVAL": str(mhseq),                "QNAM": qnam,                "QLABEL": qlabel,                "QVAL": answer,                "QORIG": "Collected",                "QEVAL": "",            })    os.makedirs(OUTPUT, exist_ok=True)    with open(os.path.join(OUTPUT, "suppmh.csv"), "w", newline="",              encoding="utf-8") as handle:        writer = csv.DictWriter(handle, fieldnames=COLUMNS)        writer.writeheader()        writer.writerows(records)if __name__ == "__main__":    main()

solutions/sdtm-suppmh-linkage/result.sas

Edit
24 lines
/* opensas reference solution for the yamaa benchmark sdtm-suppmh-linkage.   Reads the benchmark inputs and derives the requested output.   Execute with the existing opensas runtime: opensas /app/output/result.sas. */data mh;  length STUDYID USUBJID MHTERM $1024;  infile "/app/input/mh.csv" dsd dlm="," firstobs=2 truncover lrecl=32767;  input STUDYID : $char1024. USUBJID : $char1024. MHSEQ MHTERM : $char1024.;run;data mh_supp_raw;  length STUDYID USUBJID MHTERM MHFAMHX MHCONF $1024;  infile "/app/input/mh_supp_raw.csv" dsd dlm="," firstobs=2 truncover lrecl=32767;  input STUDYID : $char1024. USUBJID : $char1024. MHTERM : $char1024. MHFAMHX : $char1024. MHCONF : $char1024.;run;proc sql; create table qualified as select a.*,b.MHSEQ from mh_supp_raw a inner join mh b on a.STUDYID=b.STUDYID and a.USUBJID=b.USUBJID and a.MHTERM=b.MHTERM; quit;data result; set qualified; length RDOMAIN IDVAR IDVARVAL QNAM QLABEL QVAL QORIG QEVAL $1024; RDOMAIN='MH'; IDVAR='MHSEQ'; IDVARVAL=strip(put(MHSEQ,best32.)); QORIG='Collected'; QEVAL='';if not missing(MHFAMHX) then do; QNAM='MHFAMHX'; QLABEL='Family History'; QVAL=MHFAMHX; output; end;if not missing(MHCONF) then do; QNAM='MHCONF'; QLABEL='Confirmed by Medical Records'; QVAL=MHCONF; output; end; run;proc sql;  create table final as select STUDYID, RDOMAIN, USUBJID, IDVAR, IDVARVAL, QNAM, QLABEL, QVAL, QORIG, QEVAL from result;quit;proc export data=final outfile="/app/output/suppmh.csv" dbms=csv replace; run;