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 albumin change parameter _ALB, carrying each
visit's previous result (PREV_AVAL), the change from it (CHG),
and the previous visit's change (PREV2).
Input: laboratory (LB) records carrying a test code (LBTESTCD),
a numeric result (LBSTRESN), and a visit number (VISITNUM). Six
subjects: a four-visit chain that skips a visit number, a subject
whose middle visit has no result, a single-visit subject, a
two-visit subject, a subject with no change between two consecutive
visits, and one whose hemoglobin record produces no row.
Variables:
AVISITN: the analysis visit number, taken from the lab visit number.AVAL: the numeric albumin result for the visit.PREV_AVAL: theAVALof the visit just before inAVISITNorder, for the same subject; blank on the subject's first visit.CHG:AVAL - PREV_AVAL, the change since that visit; blank wheneverPREV_AVALis.PREV2: theCHGof the visit just before, read after that change is complete; blank until two earlier visits carry results.
Note: the previous visit's change is carried from its completed
value, so a record with no numeric result shortens the chain: it
gets no row, and the change and its lag compare against the latest
earlier visit with a result. CHG here is the change from the
previous visit, not the ADaMIG "change from baseline" definition; a
zero change is a real value (0), distinct from blank.
Inputs
Under review1 source fileinput/lb.csv
Edit15 rows| STUDYID | USUBJID | LBTESTCD | LBSTRESN | VISITNUM |
|---|---|---|---|---|
| YAMAA-01 | ALB | 4.0 | 1 | |
| YAMAA-01 | ALB | 4.5 | 2 | |
| YAMAA-01 | ALB | 5.5 | 4 | |
| YAMAA-01 | ALB | 7.0 | 5 | |
| YAMAA-01 | ALB | 4.0 | 1 | |
| YAMAA-01 | ALB | — | 2 | |
| YAMAA-01 | ALB | 5.0 | 3 | |
| YAMAA-01 | ALB | 3.75 | 1 | |
| YAMAA-01 | ALB | 4.25 | 1 | |
| YAMAA-01 | ALB | 4.75 | 2 | |
| YAMAA-01 | ALB | 4.0 | 1 | |
| YAMAA-01 | HGB | 13.5 | 1 | |
| YAMAA-01 | ALB | 4.5 | 1 | |
| YAMAA-01 | ALB | 4.5 | 2 | |
| YAMAA-01 | ALB | 5.0 | 3 |
Expected output
Under review13 expected rowsexpected/adlbc.csv
Edit13 rows| STUDYID | USUBJID | PARAMCD | AVISITN | AVAL | PREV_AVAL | CHG | PREV2 |
|---|---|---|---|---|---|---|---|
| YAMAA-01 | _ALB | 1 | 4 | — | — | — | |
| YAMAA-01 | _ALB | 2 | 4.5 | 4 | 0.5 | — | |
| YAMAA-01 | _ALB | 4 | 5.5 | 4.5 | 1 | 0.5 | |
| YAMAA-01 | _ALB | 5 | 7 | 5.5 | 1.5 | 1 | |
| YAMAA-01 | _ALB | 1 | 4 | — | — | — | |
| YAMAA-01 | _ALB | 3 | 5 | 4 | 1 | — | |
| YAMAA-01 | _ALB | 1 | 3.75 | — | — | — | |
| YAMAA-01 | _ALB | 1 | 4.25 | — | — | — | |
| YAMAA-01 | _ALB | 2 | 4.75 | 4.25 | 0.5 | — | |
| YAMAA-01 | _ALB | 1 | 4 | — | — | — | |
| YAMAA-01 | _ALB | 1 | 4.5 | — | — | — | |
| YAMAA-01 | _ALB | 2 | 4.5 | 4.5 | 0 | — | |
| YAMAA-01 | _ALB | 3 | 5 | 4.5 | 0.5 | 0 |
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 using window VISIT_ORDER. | Derived | ||
| ADLBC | CHG | Change from Previous Value | numeric | Compute AVAL - PREV_AVAL. | Derived | ||
| ADLBC | PREV2 | Lag of Change | numeric | Take CHG from 1 row earlier using window VISIT_ORDER. | Derived |
| Template | Include when | PARAMCD |
|---|---|---|
| change_alb | LB.LBTESTCD = 'ALB' AND LB.LBSTRESN IS NOT NULL | Constant "_ALB" |
| 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-window-chain/full.md
Edit23 linesFollowing CDISC ADaM standards, use the provided LB dataset to create an ADLBC dataset with one record per subject per visit.
The output dataset should contain the following columns in this order: STUDYID, USUBJID, PARAMCD, AVISITN, AVAL, PREV_AVAL, CHG, PREV2
PARAMCD is "_ALB" on every record. AVISITN is the lab visit number, and AVAL is the numeric albumin result for the visit. A record appears only for an albumin result that has a numeric value; a record for another test, or an albumin record with no numeric result, has no record in the output. PREV_AVAL is the AVAL of the visit just before in AVISITN order for the same subject, and has no value on the subject's first visit. CHG is AVAL minus PREV_AVAL, the change since that visit, and has no value whenever PREV_AVAL has no value. CHG is the change from the previous visit, not a change from baseline, and a change of zero is shown as 0, not left empty. PREV2 is the CHG of the visit just before, taken from that visit's completed CHG, and has no value until two earlier visits carry results. A record with no numeric result shortens the chain: PREV_AVAL, CHG, and PREV2 are read against the latest earlier visit that has a result.
Read the source datasets from /app/input and save the completed dataset as /app/output/adlbc.csv.
prompts/adam-adlbc-window-chain/conventions.md
Edit10 linesFollowing CDISC ADaM standards, use the provided LB dataset to create an ADLBC dataset with one record per subject per visit.
The output dataset should contain the following columns in this order: STUDYID, USUBJID, PARAMCD, AVISITN, AVAL, PREV_AVAL, CHG, PREV2
PARAMCD is "_ALB" on every record.
Read the source datasets from /app/input and save the completed dataset as /app/output/adlbc.csv.
prompts/adam-adlbc-window-chain/brief.md
Edit8 linesFollowing CDISC ADaM standards, use the provided LB dataset to create an ADLBC dataset with one record per subject per visit.
The output dataset should contain the following columns in this order: STUDYID, USUBJID, PARAMCD, AVISITN, AVAL, PREV_AVAL, CHG, PREV2
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-window-chain/result.R
Edit40 lines# Reference solution for the yamaa benchmark adam-adlbc-window-chain (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() ))# Albumin results with a numeric value; a record without one gets no row,# so the lag compares against the latest earlier visit with a result.alb <- lb |> filter(LBTESTCD %in% "ALB", !is.na(LBSTRESN)) |> mutate(PARAMCD = "_ALB", AVISITN = VISITNUM, AVAL = LBSTRESN) |> arrange(STUDYID, USUBJID, AVISITN)# The change since the previous visit with a result, and its lag: the# previous visit's change. A zero change is a real value.adlbc <- alb |> group_by(STUDYID, USUBJID) |> mutate( PREV_AVAL = lag(AVAL), CHG = AVAL - PREV_AVAL, PREV2 = lag(CHG) ) |> ungroup() |> select(STUDYID, USUBJID, PARAMCD, AVISITN, AVAL, PREV_AVAL, CHG, PREV2) |> arrange(STUDYID, USUBJID, AVISITN)dir.create("/app/output", showWarnings = FALSE)write_csv(adlbc, "/app/output/adlbc.csv", na = "")solutions/adam-adlbc-window-chain/result.py
Edit95 lines# Reference solution for the yamaa benchmark adam-adlbc-window-chain (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 csvINPUT_DIR = "/app/input"OUTPUT_DIR = "/app/output"def fmt(value): if value is None: return "" return repr(float(value))def main(): with open(f"{INPUT_DIR}/lb.csv", newline="") as f: rows = list(csv.DictReader(f)) # Keep only albumin records with a numeric result. records = [] for row in rows: if row["LBTESTCD"] != "ALB": continue raw = (row["LBSTRESN"] or "").strip() if raw == "": continue try: aval = float(raw) except ValueError: continue records.append( { "STUDYID": row["STUDYID"], "USUBJID": row["USUBJID"], "AVISITN": int(row["VISITNUM"]), "AVAL": aval, } ) # Order by subject (first appearance) then visit number. subject_order = {} for rec in records: if rec["USUBJID"] not in subject_order: subject_order[rec["USUBJID"]] = len(subject_order) records.sort(key=lambda r: (subject_order[r["USUBJID"]], r["AVISITN"])) out = [] prev_aval = {} prev_chg = {} for rec in records: subj = rec["USUBJID"] p_aval = prev_aval.get(subj) chg = None if p_aval is None else rec["AVAL"] - p_aval p_chg = prev_chg.get(subj) out.append( { "STUDYID": rec["STUDYID"], "USUBJID": subj, "PARAMCD": "_ALB", "AVISITN": rec["AVISITN"], "AVAL": rec["AVAL"], "PREV_AVAL": p_aval, "CHG": chg, "PREV2": p_chg, } ) prev_aval[subj] = rec["AVAL"] prev_chg[subj] = chg fieldnames = ["STUDYID", "USUBJID", "PARAMCD", "AVISITN", "AVAL", "PREV_AVAL", "CHG", "PREV2"] with open(f"{OUTPUT_DIR}/adlbc.csv", "w", newline="") as f: writer = csv.DictWriter(f, fieldnames=fieldnames) writer.writeheader() for row in out: writer.writerow( { "STUDYID": row["STUDYID"], "USUBJID": row["USUBJID"], "PARAMCD": row["PARAMCD"], "AVISITN": row["AVISITN"], "AVAL": fmt(row["AVAL"]), "PREV_AVAL": fmt(row["PREV_AVAL"]), "CHG": fmt(row["CHG"]), "PREV2": fmt(row["PREV2"]), } )if __name__ == "__main__": main()solutions/adam-adlbc-window-chain/result.sas
Edit28 lines/* opensas reference solution for the yamaa benchmark adam-adlbc-window-chain. 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') 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, PREV2 from result;quit;proc export data=final outfile="/app/output/adlbc.csv" dbms=csv replace; run;
yamaa