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 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 |
Human review and assessment
| 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.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-adsl-analysis-age/full.md
Edit16 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 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
Edit12 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 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
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.
R
Edit3 lineslibrary(yamaa)yamaa_spec("spec.yaml")$run()$outputPython
Edit3 linesimport yamaayamaa.spec("spec.yaml").run().outputsolutions/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
Edit83 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
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