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 each subject's analysis age (AAGE) and its unit
(AAGEU) at randomization for the subject-level dataset.
Input: demographics (DM) records carrying the birth date
(BRTHDT) and the randomization date (RANDDT); both dates are
carried through unchanged.
Variables:
AAGEis the count of yearly anniversaries ofBRTHDTfalling on or beforeRANDDT; missing when either date is absent. A February 29 birthday falls on February 28 in common years, and a randomization date before the birth date gives the negated count with the dates exchanged.
Note: AAGEU stays YEARS on every record, even where AAGE
is missing for absent dates.
Inputs
Under review1 source fileinput/dm.csv
Edit8 rows| STUDYID | USUBJID | BRTHDT | RANDDT |
|---|---|---|---|
| YAMAA-01 | 1984-09-06 | 2020-02-24 | |
| YAMAA-01 | 1996-02-29 | 2024-02-28 | |
| YAMAA-01 | 1996-02-29 | 2024-02-29 | |
| YAMAA-01 | 1975-06-15 | 2021-06-15 | |
| YAMAA-01 | 1988-03-10 | 2020-03-09 | |
| YAMAA-01 | 1990-01-01 | 1989-01-01 | |
| YAMAA-01 | 2000-01-01 | — | |
| YAMAA-01 | — | 2020-01-01 |
Expected output
Under review8 expected rowsexpected/adsl.csv
Edit8 rows| STUDYID | USUBJID | BRTHDT | RANDDT | AAGE | AAGEU |
|---|---|---|---|---|---|
| YAMAA-01 | 1984-09-06 | 2020-02-24 | 35 | YEARS | |
| YAMAA-01 | 1996-02-29 | 2024-02-28 | 27 | YEARS | |
| YAMAA-01 | 1996-02-29 | 2024-02-29 | 28 | YEARS | |
| YAMAA-01 | 1975-06-15 | 2021-06-15 | 46 | YEARS | |
| YAMAA-01 | 1988-03-10 | 2020-03-09 | 31 | YEARS | |
| YAMAA-01 | 1990-01-01 | 1989-01-01 | -1 | YEARS | |
| YAMAA-01 | 2000-01-01 | — | — | YEARS | |
| YAMAA-01 | — | 2020-01-01 | — | YEARS |
Comments and assessment materials
| Dataset Name | Variable Name | Variable Label | Type | Codelist/Controlled Terms | Core | Computational Method | Origin |
|---|---|---|---|---|---|---|---|
| ADSL | STUDYID | Study Identifier | character | Copy value from DM.STUDYID. | Predecessor | ||
| ADSL | USUBJID | Unique Subject Identifier | character | Copy value from DM.USUBJID. | Predecessor | ||
| ADSL | BRTHDT | Date of Birth | numeric | ISO 8601 | Copy value from DM.BRTHDT. | Predecessor | |
| ADSL | RANDDT | Date of Randomization | numeric | ISO 8601 | Copy value from DM.RANDDT. | Predecessor | |
| ADSL | AAGE | Analysis Age | numeric | Whole years from BRTHDT to RANDDT, counting the end date but not the start. | Derived | ||
| ADSL | AAGEU | Analysis Age Unit | character | Set constant value "YEARS". | Assigned |
| 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-adsl-analysis-age/full.md
Edit15 linesFollowing CDISC ADaM standards, use the provided DM dataset to create an ADSL dataset with one record per subject.
The output dataset should contain the following columns in this order: STUDYID, USUBJID, BRTHDT, RANDDT, AAGE, AAGEU
AAGE is the count of yearly anniversaries of the birth date falling on or before the randomization date; it has no value when either date is absent. A February 29 birthday falls on February 28 in common years, and a randomization date before the birth date gives the negated count with the dates exchanged. AAGEU is YEARS on every record, even where AAGE is missing.
Read the source datasets from /app/input and save the completed dataset as /app/output/adsl.csv.
prompts/adam-adsl-analysis-age/conventions.md
Edit11 linesFollowing CDISC ADaM standards, use the provided DM dataset to create an ADSL dataset with one record per subject.
The output dataset should contain the following columns in this order: STUDYID, USUBJID, BRTHDT, RANDDT, AAGE, AAGEU
AAGE is the count of yearly anniversaries of the birth date. A February 29 birthday falls on February 28 in common years.
Read the source datasets from /app/input and save the completed dataset as /app/output/adsl.csv.
prompts/adam-adsl-analysis-age/brief.md
Edit8 linesFollowing CDISC ADaM standards, use the provided DM dataset to create an ADSL dataset with one record per subject.
The output dataset should contain the following columns in this order: STUDYID, USUBJID, BRTHDT, RANDDT, AAGE, AAGEU
Read the source datasets from /app/input and save the completed dataset as /app/output/adsl.csv.
run.R
Edit4 lineslibrary(yamaa)adsl <- yamaa_domain("spec.yaml")$outputadslrun.py
Edit4 linesimport yamaaadsl = yamaa.yamaa_domain("spec.yaml").outputadslsolutions/adam-adsl-analysis-age/result.R
Edit50 lines# Reference solution for the yamaa benchmark adam-adsl-analysis-age (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)dm <- read_csv( "/app/input/dm.csv", col_types = cols(BRTHDT = col_date(), RANDDT = col_date(), .default = col_character()))is_leap <- function(year) { year %% 4 == 0 & (year %% 100 != 0 | year %% 400 == 0)}# Yearly anniversaries of the birth date on or before randomization; a# February 29 birthday falls on February 28 in common years, and a date# before birth gives the negated count with the dates exchanged.whole_years <- function(start, end) { if (is.na(start) || is.na(end)) { return(NA_integer_) } if (end < start) { return(-whole_years(end, start)) } years <- as.integer(format(end, "%Y")) - as.integer(format(start, "%Y")) month <- as.integer(format(start, "%m")) day <- as.integer(format(start, "%d")) if (month == 2L && day == 29L && !is_leap(as.integer(format(end, "%Y")))) { day <- 28L } end_month <- as.integer(format(end, "%m")) end_day <- as.integer(format(end, "%d")) if (end_month < month || (end_month == month && end_day < day)) { years <- years - 1L } years}adsl <- dm |> rowwise() |> mutate(AAGE = whole_years(BRTHDT, RANDDT), AAGEU = "YEARS") |> ungroup() |> select(STUDYID, USUBJID, BRTHDT, RANDDT, AAGE, AAGEU)dir.create("/app/output", showWarnings = FALSE)write_csv(adsl, "/app/output/adsl.csv", na = "")solutions/adam-adsl-analysis-age/result.py
Edit51 lines# Reference solution for the yamaa benchmark adam-adsl-analysis-age (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 datetime import datefrom pathlib import Pathimport polars as pldef is_leap(year: int) -> bool: return year % 4 == 0 and (year % 100 != 0 or year % 400 == 0)def whole_years(start: date | None, end: date | None) -> int | None: """Yearly anniversaries of start on or before end; negated when reversed.""" if start is None or end is None: return None if end < start: back = whole_years(end, start) return None if back is None else -back years = end.year - start.year month, day = start.month, start.day # A February 29 birthday falls on February 28 in common years. if month == 2 and day == 29 and not is_leap(end.year): day = 28 if (end.month, end.day) < (month, day): years -= 1 return yearsdm = pl.read_csv("/app/input/dm.csv", infer_schema=False).with_columns( pl.col("BRTHDT").str.to_date(strict=False), pl.col("RANDDT").str.to_date(strict=False),)adsl = ( dm.with_columns( AAGE=pl.struct(["BRTHDT", "RANDDT"]).map_elements( lambda r: whole_years(r["BRTHDT"], r["RANDDT"]), return_dtype=pl.Int64, ), AAGEU=pl.lit("YEARS"), ) .select("STUDYID", "USUBJID", "BRTHDT", "RANDDT", "AAGE", "AAGEU"))Path("/app/output").mkdir(exist_ok=True)adsl.write_csv("/app/output/adsl.csv")solutions/adam-adsl-analysis-age/result.sas
Edit25 lines/* opensas reference solution for the yamaa benchmark adam-adsl-analysis-age. Reads the benchmark inputs and derives the requested output. Execute with the existing opensas runtime: opensas /app/output/result.sas. */data dm; length STUDYID USUBJID BRTHDT RANDDT $1024; infile "/app/input/dm.csv" dsd dlm="," firstobs=2 truncover lrecl=32767; input STUDYID : $char1024. USUBJID : $char1024. BRTHDT : $char1024. RANDDT : $char1024.;run;data result; set dm; start=input(BRTHDT,yymmdd10.); finish=input(RANDDT,yymmdd10.); if not missing(start) and not missing(finish) then do; lo=min(start,finish); hi=max(start,finish); sign=1; if finish<start then sign=-1; AAGE=sign*intck('year',lo,hi,'continuous'); end; length AAGEU $5; AAGEU='YEARS';run;proc sql; create table final as select STUDYID, USUBJID, BRTHDT, RANDDT, AAGE, AAGEU from result;quit;proc export data=final outfile="/app/output/adsl.csv" dbms=csv replace; run;
yamaa
Comments
Signed in with GitHub; saved in repository Discussions