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: 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, or RRR on the new records; QT, RR, or HR on the collected ones. The input must not already contain QTCBR, QTCFR, or RRR.
  • 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 example BASELINE or WEEK 4.
  • AVAL: QT / SQRT(RR / 1000) for QTCBR, QT / POWER(RR / 1000, 1 / 3) for QTCFR, and 60000 divided by the heart rate for RRR; for example, a heart rate of 60 gives 1000.
  • AVALU: ms on 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 review
1 source file

input/adeg.csv

Edit
29 rows
input/adeg.csv
STUDYIDUSUBJIDPARAMCDPARAMAVISITAVALAVALU
CATH-01QTQT DurationBASELINE350ms
CATH-01RRRR DurationBASELINE1000ms
CATH-01HRHeart RateBASELINE60beats/min
CATH-01QTQT DurationWEEK 4362ms
CATH-01RRRR DurationWEEK 4950ms
CATH-01HRHeart RateWEEK 463beats/min
CATH-01QTQT DurationBASELINE400msec
CATH-01RRRR DurationBASELINE512msec
CATH-01HRHeart RateBASELINE70beats/min
CATH-01QTQT DurationBASELINE—ms
CATH-01RRRR DurationBASELINE920ms
CATH-01HRHeart RateBASELINE72beats/min
CATH-01QTQT DurationBASELINE388ms
CATH-01RRRR DurationBASELINE—ms
CATH-01HRHeart RateBASELINE60beats/min
CATH-01QTQT DurationBASELINE410ms
CATH-01RRRR DurationBASELINE880ms
CATH-01HRHeart RateBASELINE0beats/min
CATH-01QTQT DurationBASELINE375ms
CATH-01QTQT DurationBASELINE340ms
CATH-01RRRR DurationBASELINE1100ms
CATH-01HRHeart RateBASELINE1beats/min
CATH-01HRHeart RateBASELINE55beats/min
CATH-01QTQT DurationBASELINE395ms
CATH-01RRRR DurationBASELINE980ms
CATH-01HRHeart RateBASELINE—beats/min
CATH-01QTQT DurationBASELINE600ms
CATH-01RRRR DurationBASELINE1500ms
CATH-01HRHeart RateBASELINE40beats/min

Expected output

Under review
51 expected rows

expected/adeg.csv

