Review ask

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

Lifecycle: reviewedEditUnder review
What this benchmark means
README.md

Public entries: Python and R. Passing coverage requires an installed inventory.

Goal: turn each collected body measurement (BMI or WEIGHT) into one growth-percentile record holding the percentile in AVAL; the collected records are not kept.

Input: collected measurements carrying the measurement code (PARAMCD), the collected result (AVAL, stored as text), sex (SEX), and age in days (AGE); alongside a sex-and-age growth reference carrying the coefficients L, M, and S for each measurement code, sex, and age in days.

Variables:

  • PARAMCD: BMIPCTL for a collected BMI measurement, WGTPCTL for a collected WEIGHT measurement.
  • PARAM: BMI-for-Age Percentile / Weight-for-Age Percentile, matching PARAMCD.
  • AVAL: the growth percentile, 100 times the standard normal cumulative probability of the LMS z-score: the collected result divided by M, raised to the power L, minus 1, all divided by L times S. The L, M, and S are the reference coefficients matched on measurement code, sex, and age in days. A measurement with no matching reference row, or with no collected result, leaves AVAL missing.

Note: a collected result exactly at the reference median (M) has a z-score of 0 and so a percentile of exactly 50.

Specification variants

  • spec_function.yaml takes the standard normal probability from the project's normal_cdf function, implemented once in each host.
  • spec_norm_cdf.yaml takes it from the formula grammar's NORM_CDF and needs no project; it writes the same bytes.

Inputs

Under review
2 source files

input/advs_raw.csv

Edit
8 rows
input/advs_raw.csv
STUDYIDUSUBJIDAVISITPARAMCDAVALAGESEX
YAMAA-01MONTH 12BMI16.2365F
YAMAA-01MONTH 12WEIGHT9.1365F
YAMAA-01MONTH 12BMI17.5365M
YAMAA-01MONTH 12WEIGHT10.0365M
YAMAA-01MONTH 24BMI17.0730F
YAMAA-01MONTH 24WEIGHT12.4730F
YAMAA-01MONTH 12BMI16.0365F
YAMAA-01MONTH 12BMI—365F

input/lms_ref.csv

Edit
4 rows
input/lms_ref.csv
PARAMCDSEXAGELMS
BMIF365-0.816.00.08
BMIM365-0.716.50.08
WEIGHTF365-0.49.00.10
WEIGHTM365-0.39.60.10

Expected output

Under review
8 expected rows

expected/advs.csv

Edit
8 rows
expected/advs.csv
STUDYIDUSUBJIDAVISITPARAMCDPARAMAVAL
YAMAA-01MONTH 12BMIPCTLBMI-for-Age Percentile56.13971541306226
YAMAA-01MONTH 12WGTPCTLWeight-for-Age Percentile54.389623884577375
YAMAA-01MONTH 12BMIPCTLBMI-for-Age Percentile76.4411385545167
YAMAA-01MONTH 12WGTPCTLWeight-for-Age Percentile65.75296725058702
YAMAA-01MONTH 24BMIPCTLBMI-for-Age Percentile—
YAMAA-01MONTH 24WGTPCTLWeight-for-Age Percentile—
YAMAA-01MONTH 12BMIPCTLBMI-for-Age Percentile50
YAMAA-01MONTH 12BMIPCTLBMI-for-Age Percentile—
Shaded columns are derived— = missing value

Human review and assessment

Your review

3 questions and your comments · View benchmark discussions

Mapping spec

Generated from the benchmark YAML; do not edit by hand

Dataset NameVariable NameVariable LabelTypeCodelist/Controlled TermsCoreComputational MethodOrigin
ADVSSTUDYIDStudy IdentifiercharacterCopy value from ADVS_RAW.STUDYID.Predecessor
ADVSUSUBJIDUnique Subject IdentifiercharacterCopy value from ADVS_RAW.USUBJID.Predecessor
ADVSAVISITAnalysis VisitcharacterCopy value from ADVS_RAW.AVISIT.Predecessor
ADVSPARAMCDParameter CodecharacterBMIPCTL, WGTPCTLIf ADVS_RAW.PARAMCD = 'BMI' then "BMIPCTL"; If ADVS_RAW.PARAMCD = 'WEIGHT' then "WGTPCTL"; otherwise blank.Derived
ADVSPARAMParametercharacterIf PARAMCD = 'BMIPCTL' then "BMI-for-Age Percentile"; If PARAMCD = 'WGTPCTL' then "Weight-for-Age Percentile"; otherwise blank.Derived
ADVSAVALAnalysis ValuenumericCompute 100 * NORM_CDF(ZNUM).Derived
VariablePermitted values
PARAMCDBMIPCTL, WGTPCTL
VersionDateAuthorDescriptionReviewerSign-off
1.72026-10-20yamaa docs buildRead 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.62026-10-17yamaa docs buildDescribe collected date parts written as ISO 8601 date text and times of day counted in seconds since midnight
1.52026-10-17yamaa docs buildName 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.42026-10-15yamaa docs buildState datetime precision codes through the hour and minute, and complete only the time parts a collected datetime lacks
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-advs-percentiles/full.md

