Review ask

As a clinical trial statistician or programmer, challenge anything in this benchmark: describe a problem in Comments, or propose a fix with the Edit button on any source file.

  1. Task: Would a real study need this derivation, specified this way? Does it follow CDISC SDTM: variable names, controlled terms, record structure? Flag any rule that is ambiguous or that a sponsor would handle differently.
  2. Inputs: Do they look like data collected in a real trial, and do they include the situations you would expect to meet in one?
  3. Expected output: Would independent QC programming reproduce every value from these inputs and rules?

The other tabs beside Comments are background for assessment, not under review.

Summary

Lifecycle: reviewedEditUnder review
What this benchmark means
README.md

Goal: build one supplemental record per collected qualifier, carrying IDVARVAL, QLABEL, QVAL, QORIG, and QEVAL, with each record pointing back at its parent medical history (MH) record.

Input: a medical history extract with one record per condition, carrying the parent record sequence and the two collected qualifiers.

Variables:

  • IDVARVAL is the parent record sequence, written as text; a parent record with no sequence number stops the run.
  • QLABEL is the qualifier label: Family History for MHFAMHX, Confirmed by Medical Records for MHCONF.
  • QVAL is the collected qualifier value, Y or N.
  • QORIG records the collected origin as Collected (Define-XML 2.1).
  • QEVAL is blank, since a collected value is not an assessment.

Note: each parent record contributes one supplemental record per qualifier actually collected, so a record with only one of the two collected contributes only one. Records are ordered by study, then subject, then parent record sequence compared as text (so 10 sorts before 2), then qualifier name.

Inputs

Under review
1 source file

input/mh_raw.csv

Edit
4 rows
input/mh_raw.csv
STUDYIDUSUBJIDMHSEQMHTERMMHFAMHXMHCONF
CATH1ASTHMAYY
CATH2ECZEMAN—
CATH1HYPERTENSIONNN
CATH2MIGRAINEYY

Expected output

Under review
7 expected rows

expected/suppmh.csv

Edit
7 rows
expected/suppmh.csv
STUDYIDRDOMAINUSUBJIDIDVARIDVARVALQNAMQLABELQVALQORIGQEVAL
CATHMHMHSEQ1MHCONFConfirmed by Medical RecordsYCollected—
CATHMHMHSEQ1MHFAMHXFamily HistoryYCollected—
CATHMHMHSEQ2MHFAMHXFamily HistoryNCollected—
CATHMHMHSEQ1MHCONFConfirmed by Medical RecordsNCollected—
CATHMHMHSEQ1MHFAMHXFamily HistoryNCollected—
CATHMHMHSEQ2MHCONFConfirmed by Medical RecordsYCollected—
CATHMHMHSEQ2MHFAMHXFamily HistoryYCollected—
Shaded columns are derived— = missing value

Comments and assessment materials

Comments

Signed in with GitHub; saved in repository 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_RAW.STUDYID.SUPP1
RDOMAINRelated Domain AbbreviationCharAssignedSet constant value "MH".SUPP2
USUBJIDUnique Subject IdentifierCharCollectedCopy value from MH_RAW.USUBJID.SUPP3
IDVARIdentifying VariableCharAssignedSet constant value "MHSEQ".SUPP4
IDVARVALIdentifying Variable ValueCharCollectedCopy value from MH_RAW.MHSEQ.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_RAW.MHFAMHX IS NOT NULLConstant "MHFAMHX"Constant "Family History"Copy MH_RAW.MHFAMHX
medical_record_confirmationMH_RAW.MHCONF IS NOT NULLConstant "MHCONF"Constant "Confirmed by Medical Records"Copy MH_RAW.MHCONF
VariablePermitted values
QNAMMHFAMHX, MHCONF
QVALY, N
VersionDateAuthorDescriptionReviewerSign-off
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-qualifiers/full.md

Edit
20 lines

Following CDISC SDTM standards, use the provided MH_RAW dataset to create a SUPPMH dataset with one supplemental 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. IDVARVAL is the parent record sequence, written as text. QNAM is the qualifier name, MHFAMHX or MHCONF. QLABEL is Family History for MHFAMHX and Confirmed by Medical Records for MHCONF. QVAL is the collected qualifier value, Y or N. QORIG records the collected origin as Collected. QEVAL has no value, since a collected value is not an assessment.

