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: carry the supplemental qualifier value onto each analysis laboratory row (QVAL, QVAL_NAMED).

Input: laboratory records carry a numeric sequence number; supplemental records carry the same sequence as eight-character, space-padded text. Two subjects may share a sequence number.

Variables:

  • QVAL is the qualifier value from the supplemental record whose study, subject, and padded sequence all match; empty when nothing matches.
  • QVAL_NAMED holds the same value from the same match, taken again once every laboratory row exists; empty when nothing matches.

Note: the padding must be exact: a zero-padded key does not match the space-padded form, and a supplemental record with no laboratory record changes nothing. Rows in both sequence ranges use the same match.

Inputs

Under review
2 source files

input/lb.csv

Edit
6 rows
input/lb.csv
STUDYIDUSUBJIDLBSEQ
YAMAA-017
YAMAA-01200
YAMAA-01259
YAMAA-01259
YAMAA-0142
YAMAA-01311

input/supplb.csv

Edit
7 rows
input/supplb.csv
STUDYIDUSUBJIDIDVARVALQVAL
YAMAA-01 7OTHER
YAMAA-01 200BOUND
YAMAA-01 259EP
YAMAA-01 999ORPHAN
YAMAA-01 259SHARED
YAMAA-0100000259ZEROPAD
YAMAA-01 42SINGLE

Expected output

Under review
6 expected rows

expected/adlb.csv

Edit
6 rows
expected/adlb.csv
STUDYIDUSUBJIDLBSEQQVALQVAL_NAMED
YAMAA-017OTHEROTHER
YAMAA-0142SINGLESINGLE
YAMAA-01200BOUNDBOUND
YAMAA-01259EPEP
YAMAA-01259SHAREDSHARED
YAMAA-01311——
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
ADLBSTUDYIDStudy IdentifiercharacterCopy value from LB.STUDYID.Predecessor
ADLBUSUBJIDSubject IdentifiercharacterCopy value from LB.USUBJID.Predecessor
ADLBLBSEQSequence NumbernumericCopy value from LB.LBSEQ.Predecessor
ADLBQVALSupplemental ValuecharacterSet per constructed row; see the Row construction sheet.Derived
ADLBQVAL_NAMEDSupplemental Value by Named IntermediatecharacterTake QVAL from the SUPPLB record whose STUDYID equals LB.STUDYID, USUBJID equals LB.USUBJID and IDVARVAL equals LBSEQ padded on the left with spaces to at least 8 characters, and no match yields blank.Derived
TemplateInclude whenQVAL
low_sequenceLB.LBSEQ < 200Copy QVAL from the SUPPLB record whose STUDYID equals LB.STUDYID, USUBJID equals LB.USUBJID and IDVARVAL equals LBSEQ padded on the left with spaces to at least 8 characters, and no match yields blank
high_sequenceLB.LBSEQ >= 200Copy QVAL from the SUPPLB record whose STUDYID equals LB.STUDYID, USUBJID equals LB.USUBJID and IDVARVAL equals LBSEQ padded on the left with spaces to at least 8 characters, and no match yields blank
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-adlb-supplb-padded-key/full.md

Edit
15 lines

Following CDISC ADaM standards, use the provided LB and SUPPLB datasets to create an ADLB dataset with one record per laboratory row.

The output dataset should contain the following columns in this order: STUDYID, USUBJID, LBSEQ, QVAL, QVAL_NAMED

QVAL is the qualifier value from the supplemental record with the same study and subject whose IDVARVAL is the laboratory sequence number written as eight characters, right-aligned and padded with spaces; it has no value when no such record exists. The padding must be exact: a zero-padded IDVARVAL does not match, and a supplemental record with no laboratory record adds no row. QVAL_NAMED repeats QVAL.

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

prompts/adam-adlb-supplb-padded-key/conventions.md

Edit
11 lines

Following CDISC ADaM standards, use the provided LB and SUPPLB datasets to create an ADLB dataset with one record per laboratory row.

The output dataset should contain the following columns in this order: STUDYID, USUBJID, LBSEQ, QVAL, QVAL_NAMED

IDVARVAL is the laboratory sequence number written as eight characters, right-aligned and padded with spaces.

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

prompts/adam-adlb-supplb-padded-key/brief.md

Edit
8 lines

Following CDISC ADaM standards, use the provided LB and SUPPLB datasets to create an ADLB dataset with one record per laboratory row.