Edit
51 rows
expected/adeg.csv
STUDYIDUSUBJIDPARAMCDPARAMAVISITAVALAVALU
CATH-01QTQT DurationBASELINE350ms
CATH-01RRRR DurationBASELINE1000ms
CATH-01HRHeart RateBASELINE60beats/min
CATH-01QTQT DurationWEEK 4362ms
CATH-01RRRR DurationWEEK 4950ms
CATH-01HRHeart RateWEEK 463beats/min
CATH-01QTQT DurationBASELINE400msec
CATH-01RRRR DurationBASELINE512msec
CATH-01HRHeart RateBASELINE70beats/min
CATH-01QTQT DurationBASELINE—ms
CATH-01RRRR DurationBASELINE920ms
CATH-01HRHeart RateBASELINE72beats/min
CATH-01QTQT DurationBASELINE388ms
CATH-01RRRR DurationBASELINE—ms
CATH-01HRHeart RateBASELINE60beats/min
CATH-01QTQT DurationBASELINE410ms
CATH-01RRRR DurationBASELINE880ms
CATH-01HRHeart RateBASELINE0beats/min
CATH-01QTQT DurationBASELINE375ms
CATH-01QTQT DurationBASELINE340ms
CATH-01RRRR DurationBASELINE1100ms
CATH-01HRHeart RateBASELINE1beats/min
CATH-01HRHeart RateBASELINE55beats/min
CATH-01QTQT DurationBASELINE395ms
CATH-01RRRR DurationBASELINE980ms
CATH-01HRHeart RateBASELINE—beats/min
CATH-01QTQT DurationBASELINE600ms
CATH-01RRRR DurationBASELINE1500ms
CATH-01HRHeart RateBASELINE40beats/min
CATH-01QTCBRQTcB - Bazett's Correction Formula Rederived (ms)BASELINE350ms
CATH-01QTCBRQTcB - Bazett's Correction Formula Rederived (ms)WEEK 4371.4041634548258ms
CATH-01QTCBRQTcB - Bazett's Correction Formula Rederived (ms)BASELINE559.0169943749474ms
CATH-01QTCBRQTcB - Bazett's Correction Formula Rederived (ms)BASELINE437.0614685290014ms
CATH-01QTCBRQTcB - Bazett's Correction Formula Rederived (ms)BASELINE324.17728034350137ms
CATH-01QTCBRQTcB - Bazett's Correction Formula Rederived (ms)BASELINE399.01025509812325ms
CATH-01QTCBRQTcB - Bazett's Correction Formula Rederived (ms)BASELINE489.89794855663564ms
CATH-01QTCFRQTcF - Fridericia's Correction Formula Rederived (ms)BASELINE350ms
CATH-01QTCFRQTcF - Fridericia's Correction Formula Rederived (ms)WEEK 4368.2426060851786ms
CATH-01QTCFRQTcF - Fridericia's Correction Formula Rederived (ms)BASELINE500ms
CATH-01QTCFRQTcF - Fridericia's Correction Formula Rederived (ms)BASELINE427.8481245967625ms
CATH-01QTCFRQTcF - Fridericia's Correction Formula Rederived (ms)BASELINE329.3679640914978ms
CATH-01QTCFRQTcF - Fridericia's Correction Formula Rederived (ms)BASELINE397.6689998808046ms
CATH-01QTCFRQTcF - Fridericia's Correction Formula Rederived (ms)BASELINE524.1482788417793ms
CATH-01RRRRR Duration Rederived (ms)BASELINE1000ms
CATH-01RRRRR Duration Rederived (ms)WEEK 4952.3809523809524ms
CATH-01RRRRR Duration Rederived (ms)BASELINE857.1428571428571ms
CATH-01RRRRR Duration Rederived (ms)BASELINE833.3333333333334ms
CATH-01RRRRR Duration Rederived (ms)BASELINE1000ms
CATH-01RRRRR Duration Rederived (ms)BASELINE60000ms
CATH-01RRRRR Duration Rederived (ms)BASELINE1090.909090909091ms
CATH-01RRRRR Duration Rederived (ms)BASELINE1500ms
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

Dataset NameVariable NameVariable LabelTypeCodelist/Controlled TermsCoreComputational MethodOrigin
ADEGSTUDYIDStudy IdentifiercharacterCopy value from ADEG_RAW.STUDYID.Predecessor
ADEGUSUBJIDUnique Subject IdentifiercharacterCopy value from ADEG_RAW.USUBJID.Predecessor
ADEGPARAMCDParameter CodecharacterSet per constructed row; see the Row construction sheet.Derived
ADEGPARAMParametercharacterSet per constructed row; see the Row construction sheet.Derived
ADEGAVISITAnalysis VisitcharacterCopy value from ADEG_RAW.AVISIT.Predecessor
ADEGAVALAnalysis ValuenumericSet per constructed row; see the Row construction sheet.Derived
ADEGAVALUAnalysis Value UnitcharacterSet per constructed row; see the Row construction sheet.Derived
TemplateInclude whenPARAMCDPARAMQTVALRRVALAVALAVALU
collectedCopy ADEG_RAW.PARAMCDCopy ADEG_RAW.PARAMConstant "None"Constant "None"Copy ADEG_RAW.AVALCopy ADEG_RAW.AVALU
qtc_bazettQTVAL IS NOT NULL AND RRVAL IS NOT NULLConstant "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_fridericiaQTVAL IS NOT NULL AND RRVAL IS NOT NULLConstant "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_rederivedADEG_RAW.PARAMCD = 'HR' AND ADEG_RAW.AVAL IS NOT NULL AND ADEG_RAW.AVAL <> 0Constant "RRR"Constant "RR Duration Rederived (ms)"Constant "None"Constant "None"Compute 60000 / NULLIF(ADEG_RAW.AVAL, 0)Constant "ms"
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/adam-adeg-derived-intervals/full.md

Edit
26 lines

Following 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

Edit
13 lines

Following 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

Edit
8 lines

Following 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.

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/adam-adeg-derived-intervals/result.R

Edit
67 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

Edit
106 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

Edit
32 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;