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: report each analysis value (AVAL) against the analysis normal range lower limit (ANRLO), adding R2ANRLO.

Input: laboratory (LB) records carrying the analysis value (AVAL) and the analysis normal range lower limit (ANRLO) for each test.

Variables:

  • R2ANRLO: the result as a multiple of the lower limit of the normal range; blank when the result or the lower limit was not collected, or the lower limit was recorded as zero.

Note: every number is reported to four places, so a result that needs fewer still shows them and a ratio that needs more is rounded exactly once, as it is written, with an exact half going away from zero (one thirty-second is reported as 0.0313). Nothing is rounded before the report: the ratio keeps every digit it was calculated with, and a number that was never collected is reported as absent rather than as four zeroes.

Inputs

Under review
1 source file

input/lb.csv

Edit
8 rows
input/lb.csv
STUDYIDUSUBJIDPARAMCDAVALANRLO
YAMAA-01ALT4432
YAMAA-01ALT73.532
YAMAA-01ALT11032
YAMAA-01ALT132
YAMAA-01ALT58—
YAMAA-01ALT580
YAMAA-01ALT—32
YAMAA-01AST2832

Expected output

Under review
8 expected rows

expected/adlb.csv

Edit
8 rows
expected/adlb.csv
STUDYIDUSUBJIDPARAMCDAVALANRLOR2ANRLO
YAMAA-01ALT44.000032.00001.3750
YAMAA-01ALT73.500032.00002.2969
YAMAA-01ALT110.000032.00003.4375
YAMAA-01ALT1.000032.00000.0313
YAMAA-01ALT58.0000——
YAMAA-01ALT58.00000.0000—
YAMAA-01ALT—32.0000—
YAMAA-01AST28.000032.00000.8750
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
ADLBUSUBJIDUnique Subject IdentifiercharacterCopy value from LB.USUBJID.Predecessor
ADLBPARAMCDParameter CodecharacterCopy value from LB.PARAMCD.Predecessor
ADLBAVALAnalysis ValuenumericCopy value from LB.AVAL.Predecessor
ADLBANRLOAnalysis Normal Range Lower LimitnumericCopy value from LB.ANRLO.Predecessor
ADLBR2ANRLORatio to Lower Limit of NormalnumericCompute AVAL / NULLIF(ANRLO, 0).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-adlb-reported-precision/full.md

Edit
13 lines

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

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

R2ANRLO is the result as a multiple of the lower limit of the normal range, rounded once to four decimal places, with an exact half rounded away from zero. It has no value when the result or the lower limit was not collected, or the lower limit was recorded as zero.

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

prompts/adam-adlb-reported-precision/conventions.md

Edit
11 lines

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

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

R2ANRLO is rounded once to four decimal places, with an exact half rounded away from zero.

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

prompts/adam-adlb-reported-precision/brief.md

Edit
8 lines

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

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

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

Edit
34 lines
# Reference solution for the yamaa benchmark adam-adlb-reported-precision (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(    AVAL = col_double(),    ANRLO = col_double(),    .default = col_character()  ))# The result as a multiple of the lower limit, rounded once to four places# with an exact half away from zero.adlb <- lb |>  mutate(    ratio = AVAL / ANRLO,    R2ANRLO = case_when(      is.na(AVAL) | is.na(ANRLO) | ANRLO == 0 ~ NA_real_,      ratio >= 0 ~ floor(ratio * 10000 + 0.5) / 10000,      .default = ceiling(ratio * 10000 - 0.5) / 10000    )  ) |>  arrange(USUBJID) |>  select(STUDYID, USUBJID, PARAMCD, AVAL, ANRLO, R2ANRLO)dir.create("/app/output", showWarnings = FALSE)write_csv(adlb, "/app/output/adlb.csv", na = "")

solutions/adam-adlb-reported-precision/result.py

Edit
41 lines
# Reference solution for the yamaa benchmark adam-adlb-reported-precision (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("AVAL").cast(pl.Float64, strict=False),    pl.col("ANRLO").cast(pl.Float64, strict=False).alias("ANRLO_NUM"),)# Keep the collected AVAL/ANRLO as numbers; the ratio is rounded once to# four places with half away from zero.ratio = pl.col("AVAL") / pl.col("ANRLO_NUM")rounded = (    pl.when(ratio >= 0)    .then(((ratio * 10000) + 0.5).floor() / 10000)    .otherwise(((ratio * 10000) - 0.5).ceil() / 10000))adlb = (    lb.with_columns(        ANRLO=pl.col("ANRLO_NUM"),        R2ANRLO=pl.when(            pl.col("AVAL").is_null()            | pl.col("ANRLO_NUM").is_null()            | (pl.col("ANRLO_NUM") == 0)        )        .then(None)        .otherwise(rounded),    )    .select("STUDYID", "USUBJID", "PARAMCD", "AVAL", "ANRLO", "R2ANRLO")    .sort("USUBJID"))Path("/app/output").mkdir(exist_ok=True)adlb.write_csv("/app/output/adlb.csv")

solutions/adam-adlb-reported-precision/result.sas

Edit
19 lines
/* opensas reference solution for the yamaa benchmark adam-adlb-reported-precision.   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 PARAMCD $1024;  infile "/app/input/lb.csv" dsd dlm="," firstobs=2 truncover lrecl=32767;  input STUDYID : $char1024. USUBJID : $char1024. PARAMCD : $char1024. AVAL ANRLO;run;data result;  set lb;  if not missing(AVAL) and not missing(ANRLO) and ANRLO ne 0 then R2ANRLO=round(AVAL/ANRLO,0.0001);run;proc sql;  create table final as select STUDYID, USUBJID, PARAMCD, AVAL, ANRLO, R2ANRLO from result;quit;proc export data=final outfile="/app/output/adlb.csv" dbms=csv replace; run;