The output dataset should contain the following columns in this order: STUDYID, USUBJID, LBSEQ, QVAL, QVAL_NAMED

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

yamaa code

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

run.R

Edit
4 lines
library(yamaa)adlb <- yamaa_domain("spec.yaml")$outputadlb

run.py

Edit
4 lines
import yamaaadlb = yamaa.yamaa_domain("spec.yaml").outputadlb

Solution without yamaa

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

solutions/adam-adlb-supplb-padded-key/result.R

Edit
35 lines
# Reference solution for the yamaa benchmark adam-adlb-supplb-padded-key (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(stringr)lb <- read_csv(  "/app/input/lb.csv",  col_types = cols(LBSEQ = col_integer(), .default = col_character()))supp <- read_csv(  "/app/input/supplb.csv",  col_types = cols(.default = col_character()),  trim_ws = FALSE)# The qualifier value whose IDVARVAL is the laboratory sequence number as# eight characters, right-aligned and space-padded. Zero-padded keys do# not match; a supplemental record with no laboratory record adds no row.adlb <- lb |>  mutate(PADDED_KEY = str_pad(as.character(LBSEQ), width = 8, side = "left", pad = " ")) |>  left_join(    supp |> select(STUDYID, USUBJID, IDVARVAL, QVAL),    by = c("STUDYID", "USUBJID", "PADDED_KEY" = "IDVARVAL")  ) |>  mutate(QVAL_NAMED = QVAL) |>  arrange(LBSEQ, USUBJID) |>  select(STUDYID, USUBJID, LBSEQ, QVAL, QVAL_NAMED)dir.create("/app/output", showWarnings = FALSE)write_csv(adlb, "/app/output/adlb.csv", na = "")

solutions/adam-adlb-supplb-padded-key/result.py

Edit
37 lines
# Reference solution for the yamaa benchmark adam-adlb-supplb-padded-key (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("LBSEQ").cast(pl.Int64, strict=False))supp = pl.read_csv("/app/input/supplb.csv", infer_schema=False)# The qualifier value whose IDVARVAL is the laboratory sequence number as# eight characters, right-aligned and space-padded. Zero-padded keys do# not match; a supplemental record with no laboratory record adds no row.lb_keys = lb.with_columns(    PADDED_KEY=pl.col("LBSEQ").cast(pl.String).str.pad_start(8, " "))adlb = (    lb_keys.join(        supp.select("STUDYID", "USUBJID", "IDVARVAL", QVAL="QVAL"),        left_on=["STUDYID", "USUBJID", "PADDED_KEY"],        right_on=["STUDYID", "USUBJID", "IDVARVAL"],        how="left",        maintain_order="left",    )    .with_columns(QVAL_NAMED=pl.col("QVAL"))    .select("STUDYID", "USUBJID", "LBSEQ", "QVAL", "QVAL_NAMED")    .sort(["LBSEQ", "USUBJID"]))Path("/app/output").mkdir(exist_ok=True)adlb.write_csv("/app/output/adlb.csv")

solutions/adam-adlb-supplb-padded-key/result.sas

Edit
26 lines
/* opensas reference solution for the yamaa benchmark adam-adlb-supplb-padded-key.   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 $1024;  infile "/app/input/lb.csv" dsd dlm="," firstobs=2 truncover lrecl=32767;  input STUDYID : $char1024. USUBJID : $char1024. LBSEQ;run;data supplb;  length STUDYID USUBJID IDVARVAL QVAL $1024;  infile "/app/input/supplb.csv" dsd dlm="," firstobs=2 truncover lrecl=32767;  input STUDYID : $char1024. USUBJID : $char1024. IDVARVAL : $char1024. QVAL : $char1024.;run;data lb_key; set lb; length PARENTKEY $8; PARENTKEY=put(LBSEQ,8.); run;proc sql;  create table result as  select a.*,b.QVAL,b.QVAL as QVAL_NAMED from lb_key as a left join supplb as b on a.STUDYID=b.STUDYID and a.USUBJID=b.USUBJID and a.PARENTKEY=b.IDVARVAL;quit;proc sql;  create table final as select STUDYID, USUBJID, LBSEQ, QVAL, QVAL_NAMED from result;quit;proc export data=final outfile="/app/output/adlb.csv" dbms=csv replace; run;