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: finalizedEditUnder review
What this benchmark means
README.md

Goal: carry each subject's collected age (AGE) and age units (AGEU), and derive AGEGR1 and AGEGR1N to pool subjects into age groups.

Input: demographics (DM) records carrying age (AGE) and age units (AGEU).

Variables:

  • AGEGR1 is the pooled group: <18 when age is below 18, 18-64 when age is 18 through 64 inclusive, and >64 when age is above 64; Missing when AGE is missing.
  • AGEGR1N is the numeric rank of AGEGR1: 1 for <18, 2 for 18-64, and 3 for >64; empty when AGE is missing.

Note: both variables share the same bands, so the number always matches the text for each subject. A subject aged exactly 18 or 64 falls in 18-64: boundary ages belong to the middle band.

Inputs

Under review
1 source file

input/dm.csv

Edit
10 rows
input/dm.csv
STUDYIDUSUBJIDAGEAGEU
YAMAA-016YEARS
YAMAA-0117YEARS
YAMAA-0118YEARS
YAMAA-0123YEARS
YAMAA-0142YEARS
YAMAA-0164YEARS
YAMAA-0165YEARS
YAMAA-0172YEARS
YAMAA-0191YEARS
YAMAA-01——

Expected output

Under review
10 expected rows

expected/adsl.csv

Edit
10 rows
expected/adsl.csv
STUDYIDUSUBJIDAGEAGEUAGEGR1AGEGR1N
YAMAA-016YEARS<181
YAMAA-0117YEARS<181
YAMAA-0118YEARS18-642
YAMAA-0123YEARS18-642
YAMAA-0142YEARS18-642
YAMAA-0164YEARS18-642
YAMAA-0165YEARS>643
YAMAA-0172YEARS>643
YAMAA-0191YEARS>643
YAMAA-01——Missing—
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
ADSLAGEAgenumericCopy value from DM.AGE.Predecessor
ADSLAGEUAge UnitscharacterCopy value from DM.AGEU.Predecessor
ADSLAGEGR1Pooled Age Group 1characterIf AGE < 18 then "<18"; If AGE >= 18 AND AGE <= 64 then "18-64"; If AGE > 64 then ">64"; otherwise "Missing".Derived
ADSLAGEGR1NPooled Age Group 1 (N)numericIf AGEGR1 = '<18' then "1"; If AGEGR1 = '18-64' then "2"; If AGEGR1 = '>64' then "3"; otherwise "None".Derived
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-age-group/full.md

Edit
17 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, AGE, AGEU, AGEGR1, AGEGR1N

Create AGEGR1 using these labels:

  • <18
  • 18-64
  • 64

  • Missing

Create AGEGR1N as the numeric code of AGEGR1: 1 for <18, 2 for 18-64, and 3 for >64. AGEGR1N has no value when AGEGR1 is Missing.

Read the source datasets from /app/input and save the completed dataset as /app/output/adsl.csv.

prompts/adam-adsl-age-group/conventions.md

Edit
17 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, AGE, AGEU, AGEGR1, AGEGR1N

Create AGEGR1 using these labels:

  • <18
  • 18-64
  • 64

  • Missing

Create AGEGR1N as the numeric code of AGEGR1: 1 for <18, 2 for 18-64, and 3 for >64. AGEGR1N has no value when AGEGR1 is Missing.

Read the source datasets from /app/input and save the completed dataset as /app/output/adsl.csv.

prompts/adam-adsl-age-group/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, AGE, AGEU, AGEGR1, AGEGR1N

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-age-group/result.R

Edit
32 lines
# Reference solution for the yamaa benchmark adam-adsl-age-group (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(AGE = col_double(), .default = col_character()))adsl <- dm |>  mutate(    AGEGR1 = case_when(      is.na(AGE) ~ "Missing",      AGE < 18 ~ "<18",      AGE <= 64 ~ "18-64",      .default = ">64"    ),    AGEGR1N = case_when(      AGEGR1 == "<18" ~ 1L,      AGEGR1 == "18-64" ~ 2L,      AGEGR1 == ">64" ~ 3L    )  ) |>  select(STUDYID, USUBJID, AGE, AGEU, AGEGR1, AGEGR1N)dir.create("/app/output", showWarnings = FALSE)write_csv(adsl, "/app/output/adsl.csv", na = "")

solutions/adam-adsl-age-group/result.py

Edit
34 lines
# Reference solution for the yamaa benchmark adam-adsl-age-group (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 pldm = pl.read_csv("/app/input/dm.csv", infer_schema=False)age = pl.col("AGE").cast(pl.Float64)agegr1 = (    pl.when(age.is_null())    .then(pl.lit("Missing"))    .when(age < 18)    .then(pl.lit("<18"))    .when(age <= 64)    .then(pl.lit("18-64"))    .otherwise(pl.lit(">64")))agegr1n = pl.col("AGEGR1").replace_strict(    {"<18": 1, "18-64": 2, ">64": 3}, default=None, return_dtype=pl.Int64)adsl = (    dm.with_columns(AGEGR1=agegr1)    .with_columns(AGEGR1N=agegr1n)    .select("STUDYID", "USUBJID", "AGE", "AGEU", "AGEGR1", "AGEGR1N"))Path("/app/output").mkdir(exist_ok=True)adsl.write_csv("/app/output/adsl.csv")

solutions/adam-adsl-age-group/result.sas

Edit
23 lines
/* opensas reference solution for the yamaa benchmark adam-adsl-age-group.   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 AGEU $1024;  infile "/app/input/dm.csv" dsd dlm="," firstobs=2 truncover lrecl=32767;  input STUDYID : $char1024. USUBJID : $char1024. AGE AGEU : $char1024.;run;data result;  length AGEGR1 $7;  set dm;  if missing(AGE) then do; AGEGR1='Missing'; AGEGR1N=.; end;  else if AGE < 18 then do; AGEGR1='<18'; AGEGR1N=1; end;  else if AGE <= 64 then do; AGEGR1='18-64'; AGEGR1N=2; end;  else do; AGEGR1='>64'; AGEGR1N=3; end;run;proc sql;  create table final as select STUDYID, USUBJID, AGE, AGEU, AGEGR1, AGEGR1N from result;quit;proc export data=final outfile="/app/output/adsl.csv" dbms=csv replace; run;