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 laboratory record in its analysis visit (AVISIT, AWTARGET, ADIST) and flag the record closest to the visit's target day (ANL01FL).

Input: one record per laboratory measurement, carrying the analysis date (ADT), the study day (ADY, empty when it could not be computed), and the measured result (AVAL).

Variables:

  • AVISIT is the analysis visit the record falls in (WEEK 2 covers study days 8 through 22). It stays empty when the record falls outside every window or the study day is missing.
  • AWTARGET is the study day the visit aims at (day 15 for WEEK 2); empty whenever AVISIT is.
  • ADIST is how far the record's study day lies from the target, in days and without direction; empty whenever AVISIT is. It shows why a record was chosen: the smallest distance wins.
  • ANL01FL holds Y for the record that stands for its subject and parameter in the visit: the closest to the target, the one with the later study day when two are equally close, or the one with the lower sequence number when they share the same day. It stays empty on every other record.

Note: the three window columns travel together: a record inside the window carries all three, while a record outside every window or with a missing study day carries none and is never flagged. All records stay in the output, and the flag identifies the ones selected for analysis.

Inputs

Under review
1 source file

input/adlb_raw.csv

Edit
11 rows
input/adlb_raw.csv
STUDYIDUSUBJIDPARAMCDLBSEQADTADYAVAL
CATHALT12025-01-171022
CATHALT22025-01-272026
CATHALT32025-02-063024
CATHALT12025-02-191231
CATHALT22025-02-231629
CATHAST12025-02-211427
CATHALT12025-03-15818
CATHALT12025-04-092233
CATHALT12025-04-301521
CATHALT22025-04-301523
CATHALT12025-05-12—28

Expected output

Under review
11 expected rows

expected/adlb.csv

Edit
11 rows
expected/adlb.csv
STUDYIDUSUBJIDPARAMCDLBSEQADTADYAVALAVISITAWTARGETADISTANL01FL
CATHALT12025-01-171022WEEK 2155—
CATHALT22025-01-272026WEEK 2155Y
CATHALT32025-02-063024————
CATHALT12025-02-191231WEEK 2153—
CATHALT22025-02-231629WEEK 2151Y
CATHAST12025-02-211427WEEK 2151Y
CATHALT12025-03-15818WEEK 2157Y
CATHALT12025-04-092233WEEK 2157Y
CATHALT12025-04-301521WEEK 2150Y
CATHALT22025-04-301523WEEK 2150—
CATHALT12025-05-12—28————
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
ADLBSTUDYIDStudy IdentifiercharacterCopy value from ADLB_RAW.STUDYID.Predecessor
ADLBUSUBJIDUnique Subject IdentifiercharacterCopy value from ADLB_RAW.USUBJID.Predecessor
ADLBPARAMCDParameter CodecharacterCopy value from ADLB_RAW.PARAMCD.Predecessor
ADLBLBSEQSequence NumbernumericCopy value from ADLB_RAW.LBSEQ.Predecessor
ADLBADTAnalysis DatenumericISO 8601Copy value from ADLB_RAW.ADT.Predecessor
ADLBADYAnalysis Relative DaynumericCopy value from ADLB_RAW.ADY.Predecessor
ADLBAVALAnalysis ValuenumericCopy value from ADLB_RAW.AVAL.Predecessor
ADLBAVISITAnalysis VisitcharacterWEEK 2If ADY BETWEEN 8 AND 22 then "WEEK 2"; otherwise blank.Derived
ADLBAWTARGETAnalysis Window TargetnumericIf AVISIT IS NOT NULL then "15"; otherwise blank.Derived
ADLBADISTAnalysis Day Distance from TargetnumericCompute ABS(ADY - AWTARGET).Derived
ADLBANL01FLAnalysis Record Flag 01character"Y" when ARNK = 1; blank otherwise.Derived
VariablePermitted values
AVISITWEEK 2
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-adlb-closest-visit/full.md

Edit
21 lines

Following CDISC ADaM standards, use the provided ADLB_RAW dataset to create an ADLB dataset with one record per laboratory measurement in ADLB_RAW.

The output dataset should contain the following columns in this order: STUDYID, USUBJID, PARAMCD, LBSEQ, ADT, ADY, AVAL, AVISIT, AWTARGET, ADIST, ANL01FL

AVISIT is "WEEK 2" when ADY is from 8 through 22. AVISIT has no value when ADY has no value or falls outside that range. AWTARGET is 15 when AVISIT is "WEEK 2", and has no value when AVISIT has no value. ADIST is the number of days between ADY and AWTARGET, without direction, and has no value when AVISIT has no value. Within a subject, parameter, and visit, the record with the smallest ADIST stands for that subject and parameter in the visit. When two such records are equally close to the target, the one with the later ADY stands; when they also share the same ADY, the one with the lower LBSEQ stands. ANL01FL is "Y" on the record that stands for its subject and parameter in the visit, and has no value on every other record. Every record of ADLB_RAW stays in the output.

Read the source datasets from /app/input and save the completed dataset as /app/output/adlb.csv.

prompts/adam-adlb-closest-visit/conventions.md

Edit
12 lines

Following CDISC ADaM standards, use the provided ADLB_RAW dataset to create an ADLB dataset with one record per laboratory measurement in ADLB_RAW.

The output dataset should contain the following columns in this order: STUDYID, USUBJID, PARAMCD, LBSEQ, ADT, ADY, AVAL, AVISIT, AWTARGET, ADIST, ANL01FL