Edit
21 lines

Following CDISC ADaM standards, use the provided ADVS_RAW and LMS_REF datasets to create an ADVS dataset with one record per subject per visit per parameter.

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

PARAMCD is "BMIPCTL" for a collected BMI measurement and "WGTPCTL" for a collected WEIGHT measurement. PARAM is "BMI-for-Age Percentile" when PARAMCD is "BMIPCTL" and "Weight-for-Age Percentile" when PARAMCD is "WGTPCTL". AVAL is the growth percentile of the collected result: 100 times the standard normal cumulative probability of its LMS z-score, where the z-score is the collected result divided by M, raised to the power L, minus 1, all divided by L times S. The L, M, and S are the reference coefficients matched on the measurement code, sex, and age in days. AVAL has no value when no reference row matches the measurement code, sex, and age in days, or when the collected result has no value. A collected result equal to M has a percentile of exactly 50. AVAL is not rounded.

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

prompts/adam-advs-percentiles/conventions.md

Edit
13 lines

Following CDISC ADaM standards, use the provided ADVS_RAW and LMS_REF datasets to create an ADVS dataset with one record per subject per visit per parameter.

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

PARAMCD is "BMIPCTL" for a collected BMI measurement and "WGTPCTL" for a collected WEIGHT measurement. PARAM is "BMI-for-Age Percentile" when PARAMCD is "BMIPCTL" and "Weight-for-Age Percentile" when PARAMCD is "WGTPCTL". AVAL is not rounded.

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

prompts/adam-advs-percentiles/brief.md

Edit
8 lines

Following CDISC ADaM standards, use the provided ADVS_RAW and LMS_REF datasets to create an ADVS dataset with one record per subject per visit per parameter.

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

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

yamaa code

Public calls generated from benchmark.yaml; results must match the expected output

R

Edit
4 lines
library(yamaa)yamaa_project("project.yaml")$spec("ADVS")$run()$save()yamaa_spec("spec_norm_cdf.yaml")$run()$output

Python

Edit
4 lines
import yamaayamaa.project("project.yaml").spec("ADVS").run().save()yamaa.spec("spec_norm_cdf.yaml").run().output

Solution without yamaa

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

solutions/adam-advs-percentiles/result.R

Edit
39 lines
# Reference solution for the yamaa benchmark adam-advs-percentiles (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)raw <- read_csv(  "/app/input/advs_raw.csv",  col_types = cols(AVAL = col_double(), AGE = col_integer(), .default = col_character()))ref <- read_csv(  "/app/input/lms_ref.csv",  col_types = cols(    AGE = col_integer(), L = col_double(), M = col_double(), S = col_double(),    .default = col_character()  ))# The growth percentile against the matched L, M, and S coefficients.advs <- raw |>  left_join(ref, by = c("PARAMCD", "SEX", "AGE")) |>  mutate(    Z = case_when(      is.na(AVAL) | is.na(L) | is.na(M) | is.na(S) | M == 0 | S == 0 ~ NA_real_,      L == 0 ~ log(AVAL / M) / S,      .default = ((AVAL / M) ^ L - 1) / (L * S)    ),    AVAL = 100 * pnorm(Z),    PARAMCD = if_else(PARAMCD == "BMI", "BMIPCTL", "WGTPCTL"),    PARAM = if_else(PARAMCD == "BMIPCTL", "BMI-for-Age Percentile", "Weight-for-Age Percentile")  ) |>  arrange(USUBJID, AVISIT, PARAMCD) |>  select(STUDYID, USUBJID, AVISIT, PARAMCD, PARAM, AVAL)dir.create("/app/output", showWarnings = FALSE)write_csv(advs, "/app/output/advs.csv", na = "")

