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: produce standard sex, race code, age, and age group values from collected demographics, carrying SEX and RACE through and producing SEXN, RACEN, AGE, and AGEGR1.

Input: one record per subject carrying collected SEX, RACE, and AGE as reported.

Variables:

  • SEX is the collected sex carried through unchanged; a missing collected value gives U.
  • SEXN is the numeric sex code: M gives 1, F gives 2, and U gives 0.
  • RACEN is the numeric race code: WHITE gives 1, BLACK OR AFRICAN AMERICAN gives 2, ASIAN gives 3, and MULTIPLE gives 4; a missing source leaves RACEN empty while any other reported value gives 99.
  • AGE is the collected AGE as a whole number; it is missing when no age was collected and when the reported value is not a whole number.
  • AGEGR1 is the age group: <18 when age is below 18, 18-64 when age is at least 18 and below 65, and >=65 when age is at least 65; it is UNKNOWN when age is missing.

Note: the numeric mappings match exactly: a race value with different case or extra wording gives 99.

Inputs

Under review
1 source file

input/dm.csv

Edit
11 rows
input/dm.csv
STUDYIDUSUBJIDSEXRACEAGE
YAMAA-01FWHITE34
YAMAA-01MBLACK OR AFRICAN AMERICAN28
YAMAA-01FASIAN17
YAMAA-01MWHITE65
YAMAA-01FMULTIPLE44
YAMAA-01MWHITE52
YAMAA-01—WHITE—
YAMAA-01U——
YAMAA-01Fwhite18
YAMAA-01FASIAN64
YAMAA-01UWHITE0

Expected output

Under review
11 expected rows

expected/adsl.csv

Edit
11 rows
expected/adsl.csv
STUDYIDUSUBJIDSEXSEXNRACERACENAGEAGEGR1
YAMAA-01F2WHITE13418-64
YAMAA-01M1BLACK OR AFRICAN AMERICAN22818-64
YAMAA-01F2ASIAN317<18
YAMAA-01M1WHITE165>=65
YAMAA-01F2MULTIPLE44418-64
YAMAA-01M1WHITE15218-64
YAMAA-01U0WHITE1—UNKNOWN
YAMAA-01U0———UNKNOWN
YAMAA-01F2white991818-64
YAMAA-01F2ASIAN36418-64
YAMAA-01U0WHITE10<18
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
ADSLSEXSexcharacterM, F, UFirst non-missing of DM.SEX; all missing → "U".Derived
ADSLSEXNSex (N)numericRecode SEX: "M" → "1", "F" → "2", "U" → "0"; missing values → "0"; unlisted values are errors.Derived
ADSLRACERacecharacterCopy value from DM.RACE.Predecessor
ADSLRACENRace (N)numericRecode DM.RACE: "WHITE" → "1", "BLACK OR AFRICAN AMERICAN" → "2", "ASIAN" → "3", "MULTIPLE" → "4"; missing values stay missing; unlisted values → "99".Derived
ADSLAGEAgenumericCopy value from DM.AGE; a value that cannot be converted → blank.Derived
ADSLAGEGR1Pooled Age Group 1characterBand AGE at 18, 65 into "<18", "18-64" and ">=65", intervals closed on the left; a missing source → "UNKNOWN".Derived
VariablePermitted values
SEXM, F, U
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-demographics/full.md

Edit
18 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, SEX, SEXN, RACE, RACEN, AGE, AGEGR1

SEX is the collected sex, and is "U" when no sex was collected. SEXN is 1 for "M", 2 for "F", and 0 for "U". RACEN is 1 for "WHITE", 2 for "BLACK OR AFRICAN AMERICAN", 3 for "ASIAN", and 4 for "MULTIPLE". RACEN has no value when no race was collected, and is 99 for any other collected race. The race mapping matches the collected text exactly, so a value that differs in case or wording gives 99 too. AGE is the collected age as a whole number, and has no value when no age was collected. AGEGR1 is "<18" when AGE is below 18, "18-64" when AGE is at least 18 and below 65, and ">=65" when AGE is at least 65. AGEGR1 is "UNKNOWN" when AGE has no value.

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

prompts/adam-adsl-demographics/conventions.md

Edit
13 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, SEX, SEXN, RACE, RACEN, AGE, AGEGR1

SEX is "M", "F", or "U". SEXN is 1 for "M", 2 for "F", and 0 for "U". RACEN is 1 for "WHITE", 2 for "BLACK OR AFRICAN AMERICAN", 3 for "ASIAN", and 4 for "MULTIPLE", and is 99 for any other collected race, or has no value. AGEGR1 is "<18", "18-64", ">=65", or "UNKNOWN".

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

prompts/adam-adsl-demographics/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, SEX, SEXN, RACE, RACEN, AGE, AGEGR1

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

