Review ask

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.

  1. 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.
  2. Inputs: Do they look like data collected in a real trial, and do they include the situations you would expect to meet in one?
  3. 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

Lifecycle: reviewedEditUnder review
What this benchmark means
README.md

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

  • AAGE is the count of yearly anniversaries of BRTHDT falling on or before RANDDT; 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 review
1 source file

input/dm.csv

Edit
8 rows
input/dm.csv
STUDYIDUSUBJIDBRTHDTRANDDT
YAMAA-011984-09-062020-02-24
YAMAA-011996-02-292024-02-28
YAMAA-011996-02-292024-02-29
YAMAA-011975-06-152021-06-15
YAMAA-011988-03-102020-03-09
YAMAA-011990-01-011989-01-01
YAMAA-012000-01-01—
YAMAA-01—2020-01-01

Expected output

Under review
8 expected rows

expected/adsl.csv

Edit
8 rows
expected/adsl.csv
STUDYIDUSUBJIDBRTHDTRANDDTAAGEAAGEU
YAMAA-011984-09-062020-02-2435YEARS
YAMAA-011996-02-292024-02-2827YEARS
YAMAA-011996-02-292024-02-2928YEARS
YAMAA-011975-06-152021-06-1546YEARS
YAMAA-011988-03-102020-03-0931YEARS
YAMAA-011990-01-011989-01-01-1YEARS
YAMAA-012000-01-01——YEARS
YAMAA-01—2020-01-01—YEARS
Shaded columns are derived— = missing value

Comments and assessment materials

Comments

Signed in with GitHub; saved in repository Discussions

Mapping spec

Generated from the benchmark YAML; do not edit by hand

Dataset NameVariable NameVariable LabelTypeCodelist/Controlled TermsCoreComputational MethodOrigin
ADSLSTUDYIDStudy IdentifiercharacterCopy value from DM.STUDYID.Predecessor
ADSLUSUBJIDUnique Subject IdentifiercharacterCopy value from DM.USUBJID.Predecessor
ADSLBRTHDTDate of BirthnumericISO 8601Copy value from DM.BRTHDT.Predecessor
ADSLRANDDTDate of RandomizationnumericISO 8601Copy value from DM.RANDDT.Predecessor
ADSLAAGEAnalysis AgenumericWhole years from BRTHDT to RANDDT, counting the end date but not the start.Derived
ADSLAAGEUAnalysis Age UnitcharacterSet constant value "YEARS".Assigned
VersionDateAuthorDescriptionReviewerSign-off
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-adsl-analysis-age/full.md

Edit
15 lines

Following 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

Edit
11 lines

Following 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

Edit
8 lines

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

yamaa code

Runs the yamaa specification; its result must match the expected output

run.R

Edit
4 lines
library(yamaa)adsl <- yamaa_domain("spec.yaml")$outputadsl

run.py

Edit
4 lines
import yamaaadsl = yamaa.yamaa_domain("spec.yaml").outputadsl

Solution without yamaa

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

solutions/adam-adsl-analysis-age/result.R

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

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

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