Each parent record contributes one supplemental record per qualifier actually collected, so a record with only one of the two collected contributes only one.

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

prompts/sdtm-suppmh-qualifiers/conventions.md

Edit
14 lines

Following CDISC SDTM standards, use the provided MH_RAW dataset to create a SUPPMH dataset with one supplemental 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. IDVARVAL is the parent record sequence, written as text. QNAM is the qualifier name, MHFAMHX or MHCONF. QLABEL is Family History for MHFAMHX and Confirmed by Medical Records for MHCONF. QVAL is Y or N. QORIG records the collected origin as Collected. QEVAL has no value.

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

prompts/sdtm-suppmh-qualifiers/brief.md

Edit
9 lines

Following CDISC SDTM standards, use the provided MH_RAW dataset to create a SUPPMH dataset with one supplemental 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

Runs the yamaa specification; its result must match the expected output

run.R

Edit
4 lines
library(yamaa)suppmh <- yamaa_domain("spec.yaml")$outputsuppmh

run.py

Edit
4 lines
import yamaasuppmh = yamaa.yamaa_domain("spec.yaml").outputsuppmh

Solution without yamaa

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

solutions/sdtm-suppmh-qualifiers/result.R

Edit
40 lines
# Reference solution for the yamaa benchmark sdtm-suppmh-qualifiers (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_raw.csv",  col_types = cols(.default = col_character()))suppmh <- mh |>  pivot_longer(    cols = c(MHFAMHX, MHCONF),    names_to = "QNAM",    values_to = "QVAL"  ) |>  filter(!is.na(QVAL) & QVAL != "") |>  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-qualifiers/result.py

Edit
55 lines
# Reference solution for the yamaa benchmark sdtm-suppmh-qualifiers (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.from pathlib import Pathimport polars as plmh = pl.read_csv("/app/input/mh_raw.csv", infer_schema=False)labels = {"MHFAMHX": "Family History", "MHCONF": "Confirmed by Medical Records"}records = []for qnam in ("MHFAMHX", "MHCONF"):    collected = mh.filter(        pl.col(qnam).is_not_null() & (pl.col(qnam) != "")    ).select(        "STUDYID",        "USUBJID",        "MHSEQ",        QNAM=pl.lit(qnam),        QLABEL=pl.lit(labels[qnam]),        QVAL=pl.col(qnam),    )    records.append(collected)suppmh = (    pl.concat(records)    .with_columns(        RDOMAIN=pl.lit("MH"),        IDVAR=pl.lit("MHSEQ"),        IDVARVAL=pl.col("MHSEQ"),        QORIG=pl.lit("Collected"),        QEVAL=pl.lit(None, dtype=pl.String),    )    .with_columns(pl.col("MHSEQ").cast(pl.Int64).alias("_seq"))    .sort(["USUBJID", "_seq", "QNAM"])    .select(        "STUDYID",        "RDOMAIN",        "USUBJID",        "IDVAR",        "IDVARVAL",        "QNAM",        "QLABEL",        "QVAL",        "QORIG",        "QEVAL",    ))Path("/app/output").mkdir(exist_ok=True)suppmh.write_csv("/app/output/suppmh.csv")

solutions/sdtm-suppmh-qualifiers/result.sas

Edit
18 lines
/* opensas reference solution for the yamaa benchmark sdtm-suppmh-qualifiers.   Reads the benchmark inputs and derives the requested output.   Execute with the existing opensas runtime: opensas /app/output/result.sas. */data mh_raw;  length STUDYID USUBJID MHTERM MHFAMHX MHCONF $1024;  infile "/app/input/mh_raw.csv" dsd dlm="," firstobs=2 truncover lrecl=32767;  input STUDYID : $char1024. USUBJID : $char1024. MHSEQ MHTERM : $char1024. MHFAMHX : $char1024. MHCONF : $char1024.;run;data qualified; set mh_raw; run;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;