Edit
49 lines
# Reference solution for the yamaa benchmark adam-adsl-demographics (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)library(stringr)dm <- read_csv(  "/app/input/dm.csv",  col_types = cols(.default = col_character()))adsl <- dm |>  mutate(    SEX = str_trim(coalesce(SEX, "")),    SEX = if_else(SEX == "", "U", SEX),    SEXN = case_when(      SEX == "M" ~ 1L,      SEX == "F" ~ 2L,      SEX == "U" ~ 0L    ),    RACEN = case_when(      is.na(RACE) ~ NA_integer_,      RACE == "WHITE" ~ 1L,      RACE == "BLACK OR AFRICAN AMERICAN" ~ 2L,      RACE == "ASIAN" ~ 3L,      RACE == "MULTIPLE" ~ 4L,      .default = 99L    ),    .age_num = suppressWarnings(as.numeric(str_trim(coalesce(AGE, "")))),    AGE = if_else(      !is.na(.age_num) & floor(.age_num) == .age_num,      as.integer(.age_num),      NA_integer_    ),    AGEGR1 = case_when(      is.na(AGE) ~ "UNKNOWN",      AGE < 18 ~ "<18",      AGE < 65 ~ "18-64",      .default = ">=65"    )  ) |>  select(STUDYID, USUBJID, SEX, SEXN, RACE, RACEN, AGE, AGEGR1)dir.create("/app/output", showWarnings = FALSE)write_csv(adsl, "/app/output/adsl.csv", na = "")

solutions/adam-adsl-demographics/result.py

Edit
82 lines
# Reference solution for the yamaa benchmark adam-adsl-demographics (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."""Create ADSL demographics from the DM dataset.One record per subject. Reads /app/input/dm.csv and writes/app/output/adsl.csv with columns:STUDYID, USUBJID, SEX, SEXN, RACE, RACEN, AGE, AGEGR1"""import csvimport osINPUT_DIR = "/app/input"OUTPUT_DIR = "/app/output"SEXN_MAP = {"M": 1, "F": 2, "U": 0}RACEN_MAP = {    "WHITE": 1,    "BLACK OR AFRICAN AMERICAN": 2,    "ASIAN": 3,    "MULTIPLE": 4,}def main():    with open(os.path.join(INPUT_DIR, "dm.csv"), newline="") as f:        dm = list(csv.DictReader(f))    rows = []    for rec in dm:        sex_raw = (rec.get("SEX") or "").strip()        sex = sex_raw if sex_raw else "U"        sexn = SEXN_MAP.get(sex, 0)        race = (rec.get("RACE") or "").strip()        if race == "":            racen = ""        elif race in RACEN_MAP:            racen = RACEN_MAP[race]        else:            racen = 99        age_raw = (rec.get("AGE") or "").strip()        if age_raw == "":            age = ""            agegr1 = "UNKNOWN"        else:            age = int(float(age_raw))            if age < 18:                agegr1 = "<18"            elif age < 65:                agegr1 = "18-64"            else:                agegr1 = ">=65"        rows.append(            {                "STUDYID": rec.get("STUDYID", ""),                "USUBJID": rec.get("USUBJID", ""),                "SEX": sex,                "SEXN": sexn,                "RACE": race,                "RACEN": racen,                "AGE": age,                "AGEGR1": agegr1,            }        )    os.makedirs(OUTPUT_DIR, exist_ok=True)    fieldnames = ["STUDYID", "USUBJID", "SEX", "SEXN", "RACE", "RACEN", "AGE", "AGEGR1"]    with open(os.path.join(OUTPUT_DIR, "adsl.csv"), "w", newline="") as f:        writer = csv.DictWriter(f, fieldnames=fieldnames)        writer.writeheader()        writer.writerows(rows)if __name__ == "__main__":    main()

solutions/adam-adsl-demographics/result.sas

Edit
30 lines
/* opensas reference solution for the yamaa benchmark adam-adsl-demographics.   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 SEX RACE $1024;  infile "/app/input/dm.csv" dsd dlm="," firstobs=2 truncover lrecl=32767;  input STUDYID : $char1024. USUBJID : $char1024. SEX : $char1024. RACE : $char1024. AGE;run;data result;  length AGEGR1 $7;  set dm;  if missing(SEX) then SEX='U';  select(SEX); when('M') SEXN=1; when('F') SEXN=2; otherwise SEXN=0; end;  select(RACE);    when('') RACEN=.; when('WHITE') RACEN=1;    when('BLACK OR AFRICAN AMERICAN') RACEN=2;    when('ASIAN') RACEN=3; when('MULTIPLE') RACEN=4; otherwise RACEN=99;  end;  if AGE ne int(AGE) then AGE=.;  if missing(AGE) then AGEGR1='UNKNOWN';  else if AGE<18 then AGEGR1='<18';  else if AGE<65 then AGEGR1='18-64'; else AGEGR1='>=65';run;proc sql;  create table final as select STUDYID, USUBJID, SEX, SEXN, RACE, RACEN, AGE, AGEGR1 from result;quit;proc export data=final outfile="/app/output/adsl.csv" dbms=csv replace; run;