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: draftEditUnder review
What this benchmark means
README.md

Goal: derive BASEVAL, each subject's first observed result for a vital-sign parameter, carried forward to every later visit.

Input: vital-sign records keyed by subject, parameter code, and visit number, each carrying the collected numeric result. A visit with no collected result still has a record.

Variables:

  • AVISITN: the visit number of the measurement.
  • AVAL: the collected numeric result, blank when the visit has no collected result.
  • BASEVAL: the result from the subject's first visit with a collected result for the parameter, repeated on that and every later visit; blank on visits before any result was collected.

Note: the carried value never crosses subjects or parameters: each subject-parameter pair carries only its own first observed result.

Inputs

Under review
1 source file

input/vs.csv

Edit
12 rows
input/vs.csv
STUDYIDUSUBJIDPARAMCDAVISITNAVAL
YAMAA-01SYSBP1120
YAMAA-01SYSBP2125
YAMAA-01SYSBP3—
YAMAA-01SYSBP4130
YAMAA-01DIABP180
YAMAA-01DIABP282
YAMAA-01SYSBP1—
YAMAA-01SYSBP2140
YAMAA-01SYSBP3145
YAMAA-01DIABP178
YAMAA-01SYSBP1—
YAMAA-01SYSBP2—

Expected output

Under review
12 expected rows

expected/advs.csv

Edit
12 rows
expected/advs.csv
STUDYIDUSUBJIDPARAMCDAVISITNAVALBASEVAL
YAMAA-01SYSBP1120120
YAMAA-01SYSBP2125120
YAMAA-01SYSBP3—120
YAMAA-01SYSBP4130120
YAMAA-01DIABP18080
YAMAA-01DIABP28280
YAMAA-01SYSBP1——
YAMAA-01SYSBP2140140
YAMAA-01SYSBP3145140
YAMAA-01DIABP17878
YAMAA-01SYSBP1——
YAMAA-01SYSBP2——
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 VS.STUDYID.Predecessor
ADVSUSUBJIDUnique Subject IdentifiercharacterCopy value from VS.USUBJID.Predecessor
ADVSPARAMCDParameter CodecharacterCopy value from VS.PARAMCD.Predecessor
ADVSAVISITNAnalysis Visit NumbernumericCopy value from VS.AVISITN.Predecessor
ADVSAVALAnalysis ValuenumericCopy value from VS.AVAL.Predecessor
ADVSBASEVALFirst Observed Analysis Value Carried ForwardnumericFirst non-missing of _SEL_AVAL and _CARRIED.Derived
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-first-observed-carry/full.md

Edit
16 lines

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

The output dataset should contain the following columns in this order: STUDYID, USUBJID, PARAMCD, AVISITN, AVAL, BASEVAL

AVISITN is the visit number of the measurement. AVAL is the collected numeric result, and has no value when the visit has none.

BASEVAL is the result from the subject's first visit with a collected result for the parameter, repeated on that and every later visit; it has no value on visits before any result was collected. The carried value never crosses subjects or parameters.

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

prompts/adam-advs-first-observed-carry/conventions.md

Edit
8 lines

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

The output dataset should contain the following columns in this order: STUDYID, USUBJID, PARAMCD, AVISITN, AVAL, BASEVAL

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

prompts/adam-advs-first-observed-carry/brief.md

Edit
8 lines

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

The output dataset should contain the following columns in this order: STUDYID, USUBJID, PARAMCD, AVISITN, AVAL, BASEVAL

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-first-observed-carry/result.R

Edit
31 lines
# Reference solution for the yamaa benchmark adam-advs-first-observed-carry (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)vs <- read_csv(  "/app/input/vs.csv",  col_types = cols(AVISITN = col_integer(), AVAL = col_double(), .default = col_character()))# The first visit with a result for each subject and parameter.firsts <- vs |>  filter(!is.na(AVAL)) |>  arrange(STUDYID, USUBJID, PARAMCD, AVISITN) |>  distinct(STUDYID, USUBJID, PARAMCD, .keep_all = TRUE) |>  select(STUDYID, USUBJID, PARAMCD, FIRST_AVAL = AVAL, FIRST_VISIT = AVISITN)# The first result, repeated on that and every later visit; visits before# any result stay missing.advs <- vs |>  left_join(firsts, by = c("STUDYID", "USUBJID", "PARAMCD")) |>  mutate(BASEVAL = if_else(!is.na(FIRST_VISIT) & AVISITN >= FIRST_VISIT, FIRST_AVAL, NA_real_)) |>  arrange(USUBJID, PARAMCD, AVISITN) |>  select(STUDYID, USUBJID, PARAMCD, AVISITN, AVAL, BASEVAL)dir.create("/app/output", showWarnings = FALSE)write_csv(advs, "/app/output/advs.csv", na = "")

solutions/adam-advs-first-observed-carry/result.py

Edit
38 lines
# Reference solution for the yamaa benchmark adam-advs-first-observed-carry (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 plvs = pl.read_csv("/app/input/vs.csv", infer_schema=False).with_columns(    pl.col("AVISITN").cast(pl.Int64, strict=False),    pl.col("AVAL").cast(pl.Float64, strict=False),)# The first visit with a result for each subject and parameter.firsts = (    vs.filter(pl.col("AVAL").is_not_null())    .sort("AVISITN")    .unique(["STUDYID", "USUBJID", "PARAMCD"], keep="first", maintain_order=True)    .select("STUDYID", "USUBJID", "PARAMCD", FIRST_AVAL="AVAL", FIRST_VISIT="AVISITN"))# The first result, repeated on that and every later visit; visits before# any result stay missing.advs = (    vs.join(firsts, on=["STUDYID", "USUBJID", "PARAMCD"], how="left")    .with_columns(        BASEVAL=pl.when(pl.col("AVISITN") >= pl.col("FIRST_VISIT"))        .then(pl.col("FIRST_AVAL"))        .otherwise(None)    )    .sort(["USUBJID", "PARAMCD", "AVISITN"])    .select("STUDYID", "USUBJID", "PARAMCD", "AVISITN", "AVAL", "BASEVAL"))Path("/app/output").mkdir(parents=True, exist_ok=True)advs.write_csv("/app/output/advs.csv")

solutions/adam-advs-first-observed-carry/result.sas

Edit
23 lines
/* opensas reference solution for the yamaa benchmark adam-advs-first-observed-carry.   Reads the benchmark inputs and derives the requested output.   Execute with the existing opensas runtime: opensas /app/output/result.sas. */data vs;  length STUDYID USUBJID PARAMCD $1024;  infile "/app/input/vs.csv" dsd dlm="," firstobs=2 truncover lrecl=32767;  input STUDYID : $char1024. USUBJID : $char1024. PARAMCD : $char1024. AVISITN AVAL;run;proc sort data=vs out=ordered; by STUDYID USUBJID PARAMCD AVISITN; run;data result;  set ordered; by STUDYID USUBJID PARAMCD;  retain carried;  if first.PARAMCD then carried=.;  if not missing(AVAL) and missing(carried) then carried=AVAL;  BASEVAL=carried;run;proc sql;  create table final as select STUDYID, USUBJID, PARAMCD, AVISITN, AVAL, BASEVAL from result;quit;proc export data=final outfile="/app/output/advs.csv" dbms=csv replace; run;