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 ADaM: 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: add one mean arterial pressure (MAP) record, holding the result in AVAL and CALCULATION in DTYPE, for each subject and visit that has both a systolic (SYSBP) and a diastolic (DIABP) blood pressure result; every collected record stays in the data.

Input: vital-signs records carrying a collected result (AVAL) for systolic (SYSBP) and diastolic (DIABP) blood pressure, one record per subject, visit, and parameter.

Variables:

  • AVAL: the collected result, or two-thirds of the diastolic pressure plus one-third of the systolic pressure on the added record. No record is added when either contributor is absent from the visit or its result is missing.
  • DTYPE: CALCULATION on the added record and blank on collected records.

Note: a subject and visit with more than one SYSBP or DIABP record stops the run rather than choosing one, and so does an input that already carries a MAP record.

Inputs

Under review
1 source file

input/advs.csv

Edit
9 rows
input/advs.csv
STUDYIDUSUBJIDPARAMCDPARAMAVALVISIT
YAMAA-01SYSBPSystolic Blood Pressure (mmHg)121BASELINE
YAMAA-01DIABPDiastolic Blood Pressure (mmHg)81BASELINE
YAMAA-01SYSBPSystolic Blood Pressure (mmHg)118WEEK 2
YAMAA-01DIABPDiastolic Blood Pressure (mmHg)78WEEK 2
YAMAA-01SYSBPSystolic Blood Pressure (mmHg)90BASELINE
YAMAA-01DIABPDiastolic Blood Pressure (mmHg)60BASELINE
YAMAA-01SYSBPSystolic Blood Pressure (mmHg)110BASELINE
YAMAA-01SYSBPSystolic Blood Pressure (mmHg)125BASELINE
YAMAA-01DIABPDiastolic Blood Pressure (mmHg)—BASELINE

Expected output

Under review
12 expected rows

expected/advs.csv

Edit
12 rows
expected/advs.csv
STUDYIDUSUBJIDPARAMCDPARAMAVALVISITDTYPE
YAMAA-01SYSBPSystolic Blood Pressure (mmHg)121BASELINE—
YAMAA-01DIABPDiastolic Blood Pressure (mmHg)81BASELINE—
YAMAA-01SYSBPSystolic Blood Pressure (mmHg)118WEEK 2—
YAMAA-01DIABPDiastolic Blood Pressure (mmHg)78WEEK 2—
YAMAA-01SYSBPSystolic Blood Pressure (mmHg)90BASELINE—
YAMAA-01DIABPDiastolic Blood Pressure (mmHg)60BASELINE—
YAMAA-01SYSBPSystolic Blood Pressure (mmHg)110BASELINE—
YAMAA-01SYSBPSystolic Blood Pressure (mmHg)125BASELINE—
YAMAA-01DIABPDiastolic Blood Pressure (mmHg)—BASELINE—
YAMAA-01MAPMean Arterial Pressure (mmHg)94.33333333333333BASELINECALCULATION
YAMAA-01MAPMean Arterial Pressure (mmHg)91.33333333333333WEEK 2CALCULATION
YAMAA-01MAPMean Arterial Pressure (mmHg)70BASELINECALCULATION
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

