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: 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:BMIPCTLfor a collectedBMImeasurement,WGTPCTLfor a collectedWEIGHTmeasurement.PARAM:BMI-for-Age Percentile/Weight-for-Age Percentile, matchingPARAMCD.AVAL: the growth percentile, 100 times the standard normal cumulative probability of the LMS z-score: the collected result divided byM, raised to the powerL, minus 1, all divided byLtimesS. TheL,M, andSare the reference coefficients matched on measurement code, sex, and age in days. A measurement with no matching reference row, or with no collected result, leavesAVALmissing.
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.yamltakes the standard normal probability from the project'snormal_cdffunction, implemented once in each host.spec_norm_cdf.yamltakes it from the formula grammar'sNORM_CDFand needs no project; it writes the same bytes.
Inputs
Under review2 source filesinput/advs_raw.csv
Edit8 rows| STUDYID | USUBJID | AVISIT | PARAMCD | AVAL | AGE | SEX |
|---|---|---|---|---|---|---|
| YAMAA-01 | MONTH 12 | BMI | 16.2 | 365 | F | |
| YAMAA-01 | MONTH 12 | WEIGHT | 9.1 | 365 | F | |
| YAMAA-01 | MONTH 12 | BMI | 17.5 | 365 | M | |
| YAMAA-01 | MONTH 12 | WEIGHT | 10.0 | 365 | M | |
| YAMAA-01 | MONTH 24 | BMI | 17.0 | 730 | F | |
| YAMAA-01 | MONTH 24 | WEIGHT | 12.4 | 730 | F | |
| YAMAA-01 | MONTH 12 | BMI | 16.0 | 365 | F | |
| YAMAA-01 | MONTH 12 | BMI | — | 365 | F |
input/lms_ref.csv
Edit4 rows| PARAMCD | SEX | AGE | L | M | S |
|---|---|---|---|---|---|
| BMI | F | 365 | -0.8 | 16.0 | 0.08 |
| BMI | M | 365 | -0.7 | 16.5 | 0.08 |
| WEIGHT | F | 365 | -0.4 | 9.0 | 0.10 |
| WEIGHT | M | 365 | -0.3 | 9.6 | 0.10 |
Expected output
Under review8 expected rowsexpected/advs.csv
Edit8 rows| STUDYID | USUBJID | AVISIT | PARAMCD | PARAM | AVAL |
|---|---|---|---|---|---|
| YAMAA-01 | MONTH 12 | BMIPCTL | BMI-for-Age Percentile | 56.13971541306226 | |
| YAMAA-01 | MONTH 12 | WGTPCTL | Weight-for-Age Percentile | 54.389623884577375 | |
| YAMAA-01 | MONTH 12 | BMIPCTL | BMI-for-Age Percentile | 76.4411385545167 | |
| YAMAA-01 | MONTH 12 | WGTPCTL | Weight-for-Age Percentile | 65.75296725058702 | |
| YAMAA-01 | MONTH 24 | BMIPCTL | BMI-for-Age Percentile | — | |
| YAMAA-01 | MONTH 24 | WGTPCTL | Weight-for-Age Percentile | — | |
| YAMAA-01 | MONTH 12 | BMIPCTL | BMI-for-Age Percentile | 50 | |
| YAMAA-01 | MONTH 12 | BMIPCTL | BMI-for-Age Percentile | — |
Human review and assessment
| Dataset Name | Variable Name | Variable Label | Type | Codelist/Controlled Terms | Core | Computational Method | Origin |
|---|---|---|---|---|---|---|---|
| ADVS | STUDYID | Study Identifier | character | Copy value from ADVS_RAW.STUDYID. | Predecessor | ||
| ADVS | USUBJID | Unique Subject Identifier | character | Copy value from ADVS_RAW.USUBJID. | Predecessor | ||
| ADVS | AVISIT | Analysis Visit | character | Copy value from ADVS_RAW.AVISIT. | Predecessor | ||
| ADVS | PARAMCD | Parameter Code | character | BMIPCTL, WGTPCTL | If ADVS_RAW.PARAMCD = 'BMI' then "BMIPCTL"; If ADVS_RAW.PARAMCD = 'WEIGHT' then "WGTPCTL"; otherwise blank. | Derived | |
| ADVS | PARAM | Parameter | character | If PARAMCD = 'BMIPCTL' then "BMI-for-Age Percentile"; If PARAMCD = 'WGTPCTL' then "Weight-for-Age Percentile"; otherwise blank. | Derived | ||
| ADVS | AVAL | Analysis Value | numeric | Compute 100 * NORM_CDF(ZNUM). | Derived |
| Variable | Permitted values |
|---|---|
| PARAMCD | BMIPCTL, WGTPCTL |
| 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-advs-percentiles/full.md
Edit21 linesFollowing 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
Edit13 linesFollowing 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
Edit8 linesFollowing 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.
R
Edit4 lineslibrary(yamaa)yamaa_project("project.yaml")$spec("ADVS")$run()$save()yamaa_spec("spec_norm_cdf.yaml")$run()$outputPython
Edit4 linesimport yamaayamaa.project("project.yaml").spec("ADVS").run().save()yamaa.spec("spec_norm_cdf.yaml").run().outputsolutions/adam-advs-percentiles/result.R
Edit39 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
Edit74 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
Edit35 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;
yamaa