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: build the change parameters _ALB and _BILI from albumin and bilirubin lab results, carrying each visit's previous result (PREV_AVAL) and the change from it (CHG).

Input: laboratory (LB) records carrying a test code (LBTESTCD), a numeric result (LBSTRESN), and a visit number (VISITNUM). Five subjects: one with both tests across several visits, one with both tests but a single albumin visit, one whose first albumin visit has no result plus a single bilirubin visit, one albumin-only, and one with hemoglobin only, which produces no rows.

Variables:

  • AVISITN: the analysis visit number, taken from the lab visit number.
  • AVAL: the numeric lab result for the visit.
  • PREV_AVAL: the AVAL of the visit just before in AVISITN order, for the same subject and parameter, so an _ALB row never reads a _BILI value; blank on the subject's first visit for the parameter.
  • CHG: AVAL - PREV_AVAL, the change since that visit; blank whenever PREV_AVAL is.

Note: a record with no numeric result gets no row, so the previous value and the change skip that visit and compare with the latest earlier visit that has a result. CHG here is the change from the previous visit, not the ADaMIG "change from baseline" definition. Single-visit subjects have blank PREV_AVAL and CHG; equal consecutive values give CHG 0.

Inputs

Under review
1 source file

input/lb.csv

Edit
19 rows
input/lb.csv
STUDYIDUSUBJIDLBTESTCDLBSTRESNVISITNUM
YAMAA-01ALB4.01
YAMAA-01ALB4.52
YAMAA-01ALB—3
YAMAA-01ALB4.754
YAMAA-01BILI1.01
YAMAA-01BILI1.252
YAMAA-01BILI1.53
YAMAA-01ALB3.751
YAMAA-01BILI2.01
YAMAA-01BILI2.252
YAMAA-01ALB—1
YAMAA-01ALB3.52
YAMAA-01ALB3.753
YAMAA-01BILI0.751
YAMAA-01ALB4.01
YAMAA-01ALB4.02
YAMAA-01ALB3.53
YAMAA-01HGB14.21
YAMAA-01HGB14.52

Expected output

Under review
15 expected rows

expected/adlbc.csv

Edit
15 rows
expected/adlbc.csv
STUDYIDUSUBJIDPARAMCDAVISITNAVALPREV_AVALCHG
YAMAA-01_ALB14——
YAMAA-01_ALB24.540.5
YAMAA-01_ALB44.754.50.25
YAMAA-01_BILI11——
YAMAA-01_BILI21.2510.25
YAMAA-01_BILI31.51.250.25
YAMAA-01_ALB13.75——
YAMAA-01_BILI12——
YAMAA-01_BILI22.2520.25
YAMAA-01_ALB23.5——
YAMAA-01_ALB33.753.50.25
YAMAA-01_BILI10.75——
YAMAA-01_ALB14——
YAMAA-01_ALB2440
YAMAA-01_ALB33.54-0.5
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
ADLBCSTUDYIDStudy IdentifiercharacterCopy value from LB.STUDYID.Predecessor
ADLBCUSUBJIDUnique Subject IdentifiercharacterCopy value from LB.USUBJID.Predecessor
ADLBCPARAMCDParameter CodecharacterSet per constructed row; see the Row construction sheet.Derived
ADLBCAVISITNAnalysis Visit NumbernumericCopy value from LB.VISITNUM.Predecessor
ADLBCAVALAnalysis ValuenumericCopy value from LB.LBSTRESN.Predecessor
ADLBCPREV_AVALPrevious Analysis ValuenumericTake AVAL from 1 row earlier within each group of USUBJID, PARAMCD, ordered by AVISITN.Derived
ADLBCCHGChange from Previous ValuenumericCompute AVAL - PREV_AVAL.Derived
TemplateInclude whenPARAMCD
change_paramsLB.LBTESTCD IN ('ALB', 'BILI') AND LB.LBSTRESN IS NOT NULLRecode LB.LBTESTCD: "ALB" → "_ALB", "BILI" → "_BILI"; missing values are errors; unlisted values stay missing
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-adlbc-row-window/full.md

Edit
27 lines

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

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

Build the change parameters "_ALB" and "_BILI" from the albumin and bilirubin lab results; any other test produces no rows.

AVISITN is the analysis visit number, taken from the lab visit number. AVAL is the numeric lab result for the visit.

PREV_AVAL is the value of the visit just before in visit order, for the same subject and parameter, so an _ALB row never reads a _BILI value. It has no value on the subject's first visit for the parameter.

CHG is the change since that visit, not the change from baseline; it has no value whenever PREV_AVAL has none. A record with no numeric result gets no row, so the previous value and the change skip that visit and compare with the latest earlier visit that has a result. Equal consecutive values give CHG 0, and a single-visit subject leaves both empty.

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

prompts/adam-adlbc-row-window/conventions.md

Edit
11 lines

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

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

