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: 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:
SEXis the collected sex carried through unchanged; a missing collected value givesU.SEXNis the numeric sex code:Mgives1,Fgives2, andUgives0.RACENis the numeric race code:WHITEgives1,BLACK OR AFRICAN AMERICANgives2,ASIANgives3, andMULTIPLEgives4; a missing source leavesRACENempty while any other reported value gives99.AGEis the collectedAGEas a whole number; it is missing when no age was collected and when the reported value is not a whole number.AGEGR1is the age group:<18when age is below 18,18-64when age is at least 18 and below 65, and>=65when age is at least 65; it isUNKNOWNwhen age is missing.
Note: the numeric mappings match exactly: a race value with
different case or extra wording gives 99.
Inputs
Under review1 source fileinput/dm.csv
Edit11 rows| STUDYID | USUBJID | SEX | RACE | AGE |
|---|---|---|---|---|
| YAMAA-01 | F | WHITE | 34 | |
| YAMAA-01 | M | BLACK OR AFRICAN AMERICAN | 28 | |
| YAMAA-01 | F | ASIAN | 17 | |
| YAMAA-01 | M | WHITE | 65 | |
| YAMAA-01 | F | MULTIPLE | 44 | |
| YAMAA-01 | M | WHITE | 52 | |
| YAMAA-01 | — | WHITE | — | |
| YAMAA-01 | U | — | — | |
| YAMAA-01 | F | white | 18 | |
| YAMAA-01 | F | ASIAN | 64 | |
| YAMAA-01 | U | WHITE | 0 |
Expected output
Under review11 expected rowsexpected/adsl.csv
Edit11 rows| STUDYID | USUBJID | SEX | SEXN | RACE | RACEN | AGE | AGEGR1 |
|---|---|---|---|---|---|---|---|
| YAMAA-01 | F | 2 | WHITE | 1 | 34 | 18-64 | |
| YAMAA-01 | M | 1 | BLACK OR AFRICAN AMERICAN | 2 | 28 | 18-64 | |
| YAMAA-01 | F | 2 | ASIAN | 3 | 17 | <18 | |
| YAMAA-01 | M | 1 | WHITE | 1 | 65 | >=65 | |
| YAMAA-01 | F | 2 | MULTIPLE | 4 | 44 | 18-64 | |
| YAMAA-01 | M | 1 | WHITE | 1 | 52 | 18-64 | |
| YAMAA-01 | U | 0 | WHITE | 1 | — | UNKNOWN | |
| YAMAA-01 | U | 0 | — | — | — | UNKNOWN | |
| YAMAA-01 | F | 2 | white | 99 | 18 | 18-64 | |
| YAMAA-01 | F | 2 | ASIAN | 3 | 64 | 18-64 | |
| YAMAA-01 | U | 0 | WHITE | 1 | 0 | <18 |
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 | SEX | Sex | character | M, F, U | First non-missing of DM.SEX; all missing → "U". | Derived | |
| ADSL | SEXN | Sex (N) | numeric | Recode SEX: "M" → "1", "F" → "2", "U" → "0"; missing values → "0"; unlisted values are errors. | Derived | ||
| ADSL | RACE | Race | character | Copy value from DM.RACE. | Predecessor | ||
| ADSL | RACEN | Race (N) | numeric | Recode DM.RACE: "WHITE" → "1", "BLACK OR AFRICAN AMERICAN" → "2", "ASIAN" → "3", "MULTIPLE" → "4"; missing values stay missing; unlisted values → "99". | Derived | ||
| ADSL | AGE | Age | numeric | Copy value from DM.AGE; a value that cannot be converted → blank. | Derived | ||
| ADSL | AGEGR1 | Pooled Age Group 1 | character | Band AGE at 18, 65 into "<18", "18-64" and ">=65", intervals closed on the left; a missing source → "UNKNOWN". | Derived |
| Variable | Permitted values |
|---|---|
| SEX | M, F, U |
| 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-demographics/full.md
Edit18 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, 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
Edit13 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, 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
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, SEX, SEXN, RACE, RACEN, AGE, AGEGR1
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-demographics/result.R
Edit49 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
Edit82 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
Edit30 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;
yamaa