Review ask

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

Lifecycle: reviewedEditUnder review
What this benchmark means
README.md

Public 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:

  • AVISITN is 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.
  • AWTARGET is the target day stated by the matched window; missing when no window matched.
  • AWTDIFF is 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.
  • ANL01FL is Y on 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 review
2 source files

input/advs_raw.csv

Edit
16 rows
input/advs_raw.csv
STUDYIDUSUBJIDPARAMCDVSSEQVISITVISITNUMADTADYAVAL
YAMAA-01SYSBP1SCREENING12025-01-02-6128
YAMAA-01SYSBP2BASELINE22025-01-081132
YAMAA-01SYSBP3UNSCHEDULED—2025-01-158145
YAMAA-01SYSBP4WEEK 232025-01-2215138
YAMAA-01SYSBP5WEEK 442025-02-0529130
YAMAA-01SYSBP6WEEK 852025-03-0860126
YAMAA-01SYSBP7UNSCHEDULED—2025-01-2821136
YAMAA-01SYSBP8UNSCHEDULED—2025-01-2922129
YAMAA-01SYSBP1BASELINE22025-02-081118
YAMAA-01SYSBP2WEEK 232025-02-2114122
YAMAA-01SYSBP3WEEK 44——120
YAMAA-01SYSBP4UNSCHEDULED—2025-02-2316121
YAMAA-01SYSBP5UNSCHEDULED—2027-11-041000119
YAMAA-01SYSBP6UNSCHEDULED—2028-02-121100117
YAMAA-02SYSBP1BASELINE22025-06-021124
YAMAA-02SYSBP2WEEK 232025-06-1514120

input/awindow.csv

Edit
8 rows
input/awindow.csv
STUDYIDAVISITAVISITNAWLOAWHIAWTARGET
YAMAA-01SCREENING-1-28-1-7
YAMAA-01BASELINE0111
YAMAA-01WEEK 2222115
YAMAA-01WEEK 44224229
YAMAA-01POST-TREATMENT994399957
YAMAA-01LONG-TERM FOLLOW-UP1991001—1095
YAMAA-02BASELINE0111
YAMAA-02WEEK 2222114

Expected output

Under review
16 expected rows

expected/advs.csv

Edit
16 rows
expected/advs.csv
STUDYIDUSUBJIDPARAMCDVSSEQVISITADTADYAVALAVISITAVISITNAWTARGETAWTDIFFANL01FL
YAMAA-01SYSBP1SCREENING2025-01-02-6128SCREENING-1-71Y
YAMAA-01SYSBP2BASELINE2025-01-081132BASELINE010Y
YAMAA-01SYSBP3UNSCHEDULED2025-01-158145WEEK 2215-7—
YAMAA-01SYSBP4WEEK 22025-01-2215138WEEK 22150Y
YAMAA-01SYSBP5WEEK 42025-02-0529130WEEK 44290Y
YAMAA-01SYSBP6WEEK 82025-03-0860126POST-TREATMENT99573Y
YAMAA-01SYSBP7UNSCHEDULED2025-01-2821136WEEK 22156—
YAMAA-01SYSBP8UNSCHEDULED2025-01-2922129WEEK 4429-7—
YAMAA-01SYSBP1BASELINE2025-02-081118BASELINE010Y
YAMAA-01SYSBP2WEEK 22025-02-2114122WEEK 2215-1Y
YAMAA-01SYSBP3WEEK 4——120—————
YAMAA-01SYSBP4UNSCHEDULED2025-02-2316121WEEK 22151—
YAMAA-01SYSBP5UNSCHEDULED2027-11-041000119—————
YAMAA-01SYSBP6UNSCHEDULED2028-02-121100117—————
YAMAA-02SYSBP1BASELINE2025-06-021124BASELINE010Y
YAMAA-02SYSBP2WEEK 22025-06-1514120WEEK 22140Y
Shaded columns are derived— = missing value

Human review and assessment

Your review

3 questions and your comments · View benchmark discussions

Mapping spec

Generated from the benchmark YAML; do not edit by hand

Dataset NameVariable NameVariable LabelTypeCodelist/Controlled TermsCoreComputational MethodOrigin
ADVSSTUDYIDStudy IdentifiercharacterCopy value from ADVS_RAW.STUDYID.Predecessor
ADVSUSUBJIDUnique Subject IdentifiercharacterCopy value from ADVS_RAW.USUBJID.Predecessor
ADVSPARAMCDParameter CodecharacterCopy value from ADVS_RAW.PARAMCD.Predecessor
ADVSVSSEQSequence NumbernumericCopy value from ADVS_RAW.VSSEQ.Predecessor
ADVSVISITVisit NamecharacterCopy value from ADVS_RAW.VISIT.Predecessor
ADVSADTAnalysis DatenumericISO 8601Copy value from ADVS_RAW.ADT.Predecessor
ADVSADYAnalysis Relative DaynumericCopy value from ADVS_RAW.ADY.Predecessor
ADVSAVALAnalysis ValuenumericCopy value from ADVS_RAW.AVAL.Predecessor
ADVSAVISITAnalysis VisitcharacterTake AVISIT from the AWINDOW record matching on STUDYID, where ADY falls within AWLO to AWHI, and no match yields blank.Derived
ADVSAVISITNAnalysis Visit (N)numericTake AVISITN from the AWINDOW record matching on STUDYID, where ADY falls within AWLO to AWHI, and no match yields blank.Derived
ADVSAWTARGETAnalysis Window TargetnumericTake AWTARGET from the AWINDOW record matching on STUDYID, where ADY falls within AWLO to AWHI, and no match yields blank.Derived
ADVSAWTDIFFAnalysis Window DifferencenumericCompute ADY - AWTARGET.Derived
ADVSANL01FLAnalysis Record Flag 01characterY"Y" when AWRANK = 1; blank otherwise.Derived
VariablePermitted values
ANL01FLY
VersionDateAuthorDescriptionReviewerSign-off
1.72026-10-20yamaa docs buildRead 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.62026-10-17yamaa docs buildDescribe collected date parts written as ISO 8601 date text and times of day counted in seconds since midnight
1.52026-10-17yamaa docs buildName 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.42026-10-15yamaa docs buildState datetime precision codes through the hour and minute, and complete only the time parts a collected datetime lacks
1.32026-09-29yamaa docs buildShow study codelist names, external dictionaries, and ISO 8601 formats in variable rows; list the document's codelist values and metadata
1.22026-09-29yamaa docs buildClassify ADaM copies from a declared input as Predecessor and recodes as Derived, and SDTM recodes of locally derived columns as Derived
1.12026-09-29yamaa docs buildResolve lookups into the donor record they select, and give every derivation shape a plain-language rule instead of its raw YAML
1.0yamaa docs buildInitial generation from spec.yaml

Agent prompt

The request an agent receives with the input files; each tier states no more than the one above

prompts/adam-advs-window-table/full.md

Edit
25 lines

Following 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

Edit
11 lines

Following 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

Edit
9 lines

Following 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.

yamaa code

Public calls generated from benchmark.yaml; results must match the expected output

R

Edit
3 lines
library(yamaa)yamaa_spec("spec.yaml")$run()$output

Python

Edit
3 lines
import yamaayamaa.spec("spec.yaml").run().output

Solution without yamaa

Written from the full prompt and the inputs alone; CI checks it reproduces the expected output

solutions/adam-advs-window-table/result.R

Edit
73 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

Edit
100 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

Edit
28 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;