As a clinical trial statistician or programmer, answer three short questions in Your review: the task, the inputs and outputs, and the AI-assisted review. Agreeing with all three approves this benchmark; disagreeing with any needs a comment. Propose a fix with the Edit button on any source file, or add it to your comments.
We suggest spending no more than 5 minutes on a review. The other tabs beside Your review are background for assessment, not under review.
Summary
README.mdPublic entries: Python and R. Passing coverage requires an installed inventory.
Goal: derive the lower (ANRLO) and upper (ANRHI) limit of each
laboratory parameter's 95% reference range from the study's own results,
and give both on every record of the parameter.
Input: standardized laboratory results (LB), one result per subject and test, with no result when the test was not done.
Variables:
AVAL: the standardized numeric result; empty when the test was not done.ANRLO: the mean of the parameter's results less 1.96 standard deviations: exactly, the standard normal distribution's 97.5th percentile times the sample standard deviation, with divisor one less than the number of results. The same on every record of the parameter, including one without a result. It is not rounded.ANRHI: the mean plus the same multiple of the standard deviation, under the same terms.
Note: a test not done takes no part in its parameter's mean or standard deviation, and each parameter's limits come from its own results alone. The limits bound the central 95% of a normal distribution with that mean and standard deviation.
Inputs
Under review1 source fileinput/lb.csv
Edit18 rows| STUDYID | DOMAIN | USUBJID | LBSEQ | LBTESTCD | LBTEST | LBSTRESN | LBSTRESU | LBSTAT |
|---|---|---|---|---|---|---|---|---|
| YAMAA-01 | LB | 1 | ALT | Alanine Aminotransferase | 14 | U/L | — | |
| YAMAA-01 | LB | 2 | PLAT | Platelets | 245 | 10^9/L | — | |
| YAMAA-01 | LB | 3 | SODIUM | Sodium | 137 | mmol/L | — | |
| YAMAA-01 | LB | 1 | ALT | Alanine Aminotransferase | 21 | U/L | — | |
| YAMAA-01 | LB | 2 | PLAT | Platelets | 198 | 10^9/L | — | |
| YAMAA-01 | LB | 3 | SODIUM | Sodium | 141 | mmol/L | — | |
| YAMAA-01 | LB | 1 | ALT | Alanine Aminotransferase | — | — | NOT DONE | |
| YAMAA-01 | LB | 2 | PLAT | Platelets | 310 | 10^9/L | — | |
| YAMAA-01 | LB | 3 | SODIUM | Sodium | 139 | mmol/L | — | |
| YAMAA-01 | LB | 1 | ALT | Alanine Aminotransferase | 35 | U/L | — | |
| YAMAA-01 | LB | 2 | PLAT | Platelets | 262 | 10^9/L | — | |
| YAMAA-01 | LB | 3 | SODIUM | Sodium | 142 | mmol/L | — | |
| YAMAA-01 | LB | 1 | ALT | Alanine Aminotransferase | 18 | U/L | — | |
| YAMAA-01 | LB | 2 | PLAT | Platelets | 221 | 10^9/L | — | |
| YAMAA-01 | LB | 3 | SODIUM | Sodium | 139 | mmol/L | — | |
| YAMAA-01 | LB | 1 | ALT | Alanine Aminotransferase | 27 | U/L | — | |
| YAMAA-01 | LB | 2 | PLAT | Platelets | 287 | 10^9/L | — | |
| YAMAA-01 | LB | 3 | SODIUM | Sodium | 142 | mmol/L | — |
Expected output
Under review18 expected rowsexpected/adlb.csv
Edit18 rows| STUDYID | USUBJID | PARAMCD | AVAL | ANRLO | ANRHI |
|---|---|---|---|---|---|
| YAMAA-01 | ALT | 14 | 6.89725270654559 | 39.102747293454414 | |
| YAMAA-01 | PLAT | 245 | 172.57239767451978 | 335.0942689921469 | |
| YAMAA-01 | SODIUM | 137 | 136.0800720309199 | 143.9199279690801 | |
| YAMAA-01 | ALT | 21 | 6.89725270654559 | 39.102747293454414 | |
| YAMAA-01 | PLAT | 198 | 172.57239767451978 | 335.0942689921469 | |
| YAMAA-01 | SODIUM | 141 | 136.0800720309199 | 143.9199279690801 | |
| YAMAA-01 | ALT | — | 6.89725270654559 | 39.102747293454414 | |
| YAMAA-01 | PLAT | 310 | 172.57239767451978 | 335.0942689921469 | |
| YAMAA-01 | SODIUM | 139 | 136.0800720309199 | 143.9199279690801 | |
| YAMAA-01 | ALT | 35 | 6.89725270654559 | 39.102747293454414 | |
| YAMAA-01 | PLAT | 262 | 172.57239767451978 | 335.0942689921469 | |
| YAMAA-01 | SODIUM | 142 | 136.0800720309199 | 143.9199279690801 | |
| YAMAA-01 | ALT | 18 | 6.89725270654559 | 39.102747293454414 | |
| YAMAA-01 | PLAT | 221 | 172.57239767451978 | 335.0942689921469 | |
| YAMAA-01 | SODIUM | 139 | 136.0800720309199 | 143.9199279690801 | |
| YAMAA-01 | ALT | 27 | 6.89725270654559 | 39.102747293454414 | |
| YAMAA-01 | PLAT | 287 | 172.57239767451978 | 335.0942689921469 | |
| YAMAA-01 | SODIUM | 142 | 136.0800720309199 | 143.9199279690801 |
Human review and assessment
| 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.LBTESTCD. | Predecessor | ||
| ADLB | AVAL | Analysis Value | numeric | Copy value from LB.LBSTRESN. | Predecessor | ||
| ADLB | ANRLO | Analysis Normal Range Lower Limit | numeric | Aggregate MEAN(AVAL) - NORM_INV(0.975) * STDDEV(AVAL) over records grouped by STUDYID, PARAMCD, matching on the shared output keys. | Derived | ||
| ADLB | ANRHI | Analysis Normal Range Upper Limit | numeric | Aggregate MEAN(AVAL) + NORM_INV(0.975) * STDDEV(AVAL) over records grouped by STUDYID, PARAMCD, matching on the shared output keys. | Derived |
| Version | Date | Author | Description | Reviewer | Sign-off |
|---|---|---|---|---|---|
| 1.7 | 2026-10-20 | yamaa docs build | Read a specification in the 1.0 surface as its 0.5 counterpart; state that missing values stay missing where a mapping declares no missing handler, and leave out a declared missing answer that restates a handler's default | ||
| 1.6 | 2026-10-17 | yamaa docs build | Describe collected date parts written as ISO 8601 date text and times of day counted in seconds since midnight | ||
| 1.5 | 2026-10-17 | yamaa docs build | Name collected precision in words instead of letter codes; state imputation fallbacks, minimum source precision, bounds ignored outside the collected period, and invalid text with no handler as an error; describe date and datetime shifts, imputation flag codes, and partial text giving no date part | ||
| 1.4 | 2026-10-15 | yamaa docs build | State datetime precision codes through the hour and minute, and complete only the time parts a collected datetime lacks | ||
| 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-reference-limits/full.md
Edit25 linesFollowing CDISC ADaM standards, use the provided LB dataset to create an ADLB dataset with one record per subject per parameter.
The output dataset should contain the following columns in this order: STUDYID, USUBJID, PARAMCD, AVAL, ANRLO, ANRHI
Each LB record, including a test not done, gives one output record. PARAMCD is the lab test code (LBTESTCD) as given. AVAL is the standardized numeric result (LBSTRESN), and has no value when the test was not done. ANRLO and ANRHI are the lower and upper limits of the parameter's 95% reference range, estimated from the study's own results:
- ANRLO is the mean of the parameter's results less z times their sample standard deviation, and ANRHI is the mean plus z times it.
- z is the standard normal distribution's 97.5th percentile at full precision (1.9599639845400536), not the rounded 1.96.
- The standard deviation has divisor one less than the number of results.
- A test not done takes no part in its parameter's mean, standard deviation or number of results, and each parameter's limits come from its own results alone.
- Both limits are the same on every record of the parameter, including a record without a result.
- Neither limit is rounded.
Read the source datasets from /app/input and save the completed dataset as /app/output/adlb.csv.
prompts/adam-adlb-reference-limits/conventions.md
Edit11 linesFollowing CDISC ADaM standards, use the provided LB dataset to create an ADLB dataset with one record per subject per parameter.
The output dataset should contain the following columns in this order: STUDYID, USUBJID, PARAMCD, AVAL, ANRLO, ANRHI
ANRLO and ANRHI are the lower and upper limits of the parameter's 95% reference range. Neither limit is rounded.
Read the source datasets from /app/input and save the completed dataset as /app/output/adlb.csv.
prompts/adam-adlb-reference-limits/brief.md
Edit8 linesFollowing CDISC ADaM standards, use the provided LB dataset to create an ADLB dataset with one record per subject per parameter.
The output dataset should contain the following columns in this order: STUDYID, USUBJID, PARAMCD, AVAL, ANRLO, ANRHI
Read the source datasets from /app/input and save the completed dataset as /app/output/adlb.csv.
R
Edit3 lineslibrary(yamaa)yamaa_spec("spec.yaml")$run()$outputPython
Edit3 linesimport yamaayamaa.spec("spec.yaml").run().outputsolutions/adam-adlb-reference-limits/result.R
Edit31 lines# Reference solution for the yamaa benchmark adam-adlb-reference-limits (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.lb <- read.csv( "/app/input/lb.csv", colClasses = c(LBSTRESN = "numeric"), na.strings = "", stringsAsFactors = FALSE)# Each parameter's 95% reference range from the study's results: the mean# less and plus the standard normal 0.975 quantile times the sample standard# deviation, a test not done left out.limit <- function(values, sign) { mean(values, na.rm = TRUE) + sign * qnorm(0.975) * sd(values, na.rm = TRUE)}adlb <- data.frame( STUDYID = lb$STUDYID, USUBJID = lb$USUBJID, PARAMCD = lb$LBTESTCD, AVAL = lb$LBSTRESN, ANRLO = ave(lb$LBSTRESN, lb$LBTESTCD, FUN = function(x) limit(x, -1)), ANRHI = ave(lb$LBSTRESN, lb$LBTESTCD, FUN = function(x) limit(x, 1)))dir.create("/app/output", showWarnings = FALSE)write.csv(adlb, "/app/output/adlb.csv", row.names = FALSE, na = "")solutions/adam-adlb-reference-limits/result.py
Edit60 lines# Reference solution for the yamaa benchmark adam-adlb-reference-limits (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.import csvimport statisticsLB_CSV = "/app/input/lb.csv"OUTPUT_CSV = "/app/output/adlb.csv"def number(text): text = text.strip() return float(text) if text else Nonedef cell(value): return "" if value is None else repr(value)def main(): with open(LB_CSV, newline="") as f: lb = list(csv.DictReader(f)) # Each parameter's results, a test not done left out. results = {} for row in lb: value = number(row["LBSTRESN"]) if value is not None: results.setdefault(row["LBTESTCD"], []).append(value) z = statistics.NormalDist().inv_cdf(0.975) limits = {} for test, values in results.items(): mean = statistics.fmean(values) sd = statistics.stdev(values) limits[test] = (mean - z * sd, mean + z * sd) fieldnames = ["STUDYID", "USUBJID", "PARAMCD", "AVAL", "ANRLO", "ANRHI"] with open(OUTPUT_CSV, "w", newline="") as f: writer = csv.DictWriter(f, fieldnames=fieldnames) writer.writeheader() for row in lb: low, high = limits.get(row["LBTESTCD"], (None, None)) writer.writerow( { "STUDYID": row["STUDYID"], "USUBJID": row["USUBJID"], "PARAMCD": row["LBTESTCD"], "AVAL": cell(number(row["LBSTRESN"])), "ANRLO": cell(low), "ANRHI": cell(high), } )if __name__ == "__main__": main()solutions/adam-adlb-reference-limits/result.sas
Edit42 lines/* opensas reference solution for the yamaa benchmark adam-adlb-reference-limits. Reads the benchmark inputs and derives the requested output. Execute with the existing opensas runtime: opensas /app/output/result.sas. */data lb; length STUDYID DOMAIN USUBJID LBTESTCD LBTEST LBSTRESU LBSTAT $40; infile "/app/input/lb.csv" dsd dlm="," firstobs=2 truncover lrecl=32767; input STUDYID : $char40. DOMAIN : $char40. USUBJID : $char40. LBSEQ LBTESTCD : $char40. LBTEST : $char40. LBSTRESN LBSTRESU : $char40. LBSTAT : $char40.;run;/* The results of each parameter; a test not done has none and takes no part. */data results; set lb; if not missing(LBSTRESN);run;/* Each parameter's mean and sample standard deviation (divisor n - 1), and its limits at the mean less and plus the standard normal 0.975 quantile, probit(0.975) = 1.959963984540054, times that deviation. */proc sql; create table means as select LBTESTCD, mean(LBSTRESN) as M, count(*) as N from results group by LBTESTCD; create table squares as select r.LBTESTCD, m.M, m.N, (r.LBSTRESN - m.M) * (r.LBSTRESN - m.M) as SQ from results as r inner join means as m on m.LBTESTCD = r.LBTESTCD; create table limits as select LBTESTCD, M - 1.959963984540054 * sqrt(sum(SQ) / (N - 1)) as ANRLO, M + 1.959963984540054 * sqrt(sum(SQ) / (N - 1)) as ANRHI from squares group by LBTESTCD, M, N; create table final as select l.STUDYID, l.USUBJID, l.LBTESTCD as PARAMCD length=40, l.LBSTRESN as AVAL, s.ANRLO, s.ANRHI from lb as l left join limits as s on s.LBTESTCD = l.LBTESTCD order by 1, 2, 3;quit;proc export data=final outfile="/app/output/adlb.csv" dbms=csv replace; run;
yamaa