PARAMCD is "_ALB" for albumin and "_BILI" for bilirubin.

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

prompts/adam-adlbc-row-window/brief.md

Edit
9 lines

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

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

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

yamaa code

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

run.R

Edit
4 lines
library(yamaa)adlbc <- yamaa_domain("spec.yaml")$outputadlbc

run.py

Edit
4 lines
import yamaaadlbc = yamaa.yamaa_domain("spec.yaml").outputadlbc

Solution without yamaa

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

solutions/adam-adlbc-row-window/result.R

Edit
41 lines
# Reference solution for the yamaa benchmark adam-adlbc-row-window (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)lb <- read_csv(  "/app/input/lb.csv",  col_types = cols(    LBSTRESN = col_double(),    VISITNUM = col_integer(),    .default = col_character()  ))# Build the change parameters from albumin and bilirubin; any other test# produces no rows. A record with no numeric result gets no row.adbc <- lb |>  filter(LBTESTCD %in% c("ALB", "BILI"), !is.na(LBSTRESN), !is.na(VISITNUM)) |>  mutate(    PARAMCD = case_when(      LBTESTCD == "ALB" ~ "_ALB",      LBTESTCD == "BILI" ~ "_BILI"    ),    AVISITN = VISITNUM,    AVAL = LBSTRESN  ) |>  arrange(USUBJID, PARAMCD, AVISITN) |>  group_by(USUBJID, PARAMCD) |>  mutate(    PREV_AVAL = lag(AVAL),    CHG = AVAL - PREV_AVAL  ) |>  ungroup() |>  select(STUDYID, USUBJID, PARAMCD, AVISITN, AVAL, PREV_AVAL, CHG)dir.create("/app/output", showWarnings = FALSE)write_csv(adbc, "/app/output/adlbc.csv", na = "")

solutions/adam-adlbc-row-window/result.py

Edit
45 lines
# Reference solution for the yamaa benchmark adam-adlbc-row-window (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 pllb = pl.read_csv("/app/input/lb.csv", infer_schema=False).with_columns(    pl.col("LBSTRESN").cast(pl.Float64, strict=False).alias("AVAL"),    pl.col("VISITNUM").cast(pl.Int64, strict=False).alias("AVISITN"),)# Build the change parameters from albumin and bilirubin; any other test# produces no rows. A record with no numeric result gets no row.param_map = {"ALB": "_ALB", "BILI": "_BILI"}filtered = (    lb.filter(        pl.col("LBTESTCD").is_in(list(param_map.keys()))        & pl.col("AVAL").is_not_null()        & pl.col("AVISITN").is_not_null()    )    .with_columns(        PARAMCD=pl.col("LBTESTCD").replace_strict(param_map),    )    .select("STUDYID", "USUBJID", "PARAMCD", "AVISITN", "AVAL")    .sort(["USUBJID", "PARAMCD", "AVISITN"]))# The previous visit's value for the same subject and parameter, and the# change since that visit.adbc = (    filtered.with_columns(        PREV_AVAL=pl.col("AVAL").shift(1).over(["USUBJID", "PARAMCD"]),    )    .with_columns(        CHG=pl.col("AVAL") - pl.col("PREV_AVAL"),    )    .select("STUDYID", "USUBJID", "PARAMCD", "AVISITN", "AVAL", "PREV_AVAL", "CHG"))Path("/app/output").mkdir(exist_ok=True)adbc.write_csv("/app/output/adlbc.csv")

solutions/adam-adlbc-row-window/result.sas

Edit
28 lines
/* opensas reference solution for the yamaa benchmark adam-adlbc-row-window.   Reads the benchmark inputs and derives the requested output.   Execute with the existing opensas runtime: opensas /app/output/result.sas. */data lb;  length STUDYID USUBJID LBTESTCD $1024;  infile "/app/input/lb.csv" dsd dlm="," firstobs=2 truncover lrecl=32767;  input STUDYID : $char1024. USUBJID : $char1024. LBTESTCD : $char1024. LBSTRESN VISITNUM;run;data collected;  length PARAMCD $8;  set lb; if LBTESTCD in ('ALB','BILI') and not missing(LBSTRESN);  PARAMCD=cats('_',LBTESTCD); AVISITN=VISITNUM; AVAL=LBSTRESN;run;proc sort data=collected; by STUDYID USUBJID PARAMCD AVISITN; run;data result;  retain previous priorchange;  set collected; by STUDYID USUBJID PARAMCD;  if first.PARAMCD then do; previous=.; priorchange=.; end;  PREV_AVAL=previous; CHG=AVAL-PREV_AVAL; PREV2=priorchange;  previous=AVAL; priorchange=CHG;run;proc sql;  create table final as select STUDYID, USUBJID, PARAMCD, AVISITN, AVAL, PREV_AVAL, CHG from result;quit;proc export data=final outfile="/app/output/adlbc.csv" dbms=csv replace; run;