Dataset NameVariable NameVariable LabelTypeCodelist/Controlled TermsCoreComputational MethodOrigin
ADVSSTUDYIDStudy IdentifiercharacterCopy value from ADVS_RAW.STUDYID.Predecessor
ADVSUSUBJIDUnique Subject IdentifiercharacterCopy value from ADVS_RAW.USUBJID.Predecessor
ADVSPARAMCDParameter CodecharacterSet per constructed row; see the Row construction sheet.Derived
ADVSPARAMParametercharacterSet per constructed row; see the Row construction sheet.Derived
ADVSAVALAnalysis ValuenumericSet per constructed row; see the Row construction sheet.Derived
ADVSVISITVisit NamecharacterCopy value from ADVS_RAW.VISIT.Predecessor
ADVSDTYPEDerivation TypecharacterSet per constructed row; see the Row construction sheet.Derived
TemplateInclude whenPARAMCDPARAMSYSBP_VALDIABP_VALAVALDTYPE
collectedCopy ADVS_RAW.PARAMCDCopy ADVS_RAW.PARAMConstant "None"Constant "None"Copy ADVS_RAW.AVALConstant "None"
derived_mapSYSBP_VAL IS NOT NULL AND DIABP_VAL IS NOT NULLConstant "MAP"Constant "Mean Arterial Pressure (mmHg)"Aggregate ONLY(ADVS_RAW.AVAL) over records matching on the shared output keys, where ADVS_RAW.PARAMCD = 'SYSBP'Aggregate ONLY(ADVS_RAW.AVAL) over records matching on the shared output keys, where ADVS_RAW.PARAMCD = 'DIABP'Compute (2 * DIABP_VAL + SYSBP_VAL) / 3Constant "CALCULATION"
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/adam-advs-map/full.md

Edit
22 lines

Following CDISC ADaM standards, use the provided ADVS_RAW dataset to create an ADVS dataset with one record per subject per visit per parameter.

The output dataset should contain the following columns in this order: STUDYID, USUBJID, PARAMCD, PARAM, AVAL, VISIT, DTYPE

Keep every collected record, and add one mean arterial pressure record for each subject and visit that has both a systolic and a diastolic blood pressure result. Mark it with PARAMCD "MAP" and PARAM "Mean Arterial Pressure (mmHg)".

AVAL keeps each collected result. On the added record it is the average that counts the diastolic pressure twice and the systolic pressure once, not rounded. No record is added when either contributor is absent from the visit or its result is missing.

DTYPE is CALCULATION on the added record and has no value on collected records.

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

prompts/adam-advs-map/conventions.md

Edit
16 lines

Following CDISC ADaM standards, use the provided ADVS_RAW dataset to create an ADVS dataset with one record per subject per visit per parameter.

The output dataset should contain the following columns in this order: STUDYID, USUBJID, PARAMCD, PARAM, AVAL, VISIT, DTYPE

Mark a mean arterial pressure record with PARAMCD "MAP" and PARAM "Mean Arterial Pressure (mmHg)".

On a mean arterial pressure record AVAL is not rounded.

DTYPE is CALCULATION or has no value.

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

prompts/adam-advs-map/brief.md

Edit
9 lines

Following CDISC ADaM standards, use the provided ADVS_RAW dataset to create an ADVS dataset with one record per subject per visit per parameter.

The output dataset should contain the following columns in this order: STUDYID, USUBJID, PARAMCD, PARAM, AVAL, VISIT, DTYPE

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

yamaa code

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

run.R

Edit
4 lines
library(yamaa)advs <- yamaa_domain("spec.yaml")$outputadvs

run.py

Edit
4 lines
import yamaaadvs = yamaa.yamaa_domain("spec.yaml").outputadvs

Solution without yamaa

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

solutions/adam-advs-map/result.R

Edit
45 lines
# Reference solution for the yamaa benchmark adam-advs-map (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)raw <- read_csv(  "/app/input/advs.csv",  col_types = cols(AVAL = col_double(), .default = col_character()))# Every collected record stays in place.collected <- raw |>  transmute(STUDYID, USUBJID, PARAMCD, PARAM, AVAL, VISIT, DTYPE = NA_character_)# The visit's systolic and diastolic results.sysbp <- raw |>  filter(PARAMCD %in% "SYSBP", !is.na(AVAL)) |>  group_by(STUDYID, USUBJID, VISIT) |>  summarise(SYSBP_VAL = first(AVAL), .groups = "drop")diabp <- raw |>  filter(PARAMCD %in% "DIABP", !is.na(AVAL)) |>  group_by(STUDYID, USUBJID, VISIT) |>  summarise(DIABP_VAL = first(AVAL), .groups = "drop")# One mean arterial pressure record for each visit with both results,# counting the diastolic pressure twice.map_records <- sysbp |>  inner_join(diabp, by = c("STUDYID", "USUBJID", "VISIT")) |>  transmute(    STUDYID, USUBJID,    PARAMCD = "MAP", PARAM = "Mean Arterial Pressure (mmHg)",    AVAL = (SYSBP_VAL + 2 * DIABP_VAL) / 3,    VISIT, DTYPE = "CALCULATION"  )advs <- bind_rows(collected, map_records) |>  arrange(USUBJID, VISIT, PARAMCD)dir.create("/app/output", showWarnings = FALSE)write_csv(advs, "/app/output/advs.csv", na = "")

