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: derive one body mass index (BMI) record for each
collected weight record with a result, holding the index in AVAL.
Input: collected vital signs with height and weight records per subject and visit, plus each subject's baseline height.
Variables:
PARAMCDkeeps each collected test code (HEIGHT,WEIGHT) and marks each new recordBMI.PARAMkeeps each collected test name and labels each new recordBody Mass Index (kg/m^2).AVALkeeps each collected result. On a BMI record it is the collected weight in kilograms divided by the square of the baseline height in metres. It is empty when the baseline height is missing or zero. A weight record without a result gets no BMI record.
Note: a missing or zero baseline height leaves the BMI record in place with an empty value instead of dropping it; a weight record with no result is the only case that produces no BMI record.
Inputs
Under review2 source filesinput/adsl.csv
Edit4 rows| STUDYID | USUBJID | HEIGHTBL |
|---|---|---|
| YAMAA-01 | 147 | |
| YAMAA-01 | 163 | |
| YAMAA-01 | — | |
| YAMAA-01 | 0 |
input/vs.csv
Edit14 rows| STUDYID | USUBJID | VSSEQ | VSTESTCD | VSTEST | VSSTRESN | VISIT |
|---|---|---|---|---|---|---|
| YAMAA-01 | 1 | HEIGHT | Height (cm) | 147 | SCREENING | |
| YAMAA-01 | 2 | WEIGHT | Weight (kg) | 54 | SCREENING | |
| YAMAA-01 | 3 | WEIGHT | Weight (kg) | 54.4 | BASELINE | |
| YAMAA-01 | 4 | WEIGHT | Weight (kg) | 53.1 | WEEK 2 | |
| YAMAA-01 | 5 | WEIGHT | Weight (kg) | — | WEEK 4 | |
| YAMAA-01 | 1 | HEIGHT | Height (cm) | 163 | SCREENING | |
| YAMAA-01 | 2 | WEIGHT | Weight (kg) | 78.5 | SCREENING | |
| YAMAA-01 | 3 | WEIGHT | Weight (kg) | 80.3 | BASELINE | |
| YAMAA-01 | 4 | WEIGHT | Weight (kg) | 80.7 | WEEK 2 | |
| YAMAA-01 | 1 | WEIGHT | Weight (kg) | 68 | SCREENING | |
| YAMAA-01 | 2 | WEIGHT | Weight (kg) | 68.5 | BASELINE | |
| YAMAA-01 | 1 | HEIGHT | Height (cm) | 0 | SCREENING | |
| YAMAA-01 | 2 | WEIGHT | Weight (kg) | 70 | SCREENING | |
| YAMAA-01 | 3 | WEIGHT | Weight (kg) | 71.2 | BASELINE |
Expected output
Under review24 expected rowsexpected/advs.csv
Edit24 rows| STUDYID | USUBJID | AVISIT | PARAMCD | PARAM | AVAL |
|---|---|---|---|---|---|
| YAMAA-01 | SCREENING | HEIGHT | Height (cm) | 147 | |
| YAMAA-01 | SCREENING | WEIGHT | Weight (kg) | 54 | |
| YAMAA-01 | BASELINE | WEIGHT | Weight (kg) | 54.4 | |
| YAMAA-01 | WEEK 2 | WEIGHT | Weight (kg) | 53.1 | |
| YAMAA-01 | WEEK 4 | WEIGHT | Weight (kg) | — | |
| YAMAA-01 | SCREENING | HEIGHT | Height (cm) | 163 | |
| YAMAA-01 | SCREENING | WEIGHT | Weight (kg) | 78.5 | |
| YAMAA-01 | BASELINE | WEIGHT | Weight (kg) | 80.3 | |
| YAMAA-01 | WEEK 2 | WEIGHT | Weight (kg) | 80.7 | |
| YAMAA-01 | SCREENING | WEIGHT | Weight (kg) | 68 | |
| YAMAA-01 | BASELINE | WEIGHT | Weight (kg) | 68.5 | |
| YAMAA-01 | SCREENING | HEIGHT | Height (cm) | 0 | |
| YAMAA-01 | SCREENING | WEIGHT | Weight (kg) | 70 | |
| YAMAA-01 | BASELINE | WEIGHT | Weight (kg) | 71.2 | |
| YAMAA-01 | SCREENING | BMI | Body Mass Index (kg/m^2) | 24.989587671803417 | |
| YAMAA-01 | BASELINE | BMI | Body Mass Index (kg/m^2) | 25.17469572863159 | |
| YAMAA-01 | WEEK 2 | BMI | Body Mass Index (kg/m^2) | 24.573094543940027 | |
| YAMAA-01 | SCREENING | BMI | Body Mass Index (kg/m^2) | 29.545711167149687 | |
| YAMAA-01 | BASELINE | BMI | Body Mass Index (kg/m^2) | 30.22319244232 | |
| YAMAA-01 | WEEK 2 | BMI | Body Mass Index (kg/m^2) | 30.37374383680229 | |
| YAMAA-01 | SCREENING | BMI | Body Mass Index (kg/m^2) | — | |
| YAMAA-01 | BASELINE | BMI | Body Mass Index (kg/m^2) | — | |
| YAMAA-01 | SCREENING | BMI | Body Mass Index (kg/m^2) | — | |
| YAMAA-01 | BASELINE | BMI | Body Mass Index (kg/m^2) | — |
Comments and assessment materials
| Dataset Name | Variable Name | Variable Label | Type | Codelist/Controlled Terms | Core | Computational Method | Origin |
|---|---|---|---|---|---|---|---|
| ADVS | STUDYID | Study Identifier | character | Copy value from VS.STUDYID. | Predecessor | ||
| ADVS | USUBJID | Unique Subject Identifier | character | Copy value from VS.USUBJID. | Predecessor | ||
| ADVS | AVISIT | Analysis Visit Name | character | Copy value from VS.VISIT. | Predecessor | ||
| ADVS | PARAMCD | Parameter Code | character | Set per constructed row; see the Row construction sheet. | Derived | ||
| ADVS | PARAM | Parameter | character | Set per constructed row; see the Row construction sheet. | Derived | ||
| ADVS | AVAL | Analysis Value | numeric | Set per constructed row; see the Row construction sheet. | Derived |
| Template | Include when | PARAMCD | PARAM | HEIGHTBL | AVAL |
|---|---|---|---|---|---|
| collected | Copy VS.VSTESTCD | Copy VS.VSTEST | Constant "None" | Copy VS.VSSTRESN | |
| derived_bmi | VS.VSTESTCD = 'WEIGHT' AND VS.VSSTRESN IS NOT NULL | Constant "BMI" | Constant "Body Mass Index (kg/m^2)" | Copy ADSL.HEIGHTBL | Compute VS.VSSTRESN / NULLIF(HEIGHTBL * HEIGHTBL / 10000, 0) |
| 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-advs-bmi/full.md
Edit19 linesFollowing CDISC ADaM standards, use the provided VS and ADSL 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 keeps each collected test code and marks each new record "BMI"; PARAM keeps each collected test name and labels each new record "Body Mass Index (kg/m^2)".
AVAL keeps each collected result. On a BMI record it is the collected weight in kilograms divided by the square of the subject's baseline height in metres, not rounded. It has no value when the baseline height is missing or zero; the BMI record stays in place with no value. A weight record with no result gets no BMI record.
Read the source datasets from /app/input and save the completed dataset as /app/output/advs.csv.
prompts/adam-advs-bmi/conventions.md
Edit15 linesFollowing CDISC ADaM standards, use the provided VS and ADSL 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 keeps each collected test code and marks each new record "BMI"; PARAM keeps each collected test name and labels each new record "Body Mass Index (kg/m^2)".
On a BMI record AVAL is not rounded.
Read the source datasets from /app/input and save the completed dataset as /app/output/advs.csv.
prompts/adam-advs-bmi/brief.md
Edit9 linesFollowing CDISC ADaM standards, use the provided VS and ADSL 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.
run.R
Edit4 lineslibrary(yamaa)advs <- yamaa_domain("spec.yaml")$outputadvsrun.py
Edit4 linesimport yamaaadvs = yamaa.yamaa_domain("spec.yaml").outputadvssolutions/adam-advs-bmi/result.R
Edit45 lines# Reference solution for the yamaa benchmark adam-advs-bmi (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)vs <- read_csv( "/app/input/vs.csv", col_types = cols(VSSTRESN = col_double(), .default = col_character()))adsl <- read_csv( "/app/input/adsl.csv", col_types = cols(HEIGHTBL = col_double(), .default = col_character()))# Every collected result stays in place.collected <- vs |> select(STUDYID, USUBJID, AVISIT = VISIT, PARAMCD = VSTESTCD, PARAM = VSTEST, AVAL = VSSTRESN)# One BMI record for each weight with a result, using the subject's# baseline height in metres. Without a usable height the record stays# with no value.weights <- vs |> filter(VSTESTCD %in% "WEIGHT", !is.na(VSSTRESN)) |> left_join(adsl |> select(USUBJID, HEIGHTBL), by = "USUBJID") |> mutate( BMI = if_else( !is.na(HEIGHTBL) & HEIGHTBL != 0, VSSTRESN / ((HEIGHTBL / 100) ^ 2), NA_real_ ) ) |> transmute( STUDYID, USUBJID, AVISIT = VISIT, PARAMCD = "BMI", PARAM = "Body Mass Index (kg/m^2)", AVAL = BMI )advs <- bind_rows(collected, weights) |> arrange(USUBJID, AVISIT, PARAMCD)dir.create("/app/output", showWarnings = FALSE)write_csv(advs, "/app/output/advs.csv", na = "")solutions/adam-advs-bmi/result.py
Edit58 lines# Reference solution for the yamaa benchmark adam-advs-bmi (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 plvs = pl.read_csv("/app/input/vs.csv", infer_schema=False).with_columns( pl.col("VSSTRESN").cast(pl.Float64, strict=False))adsl = pl.read_csv("/app/input/adsl.csv", infer_schema=False).with_columns( pl.col("HEIGHTBL").cast(pl.Float64, strict=False))# Every collected result stays in place.collected = vs.select( "STUDYID", "USUBJID", AVISIT="VISIT", PARAMCD="VSTESTCD", PARAM="VSTEST", AVAL="VSSTRESN",)# One BMI record for each weight with a result, using the subject's# baseline height in metres. Without a usable height the record stays# with no value.weights = ( vs.filter( (pl.col("VSTESTCD") == "WEIGHT") & pl.col("VSSTRESN").is_not_null() ) .join(adsl.select("USUBJID", "HEIGHTBL"), on="USUBJID", how="left") .with_columns( BMI=pl.when( pl.col("HEIGHTBL").is_not_null() & (pl.col("HEIGHTBL") != 0) ) .then(pl.col("VSSTRESN") / ((pl.col("HEIGHTBL") / 100) ** 2)) .otherwise(None) ) .select( "STUDYID", "USUBJID", AVISIT="VISIT", PARAMCD=pl.lit("BMI"), PARAM=pl.lit("Body Mass Index (kg/m^2)"), AVAL="BMI", ))advs = pl.concat([collected, weights], how="diagonal").sort( ["USUBJID", "AVISIT", "PARAMCD"])Path("/app/output").mkdir(parents=True, exist_ok=True)advs.write_csv("/app/output/advs.csv")solutions/adam-advs-bmi/result.sas
Edit32 lines/* opensas reference solution for the yamaa benchmark adam-advs-bmi. Reads the benchmark inputs and derives the requested output. Execute with the existing opensas runtime: opensas /app/output/result.sas. */data adsl; length STUDYID USUBJID $1024; infile "/app/input/adsl.csv" dsd dlm="," firstobs=2 truncover lrecl=32767; input STUDYID : $char1024. USUBJID : $char1024. HEIGHTBL;run;data vs; length STUDYID USUBJID VSTESTCD VSTEST VISIT $1024; infile "/app/input/vs.csv" dsd dlm="," firstobs=2 truncover lrecl=32767; input STUDYID : $char1024. USUBJID : $char1024. VSSEQ VSTESTCD : $char1024. VSTEST : $char1024. VSSTRESN VISIT : $char1024.;run;proc sql; create table joined as select a.*,b.HEIGHTBL from vs as a left join adsl as b on a.STUDYID=b.STUDYID and a.USUBJID=b.USUBJID; quit;data result; length AVISIT $1024 PARAMCD $16 PARAM $1024; set joined; AVISIT=VISIT; PARAMCD=VSTESTCD; PARAM=VSTEST; AVAL=VSSTRESN; output; if VSTESTCD='WEIGHT' and not missing(VSSTRESN) then do; PARAMCD='BMI'; PARAM='Body Mass Index (kg/m^2)'; AVAL=.; if not missing(HEIGHTBL) and HEIGHTBL ne 0 then AVAL=VSSTRESN/(HEIGHTBL/100)**2; output; 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
Comments
Signed in with GitHub; saved in repository Discussions