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: place each systolic blood pressure (SYSBP) measurement
into its analysis window, assigning the visit order number
(AVISITN), the window target day (AWTARGET), and the distance
from target (AWTDIFF), and marking ANL01FL on the record that
represents its window.
Input: pre-derived measurement records carrying ADT
(analysis date), ADY (relative study day), and AVAL (measured
value) alongside the visit as collected, plus each study's own
window table, shared by all parameters, that gives for each
analysis visit its order number, its first and last study day,
and its target day.
Variables:
AVISITNis the order number of the analysis visit whose window holds the record: the one window, matched within the same study, whose range from its first through its last study day, both ends inclusive, contains the record's study day. It is missing when no window contains the day.AWTARGETis the target day stated by the matched window; missing when no window matched.AWTDIFFis the record's study day minus its target day, negative before the target and positive after; missing when there is no window or no study day.ANL01FLisYon the record nearest its window target among records for the same study, subject, parameter, and analysis visit, with the lower sequence number breaking a tie; blank on every other record, including any record with no window.
Note: an assigned window brings its analysis visit (AVISIT),
order number, and target day together, so a record with no window
has none of the three. A record has no window when it has no study
day, when its day falls in a gap between stated ranges, or when its
day sits on or past the first day of a window whose last day was
never stated: an absent bound is not an open-ended one. Window
edges are inclusive, so study day 21 closes Week 2 and day 22
opens Week 4.
Inputs
Under review2 source filesinput/advs_raw.csv
Edit16 rows| STUDYID | USUBJID | PARAMCD | VSSEQ | VISIT | VISITNUM | ADT | ADY | AVAL |
|---|---|---|---|---|---|---|---|---|
| YAMAA-01 | SYSBP | 1 | SCREENING | 1 | 2025-01-02 | -6 | 128 | |
| YAMAA-01 | SYSBP | 2 | BASELINE | 2 | 2025-01-08 | 1 | 132 | |
| YAMAA-01 | SYSBP | 3 | UNSCHEDULED | — | 2025-01-15 | 8 | 145 | |
| YAMAA-01 | SYSBP | 4 | WEEK 2 | 3 | 2025-01-22 | 15 | 138 | |
| YAMAA-01 | SYSBP | 5 | WEEK 4 | 4 | 2025-02-05 | 29 | 130 | |
| YAMAA-01 | SYSBP | 6 | WEEK 8 | 5 | 2025-03-08 | 60 | 126 | |
| YAMAA-01 | SYSBP | 7 | UNSCHEDULED | — | 2025-01-28 | 21 | 136 | |
| YAMAA-01 | SYSBP | 8 | UNSCHEDULED | — | 2025-01-29 | 22 | 129 | |
| YAMAA-01 | SYSBP | 1 | BASELINE | 2 | 2025-02-08 | 1 | 118 | |
| YAMAA-01 | SYSBP | 2 | WEEK 2 | 3 | 2025-02-21 | 14 | 122 | |
| YAMAA-01 | SYSBP | 3 | WEEK 4 | 4 | — | — | 120 | |
| YAMAA-01 | SYSBP | 4 | UNSCHEDULED | — | 2025-02-23 | 16 | 121 | |
| YAMAA-01 | SYSBP | 5 | UNSCHEDULED | — | 2027-11-04 | 1000 | 119 | |
| YAMAA-01 | SYSBP | 6 | UNSCHEDULED | — | 2028-02-12 | 1100 | 117 | |
| YAMAA-02 | SYSBP | 1 | BASELINE | 2 | 2025-06-02 | 1 | 124 | |
| YAMAA-02 | SYSBP | 2 | WEEK 2 | 3 | 2025-06-15 | 14 | 120 |
input/awindow.csv
Edit8 rows| STUDYID | AVISIT | AVISITN | AWLO | AWHI | AWTARGET |
|---|---|---|---|---|---|
| YAMAA-01 | SCREENING | -1 | -28 | -1 | -7 |
| YAMAA-01 | BASELINE | 0 | 1 | 1 | 1 |
| YAMAA-01 | WEEK 2 | 2 | 2 | 21 | 15 |
| YAMAA-01 | WEEK 4 | 4 | 22 | 42 | 29 |
| YAMAA-01 | POST-TREATMENT | 99 | 43 | 999 | 57 |
| YAMAA-01 | LONG-TERM FOLLOW-UP | 199 | 1001 | — | 1095 |
| YAMAA-02 | BASELINE | 0 | 1 | 1 | 1 |
| YAMAA-02 | WEEK 2 | 2 | 2 | 21 | 14 |
Expected output
Under review16 expected rowsexpected/advs.csv
Edit16 rows| STUDYID | USUBJID | PARAMCD | VSSEQ | VISIT | ADT | ADY | AVAL | AVISIT | AVISITN | AWTARGET | AWTDIFF | ANL01FL |
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| YAMAA-01 | SYSBP | 1 | SCREENING | 2025-01-02 | -6 | 128 | SCREENING | -1 | -7 | 1 | Y | |
| YAMAA-01 | SYSBP | 2 | BASELINE | 2025-01-08 | 1 | 132 | BASELINE | 0 | 1 | 0 | Y | |
| YAMAA-01 | SYSBP | 3 | UNSCHEDULED | 2025-01-15 | 8 | 145 | WEEK 2 | 2 | 15 | -7 | — | |
| YAMAA-01 | SYSBP | 4 | WEEK 2 | 2025-01-22 | 15 | 138 | WEEK 2 | 2 | 15 | 0 | Y | |
| YAMAA-01 | SYSBP | 5 | WEEK 4 | 2025-02-05 | 29 | 130 | WEEK 4 | 4 | 29 | 0 | Y | |
| YAMAA-01 | SYSBP | 6 | WEEK 8 | 2025-03-08 | 60 | 126 | POST-TREATMENT | 99 | 57 | 3 | Y | |
| YAMAA-01 | SYSBP | 7 | UNSCHEDULED | 2025-01-28 | 21 | 136 | WEEK 2 | 2 | 15 | 6 | — | |
| YAMAA-01 | SYSBP | 8 | UNSCHEDULED | 2025-01-29 | 22 | 129 | WEEK 4 | 4 | 29 | -7 | — | |
| YAMAA-01 | SYSBP | 1 | BASELINE | 2025-02-08 | 1 | 118 | BASELINE | 0 | 1 | 0 | Y | |
| YAMAA-01 | SYSBP | 2 | WEEK 2 | 2025-02-21 | 14 | 122 | WEEK 2 | 2 | 15 | -1 | Y | |
| YAMAA-01 | SYSBP | 3 | WEEK 4 | — | — | 120 | — | — | — | — | — | |
| YAMAA-01 | SYSBP | 4 | UNSCHEDULED | 2025-02-23 | 16 | 121 | WEEK 2 | 2 | 15 | 1 | — | |
| YAMAA-01 | SYSBP | 5 | UNSCHEDULED | 2027-11-04 | 1000 | 119 | — | — | — | — | — | |
| YAMAA-01 | SYSBP | 6 | UNSCHEDULED | 2028-02-12 | 1100 | 117 | — | — | — | — | — | |
| YAMAA-02 | SYSBP | 1 | BASELINE | 2025-06-02 | 1 | 124 | BASELINE | 0 | 1 | 0 | Y | |
| YAMAA-02 | SYSBP | 2 | WEEK 2 | 2025-06-15 | 14 | 120 | WEEK 2 | 2 | 14 | 0 | Y |
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 | PARAMCD | Parameter Code | character | Copy value from ADVS_RAW.PARAMCD. | Predecessor | ||
| ADVS | VSSEQ | Sequence Number | numeric | Copy value from ADVS_RAW.VSSEQ. | Predecessor | ||
| ADVS | VISIT | Visit Name | character | Copy value from ADVS_RAW.VISIT. | Predecessor | ||
| ADVS | ADT | Analysis Date | numeric | ISO 8601 | Copy value from ADVS_RAW.ADT. | Predecessor | |
| ADVS | ADY | Analysis Relative Day | numeric | Copy value from ADVS_RAW.ADY. | Predecessor | ||
| ADVS | AVAL | Analysis Value | numeric | Copy value from ADVS_RAW.AVAL. | Predecessor | ||
| ADVS | AVISIT | Analysis Visit | character | Take AVISIT from the AWINDOW record matching on STUDYID, where ADY falls within AWLO to AWHI, and no match yields blank. | Derived | ||
| ADVS | AVISITN | Analysis Visit (N) | numeric | Take AVISITN from the AWINDOW record matching on STUDYID, where ADY falls within AWLO to AWHI, and no match yields blank. | Derived | ||
| ADVS | AWTARGET | Analysis Window Target | numeric | Take AWTARGET from the AWINDOW record matching on STUDYID, where ADY falls within AWLO to AWHI, and no match yields blank. | Derived | ||
| ADVS | AWTDIFF | Analysis Window Difference | numeric | Compute ADY - AWTARGET. | Derived | ||
| ADVS | ANL01FL | Analysis Record Flag 01 | character | Y | "Y" when AWRANK = 1; blank otherwise. | Derived |
| Variable | Permitted values |
|---|---|
| ANL01FL | Y |
| 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-window-table/full.md
Edit25 linesFollowing CDISC ADaM standards, use the provided ADVS_RAW and AWINDOW datasets to create an ADVS dataset with one record per measurement.
The output dataset should contain the following columns in this order: STUDYID, USUBJID, PARAMCD, VSSEQ, VISIT, ADT, ADY, AVAL, AVISIT, AVISITN, AWTARGET, AWTDIFF, ANL01FL
A record's window is the one window of its own study whose range, from its first study day through its last, both ends inclusive, contains the record's study day (ADY). AVISIT is the analysis visit of the matched window, AVISITN is its order number, and AWTARGET is its target day. A record with no window has no value for AVISIT, AVISITN, or AWTARGET. A record has no window when it has no study day, when its study day falls in a gap between stated ranges, or when its study day sits on or past the first day of a window whose last day was never stated: an absent bound is not an open-ended one. AWTDIFF is the record's study day minus its target day, negative before the target and positive after, and has no value when there is no window or no study day. ANL01FL is Y on the record nearest its window target among the records for the same study, subject, parameter, and analysis visit, with the lower VSSEQ breaking a tie; it has no value on every other record, including any record with no window.
Read the source datasets from /app/input and save the completed dataset as /app/output/advs.csv.
prompts/adam-advs-window-table/conventions.md
Edit11 linesFollowing CDISC ADaM standards, use the provided ADVS_RAW and AWINDOW datasets to create an ADVS dataset with one record per measurement.
The output dataset should contain the following columns in this order: STUDYID, USUBJID, PARAMCD, VSSEQ, VISIT, ADT, ADY, AVAL, AVISIT, AVISITN, AWTARGET, AWTDIFF, ANL01FL
ANL01FL is Y or has no value.
Read the source datasets from /app/input and save the completed dataset as /app/output/advs.csv.
prompts/adam-advs-window-table/brief.md
Edit9 linesFollowing CDISC ADaM standards, use the provided ADVS_RAW and AWINDOW datasets to create an ADVS dataset with one record per measurement.
The output dataset should contain the following columns in this order: STUDYID, USUBJID, PARAMCD, VSSEQ, VISIT, ADT, ADY, AVAL, AVISIT, AVISITN, AWTARGET, AWTDIFF, ANL01FL
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-window-table/result.R
Edit73 lines# Reference solution for the yamaa benchmark adam-advs-window-table (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)raw <- read_csv( "/app/input/advs_raw.csv", col_types = cols( VSSEQ = col_integer(), ADT = col_date(), ADY = col_integer(), AVAL = col_double(), .default = col_character() ))windows <- read_csv( "/app/input/awindow.csv", col_types = cols( AVISITN = col_integer(), AWLO = col_integer(), AWHI = col_integer(), AWTARGET = col_integer(), .default = col_character() ))# The one window in the same study whose first-to-last range, both ends# inclusive, holds the study day. An absent bound never matches.match_window <- function(studyid, ady) { if (is.na(ady)) { return(tibble::tibble(AVISIT = NA_character_, AVISITN = NA_integer_, AWTARGET = NA_integer_)) } hit <- windows |> filter( STUDYID == studyid, !is.na(AWLO), !is.na(AWHI), AWLO <= ady, ady <= AWHI ) |> slice_head(n = 1) if (nrow(hit) == 0) { tibble::tibble(AVISIT = NA_character_, AVISITN = NA_integer_, AWTARGET = NA_integer_) } else { hit |> select(AVISIT, AVISITN, AWTARGET) }}framed <- raw |> arrange(STUDYID, USUBJID, VSSEQ) |> mutate(window = map2(STUDYID, ADY, match_window)) |> tidyr::unnest(window) |> mutate( AWTDIFF = ADY - AWTARGET, AWTABS = abs(AWTDIFF) )# The record nearest its target in each study, subject, parameter, and# visit; the lower sequence number breaks a tie.flagged <- framed |> filter(!is.na(AVISIT)) |> arrange(AWTABS, VSSEQ) |> distinct(STUDYID, USUBJID, PARAMCD, AVISIT, .keep_all = TRUE) |> select(STUDYID, USUBJID, PARAMCD, AVISIT, VSSEQ) |> mutate(ANL01FL = "Y")advs <- framed |> select(-AWTABS) |> left_join(flagged, by = c("STUDYID", "USUBJID", "PARAMCD", "AVISIT", "VSSEQ")) |> arrange(STUDYID, USUBJID, VSSEQ) |> select( STUDYID, USUBJID, PARAMCD, VSSEQ, VISIT, ADT, ADY, AVAL, AVISIT, AVISITN, AWTARGET, AWTDIFF, ANL01FL )dir.create("/app/output", showWarnings = FALSE)write_csv(advs, "/app/output/advs.csv", na = "")solutions/adam-advs-window-table/result.py
Edit100 lines# Reference solution for the yamaa benchmark adam-advs-window-table (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 read_csv(path): with open(path, newline="") as f: return list(csv.DictReader(f))def to_int(text): if text is None or text.strip() == "": return None return int(text)def main(): raw = read_csv(f"{INPUT_DIR}/advs_raw.csv") windows = read_csv(f"{INPUT_DIR}/awindow.csv") windows_by_study = {} for w in windows: windows_by_study.setdefault(w["STUDYID"], []).append(w) records = [] for row in raw: ady = to_int(row["ADY"]) matched = None if ady is not None: for w in windows_by_study.get(row["STUDYID"], []): lo = to_int(w["AWLO"]) hi = to_int(w["AWHI"]) # An absent bound is not an open-ended one: a window # whose last day was never stated matches nothing. if lo is None or hi is None: continue if lo <= ady <= hi: matched = w break rec = { "STUDYID": row["STUDYID"], "USUBJID": row["USUBJID"], "PARAMCD": row["PARAMCD"], "VSSEQ": row["VSSEQ"], "VISIT": row["VISIT"], "ADT": row["ADT"], "ADY": row["ADY"], "AVAL": row["AVAL"], "AVISIT": "", "AVISITN": "", "AWTARGET": "", "AWTDIFF": "", "ANL01FL": "", } diff = None if matched is not None: target = to_int(matched["AWTARGET"]) rec["AVISIT"] = matched["AVISIT"] rec["AVISITN"] = matched["AVISITN"] rec["AWTARGET"] = matched["AWTARGET"] if target is not None: diff = ady - target rec["AWTDIFF"] = str(diff) rec["_diff"] = diff records.append(rec) # ANL01FL is Y on the record nearest its window target among the # records for the same study, subject, parameter and analysis # visit; the lower VSSEQ breaks a tie. groups = {} for rec in records: if rec["AVISIT"] == "" or rec["_diff"] is None: continue key = (rec["STUDYID"], rec["USUBJID"], rec["PARAMCD"], rec["AVISIT"]) groups.setdefault(key, []).append(rec) for group in groups.values(): best = min(group, key=lambda r: (abs(r["_diff"]), int(r["VSSEQ"]))) best["ANL01FL"] = "Y" fieldnames = [ "STUDYID", "USUBJID", "PARAMCD", "VSSEQ", "VISIT", "ADT", "ADY", "AVAL", "AVISIT", "AVISITN", "AWTARGET", "AWTDIFF", "ANL01FL", ] with open(f"{OUTPUT_DIR}/advs.csv", "w", newline="") as f: writer = csv.DictWriter(f, fieldnames=fieldnames) writer.writeheader() for rec in records: writer.writerow({k: rec[k] for k in fieldnames})if __name__ == "__main__": main()solutions/adam-advs-window-table/result.sas
Edit28 lines/* opensas reference solution for the yamaa benchmark adam-advs-window-table. 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 PARAMCD VISIT ADT $1024; infile "/app/input/advs_raw.csv" dsd dlm="," firstobs=2 truncover lrecl=32767; input STUDYID : $char1024. USUBJID : $char1024. PARAMCD : $char1024. VSSEQ VISIT : $char1024. VISITNUM ADT : $char1024. ADY AVAL;run;data awindow; length STUDYID AVISIT $1024; infile "/app/input/awindow.csv" dsd dlm="," firstobs=2 truncover lrecl=32767; input STUDYID : $char1024. AVISIT : $char1024. AVISITN AWLO AWHI AWTARGET;run;proc sql; create table candidates as select a.*,b.AVISIT,b.AVISITN,b.AWTARGET,a.ADY-b.AWTARGET as AWTDIFF from advs_raw as a left join awindow as b on a.STUDYID=b.STUDYID and not missing(a.ADY) and not missing(b.AWLO) and not missing(b.AWHI) and a.ADY>=b.AWLO and a.ADY<=b.AWHI;quit;data ordered; set candidates; distance=abs(AWTDIFF); nodistance=missing(distance); run;proc sort data=ordered; by STUDYID USUBJID PARAMCD AVISITN nodistance distance VSSEQ; run;data result; length ANL01FL $1; set ordered; by STUDYID USUBJID PARAMCD AVISITN; if first.AVISITN and not missing(AVISITN) then ANL01FL='Y'; run;proc sql; create table final as select STUDYID, USUBJID, PARAMCD, VSSEQ, VISIT, ADT, ADY, AVAL, AVISIT, AVISITN, AWTARGET, AWTDIFF, ANL01FL from result;quit;proc export data=final outfile="/app/output/advs.csv" dbms=csv replace; run;
yamaa