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

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
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.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-adsl-analysis-age/full.md

Edit
16 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 BRTHDT falling on or before RANDDT.
  • AAGE has no value when BRTHDT or RANDDT has no value.
  • A February 29 birthday falls on February 28 in a common year.
  • When RANDDT is before BRTHDT, AAGE is the negated count of yearly anniversaries of RANDDT falling on or before BRTHDT.
  • AAGEU is "YEARS" on every record, even when AAGE has no value.

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
12 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 BRTHDT falling on or before RANDDT.
  • A February 29 birthday falls on February 28 in a common year.

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

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-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
83 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.import csvimport osfrom datetime import datedef parse_date(text):    text = (text or "").strip()    if not text:        return None    year, month, day = text.split("-")    return date(int(year), int(month), int(day))def anniversary_in_year(birth, year):    """Yearly anniversary of `birth` within `year`.    A February 29 birthday falls on February 28 in a common year.    """    month, day = birth.month, birth.day    if month == 2 and day == 29:        try:            return date(year, 2, 29)        except ValueError:            return date(year, 2, 28)    return date(year, month, day)def count_anniversaries(start, end):    """Count of yearly anniversaries of `start` falling on or before `end`.    Assumes end >= start.    """    years = end.year - start.year    if anniversary_in_year(start, end.year) > end:        years -= 1    return yearsdef analysis_age(brthdt, randdt):    if brthdt is None or randdt is None:        return ""    if randdt >= brthdt:        return count_anniversaries(brthdt, randdt)    return -count_anniversaries(randdt, brthdt)def main():    with open("/app/input/dm.csv", newline="") as f:        rows = list(csv.DictReader(f))    out_rows = []    for row in rows:        brthdt = parse_date(row["BRTHDT"])        randdt = parse_date(row["RANDDT"])        out_rows.append(            {                "STUDYID": row["STUDYID"],                "USUBJID": row["USUBJID"],                "BRTHDT": row["BRTHDT"],                "RANDDT": row["RANDDT"],                "AAGE": analysis_age(brthdt, randdt),                "AAGEU": "YEARS",            }        )    os.makedirs("/app/output", exist_ok=True)    with open("/app/output/adsl.csv", "w", newline="") as f:        writer = csv.DictWriter(            f,            fieldnames=["STUDYID", "USUBJID", "BRTHDT", "RANDDT", "AAGE", "AAGEU"],        )        writer.writeheader()        writer.writerows(out_rows)if __name__ == "__main__":    main()

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;