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: build the change parameters _ALB and _BILI from albumin
and bilirubin lab results, carrying each visit's previous result
(PREV_AVAL) and the change from it (CHG).
Input: laboratory (LB) records carrying a test code (LBTESTCD), a
numeric result (LBSTRESN), and a visit number (VISITNUM). Five
subjects: one with both tests across several visits, one with both
tests but a single albumin visit, one whose first albumin visit has
no result plus a single bilirubin visit, one albumin-only, and one
with hemoglobin only, which produces no rows.
Variables:
AVISITN: the analysis visit number, taken from the lab visit number.AVAL: the numeric lab result for the visit.PREV_AVAL: theAVALof the visit just before inAVISITNorder, for the same subject and parameter, so an_ALBrow never reads a_BILIvalue; blank on the subject's first visit for the parameter.CHG:AVAL - PREV_AVAL, the change since that visit; blank wheneverPREV_AVALis.
Note: a record with no numeric result gets no row, so the previous
value and the change skip that visit and compare with the latest
earlier visit that has a result. CHG here is the change from the
previous visit, not the ADaMIG "change from baseline" definition.
Single-visit subjects have blank PREV_AVAL and CHG; equal
consecutive values give CHG 0.
Inputs
Under review1 source fileinput/lb.csv
Edit19 rows| STUDYID | USUBJID | LBTESTCD | LBSTRESN | VISITNUM |
|---|---|---|---|---|
| YAMAA-01 | ALB | 4.0 | 1 | |
| YAMAA-01 | ALB | 4.5 | 2 | |
| YAMAA-01 | ALB | — | 3 | |
| YAMAA-01 | ALB | 4.75 | 4 | |
| YAMAA-01 | BILI | 1.0 | 1 | |
| YAMAA-01 | BILI | 1.25 | 2 | |
| YAMAA-01 | BILI | 1.5 | 3 | |
| YAMAA-01 | ALB | 3.75 | 1 | |
| YAMAA-01 | BILI | 2.0 | 1 | |
| YAMAA-01 | BILI | 2.25 | 2 | |
| YAMAA-01 | ALB | — | 1 | |
| YAMAA-01 | ALB | 3.5 | 2 | |
| YAMAA-01 | ALB | 3.75 | 3 | |
| YAMAA-01 | BILI | 0.75 | 1 | |
| YAMAA-01 | ALB | 4.0 | 1 | |
| YAMAA-01 | ALB | 4.0 | 2 | |
| YAMAA-01 | ALB | 3.5 | 3 | |
| YAMAA-01 | HGB | 14.2 | 1 | |
| YAMAA-01 | HGB | 14.5 | 2 |
Expected output
Under review15 expected rowsexpected/adlbc.csv
Edit15 rows| STUDYID | USUBJID | PARAMCD | AVISITN | AVAL | PREV_AVAL | CHG |
|---|---|---|---|---|---|---|
| YAMAA-01 | _ALB | 1 | 4 | — | — | |
| YAMAA-01 | _ALB | 2 | 4.5 | 4 | 0.5 | |
| YAMAA-01 | _ALB | 4 | 4.75 | 4.5 | 0.25 | |
| YAMAA-01 | _BILI | 1 | 1 | — | — | |
| YAMAA-01 | _BILI | 2 | 1.25 | 1 | 0.25 | |
| YAMAA-01 | _BILI | 3 | 1.5 | 1.25 | 0.25 | |
| YAMAA-01 | _ALB | 1 | 3.75 | — | — | |
| YAMAA-01 | _BILI | 1 | 2 | — | — | |
| YAMAA-01 | _BILI | 2 | 2.25 | 2 | 0.25 | |
| YAMAA-01 | _ALB | 2 | 3.5 | — | — | |
| YAMAA-01 | _ALB | 3 | 3.75 | 3.5 | 0.25 | |
| YAMAA-01 | _BILI | 1 | 0.75 | — | — | |
| YAMAA-01 | _ALB | 1 | 4 | — | — | |
| YAMAA-01 | _ALB | 2 | 4 | 4 | 0 | |
| YAMAA-01 | _ALB | 3 | 3.5 | 4 | -0.5 |
Human review and assessment
| Dataset Name | Variable Name | Variable Label | Type | Codelist/Controlled Terms | Core | Computational Method | Origin |
|---|---|---|---|---|---|---|---|
| ADLBC | STUDYID | Study Identifier | character | Copy value from LB.STUDYID. | Predecessor | ||
| ADLBC | USUBJID | Unique Subject Identifier | character | Copy value from LB.USUBJID. | Predecessor | ||
| ADLBC | PARAMCD | Parameter Code | character | Set per constructed row; see the Row construction sheet. | Derived | ||
| ADLBC | AVISITN | Analysis Visit Number | numeric | Copy value from LB.VISITNUM. | Predecessor | ||
| ADLBC | AVAL | Analysis Value | numeric | Copy value from LB.LBSTRESN. | Predecessor | ||
| ADLBC | PREV_AVAL | Previous Analysis Value | numeric | Take AVAL from 1 row earlier within each group of USUBJID, PARAMCD, ordered by AVISITN. | Derived | ||
| ADLBC | CHG | Change from Previous Value | numeric | Compute AVAL - PREV_AVAL. | Derived |
| Template | Include when | PARAMCD |
|---|---|---|
| change_params | LB.LBTESTCD IN ('ALB', 'BILI') AND LB.LBSTRESN IS NOT NULL | Recode LB.LBTESTCD: "ALB" → "_ALB", "BILI" → "_BILI"; missing or unlisted values stay missing |
| 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-adlbc-row-window/full.md
Edit24 linesFollowing CDISC ADaM standards, use the provided LB dataset to create an ADLBC dataset with one record per subject per parameter per visit.
The output dataset should contain the following columns in this order: STUDYID, USUBJID, PARAMCD, AVISITN, AVAL, PREV_AVAL, CHG
- The dataset holds rows only for LB records with test code ALB or BILI and a numeric result; records with another test code or no numeric result have no row.
- PARAMCD is "_ALB" for an albumin (ALB) record and "_BILI" for a bilirubin (BILI) record.
- AVISITN is the lab visit number, and AVAL is the numeric lab result for the visit.
- PREV_AVAL is the AVAL of the latest earlier visit with a result for the same subject and parameter in AVISITN order, so an "_ALB" row never takes a value from a "_BILI" row.
- PREV_AVAL has no value for the earliest visit with a result for a subject and parameter.
- CHG is AVAL - PREV_AVAL, the change since the previous visit rather than a change from baseline; it has no value whenever PREV_AVAL has no value, and equal consecutive values give CHG 0.
Read the source datasets from /app/input and save the completed dataset as /app/output/adlbc.csv.
prompts/adam-adlbc-row-window/conventions.md
Edit11 linesFollowing CDISC ADaM standards, use the provided LB dataset to create an ADLBC dataset with one record per subject per parameter per visit.
The output dataset should contain the following columns in this order: STUDYID, USUBJID, PARAMCD, AVISITN, AVAL, PREV_AVAL, CHG
PARAMCD is "_ALB" for an albumin (ALB) record and "_BILI" for a bilirubin (BILI) record.
Read the source datasets from /app/input and save the completed dataset as /app/output/adlbc.csv.
prompts/adam-adlbc-row-window/brief.md
Edit8 linesFollowing CDISC ADaM standards, use the provided LB dataset to create an ADLBC dataset with one record per subject per parameter per visit.
The output dataset should contain the following columns in this order: STUDYID, USUBJID, PARAMCD, AVISITN, AVAL, PREV_AVAL, CHG
Read the source datasets from /app/input and save the completed dataset as /app/output/adlbc.csv.
R
Edit3 lineslibrary(yamaa)yamaa_spec("spec.yaml")$run()$outputPython
Edit3 linesimport yamaayamaa.spec("spec.yaml").run().outputsolutions/adam-adlbc-row-window/result.R
Edit41 lines# Reference solution for the yamaa benchmark adam-adlbc-row-window (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( LBSTRESN = col_double(), VISITNUM = col_integer(), .default = col_character() ))# Build the change parameters from albumin and bilirubin; any other test# produces no rows. A record with no numeric result gets no row.adbc <- lb |> filter(LBTESTCD %in% c("ALB", "BILI"), !is.na(LBSTRESN), !is.na(VISITNUM)) |> mutate( PARAMCD = case_when( LBTESTCD == "ALB" ~ "_ALB", LBTESTCD == "BILI" ~ "_BILI" ), AVISITN = VISITNUM, AVAL = LBSTRESN ) |> arrange(USUBJID, PARAMCD, AVISITN) |> group_by(USUBJID, PARAMCD) |> mutate( PREV_AVAL = lag(AVAL), CHG = AVAL - PREV_AVAL ) |> ungroup() |> select(STUDYID, USUBJID, PARAMCD, AVISITN, AVAL, PREV_AVAL, CHG)dir.create("/app/output", showWarnings = FALSE)write_csv(adbc, "/app/output/adlbc.csv", na = "")solutions/adam-adlbc-row-window/result.py
Edit95 lines# Reference solution for the yamaa benchmark adam-adlbc-row-window (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."""Create ADLBC from LB: one record per subject per parameter per visit,with the previous visit's result and the change since the previous visit."""import csvfrom decimal import Decimal, InvalidOperationINPUT_CSV = "/app/input/lb.csv"OUTPUT_CSV = "/app/output/adlbc.csv"PARAM_BY_TEST = {"ALB": "_ALB", "BILI": "_BILI"}def parse_number(text): """Return the Decimal value of a collected result, or None.""" if text is None: return None text = text.strip() if not text: return None try: return Decimal(text) except InvalidOperation: return Nonedef fmt(value): """Render a Decimal without exponent notation, or blank for None.""" if value is None: return "" return format(value, "f")def main(): with open(INPUT_CSV, newline="") as handle: rows = list(csv.DictReader(handle)) # Keep only ALB/BILI records with a numeric result. kept = [] for row in rows: testcd = (row.get("LBTESTCD") or "").strip() if testcd not in PARAM_BY_TEST: continue aval = parse_number(row.get("LBSTRESN")) if aval is None: continue kept.append( { "STUDYID": row["STUDYID"], "USUBJID": row["USUBJID"], "PARAMCD": PARAM_BY_TEST[testcd], "AVISITN": int(row["VISITNUM"]), "AVAL": aval, } ) # Order by subject, parameter, then visit number so each row's # previous value is the latest earlier visit for the same # subject and parameter. kept.sort(key=lambda r: (r["STUDYID"], r["USUBJID"], r["PARAMCD"], r["AVISITN"])) previous = {} out_rows = [] for record in kept: key = (record["STUDYID"], record["USUBJID"], record["PARAMCD"]) prev = previous.get(key) chg = record["AVAL"] - prev if prev is not None else None out_rows.append( [ record["STUDYID"], record["USUBJID"], record["PARAMCD"], str(record["AVISITN"]), fmt(record["AVAL"]), fmt(prev), fmt(chg), ] ) previous[key] = record["AVAL"] with open(OUTPUT_CSV, "w", newline="") as handle: writer = csv.writer(handle) writer.writerow( ["STUDYID", "USUBJID", "PARAMCD", "AVISITN", "AVAL", "PREV_AVAL", "CHG"] ) writer.writerows(out_rows)if __name__ == "__main__": main()solutions/adam-adlbc-row-window/result.sas
Edit28 lines/* opensas reference solution for the yamaa benchmark adam-adlbc-row-window. 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 LBTESTCD $1024; infile "/app/input/lb.csv" dsd dlm="," firstobs=2 truncover lrecl=32767; input STUDYID : $char1024. USUBJID : $char1024. LBTESTCD : $char1024. LBSTRESN VISITNUM;run;data collected; length PARAMCD $8; set lb; if LBTESTCD in ('ALB','BILI') and not missing(LBSTRESN); PARAMCD=cats('_',LBTESTCD); AVISITN=VISITNUM; AVAL=LBSTRESN;run;proc sort data=collected; by STUDYID USUBJID PARAMCD AVISITN; run;data result; retain previous priorchange; set collected; by STUDYID USUBJID PARAMCD; if first.PARAMCD then do; previous=.; priorchange=.; end; PREV_AVAL=previous; CHG=AVAL-PREV_AVAL; PREV2=priorchange; previous=AVAL; priorchange=CHG;run;proc sql; create table final as select STUDYID, USUBJID, PARAMCD, AVISITN, AVAL, PREV_AVAL, CHG from result;quit;proc export data=final outfile="/app/output/adlbc.csv" dbms=csv replace; run;
yamaa