AVISIT is "WEEK 2" or has no value. AWTARGET is 15 or has no value. ANL01FL is "Y" or has no value.

Read the source datasets from /app/input and save the completed dataset as /app/output/adlb.csv.

prompts/adam-adlb-closest-visit/brief.md

Edit
9 lines

Following CDISC ADaM standards, use the provided ADLB_RAW dataset to create an ADLB dataset with one record per laboratory measurement in ADLB_RAW.

The output dataset should contain the following columns in this order: STUDYID, USUBJID, PARAMCD, LBSEQ, ADT, ADY, AVAL, AVISIT, AWTARGET, ADIST, ANL01FL

Read the source datasets from /app/input and save the completed dataset as /app/output/adlb.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-adlb-closest-visit/result.R

Edit
51 lines
# Reference solution for the yamaa benchmark adam-adlb-closest-visit (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)raw <- read_csv(  "/app/input/adlb_raw.csv",  col_types = cols(    LBSEQ = col_integer(),    ADY = col_integer(),    AVAL = col_double(),    ADT = col_date(),    .default = col_character()  ))# WEEK 2 for study days 8 through 22; target day 15 and distance travel# together, and records outside the window or with a missing day carry# none and are never flagged.based <- raw |>  mutate(    AVISIT = if_else(!is.na(ADY) & ADY >= 8 & ADY <= 22, "WEEK 2", NA_character_),    AWTARGET = if_else(!is.na(AVISIT), 15L, NA_integer_),    ADIST = abs(ADY - AWTARGET)  )# The record standing for its subject and parameter: the closest to the# target, the later study day when equally close, the lower sequence# number when they share the same day.winners <- based |>  filter(!is.na(AVISIT)) |>  arrange(ADIST, desc(ADY), LBSEQ) |>  distinct(STUDYID, USUBJID, PARAMCD, AVISIT, .keep_all = TRUE) |>  transmute(STUDYID, USUBJID, PARAMCD, AVISIT, LBSEQ, ANL01FL = "Y")adlb <- based |>  left_join(    winners,    by = c("STUDYID", "USUBJID", "PARAMCD", "AVISIT", "LBSEQ")  ) |>  select(    STUDYID, USUBJID, PARAMCD, LBSEQ, ADT, ADY, AVAL,    AVISIT, AWTARGET, ADIST, ANL01FL  )dir.create("/app/output", showWarnings = FALSE)write_csv(adlb, "/app/output/adlb.csv", na = "")

solutions/adam-adlb-closest-visit/result.py

Edit
51 lines
# Reference solution for the yamaa benchmark adam-adlb-closest-visit (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 = "/app/input/adlb_raw.csv"OUTPUT = "/app/output/adlb.csv"with open(INPUT, newline="") as f:    rows = list(csv.DictReader(f))for row in rows:    ady_raw = (row["ADY"] or "").strip()    ady = int(ady_raw) if ady_raw else None    row["_ady"] = ady    if ady is not None and 8 <= ady <= 22:        row["AVISIT"] = "WEEK 2"        row["AWTARGET"] = 15        row["ADIST"] = abs(ady - 15)    else:        row["AVISIT"] = ""        row["AWTARGET"] = ""        row["ADIST"] = ""    row["ANL01FL"] = ""groups = {}for i, row in enumerate(rows):    if row["AVISIT"]:        key = (row["USUBJID"], row["PARAMCD"], row["AVISIT"])        groups.setdefault(key, []).append(i)for idxs in groups.values():    best = min(        idxs,        key=lambda i: (rows[i]["ADIST"], -rows[i]["_ady"], int(rows[i]["LBSEQ"])),    )    rows[best]["ANL01FL"] = "Y"columns = [    "STUDYID", "USUBJID", "PARAMCD", "LBSEQ", "ADT", "ADY", "AVAL",    "AVISIT", "AWTARGET", "ADIST", "ANL01FL",]with open(OUTPUT, "w", newline="") as f:    writer = csv.DictWriter(f, fieldnames=columns, extrasaction="ignore")    writer.writeheader()    for row in rows:        writer.writerow(row)

solutions/adam-adlb-closest-visit/result.sas

Edit
24 lines
/* opensas reference solution for the yamaa benchmark adam-adlb-closest-visit.   Reads the benchmark inputs and derives the requested output.   Execute with the existing opensas runtime: opensas /app/output/result.sas. */data adlb_raw;  length STUDYID USUBJID PARAMCD ADT $1024;  infile "/app/input/adlb_raw.csv" dsd dlm="," firstobs=2 truncover lrecl=32767;  input STUDYID : $char1024. USUBJID : $char1024. PARAMCD : $char1024. LBSEQ ADT : $char1024. ADY AVAL;run;data candidates;  length AVISIT $6 ANL01FL $1;  set adlb_raw;  if not missing(ADY) and ADY>=8 and ADY<=22 then do;    AVISIT='WEEK 2'; AWTARGET=15; ADIST=abs(ADY-15);  end;run;proc sort data=candidates; by STUDYID USUBJID PARAMCD AVISIT ADIST descending ADY LBSEQ; run;data result; set candidates; by STUDYID USUBJID PARAMCD AVISIT; if first.AVISIT and not missing(AVISIT) then ANL01FL='Y'; run;proc sql;  create table final as select STUDYID, USUBJID, PARAMCD, LBSEQ, ADT, ADY, AVAL, AVISIT, AWTARGET, ADIST, ANL01FL from result;quit;proc export data=final outfile="/app/output/adlb.csv" dbms=csv replace; run;