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.
- 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.
- Inputs: Do they look like data collected in a real trial, and do they include the situations you would expect to meet in one?
- 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
README.mdGoal: 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 review1 source fileinput/lb.csv
Edit8 rows| STUDYID | USUBJID | PARAMCD | AVAL | ANRLO |
|---|---|---|---|---|
| YAMAA-01 | ALT | 44 | 32 | |
| YAMAA-01 | ALT | 73.5 | 32 | |
| YAMAA-01 | ALT | 110 | 32 | |
| YAMAA-01 | ALT | 1 | 32 | |
| YAMAA-01 | ALT | 58 | — | |
| YAMAA-01 | ALT | 58 | 0 | |
| YAMAA-01 | ALT | — | 32 | |
| YAMAA-01 | AST | 28 | 32 |
Expected output
Under review8 expected rowsexpected/adlb.csv
Edit8 rows| STUDYID | USUBJID | PARAMCD | AVAL | ANRLO | R2ANRLO |
|---|---|---|---|---|---|
| YAMAA-01 | ALT | 44.0000 | 32.0000 | 1.3750 | |
| YAMAA-01 | ALT | 73.5000 | 32.0000 | 2.2969 | |
| YAMAA-01 | ALT | 110.0000 | 32.0000 | 3.4375 | |
| YAMAA-01 | ALT | 1.0000 | 32.0000 | 0.0313 | |
| YAMAA-01 | ALT | 58.0000 | — | — | |
| YAMAA-01 | ALT | 58.0000 | 0.0000 | — | |
| YAMAA-01 | ALT | — | 32.0000 | — | |
| YAMAA-01 | AST | 28.0000 | 32.0000 | 0.8750 |
Comments and assessment materials
| Dataset Name | Variable Name | Variable Label | Type | Codelist/Controlled Terms | Core | Computational Method | Origin |
|---|---|---|---|---|---|---|---|
| ADLB | STUDYID | Study Identifier | character | Copy value from LB.STUDYID. | Predecessor | ||
| ADLB | USUBJID | Unique Subject Identifier | character | Copy value from LB.USUBJID. | Predecessor | ||
| ADLB | PARAMCD | Parameter Code | character | Copy value from LB.PARAMCD. | Predecessor | ||
| ADLB | AVAL | Analysis Value | numeric | Copy value from LB.AVAL. | Predecessor | ||
| ADLB | ANRLO | Analysis Normal Range Lower Limit | numeric | Copy value from LB.ANRLO. | Predecessor | ||
| ADLB | R2ANRLO | Ratio to Lower Limit of Normal | numeric | Compute AVAL / NULLIF(ANRLO, 0). | Derived |
| Version | Date | Author | Description | Reviewer | Sign-off |
|---|---|---|---|---|---|
| 1.3 | 2026-09-29 | yamaa docs build | Show study codelist names, external dictionaries, and ISO 8601 formats in variable rows; list the document's codelist values and metadata | ||
| 1.2 | 2026-09-29 | yamaa docs build | Classify ADaM copies from a declared input as Predecessor and recodes as Derived, and SDTM recodes of locally derived columns as Derived | ||
| 1.1 | 2026-09-29 | yamaa docs build | Resolve lookups into the donor record they select, and give every derivation shape a plain-language rule instead of its raw YAML | ||
| 1.0 | yamaa docs build | Initial generation from spec.yaml |
prompts/adam-adlb-reported-precision/full.md
Edit13 linesFollowing 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
Edit11 linesFollowing 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
Edit8 linesFollowing 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.
run.R
Edit4 lineslibrary(yamaa)adlb <- yamaa_domain("spec.yaml")$outputadlbrun.py
Edit4 linesimport yamaaadlb = yamaa.yamaa_domain("spec.yaml").outputadlbsolutions/adam-adlb-reported-precision/result.R
Edit34 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
Edit41 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
Edit19 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;
yamaa
Comments
Signed in with GitHub; saved in repository Discussions