solutions/adam-advs-map/result.py

Edit
59 lines
# Reference solution for the yamaa benchmark adam-advs-map (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 plraw = pl.read_csv("/app/input/advs.csv", infer_schema=False).with_columns(    pl.col("AVAL").cast(pl.Float64, strict=False))# Every collected record stays in place.collected = raw.select(    "STUDYID", "USUBJID", "PARAMCD", "PARAM", "AVAL", "VISIT",    DTYPE=pl.lit(None, dtype=pl.String),)# The visit's systolic and diastolic results.sysbp = (    raw.filter(        (pl.col("PARAMCD") == "SYSBP") & pl.col("AVAL").is_not_null()    )    .group_by(["STUDYID", "USUBJID", "VISIT"])    .agg(SYSBP_VAL=pl.col("AVAL").first()))diabp = (    raw.filter(        (pl.col("PARAMCD") == "DIABP") & pl.col("AVAL").is_not_null()    )    .group_by(["STUDYID", "USUBJID", "VISIT"])    .agg(DIABP_VAL=pl.col("AVAL").first()))# One mean arterial pressure record for each visit with both results,# counting the diastolic pressure twice.map_records = (    sysbp.join(diabp, on=["STUDYID", "USUBJID", "VISIT"], how="inner")    .with_columns(AVAL=(pl.col("SYSBP_VAL") + 2 * pl.col("DIABP_VAL")) / 3)    .select(        "STUDYID",        "USUBJID",        "AVAL",        "VISIT",        PARAMCD=pl.lit("MAP"),        PARAM=pl.lit("Mean Arterial Pressure (mmHg)"),        DTYPE=pl.lit("CALCULATION"),    )    .select("STUDYID", "USUBJID", "PARAMCD", "PARAM", "AVAL", "VISIT", "DTYPE"))advs = pl.concat([collected, map_records], how="diagonal").sort(    ["USUBJID", "VISIT", "PARAMCD"])Path("/app/output").mkdir(parents=True, exist_ok=True)advs.write_csv("/app/output/advs.csv")

solutions/adam-advs-map/result.sas

Edit
21 lines
/* opensas reference solution for the yamaa benchmark adam-advs-map.   Reads the benchmark inputs and derives the requested output.   Execute with the existing opensas runtime: opensas /app/output/result.sas. */data advs;  length STUDYID USUBJID PARAMCD PARAM VISIT $1024;  infile "/app/input/advs.csv" dsd dlm="," firstobs=2 truncover lrecl=32767;  input STUDYID : $char1024. USUBJID : $char1024. PARAMCD : $char1024. PARAM : $char1024. AVAL VISIT : $char1024.;run;proc sql;  create table computed as select a.STUDYID,a.USUBJID,'MAP' as PARAMCD,'Mean Arterial Pressure (mmHg)' as PARAM,(a.AVAL+2*b.AVAL)/3 as AVAL,a.VISIT,'CALCULATION' as DTYPE from advs as a inner join advs as b on a.STUDYID=b.STUDYID and a.USUBJID=b.USUBJID and a.VISIT=b.VISIT  where a.PARAMCD='SYSBP' and b.PARAMCD='DIABP' and not missing(a.AVAL) and not missing(b.AVAL);quit;data collected; length DTYPE $11; set advs; run;data result; set collected computed; run;proc sql;  create table final as select STUDYID, USUBJID, PARAMCD, PARAM, AVAL, VISIT, DTYPE from result;quit;proc export data=final outfile="/app/output/advs.csv" dbms=csv replace; run;