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: build one ADVS row per collected character-result row, carrying SERIES, AVISITN, and AVALC through unchanged and adding PREVAVALC for the closest earlier non-blank result.

Input: collected character results for three subjects, with series, visit number, and character result.

Variables:

  • SERIES identifies the analysis series; rows with no series value share one series.
  • AVISITN is the visit number that orders rows within a series.
  • AVALC is the current character result, kept as collected; blank when no result was collected.
  • PREVAVALC is the closest earlier non-blank result for the same subject and series, never the row's own; blank when no earlier row in the series has a result.

Note: within a series, rows are ordered by visit number with missing numbers last, and rows sharing a visit number (or both missing one) keep their collected order. The look-back skips blank results, so it can cross consecutive blank rows, but it never crosses into another series. A subject with a single collected row, and a series whose earlier rows are all blank, both leave PREVAVALC blank.

Inputs

Under review
1 source file

input/vs.csv

Edit
14 rows
input/vs.csv
STUDYIDUSUBJIDVSSEQSERIESAVISITNAVALC
YAMAA-011A—NULL-ORDER
YAMAA-012A1FIRST
YAMAA-013A1—
YAMAA-014A2—
YAMAA-015B1B-FIRST
YAMAA-016B2—
YAMAA-017—1UNGROUPED
YAMAA-018—2—
YAMAA-019A1SOLO
YAMAA-0110C1—
YAMAA-0111C2—
YAMAA-0112C3LATE
YAMAA-0113C——
YAMAA-0114C——

Expected output

Under review
14 expected rows

expected/advs.csv

Edit
14 rows
expected/advs.csv
STUDYIDUSUBJIDVSSEQSERIESAVISITNAVALCPREVAVALC
YAMAA-011A—NULL-ORDERFIRST
YAMAA-012A1FIRST—
YAMAA-013A1—FIRST
YAMAA-014A2—FIRST
YAMAA-015B1B-FIRST—
YAMAA-016B2—B-FIRST
YAMAA-017—1UNGROUPED—
YAMAA-018—2—UNGROUPED
YAMAA-019A1SOLO—
YAMAA-0110C1——
YAMAA-0111C2——
YAMAA-0112C3LATE—
YAMAA-0113C——LATE
YAMAA-0114C——LATE
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
ADVSVSSEQSequence NumbernumericCopy value from VS.VSSEQ.Predecessor
ADVSSERIESAnalysis SeriescharacterCopy value from VS.SERIES.Predecessor
ADVSAVISITNAnalysis Visit NumbernumericCopy value from VS.AVISITN.Predecessor
ADVSAVALCAnalysis Value (C)characterCopy value from VS.AVALC.Predecessor
ADVSPREVAVALCPrevious Non-Missing Analysis Value (C)characterMost recent non-missing AVALC from an earlier row within each group of STUDYID, USUBJID, SERIES, ordered by AVISITN then VSSEQ.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-prior-result/full.md

Edit
20 lines

Following CDISC ADaM standards, use the provided VS dataset to create an ADVS dataset with one record per vital-signs record.

The output dataset should contain the following columns in this order: STUDYID, USUBJID, VSSEQ, SERIES, AVISITN, AVALC, PREVAVALC

SERIES identifies the analysis series; rows with no series value share one series. AVISITN is the visit number that orders rows within a series. AVALC is the current character result, kept as collected, and has no value when no result was collected.

PREVAVALC is the closest earlier result with a value for the same subject and series, never the row's own; it has no value when no earlier row in the series has a result. Within a series, rows are ordered by visit number with missing numbers last, and rows sharing a visit number, or both missing one, keep their collected order. The look-back skips blank results but never crosses into another series.

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

prompts/adam-advs-prior-result/conventions.md

Edit
8 lines

Following CDISC ADaM standards, use the provided VS dataset to create an ADVS dataset with one record per vital-signs record.

The output dataset should contain the following columns in this order: STUDYID, USUBJID, VSSEQ, SERIES, AVISITN, AVALC, PREVAVALC

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

prompts/adam-advs-prior-result/brief.md

Edit
8 lines

Following CDISC ADaM standards, use the provided VS dataset to create an ADVS dataset with one record per vital-signs record.

