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: 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:
IDVARVALis the parent record sequence, written as text; a parent record with no sequence number stops the run.QLABELis the qualifier label:Family HistoryforMHFAMHX,Confirmed by Medical RecordsforMHCONF.QVALis the collected qualifier value,YorN.QORIGrecords the collected origin asCollected(Define-XML 2.1).QEVALis 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 review1 source fileinput/mh_raw.csv
Edit4 rows| STUDYID | USUBJID | MHSEQ | MHTERM | MHFAMHX | MHCONF |
|---|---|---|---|---|---|
| CATH | 1 | ASTHMA | Y | Y | |
| CATH | 2 | ECZEMA | N | — | |
| CATH | 1 | HYPERTENSION | N | N | |
| CATH | 2 | MIGRAINE | Y | Y |
Expected output
Under review7 expected rowsexpected/suppmh.csv
Edit7 rows| STUDYID | RDOMAIN | USUBJID | IDVAR | IDVARVAL | QNAM | QLABEL | QVAL | QORIG | QEVAL |
|---|---|---|---|---|---|---|---|---|---|
| CATH | MH | MHSEQ | 1 | MHCONF | Confirmed by Medical Records | Y | Collected | — | |
| CATH | MH | MHSEQ | 1 | MHFAMHX | Family History | Y | Collected | — | |
| CATH | MH | MHSEQ | 2 | MHFAMHX | Family History | N | Collected | — | |
| CATH | MH | MHSEQ | 1 | MHCONF | Confirmed by Medical Records | N | Collected | — | |
| CATH | MH | MHSEQ | 1 | MHFAMHX | Family History | N | Collected | — | |
| CATH | MH | MHSEQ | 2 | MHCONF | Confirmed by Medical Records | Y | Collected | — | |
| CATH | MH | MHSEQ | 2 | MHFAMHX | Family History | Y | Collected | — |
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 | Collected | Copy value from MH_RAW.STUDYID. | SUPP | 1 | ||||
| RDOMAIN | Related Domain Abbreviation | Char | Assigned | Set constant value "MH". | SUPP | 2 | ||||
| USUBJID | Unique Subject Identifier | Char | Collected | Copy value from MH_RAW.USUBJID. | SUPP | 3 | ||||
| IDVAR | Identifying Variable | Char | Assigned | Set constant value "MHSEQ". | SUPP | 4 | ||||
| IDVARVAL | Identifying Variable Value | Char | Collected | Copy value from MH_RAW.MHSEQ. | SUPP | 5 | ||||
| QNAM | Qualifier Variable Name | Char | MHFAMHX, MHCONF | Derived | Set per constructed row; see the Row construction sheet. | SUPP | 6 | |||
| QLABEL | Qualifier Label | Char | Derived | Set per constructed row; see the Row construction sheet. | SUPP | 7 | ||||
| QVAL | Data Value | Char | Y, N | Derived | Set per constructed row; see the Row construction sheet. | SUPP | 8 | |||
| QORIG | Origin | Char | Assigned | Set constant value "Collected". | SUPP | 9 | ||||
| QEVAL | Evaluator | Char | Assigned | Set constant value "None". | SUPP | 10 |
| Template | Include when | QNAM | QLABEL | QVAL |
|---|---|---|---|---|
| family_history | MH_RAW.MHFAMHX IS NOT NULL | Constant "MHFAMHX" | Constant "Family History" | Copy MH_RAW.MHFAMHX |
| medical_record_confirmation | MH_RAW.MHCONF IS NOT NULL | Constant "MHCONF" | Constant "Confirmed by Medical Records" | Copy MH_RAW.MHCONF |
| Variable | Permitted values |
|---|---|
| QNAM | MHFAMHX, MHCONF |
| QVAL | Y, N |
| 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-suppmh-qualifiers/full.md
Edit19 linesFollowing CDISC SDTM standards, use the provided MH_RAW dataset 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" on every record. IDVAR is "MHSEQ" on every record. IDVARVAL is the parent record's sequence number, written as text. A parent record gives one record for each of its two qualifiers that was collected, so a parent record with only one qualifier collected gives only one record. On a record for the family history qualifier, QNAM is "MHFAMHX" and QLABEL is "Family History". On a record for the medical record confirmation qualifier, QNAM is "MHCONF" and QLABEL is "Confirmed by Medical Records". QVAL is the qualifier value collected on the parent record, "Y" or "N". QORIG is "Collected" on every record. QEVAL has no value on any record, since a collected value is not an assessment.
Read the source datasets from /app/input and save the completed dataset as /app/output/suppmh.csv.
prompts/sdtm-suppmh-qualifiers/conventions.md
Edit16 linesFollowing CDISC SDTM standards, use the provided MH_RAW dataset 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" on every record. IDVAR is "MHSEQ" on every record. IDVARVAL is the parent record's sequence number, written as text. On a record for the family history qualifier, QNAM is "MHFAMHX" and QLABEL is "Family History". On a record for the medical record confirmation qualifier, QNAM is "MHCONF" and QLABEL is "Confirmed by Medical Records". QVAL is "Y" or "N". QORIG is "Collected" on every record. QEVAL has no value on any record.
Read the source datasets from /app/input and save the completed dataset as /app/output/suppmh.csv.
prompts/sdtm-suppmh-qualifiers/brief.md
Edit8 linesFollowing CDISC SDTM standards, use the provided MH_RAW dataset 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.
R
Edit3 lineslibrary(yamaa)yamaa_spec("spec.yaml")$run()$outputPython
Edit3 linesimport yamaayamaa.spec("spec.yaml").run().outputsolutions/sdtm-suppmh-qualifiers/result.R
Edit40 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
Edit73 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."""Build the SUPPMH dataset from MH_RAW.One SUPPMH record per collected qualifier on each parent MH record.The two qualifiers are family history (MHFAMHX) and confirmation bymedical records (MHCONF). A qualifier that was not collected on theparent record (empty value) gives no SUPPMH record."""import csvimport osINPUT_DIR = "/app/input"OUTPUT_DIR = "/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 main(): with open(os.path.join(INPUT_DIR, "mh_raw.csv"), newline="") as f: parents = list(csv.DictReader(f)) rows = [] for parent in parents: for source_col, qnam, qlabel in QUALIFIERS: qval = (parent.get(source_col) or "").strip() if qval == "": continue rows.append( { "STUDYID": parent["STUDYID"], "RDOMAIN": "MH", "USUBJID": parent["USUBJID"], "IDVAR": "MHSEQ", "IDVARVAL": str(parent["MHSEQ"]), "QNAM": qnam, "QLABEL": qlabel, "QVAL": qval, "QORIG": "Collected", "QEVAL": "", } ) os.makedirs(OUTPUT_DIR, exist_ok=True) with open(os.path.join(OUTPUT_DIR, "suppmh.csv"), "w", newline="") as f: writer = csv.DictWriter(f, fieldnames=COLUMNS) writer.writeheader() writer.writerows(rows)if __name__ == "__main__": main()solutions/sdtm-suppmh-qualifiers/result.sas
Edit18 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;
yamaa