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: give each planned visit the result, date, and sequence number (AVAL, ADT, QSSEQ) of one observation carried forward to it.

Input: the planned analysis visits per subject and parameter, and the collected vital signs observations, each flagged as selected for analysis or not.

Variables:

  • AVISITN identifies the planned analysis visit.
  • AVAL is the latest non-missing result selected for analysis at or before that visit, within the same subject and parameter. A result of zero counts as a collected result. With no such result it is missing.
  • ADT and QSSEQ are the date and the source sequence number of that same observation. A missing date stays missing even when an earlier observation has a date.

Note: the latest observation is the one with the highest visit number, then the highest sequence number within that visit.

Inputs

Under review
2 source files

input/plan.csv

Edit
15 rows
input/plan.csv
USUBJIDPARAMCDAVISITN
SYSBP0
SYSBP1
SYSBP2
SYSBP3
SYSBP4
DIABP2
SYSBP1
SYSBP2
SYSBP3
SYSBP1
SYSBP2
SYSBP3
SYSBP1
SYSBP1
SYSBP2

input/vs.csv

Edit
11 rows
input/vs.csv
USUBJIDPARAMCDAVISITNAVALADTQSSEQANL01FL
SYSBP11182026-01-06101Y
SYSBP2—2026-01-13102Y
SYSBP3—2026-01-20103Y
SYSBP4126—104Y
SYSBP21422026-01-13105N
SYSBP11322026-02-03201Y
SYSBP11282026-02-03202Y
SYSBP202026-02-10203Y
SYSBP11402026-03-04301Y
SYSBP21362026-03-11302Y
SYSBP11212026-04-08401Y

Expected output

Under review
15 expected rows

expected/advs.csv

Edit
15 rows
expected/advs.csv
USUBJIDPARAMCDAVISITNAVALADTQSSEQ
SYSBP0———
SYSBP11182026-01-06101
SYSBP21182026-01-06101
SYSBP31182026-01-06101
SYSBP4126—104
DIABP2———
SYSBP11282026-02-03202
SYSBP202026-02-10203
SYSBP302026-02-10203
SYSBP11402026-03-04301
SYSBP21362026-03-11302
SYSBP31362026-03-11302
SYSBP11212026-04-08401
SYSBP1———
SYSBP2———
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
ADVSUSUBJIDUnique Subject IdentifiercharacterCopy value from PLAN.USUBJID.Predecessor
ADVSPARAMCDParameter CodecharacterCopy value from PLAN.PARAMCD.Predecessor
ADVSAVISITNAnalysis Visit NumbernumericCopy value from PLAN.AVISITN.Predecessor
ADVSAVALAnalysis ValuenumericTake AVAL from the last OBS record matching on USUBJID and PARAMCD, where OBS.ANL01FL = 'Y' AND OBS.AVAL IS NOT NULL AND OBS.AVISITN <= PLAN.AVISITN, ordered by OBS.AVISITN then OBS.QSSEQ, and no match yields blank.Derived
ADVSADTAnalysis DatenumericISO 8601Take ADT from the last OBS record matching on USUBJID and PARAMCD, where OBS.ANL01FL = 'Y' AND OBS.AVAL IS NOT NULL AND OBS.AVISITN <= PLAN.AVISITN, ordered by OBS.AVISITN then OBS.QSSEQ, and no match yields blank.Derived
ADVSQSSEQSource Sequence NumbernumericTake QSSEQ from the last OBS record matching on USUBJID and PARAMCD, where OBS.ANL01FL = 'Y' AND OBS.AVAL IS NOT NULL AND OBS.AVISITN <= PLAN.AVISITN, ordered by OBS.AVISITN then OBS.QSSEQ, and no match yields blank.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-locf-record/full.md

Edit
20 lines

Following CDISC ADaM standards, use the provided PLAN and OBS datasets to create an ADVS dataset with one record per subject per parameter per planned visit.

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

AVISITN identifies the planned analysis visit. AVAL is the latest non-missing result selected for analysis (ANL01FL is Y) at or before that visit, within the same subject and parameter; a result of zero counts as collected. With no such result it has no value.

ADT and QSSEQ are the date and the source sequence number of that same observation. A missing date on that observation has no value even when an earlier observation has a date. The latest observation is the one with the highest visit number, then the highest sequence number within that visit.

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

prompts/adam-advs-locf-record/conventions.md

Edit
9 lines

Following CDISC ADaM standards, use the provided PLAN and OBS datasets to create an ADVS dataset with one record per subject per parameter per planned visit.

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

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

prompts/adam-advs-locf-record/brief.md

Edit
9 lines

Following CDISC ADaM standards, use the provided PLAN and OBS datasets to create an ADVS dataset with one record per subject per parameter per planned visit.

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

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-locf-record/result.R

