As a clinical trial statistician or programmer, challenge anything in this benchmark: describe a problem in Comments, or propose a fix with the Edit button on any source file.
- Task: Would a real study need this derivation, specified this way? Does it follow CDISC ADaM: variable names, controlled terms, record structure? Flag any rule that is ambiguous or that a sponsor would handle differently.
- Inputs: Do they look like data collected in a real trial, and do they include the situations you would expect to meet in one?
- Expected output: Would independent QC programming reproduce every value from these inputs and rules?
The other tabs beside Comments are background for assessment, not under review.
Summary
README.mdGoal: derive BASEVAL, each subject's first observed result
for a vital-sign parameter, carried forward to every later visit.
Input: vital-sign records keyed by subject, parameter code, and visit number, each carrying the collected numeric result. A visit with no collected result still has a record.
Variables:
AVISITN: the visit number of the measurement.AVAL: the collected numeric result, blank when the visit has no collected result.BASEVAL: the result from the subject's first visit with a collected result for the parameter, repeated on that and every later visit; blank on visits before any result was collected.
Note: the carried value never crosses subjects or parameters: each subject-parameter pair carries only its own first observed result.
Inputs
Under review1 source fileinput/vs.csv
Edit12 rows| STUDYID | USUBJID | PARAMCD | AVISITN | AVAL |
|---|---|---|---|---|
| YAMAA-01 | SYSBP | 1 | 120 | |
| YAMAA-01 | SYSBP | 2 | 125 | |
| YAMAA-01 | SYSBP | 3 | — | |
| YAMAA-01 | SYSBP | 4 | 130 | |
| YAMAA-01 | DIABP | 1 | 80 | |
| YAMAA-01 | DIABP | 2 | 82 | |
| YAMAA-01 | SYSBP | 1 | — | |
| YAMAA-01 | SYSBP | 2 | 140 | |
| YAMAA-01 | SYSBP | 3 | 145 | |
| YAMAA-01 | DIABP | 1 | 78 | |
| YAMAA-01 | SYSBP | 1 | — | |
| YAMAA-01 | SYSBP | 2 | — |
Expected output
Under review12 expected rowsexpected/advs.csv
Edit12 rows| STUDYID | USUBJID | PARAMCD | AVISITN | AVAL | BASEVAL |
|---|---|---|---|---|---|
| YAMAA-01 | SYSBP | 1 | 120 | 120 | |
| YAMAA-01 | SYSBP | 2 | 125 | 120 | |
| YAMAA-01 | SYSBP | 3 | — | 120 | |
| YAMAA-01 | SYSBP | 4 | 130 | 120 | |
| YAMAA-01 | DIABP | 1 | 80 | 80 | |
| YAMAA-01 | DIABP | 2 | 82 | 80 | |
| YAMAA-01 | SYSBP | 1 | — | — | |
| YAMAA-01 | SYSBP | 2 | 140 | 140 | |
| YAMAA-01 | SYSBP | 3 | 145 | 140 | |
| YAMAA-01 | DIABP | 1 | 78 | 78 | |
| YAMAA-01 | SYSBP | 1 | — | — | |
| YAMAA-01 | SYSBP | 2 | — | — |
Comments and assessment materials
| Dataset Name | Variable Name | Variable Label | Type | Codelist/Controlled Terms | Core | Computational Method | Origin |
|---|---|---|---|---|---|---|---|
| ADVS | STUDYID | Study Identifier | character | Copy value from VS.STUDYID. | Predecessor | ||
| ADVS | USUBJID | Unique Subject Identifier | character | Copy value from VS.USUBJID. | Predecessor | ||
| ADVS | PARAMCD | Parameter Code | character | Copy value from VS.PARAMCD. | Predecessor | ||
| ADVS | AVISITN | Analysis Visit Number | numeric | Copy value from VS.AVISITN. | Predecessor | ||
| ADVS | AVAL | Analysis Value | numeric | Copy value from VS.AVAL. | Predecessor | ||
| ADVS | BASEVAL | First Observed Analysis Value Carried Forward | numeric | First non-missing of _SEL_AVAL and _CARRIED. | Derived |
| Version | Date | Author | Description | Reviewer | Sign-off |
|---|---|---|---|---|---|
| 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-first-observed-carry/full.md
Edit16 linesFollowing CDISC ADaM standards, use the provided VS dataset to create an ADVS dataset with one record per subject per parameter per visit.
The output dataset should contain the following columns in this order: STUDYID, USUBJID, PARAMCD, AVISITN, AVAL, BASEVAL
AVISITN is the visit number of the measurement. AVAL is the collected numeric result, and has no value when the visit has none.
BASEVAL is the result from the subject's first visit with a collected result for the parameter, repeated on that and every later visit; it has no value on visits before any result was collected. The carried value never crosses subjects or parameters.
Read the source datasets from /app/input and save the completed dataset as /app/output/advs.csv.
prompts/adam-advs-first-observed-carry/conventions.md
Edit8 linesFollowing CDISC ADaM standards, use the provided VS dataset to create an ADVS dataset with one record per subject per parameter per visit.
The output dataset should contain the following columns in this order: STUDYID, USUBJID, PARAMCD, AVISITN, AVAL, BASEVAL
Read the source datasets from /app/input and save the completed dataset as /app/output/advs.csv.
prompts/adam-advs-first-observed-carry/brief.md
Edit8 linesFollowing CDISC ADaM standards, use the provided VS dataset to create an ADVS dataset with one record per subject per parameter per visit.
The output dataset should contain the following columns in this order: STUDYID, USUBJID, PARAMCD, AVISITN, AVAL, BASEVAL
Read the source datasets from /app/input and save the completed dataset as /app/output/advs.csv.
run.R
Edit4 lineslibrary(yamaa)advs <- yamaa_domain("spec.yaml")$outputadvsrun.py
Edit4 linesimport yamaaadvs = yamaa.yamaa_domain("spec.yaml").outputadvssolutions/adam-advs-first-observed-carry/result.R
Edit31 lines# Reference solution for the yamaa benchmark adam-advs-first-observed-carry (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)vs <- read_csv( "/app/input/vs.csv", col_types = cols(AVISITN = col_integer(), AVAL = col_double(), .default = col_character()))# The first visit with a result for each subject and parameter.firsts <- vs |> filter(!is.na(AVAL)) |> arrange(STUDYID, USUBJID, PARAMCD, AVISITN) |> distinct(STUDYID, USUBJID, PARAMCD, .keep_all = TRUE) |> select(STUDYID, USUBJID, PARAMCD, FIRST_AVAL = AVAL, FIRST_VISIT = AVISITN)# The first result, repeated on that and every later visit; visits before# any result stay missing.advs <- vs |> left_join(firsts, by = c("STUDYID", "USUBJID", "PARAMCD")) |> mutate(BASEVAL = if_else(!is.na(FIRST_VISIT) & AVISITN >= FIRST_VISIT, FIRST_AVAL, NA_real_)) |> arrange(USUBJID, PARAMCD, AVISITN) |> select(STUDYID, USUBJID, PARAMCD, AVISITN, AVAL, BASEVAL)dir.create("/app/output", showWarnings = FALSE)write_csv(advs, "/app/output/advs.csv", na = "")solutions/adam-advs-first-observed-carry/result.py
Edit38 lines# Reference solution for the yamaa benchmark adam-advs-first-observed-carry (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.from pathlib import Pathimport polars as plvs = pl.read_csv("/app/input/vs.csv", infer_schema=False).with_columns( pl.col("AVISITN").cast(pl.Int64, strict=False), pl.col("AVAL").cast(pl.Float64, strict=False),)# The first visit with a result for each subject and parameter.firsts = ( vs.filter(pl.col("AVAL").is_not_null()) .sort("AVISITN") .unique(["STUDYID", "USUBJID", "PARAMCD"], keep="first", maintain_order=True) .select("STUDYID", "USUBJID", "PARAMCD", FIRST_AVAL="AVAL", FIRST_VISIT="AVISITN"))# The first result, repeated on that and every later visit; visits before# any result stay missing.advs = ( vs.join(firsts, on=["STUDYID", "USUBJID", "PARAMCD"], how="left") .with_columns( BASEVAL=pl.when(pl.col("AVISITN") >= pl.col("FIRST_VISIT")) .then(pl.col("FIRST_AVAL")) .otherwise(None) ) .sort(["USUBJID", "PARAMCD", "AVISITN"]) .select("STUDYID", "USUBJID", "PARAMCD", "AVISITN", "AVAL", "BASEVAL"))Path("/app/output").mkdir(parents=True, exist_ok=True)advs.write_csv("/app/output/advs.csv")solutions/adam-advs-first-observed-carry/result.sas
Edit23 lines/* opensas reference solution for the yamaa benchmark adam-advs-first-observed-carry. Reads the benchmark inputs and derives the requested output. Execute with the existing opensas runtime: opensas /app/output/result.sas. */data vs; length STUDYID USUBJID PARAMCD $1024; infile "/app/input/vs.csv" dsd dlm="," firstobs=2 truncover lrecl=32767; input STUDYID : $char1024. USUBJID : $char1024. PARAMCD : $char1024. AVISITN AVAL;run;proc sort data=vs out=ordered; by STUDYID USUBJID PARAMCD AVISITN; run;data result; set ordered; by STUDYID USUBJID PARAMCD; retain carried; if first.PARAMCD then carried=.; if not missing(AVAL) and missing(carried) then carried=AVAL; BASEVAL=carried;run;proc sql; create table final as select STUDYID, USUBJID, PARAMCD, AVISITN, AVAL, BASEVAL from result;quit;proc export data=final outfile="/app/output/advs.csv" dbms=csv replace; run;
yamaa
Comments
Signed in with GitHub; saved in repository Discussions