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: derive ADT, AVAL, TRTSDT, and HEIGHTBL for each
planned measurement: height is planned under the code
HEIGHT (one subject plans it twice to exercise baseline-height
selection) and weight is planned repeatedly under the code
WEIGHT.
Input: a planned-measurement spine per subject carrying the
planned order, the parameter code, and ADT; long-form vital
signs carrying the test code (VSTESTCD), the collection date
(VSDTC), the numeric result (VSSTRESN) that supplies the
analysis value, and the sequence number; and subject treatment
dates (TRTSDT). A collected record belongs to a planned
measurement when the test code matches the planned parameter and
the collection date matches ADT.
Variables:
ADT: the planned analysis date, carried through unchanged.AVAL: the collected numeric result when the planned measurement was collected, otherwise the most recent earlier collected value for the same subject and parameter; missing before the first collected value.TRTSDT: the subject treatment start date, repeated on every record of the subject.HEIGHTBL: the latest height collected on or before treatment start, repeated on every record of the subject so later weight records retain the once-measured characteristic; missing for a subject with no pre-treatment height.
Note: a carried value never crosses subjects or parameters,
while HEIGHTBL repeats one selected height across both
parameters.
Inputs
Under review3 source filesinput/adsl.csv
Edit6 rows| STUDYID | USUBJID | TRTSDT |
|---|---|---|
| YAMAA-01 | 2025-01-07 | |
| YAMAA-01 | 2025-01-15 | |
| YAMAA-01 | 2025-02-03 | |
| YAMAA-01 | 2025-02-10 | |
| YAMAA-01 | 2025-03-01 | |
| YAMAA-01 | 2025-03-10 |
input/plan.csv
Edit21 rows| STUDYID | USUBJID | ASEQ | PARAMCD | ADT |
|---|---|---|---|---|
| YAMAA-01 | 1 | HEIGHT | 2025-01-06 | |
| YAMAA-01 | 2 | WEIGHT | 2025-01-06 | |
| YAMAA-01 | 3 | WEIGHT | 2025-01-27 | |
| YAMAA-01 | 4 | WEIGHT | 2025-02-17 | |
| YAMAA-01 | 1 | HEIGHT | 2025-01-14 | |
| YAMAA-01 | 2 | WEIGHT | 2025-01-14 | |
| YAMAA-01 | 3 | WEIGHT | 2025-02-04 | |
| YAMAA-01 | 4 | WEIGHT | 2025-02-25 | |
| YAMAA-01 | 1 | HEIGHT | 2025-02-02 | |
| YAMAA-01 | 2 | WEIGHT | 2025-02-02 | |
| YAMAA-01 | 3 | WEIGHT | 2025-02-23 | |
| YAMAA-01 | 4 | WEIGHT | 2025-03-16 | |
| YAMAA-01 | 1 | HEIGHT | 2025-02-01 | |
| YAMAA-01 | 2 | HEIGHT | 2025-02-20 | |
| YAMAA-01 | 3 | WEIGHT | 2025-02-01 | |
| YAMAA-01 | 4 | WEIGHT | 2025-02-20 | |
| YAMAA-01 | 5 | WEIGHT | 2025-03-13 | |
| YAMAA-01 | 1 | HEIGHT | 2025-03-01 | |
| YAMAA-01 | 2 | WEIGHT | 2025-03-01 | |
| YAMAA-01 | 3 | WEIGHT | 2025-03-22 | |
| YAMAA-01 | 1 | WEIGHT | 2025-03-09 |
input/vs.csv
Edit13 rows| STUDYID | USUBJID | VSSEQ | VSTESTCD | VSDTC | VSSTRESN |
|---|---|---|---|---|---|
| YAMAA-01 | 1 | HEIGHT | 2025-01-06 | 175 | |
| YAMAA-01 | 2 | WEIGHT | 2025-01-06 | 72.5 | |
| YAMAA-01 | 3 | WEIGHT | 2025-01-27 | 73.1 | |
| YAMAA-01 | 4 | WEIGHT | 2025-02-17 | 71.8 | |
| YAMAA-01 | 1 | WEIGHT | 2025-02-04 | 88.0 | |
| YAMAA-01 | 1 | HEIGHT | 2025-02-02 | 162 | |
| YAMAA-01 | 2 | WEIGHT | 2025-02-02 | 58.4 | |
| YAMAA-01 | 1 | HEIGHT | 2025-02-01 | 180 | |
| YAMAA-01 | 2 | HEIGHT | 2025-02-20 | 181 | |
| YAMAA-01 | 3 | WEIGHT | 2025-02-01 | 95.2 | |
| YAMAA-01 | 1 | HEIGHT | 2025-03-01 | 168 | |
| YAMAA-01 | 2 | WEIGHT | 2025-03-22 | 64.0 | |
| YAMAA-01 | 1 | WEIGHT | 2025-03-09 | 77.3 |
Expected output
Under review21 expected rowsexpected/advs.csv
Edit21 rows| STUDYID | USUBJID | ASEQ | VSSEQ | PARAMCD | ADT | AVAL | TRTSDT | HEIGHTBL |
|---|---|---|---|---|---|---|---|---|
| YAMAA-01 | 1 | 1 | HEIGHT | 2025-01-06 | 175 | 2025-01-07 | 175 | |
| YAMAA-01 | 2 | 2 | WEIGHT | 2025-01-06 | 72.5 | 2025-01-07 | 175 | |
| YAMAA-01 | 3 | 3 | WEIGHT | 2025-01-27 | 73.1 | 2025-01-07 | 175 | |
| YAMAA-01 | 4 | 4 | WEIGHT | 2025-02-17 | 71.8 | 2025-01-07 | 175 | |
| YAMAA-01 | 1 | — | HEIGHT | 2025-01-14 | — | 2025-01-15 | — | |
| YAMAA-01 | 2 | — | WEIGHT | 2025-01-14 | — | 2025-01-15 | — | |
| YAMAA-01 | 3 | 1 | WEIGHT | 2025-02-04 | 88 | 2025-01-15 | — | |
| YAMAA-01 | 4 | — | WEIGHT | 2025-02-25 | 88 | 2025-01-15 | — | |
| YAMAA-01 | 1 | 1 | HEIGHT | 2025-02-02 | 162 | 2025-02-03 | 162 | |
| YAMAA-01 | 2 | 2 | WEIGHT | 2025-02-02 | 58.4 | 2025-02-03 | 162 | |
| YAMAA-01 | 3 | — | WEIGHT | 2025-02-23 | 58.4 | 2025-02-03 | 162 | |
| YAMAA-01 | 4 | — | WEIGHT | 2025-03-16 | 58.4 | 2025-02-03 | 162 | |
| YAMAA-01 | 1 | 1 | HEIGHT | 2025-02-01 | 180 | 2025-02-10 | 180 | |
| YAMAA-01 | 2 | 2 | HEIGHT | 2025-02-20 | 181 | 2025-02-10 | 180 | |
| YAMAA-01 | 3 | 3 | WEIGHT | 2025-02-01 | 95.2 | 2025-02-10 | 180 | |
| YAMAA-01 | 4 | — | WEIGHT | 2025-02-20 | 95.2 | 2025-02-10 | 180 | |
| YAMAA-01 | 5 | — | WEIGHT | 2025-03-13 | 95.2 | 2025-02-10 | 180 | |
| YAMAA-01 | 1 | 1 | HEIGHT | 2025-03-01 | 168 | 2025-03-01 | 168 | |
| YAMAA-01 | 2 | — | WEIGHT | 2025-03-01 | — | 2025-03-01 | 168 | |
| YAMAA-01 | 3 | 2 | WEIGHT | 2025-03-22 | 64 | 2025-03-01 | 168 | |
| YAMAA-01 | 1 | 1 | WEIGHT | 2025-03-09 | 77.3 | 2025-03-10 | — |
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 PLAN.STUDYID. | Predecessor | ||
| ADVS | USUBJID | Unique Subject Identifier | character | Copy value from PLAN.USUBJID. | Predecessor | ||
| ADVS | ASEQ | Analysis Sequence Number | numeric | Copy value from PLAN.ASEQ. | Predecessor | ||
| ADVS | PARAMCD | Parameter Code | character | Copy value from PLAN.PARAMCD. | Predecessor | ||
| ADVS | ADT | Analysis Date | numeric | ISO 8601 | Copy value from PLAN.ADT. | Predecessor | |
| ADVS | VSSEQ | Sequence Number | numeric | Take VSSEQ from the VS record whose STUDYID equals STUDYID, USUBJID equals USUBJID, VSTESTCD equals PARAMCD and VSDTC equals ADT, and no match yields blank. | Derived | ||
| ADVS | AVAL | Analysis Value | numeric | First non-missing of AVALCOL and AVALPREV. | Derived | ||
| ADVS | TRTSDT | Date of First Exposure to Treatment | numeric | ISO 8601 | Copy value from ADSL.TRTSDT. | Predecessor | |
| ADVS | HEIGHTBL | Baseline Height | numeric | Aggregate ONLY(AVALCOL) over records grouped by STUDYID, USUBJID, matching on the shared output keys, where HGTBLFL = 'Y'. | 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-carryforward/full.md
Edit23 linesFollowing CDISC ADaM standards, use the provided ADSL, PLAN, and VS datasets to create an ADVS dataset with one record per planned measurement.
The output dataset should contain the following columns in this order: STUDYID, USUBJID, ASEQ, VSSEQ, PARAMCD, ADT, AVAL, TRTSDT, HEIGHTBL
A collected record belongs to a planned measurement when it is for the same study and subject, its test code is the planned parameter code, and its collection date matches ADT. VSSEQ is the sequence number of that collected record, and VSSEQ has no value when the planned measurement was not collected. AVAL is the collected numeric result when the planned measurement was collected. When the planned measurement was not collected, AVAL is the most recent earlier collected value for the same subject and parameter, and AVAL has no value before the first collected value for that subject and parameter. TRTSDT is the subject's treatment start date, repeated on every record of the subject. HEIGHTBL is the latest height value collected on or before the subject's treatment start date, repeated on every record of the subject. HEIGHTBL has no value when no height was collected on or before the subject's treatment start date.
Read the source datasets from /app/input and save the completed dataset as /app/output/advs.csv.
prompts/adam-advs-carryforward/conventions.md
Edit8 linesFollowing CDISC ADaM standards, use the provided ADSL, PLAN, and VS datasets to create an ADVS dataset with one record per planned measurement.
The output dataset should contain the following columns in this order: STUDYID, USUBJID, ASEQ, VSSEQ, PARAMCD, ADT, AVAL, TRTSDT, HEIGHTBL
Read the source datasets from /app/input and save the completed dataset as /app/output/advs.csv.
prompts/adam-advs-carryforward/brief.md
Edit8 linesFollowing CDISC ADaM standards, use the provided ADSL, PLAN, and VS datasets to create an ADVS dataset with one record per planned measurement.
The output dataset should contain the following columns in this order: STUDYID, USUBJID, ASEQ, VSSEQ, PARAMCD, ADT, AVAL, TRTSDT, HEIGHTBL
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-carryforward/result.R
Edit61 lines# Reference solution for the yamaa benchmark adam-advs-carryforward (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)library(tidyr)plan <- read_csv( "/app/input/plan.csv", col_types = cols(ASEQ = col_integer(), ADT = col_date(), .default = col_character()))vs <- read_csv( "/app/input/vs.csv", col_types = cols( VSSEQ = col_integer(), VSDTC = col_date(), VSSTRESN = col_double(), .default = col_character() ))adsl <- read_csv( "/app/input/adsl.csv", col_types = cols(TRTSDT = col_date(), .default = col_character()))# The record collected for a planned measurement: same subject, test code# as the parameter, and collection date as the planned date.collected <- plan |> left_join( vs |> select(STUDYID, USUBJID, VSSEQ, VSTESTCD, VSDTC, AVALCOL = VSSTRESN), by = c("STUDYID", "USUBJID", "PARAMCD" = "VSTESTCD", "ADT" = "VSDTC") )# The collected value, otherwise the most recent earlier value for the# same subject and parameter, in planned order.carried <- collected |> arrange(STUDYID, USUBJID, PARAMCD, ADT, ASEQ) |> group_by(STUDYID, USUBJID, PARAMCD) |> fill(AVALCOL, .direction = "down") |> mutate(AVAL = AVALCOL) |> ungroup()# The latest height on or before treatment start, repeated on every# record of the subject.heights <- vs |> filter(VSTESTCD %in% "HEIGHT", !is.na(VSSTRESN)) |> left_join(adsl |> select(STUDYID, USUBJID, TRTSDT), by = c("STUDYID", "USUBJID")) |> filter(!is.na(VSDTC), VSDTC <= TRTSDT) |> arrange(STUDYID, USUBJID, VSDTC, VSSEQ) |> group_by(STUDYID, USUBJID) |> summarise(HEIGHTBL = last(VSSTRESN), .groups = "drop")advs <- carried |> left_join(adsl |> select(STUDYID, USUBJID, TRTSDT), by = c("STUDYID", "USUBJID")) |> left_join(heights, by = c("STUDYID", "USUBJID")) |> arrange(USUBJID, ASEQ) |> select(STUDYID, USUBJID, ASEQ, VSSEQ, PARAMCD, ADT, AVAL, TRTSDT, HEIGHTBL)dir.create("/app/output", showWarnings = FALSE)write_csv(advs, "/app/output/advs.csv", na = "")solutions/adam-advs-carryforward/result.py
Edit111 lines# Reference solution for the yamaa benchmark adam-advs-carryforward (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 ADVS with one record per planned measurement.Reads ADSL, PLAN and VS from /app/input and writes /app/output/advs.csv.A collected VS record belongs to a planned measurement when study,subject, test code (= planned parameter code) and collection date(= ADT) all match. Uncollected planned measurements carry forward themost recent earlier collected value for the same subject and parameter(LOCF). HEIGHTBL is the latest height collected on or before thesubject's treatment start date."""import csvimport osINPUT_DIR = "/app/input"OUTPUT_DIR = "/app/output"def read_csv(name): with open(os.path.join(INPUT_DIR, name), newline="") as f: return list(csv.DictReader(f))def main(): adsl = read_csv("adsl.csv") plan = read_csv("plan.csv") vs = read_csv("vs.csv") trtsdt = {row["USUBJID"]: row["TRTSDT"] for row in adsl} # Collected records keyed by (study, subject, test code). collected = {} for row in vs: key = (row["STUDYID"], row["USUBJID"], row["VSTESTCD"]) collected.setdefault(key, []).append(row) for rows in collected.values(): rows.sort(key=lambda r: (r["VSDTC"], int(r["VSSEQ"]))) def heightbl(usubjid): start = trtsdt.get(usubjid, "") best = None for row in vs: if ( row["USUBJID"] == usubjid and row["VSTESTCD"] == "HEIGHT" and row["VSDTC"] <= start ): if best is None or (row["VSDTC"], int(row["VSSEQ"])) > ( best["VSDTC"], int(best["VSSEQ"]), ): best = row return best["VSSTRESN"] if best is not None else "" out_rows = [] for p in plan: key = (p["STUDYID"], p["USUBJID"], p["PARAMCD"]) records = collected.get(key, []) match = None earlier = None for row in records: if row["VSDTC"] == p["ADT"]: match = row elif row["VSDTC"] < p["ADT"]: earlier = row if match is not None: vsseq = match["VSSEQ"] aval = match["VSSTRESN"] else: vsseq = "" aval = earlier["VSSTRESN"] if earlier is not None else "" out_rows.append( { "STUDYID": p["STUDYID"], "USUBJID": p["USUBJID"], "ASEQ": p["ASEQ"], "VSSEQ": vsseq, "PARAMCD": p["PARAMCD"], "ADT": p["ADT"], "AVAL": aval, "TRTSDT": trtsdt.get(p["USUBJID"], ""), "HEIGHTBL": heightbl(p["USUBJID"]), } ) os.makedirs(OUTPUT_DIR, exist_ok=True) fieldnames = [ "STUDYID", "USUBJID", "ASEQ", "VSSEQ", "PARAMCD", "ADT", "AVAL", "TRTSDT", "HEIGHTBL", ] with open(os.path.join(OUTPUT_DIR, "advs.csv"), "w", newline="") as f: writer = csv.DictWriter(f, fieldnames=fieldnames) writer.writeheader() writer.writerows(out_rows)if __name__ == "__main__": main()solutions/adam-advs-carryforward/result.sas
Edit45 lines/* opensas reference solution for the yamaa benchmark adam-advs-carryforward. Reads the benchmark inputs and derives the requested output. Execute with the existing opensas runtime: opensas /app/output/result.sas. */data adsl; length STUDYID USUBJID TRTSDT $1024; infile "/app/input/adsl.csv" dsd dlm="," firstobs=2 truncover lrecl=32767; input STUDYID : $char1024. USUBJID : $char1024. TRTSDT : $char1024.;run;data plan; length STUDYID USUBJID PARAMCD ADT $1024; infile "/app/input/plan.csv" dsd dlm="," firstobs=2 truncover lrecl=32767; input STUDYID : $char1024. USUBJID : $char1024. ASEQ PARAMCD : $char1024. ADT : $char1024.;run;data vs; length STUDYID USUBJID VSTESTCD VSDTC $1024; infile "/app/input/vs.csv" dsd dlm="," firstobs=2 truncover lrecl=32767; input STUDYID : $char1024. USUBJID : $char1024. VSSEQ VSTESTCD : $char1024. VSDTC : $char1024. VSSTRESN;run;proc sql; create table heights as select a.STUDYID,a.USUBJID,a.VSSTRESN as HEIGHTBL,a.VSDTC,a.VSSEQ from vs as a inner join adsl as b on a.STUDYID=b.STUDYID and a.USUBJID=b.USUBJID where a.VSTESTCD='HEIGHT' and not missing(a.VSSTRESN) and a.VSDTC ne '' and a.VSDTC<=b.TRTSDT;quit;proc sort data=heights; by STUDYID USUBJID descending VSDTC descending VSSEQ; run;data height; set heights; by STUDYID USUBJID; if first.USUBJID; run;proc sql; create table collected as select a.*,b.VSSEQ,b.VSSTRESN as AVALCOL,c.TRTSDT,d.HEIGHTBL from plan as a left join vs as b on a.STUDYID=b.STUDYID and a.USUBJID=b.USUBJID and a.PARAMCD=b.VSTESTCD and a.ADT=b.VSDTC left join adsl as c on a.STUDYID=c.STUDYID and a.USUBJID=c.USUBJID left join height as d on a.STUDYID=d.STUDYID and a.USUBJID=d.USUBJID;quit;proc sort data=collected; by STUDYID USUBJID PARAMCD ADT ASEQ; run;data result; retain carried; set collected; by STUDYID USUBJID PARAMCD; if first.PARAMCD then carried=.; if not missing(AVALCOL) then carried=AVALCOL; AVAL=carried;run;proc sql; create table final as select STUDYID, USUBJID, ASEQ, VSSEQ, PARAMCD, ADT, AVAL, TRTSDT, HEIGHTBL from result;quit;proc export data=final outfile="/app/output/advs.csv" dbms=csv replace; run;
yamaa