Edit
49 lines
# Reference solution for the yamaa benchmark adam-advs-locf-record (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(purrr)library(readr)library(tidyr)plan <- read_csv(  "/app/input/plan.csv",  col_types = cols(AVISITN = col_integer(), .default = col_character()))vs <- read_csv(  "/app/input/vs.csv",  col_types = cols(    AVISITN = col_integer(), AVAL = col_double(), ADT = col_date(),    QSSEQ = col_integer(), .default = col_character()  ))# Only results selected for analysis can be carried.candidates <- vs |>  filter(ANL01FL %in% "Y", !is.na(AVAL))# The latest non-missing selected result at or before the planned visit:# the highest visit number, then the highest sequence number.pick_donor <- function(usubjid, paramcd, avisitn) {  donor <- candidates |>    filter(USUBJID == usubjid, PARAMCD == paramcd, AVISITN <= avisitn) |>    arrange(AVISITN, QSSEQ) |>    slice_tail(n = 1)  if (nrow(donor) == 0) {    tibble::tibble(AVAL = NA_real_, ADT = as.Date(NA), QSSEQ = NA_integer_)  } else {    donor |> select(AVAL, ADT, QSSEQ)  }}advs <- plan |>  arrange(USUBJID, PARAMCD, AVISITN) |>  mutate(donor = pmap(list(USUBJID, PARAMCD, AVISITN), pick_donor)) |>  unnest(donor) |>  select(USUBJID, PARAMCD, AVISITN, AVAL, ADT, QSSEQ)dir.create("/app/output", showWarnings = FALSE)write_csv(advs, "/app/output/advs.csv", na = "")

solutions/adam-advs-locf-record/result.py

Edit
76 lines
# Reference solution for the yamaa benchmark adam-advs-locf-record (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 plplan = pl.read_csv("/app/input/plan.csv", infer_schema=False).with_columns(    pl.col("AVISITN").cast(pl.Int64, strict=False))vs = 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),    pl.col("ADT").str.to_date(strict=False),    pl.col("QSSEQ").cast(pl.Int64, strict=False),)# Only results selected for analysis can be carried.candidates = vs.filter(    (pl.col("ANL01FL") == "Y") & pl.col("AVAL").is_not_null())# The latest non-missing selected result at or before the planned visit:# the highest visit number, then the highest sequence number.rows = []for planned in plan.sort(["USUBJID", "PARAMCD", "AVISITN"]).iter_rows(named=True):    donor = (        candidates.filter(            (pl.col("USUBJID") == planned["USUBJID"])            & (pl.col("PARAMCD") == planned["PARAMCD"])            & (pl.col("AVISITN") <= planned["AVISITN"])        )        .sort(["AVISITN", "QSSEQ"])        .tail(1)    )    if donor.height:        record = donor.row(0, named=True)        rows.append(            {                "USUBJID": planned["USUBJID"],                "PARAMCD": planned["PARAMCD"],                "AVISITN": planned["AVISITN"],                "AVAL": record["AVAL"],                "ADT": record["ADT"],                "QSSEQ": record["QSSEQ"],            }        )    else:        rows.append(            {                "USUBJID": planned["USUBJID"],                "PARAMCD": planned["PARAMCD"],                "AVISITN": planned["AVISITN"],                "AVAL": None,                "ADT": None,                "QSSEQ": None,            }        )advs = pl.DataFrame(    rows,    schema={        "USUBJID": pl.String,        "PARAMCD": pl.String,        "AVISITN": pl.Int64,        "AVAL": pl.Float64,        "ADT": pl.Date,        "QSSEQ": pl.Int64,    },).sort(["USUBJID", "PARAMCD", "AVISITN"])Path("/app/output").mkdir(parents=True, exist_ok=True)advs.write_csv("/app/output/advs.csv")

solutions/adam-advs-locf-record/result.sas

Edit
27 lines
/* opensas reference solution for the yamaa benchmark adam-advs-locf-record.   Reads the benchmark inputs and derives the requested output.   Execute with the existing opensas runtime: opensas /app/output/result.sas. */data plan;  length USUBJID PARAMCD $1024;  infile "/app/input/plan.csv" dsd dlm="," firstobs=2 truncover lrecl=32767;  input USUBJID : $char1024. PARAMCD : $char1024. AVISITN;run;data vs;  length USUBJID PARAMCD ADT ANL01FL $1024;  infile "/app/input/vs.csv" dsd dlm="," firstobs=2 truncover lrecl=32767;  input USUBJID : $char1024. PARAMCD : $char1024. AVISITN AVAL ADT : $char1024. QSSEQ ANL01FL : $char1024.;run;proc sql;  create table candidates as select a.USUBJID,a.PARAMCD,a.AVISITN,b.AVAL,b.ADT,b.QSSEQ,b.AVISITN as observedvisit from plan as a left join vs as b    on a.USUBJID=b.USUBJID and a.PARAMCD=b.PARAMCD and b.AVISITN<=a.AVISITN and b.ANL01FL='Y' and not missing(b.AVAL);quit;proc sort data=candidates; by USUBJID PARAMCD AVISITN descending observedvisit descending QSSEQ; run;data result; set candidates; by USUBJID PARAMCD AVISITN; if first.AVISITN; run;proc sql;  create table final as select USUBJID, PARAMCD, AVISITN, AVAL, ADT, QSSEQ from result;quit;proc export data=final outfile="/app/output/advs.csv" dbms=csv replace; run;