solutions/adam-advs-percentiles/result.py

Edit
74 lines
# Reference solution for the yamaa benchmark adam-advs-percentiles (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."""Build ADVS growth percentiles from ADVS_RAW and LMS_REF.For each collected BMI or WEIGHT measurement, compute the LMS z-scoreusing the reference coefficients matched on measurement code, sex, andage in days, then convert to a percentile via the standard normal CDF."""import csvimport mathimport osINPUT_DIR = "/app/input"OUTPUT_DIR = "/app/output"PARAM_MAP = {    "BMI": ("BMIPCTL", "BMI-for-Age Percentile"),    "WEIGHT": ("WGTPCTL", "Weight-for-Age Percentile"),}def norm_cdf(z):    return 0.5 * (1.0 + math.erf(z / math.sqrt(2.0)))def main():    with open(os.path.join(INPUT_DIR, "lms_ref.csv"), newline="") as f:        ref = {}        for row in csv.DictReader(f):            key = (row["PARAMCD"], row["SEX"], int(row["AGE"]))            ref[key] = (float(row["L"]), float(row["M"]), float(row["S"]))    with open(os.path.join(INPUT_DIR, "advs_raw.csv"), newline="") as f:        raw_rows = list(csv.DictReader(f))    out_rows = []    for row in raw_rows:        code = row["PARAMCD"]        paramcd, param = PARAM_MAP[code]        aval = ""        value_text = (row["AVAL"] or "").strip()        coeffs = ref.get((code, row["SEX"], int(row["AGE"])))        if value_text != "" and coeffs is not None:            x = float(value_text)            L, M, S = coeffs            z = ((x / M) ** L - 1.0) / (L * S)            aval = 100.0 * norm_cdf(z)        out_rows.append(            {                "STUDYID": row["STUDYID"],                "USUBJID": row["USUBJID"],                "AVISIT": row["AVISIT"],                "PARAMCD": paramcd,                "PARAM": param,                "AVAL": aval,            }        )    os.makedirs(OUTPUT_DIR, exist_ok=True)    with open(os.path.join(OUTPUT_DIR, "advs.csv"), "w", newline="") as f:        writer = csv.DictWriter(            f, fieldnames=["STUDYID", "USUBJID", "AVISIT", "PARAMCD", "PARAM", "AVAL"]        )        writer.writeheader()        writer.writerows(out_rows)if __name__ == "__main__":    main()

solutions/adam-advs-percentiles/result.sas

Edit
35 lines
/* opensas reference solution for the yamaa benchmark adam-advs-percentiles.   Reads the benchmark inputs and derives the requested output.   Execute with the existing opensas runtime: opensas /app/output/result.sas. */data advs_raw;  length STUDYID USUBJID AVISIT PARAMCD SEX $1024;  infile "/app/input/advs_raw.csv" dsd dlm="," firstobs=2 truncover lrecl=32767;  input STUDYID : $char1024. USUBJID : $char1024. AVISIT : $char1024. PARAMCD : $char1024. AVAL AGE SEX : $char1024.;run;data lms_ref;  length PARAMCD SEX $1024;  infile "/app/input/lms_ref.csv" dsd dlm="," firstobs=2 truncover lrecl=32767;  input PARAMCD : $char1024. SEX : $char1024. AGE L M S;run;proc sql;  create table joined as select a.*,b.L,b.M,b.S from advs_raw as a left join lms_ref as b on a.PARAMCD=b.PARAMCD and a.SEX=b.SEX and a.AGE=b.AGE;quit;data result;  length PARAM $40;  set joined;  value=AVAL; AVAL=.;  if not missing(value) and not missing(M) and not missing(L) and not missing(S) then do;    if L=0 then z=log(value/M)/S; else z=((value/M)**L-1)/(L*S);    AVAL=100*probnorm(z);  end;  if PARAMCD='BMI' then do; PARAMCD='BMIPCTL'; PARAM='BMI-for-Age Percentile'; end;  else if PARAMCD='WEIGHT' then do; PARAMCD='WGTPCTL'; PARAM='Weight-for-Age Percentile'; end;run;proc sql;  create table final as select STUDYID, USUBJID, AVISIT, PARAMCD, PARAM, AVAL from result;quit;proc export data=final outfile="/app/output/advs.csv" dbms=csv replace; run;