The output dataset should contain the following columns in this order: STUDYID, USUBJID, VSSEQ, SERIES, AVISITN, AVALC, PREVAVALC

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

Edit
40 lines
# Reference solution for the yamaa benchmark adam-advs-prior-result (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)vs <- read_csv(  "/app/input/vs.csv",  col_types = cols(    VSSEQ = col_integer(), AVISITN = col_integer(),    .default = col_character()  ))# Within a series, rows are ordered by visit number with missing numbers# last, keeping the collected order for ties. The look-back skips blank# results but never crosses into another series.ordered <- vs |>  arrange(STUDYID, USUBJID, SERIES, is.na(AVISITN), AVISITN)# Forward-fill the ordered results, then lag by one so the row's own# value never counts.prev <- ordered |>  group_by(STUDYID, USUBJID, SERIES) |>  fill(AVALC, .direction = "down") |>  mutate(PREVAVALC = lag(AVALC)) |>  ungroup() |>  select(STUDYID, USUBJID, VSSEQ, PREVAVALC)advs <- vs |>  left_join(prev, by = c("STUDYID", "USUBJID", "VSSEQ")) |>  arrange(USUBJID, VSSEQ) |>  select(STUDYID, USUBJID, VSSEQ, SERIES, AVISITN, AVALC, PREVAVALC)dir.create("/app/output", showWarnings = FALSE)write_csv(advs, "/app/output/advs.csv", na = "")

solutions/adam-advs-prior-result/result.py

Edit
46 lines
# Reference solution for the yamaa benchmark adam-advs-prior-result (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("VSSEQ").cast(pl.Int64, strict=False),    pl.col("AVISITN").cast(pl.Int64, strict=False),)# Rows with no series value share one series within each subject; order# within a series by visit number with missing numbers last, keeping the# collected order (input row order) for ties.ordered = vs.sort(    ["STUDYID", "USUBJID", "SERIES", "AVISITN"],    nulls_last=True,    maintain_order=True,)# The closest earlier result with a value in the same subject and series.prev_by_key: dict[tuple, str | None] = {}last_seen: dict[tuple, str | None] = {}for record in ordered.iter_rows(named=True):    key = (record["STUDYID"], record["USUBJID"], record["SERIES"])    prev_by_key[(record["STUDYID"], record["USUBJID"], record["VSSEQ"])] = last_seen.get(key)    if record["AVALC"] is not None:        last_seen[key] = record["AVALC"]advs = (    vs.with_columns(        PREVAVALC=pl.struct(["STUDYID", "USUBJID", "VSSEQ"]).map_elements(            lambda s: prev_by_key.get((s["STUDYID"], s["USUBJID"], s["VSSEQ"])),            return_dtype=pl.String,        )    )    .sort(["USUBJID", "VSSEQ"])    .select("STUDYID", "USUBJID", "VSSEQ", "SERIES", "AVISITN", "AVALC", "PREVAVALC"))Path("/app/output").mkdir(parents=True, exist_ok=True)advs.write_csv("/app/output/advs.csv")

solutions/adam-advs-prior-result/result.sas

Edit
25 lines
/* opensas reference solution for the yamaa benchmark adam-advs-prior-result.   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 SERIES AVALC $1024;  infile "/app/input/vs.csv" dsd dlm="," firstobs=2 truncover lrecl=32767;  input STUDYID : $char1024. USUBJID : $char1024. VSSEQ SERIES : $char1024. AVISITN AVALC : $char1024.;run;data ordered; set vs; ordinal=_n_; novisit=missing(AVISITN); run;proc sort data=ordered; by STUDYID USUBJID SERIES novisit AVISITN ordinal; run;data result;  length PREVAVALC carried $1024;  retain carried;  set ordered; by STUDYID USUBJID SERIES;  if first.SERIES then carried='';  PREVAVALC=carried;  if not missing(AVALC) then carried=AVALC;run;proc sql;  create table final as select STUDYID, USUBJID, VSSEQ, SERIES, AVISITN, AVALC, PREVAVALC from result;quit;proc export data=final outfile="/app/output/advs.csv" dbms=csv replace; run;