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: give each planned visit the result, date, and sequence number
(AVAL, ADT, QSSEQ) of one observation carried forward to it.
Input: the planned analysis visits per subject and parameter, and the collected vital signs observations, each flagged as selected for analysis or not.
Variables:
AVISITNidentifies the planned analysis visit.AVALis the latest non-missing result selected for analysis at or before that visit, within the same subject and parameter. A result of zero counts as a collected result. With no such result it is missing.ADTandQSSEQare the date and the source sequence number of that same observation. A missing date stays missing even when an earlier observation has a date.
Note: the latest observation is the one with the highest visit number, then the highest sequence number within that visit.
Inputs
Under review2 source filesinput/plan.csv
Edit15 rows| USUBJID | PARAMCD | AVISITN |
|---|---|---|
| SYSBP | 0 | |
| SYSBP | 1 | |
| SYSBP | 2 | |
| SYSBP | 3 | |
| SYSBP | 4 | |
| DIABP | 2 | |
| SYSBP | 1 | |
| SYSBP | 2 | |
| SYSBP | 3 | |
| SYSBP | 1 | |
| SYSBP | 2 | |
| SYSBP | 3 | |
| SYSBP | 1 | |
| SYSBP | 1 | |
| SYSBP | 2 |
input/vs.csv
Edit11 rows| USUBJID | PARAMCD | AVISITN | AVAL | ADT | QSSEQ | ANL01FL |
|---|---|---|---|---|---|---|
| SYSBP | 1 | 118 | 2026-01-06 | 101 | Y | |
| SYSBP | 2 | — | 2026-01-13 | 102 | Y | |
| SYSBP | 3 | — | 2026-01-20 | 103 | Y | |
| SYSBP | 4 | 126 | — | 104 | Y | |
| SYSBP | 2 | 142 | 2026-01-13 | 105 | N | |
| SYSBP | 1 | 132 | 2026-02-03 | 201 | Y | |
| SYSBP | 1 | 128 | 2026-02-03 | 202 | Y | |
| SYSBP | 2 | 0 | 2026-02-10 | 203 | Y | |
| SYSBP | 1 | 140 | 2026-03-04 | 301 | Y | |
| SYSBP | 2 | 136 | 2026-03-11 | 302 | Y | |
| SYSBP | 1 | 121 | 2026-04-08 | 401 | Y |
Expected output
Under review15 expected rowsexpected/advs.csv
Edit15 rows| USUBJID | PARAMCD | AVISITN | AVAL | ADT | QSSEQ |
|---|---|---|---|---|---|
| SYSBP | 0 | — | — | — | |
| SYSBP | 1 | 118 | 2026-01-06 | 101 | |
| SYSBP | 2 | 118 | 2026-01-06 | 101 | |
| SYSBP | 3 | 118 | 2026-01-06 | 101 | |
| SYSBP | 4 | 126 | — | 104 | |
| DIABP | 2 | — | — | — | |
| SYSBP | 1 | 128 | 2026-02-03 | 202 | |
| SYSBP | 2 | 0 | 2026-02-10 | 203 | |
| SYSBP | 3 | 0 | 2026-02-10 | 203 | |
| SYSBP | 1 | 140 | 2026-03-04 | 301 | |
| SYSBP | 2 | 136 | 2026-03-11 | 302 | |
| SYSBP | 3 | 136 | 2026-03-11 | 302 | |
| SYSBP | 1 | 121 | 2026-04-08 | 401 | |
| SYSBP | 1 | — | — | — | |
| SYSBP | 2 | — | — | — |
Human review and assessment
| Dataset Name | Variable Name | Variable Label | Type | Codelist/Controlled Terms | Core | Computational Method | Origin |
|---|---|---|---|---|---|---|---|
| ADVS | USUBJID | Unique Subject Identifier | character | Copy value from PLAN.USUBJID. | Predecessor | ||
| ADVS | PARAMCD | Parameter Code | character | Copy value from PLAN.PARAMCD. | Predecessor | ||
| ADVS | AVISITN | Analysis Visit Number | numeric | Copy value from PLAN.AVISITN. | Predecessor | ||
| ADVS | AVAL | Analysis Value | numeric | Take AVAL from the last OBS record matching on USUBJID and PARAMCD, where OBS.ANL01FL = 'Y' AND OBS.AVAL IS NOT NULL AND OBS.AVISITN <= PLAN.AVISITN, ordered by OBS.AVISITN then OBS.QSSEQ, and no match yields blank. | Derived | ||
| ADVS | ADT | Analysis Date | numeric | ISO 8601 | Take ADT from the last OBS record matching on USUBJID and PARAMCD, where OBS.ANL01FL = 'Y' AND OBS.AVAL IS NOT NULL AND OBS.AVISITN <= PLAN.AVISITN, ordered by OBS.AVISITN then OBS.QSSEQ, and no match yields blank. | Derived | |
| ADVS | QSSEQ | Source Sequence Number | numeric | Take QSSEQ from the last OBS record matching on USUBJID and PARAMCD, where OBS.ANL01FL = 'Y' AND OBS.AVAL IS NOT NULL AND OBS.AVISITN <= PLAN.AVISITN, ordered by OBS.AVISITN then OBS.QSSEQ, and no match yields blank. | Derived |
| 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-locf-record/full.md
Edit18 linesFollowing CDISC ADaM standards, use the provided PLAN and VS datasets to create an ADVS dataset with one record per subject per parameter per planned visit.
The output dataset should contain the following columns in this order: USUBJID, PARAMCD, AVISITN, AVAL, ADT, QSSEQ
AVAL is the latest non-missing result selected for analysis at or before the planned visit, within the same subject and parameter. An observation is selected for analysis when its ANL01FL is "Y". The latest observation is the one with the highest visit number, then the highest sequence number within that visit. A result of zero counts as a collected result. ADT and QSSEQ are the date and the source sequence number of the same observation that gives AVAL. A missing date stays missing even when an earlier observation has a date. With no such observation, AVAL, ADT, and QSSEQ have no value.
Read the source datasets from /app/input and save the completed dataset as /app/output/advs.csv.
prompts/adam-advs-locf-record/conventions.md
Edit10 linesFollowing CDISC ADaM standards, use the provided PLAN and VS datasets to create an ADVS dataset with one record per subject per parameter per planned visit.
The output dataset should contain the following columns in this order: USUBJID, PARAMCD, AVISITN, AVAL, ADT, QSSEQ
ANL01FL is "Y".
Read the source datasets from /app/input and save the completed dataset as /app/output/advs.csv.
prompts/adam-advs-locf-record/brief.md
Edit8 linesFollowing CDISC ADaM standards, use the provided PLAN and VS datasets to create an ADVS dataset with one record per subject per parameter per planned visit.
The output dataset should contain the following columns in this order: USUBJID, PARAMCD, AVISITN, AVAL, ADT, QSSEQ
Read the source datasets from /app/input and save the completed dataset as /app/output/advs.csv.
R
Edit3 lineslibrary(yamaa)yamaa_spec("spec.yaml")$run()$outputPython
Edit3 linesimport yamaayamaa.spec("spec.yaml").run().outputsolutions/adam-advs-locf-record/result.R
Edit49 lines# Reference solution for the yamaa benchmark adam-advs-locf-record (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(purrr)library(readr)library(tidyr)plan <- read_csv( "/app/input/plan.csv", col_types = cols(AVISITN = col_integer(), .default = col_character()))vs <- read_csv( "/app/input/vs.csv", col_types = cols( AVISITN = col_integer(), AVAL = col_double(), ADT = col_date(), QSSEQ = col_integer(), .default = col_character() ))# Only results selected for analysis can be carried.candidates <- vs |> filter(ANL01FL %in% "Y", !is.na(AVAL))# The latest non-missing selected result at or before the planned visit:# the highest visit number, then the highest sequence number.pick_donor <- function(usubjid, paramcd, avisitn) { donor <- candidates |> filter(USUBJID == usubjid, PARAMCD == paramcd, AVISITN <= avisitn) |> arrange(AVISITN, QSSEQ) |> slice_tail(n = 1) if (nrow(donor) == 0) { tibble::tibble(AVAL = NA_real_, ADT = as.Date(NA), QSSEQ = NA_integer_) } else { donor |> select(AVAL, ADT, QSSEQ) }}advs <- plan |> arrange(USUBJID, PARAMCD, AVISITN) |> mutate(donor = pmap(list(USUBJID, PARAMCD, AVISITN), pick_donor)) |> unnest(donor) |> select(USUBJID, PARAMCD, AVISITN, AVAL, ADT, QSSEQ)dir.create("/app/output", showWarnings = FALSE)write_csv(advs, "/app/output/advs.csv", na = "")solutions/adam-advs-locf-record/result.py
Edit85 lines# Reference solution for the yamaa benchmark adam-advs-locf-record (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 the ADVS LOCF dataset from PLAN and VS.One output record per planned visit (per subject and parameter). For eachplanned visit, AVAL is the latest non-missing result selected for analysis(ANL01FL = "Y") at or before the planned visit within the same subject andparameter; the latest observation is the one with the highest visit number,then the highest sequence number within that visit. ADT and QSSEQ are thedate and source sequence number of that same observation. A result of zerocounts as a collected result. With no such observation, AVAL, ADT, andQSSEQ are blank."""import csvimport osINPUT_DIR = "/app/input"OUTPUT_DIR = "/app/output"def read_rows(path): with open(path, newline="", encoding="utf-8") as handle: return list(csv.DictReader(handle))def main(): plan = read_rows(os.path.join(INPUT_DIR, "plan.csv")) vs = read_rows(os.path.join(INPUT_DIR, "vs.csv")) # Candidate observations: selected for analysis with a collected result. candidates = {} for row in vs: if row["ANL01FL"] != "Y": continue if row["AVAL"] is None or row["AVAL"].strip() == "": continue key = (row["USUBJID"], row["PARAMCD"]) candidates.setdefault(key, []).append(row) out_rows = [] for planned in plan: key = (planned["USUBJID"], planned["PARAMCD"]) planned_visit = int(planned["AVISITN"]) eligible = [ row for row in candidates.get(key, []) if int(row["AVISITN"]) <= planned_visit ] aval = adt = qsseq = "" if eligible: latest = max( eligible, key=lambda row: (int(row["AVISITN"]), int(row["QSSEQ"])), ) aval = latest["AVAL"] adt = latest["ADT"] qsseq = latest["QSSEQ"] out_rows.append( { "USUBJID": planned["USUBJID"], "PARAMCD": planned["PARAMCD"], "AVISITN": planned["AVISITN"], "AVAL": aval, "ADT": adt, "QSSEQ": qsseq, } ) os.makedirs(OUTPUT_DIR, exist_ok=True) fieldnames = ["USUBJID", "PARAMCD", "AVISITN", "AVAL", "ADT", "QSSEQ"] with open( os.path.join(OUTPUT_DIR, "advs.csv"), "w", newline="", encoding="utf-8" ) as handle: writer = csv.DictWriter(handle, fieldnames=fieldnames) writer.writeheader() writer.writerows(out_rows)if __name__ == "__main__": main()solutions/adam-advs-locf-record/result.sas
Edit24 lines/* opensas reference solution for the yamaa benchmark adam-advs-locf-record. Reads the benchmark inputs and derives the requested output. Execute with the existing opensas runtime: opensas /app/output/result.sas. */data plan; length USUBJID PARAMCD $1024; infile "/app/input/plan.csv" dsd dlm="," firstobs=2 truncover lrecl=32767; input USUBJID : $char1024. PARAMCD : $char1024. AVISITN;run;data vs; length USUBJID PARAMCD ADT ANL01FL $1024; infile "/app/input/vs.csv" dsd dlm="," firstobs=2 truncover lrecl=32767; input USUBJID : $char1024. PARAMCD : $char1024. AVISITN AVAL ADT : $char1024. QSSEQ ANL01FL : $char1024.;run;proc sql; create table candidates as select a.USUBJID,a.PARAMCD,a.AVISITN,b.AVAL,b.ADT,b.QSSEQ,b.AVISITN as observedvisit from plan as a left join vs as b on a.USUBJID=b.USUBJID and a.PARAMCD=b.PARAMCD and b.AVISITN<=a.AVISITN and b.ANL01FL='Y' and not missing(b.AVAL);quit;proc sort data=candidates; by USUBJID PARAMCD AVISITN descending observedvisit descending QSSEQ; run;data result; set candidates; by USUBJID PARAMCD AVISITN; if first.AVISITN; run;proc export data=result(keep=USUBJID PARAMCD AVISITN AVAL ADT QSSEQ) outfile="/app/output/advs.csv" dbms=csv replace; run;
yamaa