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: add one new record per subject (USUBJID) and analysis visit
(AVISIT) in study CATH-01 for each of three ECG measures: the
Bazett-corrected QT interval (QTCBR), the Fridericia-corrected QT
interval (QTCFR), and the RR duration recomputed from heart rate
(RRR).
Input: collected electrocardiogram records with parameter codes QT
(QT interval duration), RR (RR interval duration), and HR (heart
rate), each carrying its label (PARAM), result (AVAL), and unit
(AVALU). QT and RR results are in milliseconds (ms or msec);
heart rate is in beats per minute (beats/min).
Variables:
PARAMCD:QTCBR,QTCFR, orRRRon the new records;QT,RR, orHRon the collected ones. The input must not already containQTCBR,QTCFR, orRRR.PARAM: "QTcB - Bazett's Correction Formula Rederived (ms)", "QTcF - Fridericia's Correction Formula Rederived (ms)", or "RR Duration Rederived (ms)" on the new records.AVISIT: the analysis visit the record belongs to, for exampleBASELINEorWEEK 4.AVAL:QT / SQRT(RR / 1000)forQTCBR,QT / POWER(RR / 1000, 1 / 3)forQTCFR, and60000divided by the heart rate forRRR; for example, a heart rate of 60 gives 1000.AVALU:mson the new records.
Note: a QTc record is added only when both the QT and the RR
results are present at that visit; an RRR record is added only when
the heart rate is present and not zero. Collected QT and RR records in
a unit other than ms or msec fail the run, and each visit is
expected to carry at most one record per parameter code.
Inputs
Under review1 source fileinput/adeg.csv
Edit29 rows| STUDYID | USUBJID | PARAMCD | PARAM | AVISIT | AVAL | AVALU |
|---|---|---|---|---|---|---|
| CATH-01 | QT | QT Duration | BASELINE | 350 | ms | |
| CATH-01 | RR | RR Duration | BASELINE | 1000 | ms | |
| CATH-01 | HR | Heart Rate | BASELINE | 60 | beats/min | |
| CATH-01 | QT | QT Duration | WEEK 4 | 362 | ms | |
| CATH-01 | RR | RR Duration | WEEK 4 | 950 | ms | |
| CATH-01 | HR | Heart Rate | WEEK 4 | 63 | beats/min | |
| CATH-01 | QT | QT Duration | BASELINE | 400 | msec | |
| CATH-01 | RR | RR Duration | BASELINE | 512 | msec | |
| CATH-01 | HR | Heart Rate | BASELINE | 70 | beats/min | |
| CATH-01 | QT | QT Duration | BASELINE | — | ms | |
| CATH-01 | RR | RR Duration | BASELINE | 920 | ms | |
| CATH-01 | HR | Heart Rate | BASELINE | 72 | beats/min | |
| CATH-01 | QT | QT Duration | BASELINE | 388 | ms | |
| CATH-01 | RR | RR Duration | BASELINE | — | ms | |
| CATH-01 | HR | Heart Rate | BASELINE | 60 | beats/min | |
| CATH-01 | QT | QT Duration | BASELINE | 410 | ms | |
| CATH-01 | RR | RR Duration | BASELINE | 880 | ms | |
| CATH-01 | HR | Heart Rate | BASELINE | 0 | beats/min | |
| CATH-01 | QT | QT Duration | BASELINE | 375 | ms | |
| CATH-01 | QT | QT Duration | BASELINE | 340 | ms | |
| CATH-01 | RR | RR Duration | BASELINE | 1100 | ms | |
| CATH-01 | HR | Heart Rate | BASELINE | 1 | beats/min | |
| CATH-01 | HR | Heart Rate | BASELINE | 55 | beats/min | |
| CATH-01 | QT | QT Duration | BASELINE | 395 | ms | |
| CATH-01 | RR | RR Duration | BASELINE | 980 | ms | |
| CATH-01 | HR | Heart Rate | BASELINE | — | beats/min | |
| CATH-01 | QT | QT Duration | BASELINE | 600 | ms | |
| CATH-01 | RR | RR Duration | BASELINE | 1500 | ms | |
| CATH-01 | HR | Heart Rate | BASELINE | 40 | beats/min |
Expected output
Under review51 expected rowsexpected/adeg.csv
Edit51 rows| STUDYID | USUBJID | PARAMCD | PARAM | AVISIT | AVAL | AVALU |
|---|---|---|---|---|---|---|
| CATH-01 | QT | QT Duration | BASELINE | 350 | ms | |
| CATH-01 | RR | RR Duration | BASELINE | 1000 | ms | |
| CATH-01 | HR | Heart Rate | BASELINE | 60 | beats/min | |
| CATH-01 | QT | QT Duration | WEEK 4 | 362 | ms | |
| CATH-01 | RR | RR Duration | WEEK 4 | 950 | ms | |
| CATH-01 | HR | Heart Rate | WEEK 4 | 63 | beats/min | |
| CATH-01 | QT | QT Duration | BASELINE | 400 | msec | |
| CATH-01 | RR | RR Duration | BASELINE | 512 | msec | |
| CATH-01 | HR | Heart Rate | BASELINE | 70 | beats/min | |
| CATH-01 | QT | QT Duration | BASELINE | — | ms | |
| CATH-01 | RR | RR Duration | BASELINE | 920 | ms | |
| CATH-01 | HR | Heart Rate | BASELINE | 72 | beats/min | |
| CATH-01 | QT | QT Duration | BASELINE | 388 | ms | |
| CATH-01 | RR | RR Duration | BASELINE | — | ms | |
| CATH-01 | HR | Heart Rate | BASELINE | 60 | beats/min | |
| CATH-01 | QT | QT Duration | BASELINE | 410 | ms | |
| CATH-01 | RR | RR Duration | BASELINE | 880 | ms | |
| CATH-01 | HR | Heart Rate | BASELINE | 0 | beats/min | |
| CATH-01 | QT | QT Duration | BASELINE | 375 | ms | |
| CATH-01 | QT | QT Duration | BASELINE | 340 | ms | |
| CATH-01 | RR | RR Duration | BASELINE | 1100 | ms | |
| CATH-01 | HR | Heart Rate | BASELINE | 1 | beats/min | |
| CATH-01 | HR | Heart Rate | BASELINE | 55 | beats/min | |
| CATH-01 | QT | QT Duration | BASELINE | 395 | ms | |
| CATH-01 | RR | RR Duration | BASELINE | 980 | ms | |
| CATH-01 | HR | Heart Rate | BASELINE | — | beats/min | |
| CATH-01 | QT | QT Duration | BASELINE | 600 | ms | |
| CATH-01 | RR | RR Duration | BASELINE | 1500 | ms | |
| CATH-01 | HR | Heart Rate | BASELINE | 40 | beats/min | |
| CATH-01 | QTCBR | QTcB - Bazett's Correction Formula Rederived (ms) | BASELINE | 350 | ms | |
| CATH-01 | QTCBR | QTcB - Bazett's Correction Formula Rederived (ms) | WEEK 4 | 371.4041634548258 | ms | |
| CATH-01 | QTCBR | QTcB - Bazett's Correction Formula Rederived (ms) | BASELINE | 559.0169943749474 | ms | |
| CATH-01 | QTCBR | QTcB - Bazett's Correction Formula Rederived (ms) | BASELINE | 437.0614685290014 | ms | |
| CATH-01 | QTCBR | QTcB - Bazett's Correction Formula Rederived (ms) | BASELINE | 324.17728034350137 | ms | |
| CATH-01 | QTCBR | QTcB - Bazett's Correction Formula Rederived (ms) | BASELINE | 399.01025509812325 | ms | |
| CATH-01 | QTCBR | QTcB - Bazett's Correction Formula Rederived (ms) | BASELINE | 489.89794855663564 | ms | |
| CATH-01 | QTCFR | QTcF - Fridericia's Correction Formula Rederived (ms) | BASELINE | 350 | ms | |
| CATH-01 | QTCFR | QTcF - Fridericia's Correction Formula Rederived (ms) | WEEK 4 | 368.2426060851786 | ms | |
| CATH-01 | QTCFR | QTcF - Fridericia's Correction Formula Rederived (ms) | BASELINE | 500 | ms | |
| CATH-01 | QTCFR | QTcF - Fridericia's Correction Formula Rederived (ms) | BASELINE | 427.8481245967625 | ms | |
| CATH-01 | QTCFR | QTcF - Fridericia's Correction Formula Rederived (ms) | BASELINE | 329.3679640914978 | ms | |
| CATH-01 | QTCFR | QTcF - Fridericia's Correction Formula Rederived (ms) | BASELINE | 397.6689998808046 | ms | |
| CATH-01 | QTCFR | QTcF - Fridericia's Correction Formula Rederived (ms) | BASELINE | 524.1482788417793 | ms | |
| CATH-01 | RRR | RR Duration Rederived (ms) | BASELINE | 1000 | ms | |
| CATH-01 | RRR | RR Duration Rederived (ms) | WEEK 4 | 952.3809523809524 | ms | |
| CATH-01 | RRR | RR Duration Rederived (ms) | BASELINE | 857.1428571428571 | ms | |
| CATH-01 | RRR | RR Duration Rederived (ms) | BASELINE | 833.3333333333334 | ms | |
| CATH-01 | RRR | RR Duration Rederived (ms) | BASELINE | 1000 | ms | |
| CATH-01 | RRR | RR Duration Rederived (ms) | BASELINE | 60000 | ms | |
| CATH-01 | RRR | RR Duration Rederived (ms) | BASELINE | 1090.909090909091 | ms | |
| CATH-01 | RRR | RR Duration Rederived (ms) | BASELINE | 1500 | ms |
Human review and assessment
| Dataset Name | Variable Name | Variable Label | Type | Codelist/Controlled Terms | Core | Computational Method | Origin |
|---|---|---|---|---|---|---|---|
| ADEG | STUDYID | Study Identifier | character | Copy value from ADEG_RAW.STUDYID. | Predecessor | ||
| ADEG | USUBJID | Unique Subject Identifier | character | Copy value from ADEG_RAW.USUBJID. | Predecessor | ||
| ADEG | PARAMCD | Parameter Code | character | Set per constructed row; see the Row construction sheet. | Derived | ||
| ADEG | PARAM | Parameter | character | Set per constructed row; see the Row construction sheet. | Derived | ||
| ADEG | AVISIT | Analysis Visit | character | Copy value from ADEG_RAW.AVISIT. | Predecessor | ||
| ADEG | AVAL | Analysis Value | numeric | Set per constructed row; see the Row construction sheet. | Derived | ||
| ADEG | AVALU | Analysis Value Unit | character | Set per constructed row; see the Row construction sheet. | Derived |
| Template | Include when | PARAMCD | PARAM | QTVAL | RRVAL | AVAL | AVALU |
|---|---|---|---|---|---|---|---|
| collected | Copy ADEG_RAW.PARAMCD | Copy ADEG_RAW.PARAM | Constant "None" | Constant "None" | Copy ADEG_RAW.AVAL | Copy ADEG_RAW.AVALU | |
| qtc_bazett | QTVAL IS NOT NULL AND RRVAL IS NOT NULL | Constant "QTCBR" | Constant "QTcB - Bazett's Correction Formula Rederived (ms)" | Aggregate ONLY(ADEG_RAW.AVAL) over records matching on the shared output keys, where ADEG_RAW.PARAMCD = 'QT' | Aggregate ONLY(ADEG_RAW.AVAL) over records matching on the shared output keys, where ADEG_RAW.PARAMCD = 'RR' | Compute QTVAL / SQRT(RRVAL / 1000) | Constant "ms" |
| qtc_fridericia | QTVAL IS NOT NULL AND RRVAL IS NOT NULL | Constant "QTCFR" | Constant "QTcF - Fridericia's Correction Formula Rederived (ms)" | Aggregate ONLY(ADEG_RAW.AVAL) over records matching on the shared output keys, where ADEG_RAW.PARAMCD = 'QT' | Aggregate ONLY(ADEG_RAW.AVAL) over records matching on the shared output keys, where ADEG_RAW.PARAMCD = 'RR' | Compute QTVAL / POWER(RRVAL / 1000, 1 / 3) | Constant "ms" |
| rr_rederived | ADEG_RAW.PARAMCD = 'HR' AND ADEG_RAW.AVAL IS NOT NULL AND ADEG_RAW.AVAL <> 0 | Constant "RRR" | Constant "RR Duration Rederived (ms)" | Constant "None" | Constant "None" | Compute 60000 / NULLIF(ADEG_RAW.AVAL, 0) | Constant "ms" |
| 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/adam-adeg-derived-intervals/full.md
Edit26 linesFollowing CDISC ADaM standards, use the provided ADEG dataset to create an ADEG dataset with one record per subject, parameter, and analysis visit.
The output dataset should contain the following columns in this order: STUDYID, USUBJID, PARAMCD, PARAM, AVISIT, AVAL, AVALU
The output holds every collected record and adds one new record per subject and analysis visit for each derived parameter. A new record with PARAMCD QTCBR has PARAM "QTcB - Bazett's Correction Formula Rederived (ms)". A new record with PARAMCD QTCFR has PARAM "QTcF - Fridericia's Correction Formula Rederived (ms)". A new record with PARAMCD RRR has PARAM "RR Duration Rederived (ms)". AVALU is "ms" on the new records.
QT and RR results are in milliseconds, with the unit shown as "ms" or "msec", and the heart rate is in beats per minute. For QTCBR, AVAL is QT / SQRT(RR / 1000), and for QTCFR, AVAL is QT / POWER(RR / 1000, 1 / 3), where QT and RR are the results for the same subject and analysis visit. A QTCBR or QTCFR record is added only when both the QT and the RR results are present for that subject and analysis visit. For RRR, AVAL is 60000 divided by the heart rate for the same subject and analysis visit, so a heart rate of 60 gives 1000. An RRR record is added only when the heart rate is present and not zero. AVAL on the new records is not rounded.
Read the source datasets from /app/input and save the completed dataset as /app/output/adeg.csv.
prompts/adam-adeg-derived-intervals/conventions.md
Edit13 linesFollowing CDISC ADaM standards, use the provided ADEG dataset to create an ADEG dataset with one record per subject, parameter, and analysis visit.
The output dataset should contain the following columns in this order: STUDYID, USUBJID, PARAMCD, PARAM, AVISIT, AVAL, AVALU
PARAMCD QTCBR has PARAM "QTcB - Bazett's Correction Formula Rederived (ms)", PARAMCD QTCFR has PARAM "QTcF - Fridericia's Correction Formula Rederived (ms)", and PARAMCD RRR has PARAM "RR Duration Rederived (ms)". AVAL on the new records is not rounded.
Read the source datasets from /app/input and save the completed dataset as /app/output/adeg.csv.
prompts/adam-adeg-derived-intervals/brief.md
Edit8 linesFollowing CDISC ADaM standards, use the provided ADEG dataset to create an ADEG dataset with one record per subject, parameter, and analysis visit.
The output dataset should contain the following columns in this order: STUDYID, USUBJID, PARAMCD, PARAM, AVISIT, AVAL, AVALU
Read the source datasets from /app/input and save the completed dataset as /app/output/adeg.csv.
R
Edit3 lineslibrary(yamaa)yamaa_spec("spec.yaml")$run()$outputPython
Edit3 linesimport yamaayamaa.spec("spec.yaml").run().outputsolutions/adam-adeg-derived-intervals/result.R
Edit67 lines# Reference solution for the yamaa benchmark adam-adeg-derived-intervals (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)adeg <- read_csv( "/app/input/adeg.csv", col_types = cols(AVAL = col_double(), .default = col_character()))wide <- adeg |> select(STUDYID, USUBJID, AVISIT, PARAMCD, AVAL) |> pivot_wider(names_from = PARAMCD, values_from = AVAL)# A QTc record needs both QT and RR; RR in seconds is RR in ms over 1000.qtc <- wide |> filter(!is.na(QT), !is.na(RR)) |> mutate( RRSEC = RR / 1000, QTCBR = QT / sqrt(RRSEC), QTCFR = QT / (RRSEC^(1 / 3)) )qtcbr <- qtc |> transmute( STUDYID, USUBJID, AVISIT, PARAMCD = "QTCBR", PARAM = "QTcB - Bazett's Correction Formula Rederived (ms)", AVAL = QTCBR, AVALU = "ms" )qtcfr <- qtc |> transmute( STUDYID, USUBJID, AVISIT, PARAMCD = "QTCFR", PARAM = "QTcF - Fridericia's Correction Formula Rederived (ms)", AVAL = QTCFR, AVALU = "ms" )# An RRR record needs a present, nonzero heart rate.rrr <- wide |> filter(!is.na(HR), HR != 0) |> transmute( STUDYID, USUBJID, AVISIT, PARAMCD = "RRR", PARAM = "RR Duration Rederived (ms)", AVAL = 60000 / HR, AVALU = "ms" )adeg_out <- bind_rows( adeg |> select(STUDYID, USUBJID, PARAMCD, PARAM, AVISIT, AVAL, AVALU), qtcbr, qtcfr, rrr) |> select(STUDYID, USUBJID, PARAMCD, PARAM, AVISIT, AVAL, AVALU)dir.create("/app/output", showWarnings = FALSE)write_csv(adeg_out, "/app/output/adeg.csv", na = "")solutions/adam-adeg-derived-intervals/result.py
Edit106 lines# Reference solution for the yamaa benchmark adam-adeg-derived-intervals (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."""Create ADEG with derived QTcB, QTcF, and RR-rederived records.Reads the collected ADEG dataset from /app/input, keeps every collectedrecord, and adds one record per subject and analysis visit for eachderived parameter whose source results are present:- QTCBR: QT / SQRT(RR / 1000) (needs QT and RR)- QTCFR: QT / POWER(RR / 1000, 1/3) (needs QT and RR)- RRR: 60000 / heart rate (needs heart rate present and nonzero)AVAL on the derived records is not rounded."""import csvimport mathfrom collections import OrderedDictINPUT_PATH = "/app/input/adeg.csv"OUTPUT_PATH = "/app/output/adeg.csv"COLUMNS = ["STUDYID", "USUBJID", "PARAMCD", "PARAM", "AVISIT", "AVAL", "AVALU"]DERIVED_PARAMS = { "QTCBR": "QTcB - Bazett's Correction Formula Rederived (ms)", "QTCFR": "QTcF - Fridericia's Correction Formula Rederived (ms)", "RRR": "RR Duration Rederived (ms)",}def parse_number(text): """Return the float value of a cell, or None when it is empty.""" if text is None: return None text = text.strip() if text == "": return None return float(text)def format_number(value): """Write a number without rounding; whole numbers without a fraction.""" if value == int(value) and abs(value) < 1e15: return str(int(value)) return repr(value)def main(): with open(INPUT_PATH, newline="", encoding="utf-8") as handle: rows = list(csv.DictReader(handle)) # Group collected records by subject and analysis visit, keeping the # order in which each group first appears. groups = OrderedDict() for row in rows: key = (row["STUDYID"], row["USUBJID"], row["AVISIT"]) groups.setdefault(key, []).append(row) out_rows = [] for (studyid, usubjid, avisit), group in groups.items(): out_rows.extend(group) # Source results for this subject and visit, by parameter. values = {} for row in group: number = parse_number(row["AVAL"]) if number is not None: values[row["PARAMCD"]] = number derived = [] qt = values.get("QT") rr = values.get("RR") if qt is not None and rr is not None: rr_seconds = rr / 1000.0 derived.append(("QTCBR", qt / math.sqrt(rr_seconds))) derived.append(("QTCFR", qt / (rr_seconds ** (1.0 / 3.0)))) hr = values.get("HR") if hr is not None and hr != 0: derived.append(("RRR", 60000.0 / hr)) for paramcd, aval in derived: out_rows.append( { "STUDYID": studyid, "USUBJID": usubjid, "PARAMCD": paramcd, "PARAM": DERIVED_PARAMS[paramcd], "AVISIT": avisit, "AVAL": format_number(aval), "AVALU": "ms", } ) with open(OUTPUT_PATH, "w", newline="", encoding="utf-8") as handle: writer = csv.DictWriter(handle, fieldnames=COLUMNS) writer.writeheader() writer.writerows(out_rows)if __name__ == "__main__": main()solutions/adam-adeg-derived-intervals/result.sas
Edit32 lines/* opensas reference solution for the yamaa benchmark adam-adeg-derived-intervals. Reads the benchmark inputs and derives the requested output. Execute with the existing opensas runtime: opensas /app/output/result.sas. */data adeg; length STUDYID USUBJID PARAMCD PARAM AVISIT AVALU $1024; infile "/app/input/adeg.csv" dsd dlm="," firstobs=2 truncover lrecl=32767; input STUDYID : $char1024. USUBJID : $char1024. PARAMCD : $char1024. PARAM : $char1024. AVISIT : $char1024. AVAL AVALU : $char1024.;run;proc sql; create table qt as select a.*,b.AVAL as RRVAL from adeg as a inner join adeg as b on a.STUDYID=b.STUDYID and a.USUBJID=b.USUBJID and a.AVISIT=b.AVISIT where a.PARAMCD='QT' and b.PARAMCD='RR' and not missing(a.AVAL) and not missing(b.AVAL);quit;data corrected; length PARAMCD PARAM AVALU $1024; set qt; QTVAL=AVAL; AVALU='ms'; PARAMCD='QTCBR'; PARAM="QTcB - Bazett's Correction Formula Rederived (ms)"; AVAL=QTVAL/sqrt(RRVAL/1000); output; PARAMCD='QTCFR'; PARAM="QTcF - Fridericia's Correction Formula Rederived (ms)"; AVAL=QTVAL/(RRVAL/1000)**(1/3); output;run;data heart; length PARAMCD PARAM $1024; set adeg; if PARAMCD='HR' and not missing(AVAL) and AVAL ne 0; AVAL=60000/AVAL; PARAMCD='RRR'; PARAM='RR Duration Rederived (ms)'; AVALU='ms';run;data result; set adeg corrected heart; run;proc sql; create table final as select STUDYID, USUBJID, PARAMCD, PARAM, AVISIT, AVAL, AVALU from result;quit;proc export data=final outfile="/app/output/adeg.csv" dbms=csv replace; run;
yamaa