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: summarize each subject's exposure, carrying TRT01P (planned
treatment) through and adding DOSECUM (cumulative dose), NDOSREC
(exposure-record count), and NDOSVAL (recorded-dose count).
Input: SDTM demographics (DM) carrying each subject's planned arm
(ARM), and the SDTM exposure (EX) records holding
administered doses (EXDOSE) and exposure sequence numbers (EXSEQ).
Every recorded dose in this case is expressed in milligrams (EXDOSU=mg),
including any additional treatment records. Mixed-unit dose normalization
is outside this case's contract; doses in other units must be standardized
before supplying EX.
Variables:
TRT01Pis the subject's planned treatment fromDM.ARM, so a subject who was never dosed still has a record.DOSECUMis the total administered dose in milligrams across the subject's exposure records; empty when no dose was ever recorded, while a recorded zero total is kept so a measured zero never reads as missing.NDOSRECis the number of the subject's exposure records; empty when the subject has no exposure record at all.NDOSVALis the number of exposure records carrying a recorded dose; an explicitly recorded zero counts as a dose, and the count is zero (not empty) when records exist but every dose was left blank.
Note: a subject whose doses were all left blank stays distinguishable
from one who was never dosed: the first has exposure records with a zero
NDOSVAL, while the second has nothing to count and leaves all three
measures empty.
Inputs
Under review2 source filesinput/dm.csv
Edit5 rows| DOMAIN | STUDYID | USUBJID | ARM |
|---|---|---|---|
| DM | YAMAA-01 | Carboplatin | |
| DM | YAMAA-01 | Cisplatin | |
| DM | YAMAA-01 | Carboplatin | |
| DM | YAMAA-01 | Cisplatin | |
| DM | YAMAA-01 | Carboplatin |
input/ex.csv
Edit7 rows| STUDYID | DOMAIN | USUBJID | EXSEQ | EXTRT | EXDOSE | EXDOSU | EXSTDTC |
|---|---|---|---|---|---|---|---|
| YAMAA-01 | EX | 1 | Carboplatin | 400 | mg | 2025-01-06 | |
| YAMAA-01 | EX | 2 | Carboplatin | 350 | mg | 2025-01-27 | |
| YAMAA-01 | EX | 1 | Cisplatin | — | — | 2025-01-08 | |
| YAMAA-01 | EX | 2 | Cisplatin | — | — | 2025-01-29 | |
| YAMAA-01 | EX | 1 | Carboplatin | 0 | mg | 2025-01-10 | |
| YAMAA-01 | EX | 2 | Carboplatin | — | — | 2025-01-31 | |
| YAMAA-01 | EX | 1 | Carboplatin | — | — | 2025-01-14 |
Expected output
Under review5 expected rowsexpected/adex.csv
Edit5 rows| STUDYID | USUBJID | TRT01P | DOSECUM | NDOSREC | NDOSVAL |
|---|---|---|---|---|---|
| YAMAA-01 | Carboplatin | 750 | 2 | 2 | |
| YAMAA-01 | Cisplatin | — | 2 | 0 | |
| YAMAA-01 | Carboplatin | 0 | 2 | 1 | |
| YAMAA-01 | Cisplatin | — | — | — | |
| YAMAA-01 | Carboplatin | — | 1 | 0 |
Human review and assessment
| Dataset Name | Variable Name | Variable Label | Type | Codelist/Controlled Terms | Core | Computational Method | Origin |
|---|---|---|---|---|---|---|---|
| ADEX | STUDYID | Study Identifier | character | Copy value from DM.STUDYID. | Predecessor | ||
| ADEX | USUBJID | Unique Subject Identifier | character | Copy value from DM.USUBJID. | Predecessor | ||
| ADEX | TRT01P | Planned Treatment for Period 01 | character | Copy value from DM.ARM. | Predecessor | ||
| ADEX | DOSECUM | Cumulative Dose | numeric | Aggregate SUM(EX.EXDOSE) over records matching on the shared output keys. | Derived | ||
| ADEX | NDOSREC | Number of Dose Records | numeric | Aggregate COUNT(EX.*) over records matching on the shared output keys. | Derived | ||
| ADEX | NDOSVAL | Number of Nonmissing Doses | numeric | Aggregate COUNT(EX.EXDOSE) over records matching on the shared output keys. | Derived |
| Template | Include when | STUDYID | USUBJID | TRT01P | NDOSOTHER |
|---|---|---|---|---|---|
| exposure-units | NDOSOTHER > 0 | Constant "(validation)" | Constant "(validation)" | Constant "None" | Aggregate COUNT(EX.*) over records matching on the shared output keys, where EX.EXDOSE IS NOT NULL AND (EX.EXDOSU IS NULL OR EX.EXDOSU <> 'mg') |
| subjects | None | None | None | None |
| 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-adex-uncollected/full.md
Edit22 linesFollowing CDISC ADaM standards, use the provided DM and EX datasets to create an ADEX dataset with one record per subject.
The output dataset should contain the following columns in this order: STUDYID, USUBJID, TRT01P, DOSECUM, NDOSREC, NDOSVAL
All recorded EXDOSE values are in milligrams (EXDOSU=mg), including doses of different treatments; any other units have been standardized before these inputs are supplied. DOSECUM is therefore expressed in milligrams.
TRT01P is the subject's planned treatment from DM.ARM, and every DM subject has a record. DOSECUM is the total of the administered doses (EXDOSE) on the subject's EX records. DOSECUM has no value when no dose was ever recorded for the subject, while a recorded total of zero is kept as zero. NDOSREC is the number of the subject's EX records, and has no value when the subject has no EX record at all. NDOSVAL is the number of the subject's EX records that carry a recorded dose. An explicitly recorded zero counts as a recorded dose, and NDOSVAL is 0 when the subject has EX records but every dose was left blank.
Read the source datasets from /app/input and save the completed dataset as /app/output/adex.csv.
prompts/adam-adex-uncollected/conventions.md
Edit8 linesFollowing CDISC ADaM standards, use the provided DM and EX datasets to create an ADEX dataset with one record per subject.
The output dataset should contain the following columns in this order: STUDYID, USUBJID, TRT01P, DOSECUM, NDOSREC, NDOSVAL
Read the source datasets from /app/input and save the completed dataset as /app/output/adex.csv.
prompts/adam-adex-uncollected/brief.md
Edit8 linesFollowing CDISC ADaM standards, use the provided DM and EX datasets to create an ADEX dataset with one record per subject.
The output dataset should contain the following columns in this order: STUDYID, USUBJID, TRT01P, DOSECUM, NDOSREC, NDOSVAL
Read the source datasets from /app/input and save the completed dataset as /app/output/adex.csv.
R
Edit3 lineslibrary(yamaa)yamaa_spec("spec.yaml")$run()$outputPython
Edit3 linesimport yamaayamaa.spec("spec.yaml").run().outputsolutions/adam-adex-uncollected/result.R
Edit40 lines# Reference solution for the yamaa benchmark adam-adex-uncollected (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(.default = col_character()))ex <- read_csv( "/app/input/ex.csv", col_types = cols(EXDOSE = col_double(), .default = col_character()))if (any(!is.na(ex$EXDOSE) & (is.na(ex$EXDOSU) | ex$EXDOSU != "mg"))) { stop("Recorded doses must be standardized to mg")}# Per subject: total dose, record count, and count of recorded doses.agg <- ex |> group_by(STUDYID, USUBJID) |> summarise( DOSE_SUM = sum(EXDOSE, na.rm = TRUE), NDOSREC = n(), NDOSVAL = sum(!is.na(EXDOSE)), .groups = "drop" ) |> mutate(DOSECUM = if_else(NDOSVAL > 0, DOSE_SUM, NA_real_)) |> select(STUDYID, USUBJID, DOSECUM, NDOSREC, NDOSVAL)adex <- dm |> left_join(agg, by = c("STUDYID", "USUBJID")) |> transmute(STUDYID, USUBJID, TRT01P = ARM, DOSECUM, NDOSREC, NDOSVAL)dir.create("/app/output", showWarnings = FALSE)write_csv(adex, "/app/output/adex.csv", na = "")solutions/adam-adex-uncollected/result.py
Edit81 lines# Reference solution for the yamaa benchmark adam-adex-uncollected (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 the ADEX dataset from SDTM DM and EX.One record per DM subject, carrying ARM as the planned treatment TRT01P.DOSECUM is the total of the recorded EXDOSE values on the subject's EXrecords; it has no value when no dose was ever recorded, while arecorded total of zero is kept as zero. NDOSREC is the number of thesubject's EX records, with no value when the subject has no EX record atall. NDOSVAL is the number of those EX records that carry a recordeddose; an explicitly recorded zero counts, and NDOSVAL is 0 when thesubject has EX records but every dose was left blank."""import csvfrom collections import defaultdictINPUT_DIR = "/app/input"OUTPUT_PATH = "/app/output/adex.csv"def read_rows(path): with open(path, newline="", encoding="utf-8") as handle: return list(csv.DictReader(handle))def format_number(value): """Write a number without a trailing decimal part when whole.""" if value == int(value): return str(int(value)) return repr(value)def main(): subjects = read_rows(f"{INPUT_DIR}/dm.csv") exposure = read_rows(f"{INPUT_DIR}/ex.csv") doses_by_key = defaultdict(list) for row in exposure: if row["EXDOSE"].strip() and row["EXDOSU"] != "mg": raise ValueError("Recorded doses must be standardized to mg") key = (row["STUDYID"], row["USUBJID"]) doses_by_key[key].append(row["EXDOSE"]) records = [] for row in subjects: key = (row["STUDYID"], row["USUBJID"]) doses = doses_by_key.get(key) if doses is None: n_records = "" n_values = "" dose_cum = "" else: recorded = [float(dose) for dose in doses if dose.strip() != ""] n_records = str(len(doses)) n_values = str(len(recorded)) dose_cum = format_number(sum(recorded)) if recorded else "" records.append( { "STUDYID": row["STUDYID"], "USUBJID": row["USUBJID"], "TRT01P": row["ARM"], "DOSECUM": dose_cum, "NDOSREC": n_records, "NDOSVAL": n_values, } ) columns = ["STUDYID", "USUBJID", "TRT01P", "DOSECUM", "NDOSREC", "NDOSVAL"] with open(OUTPUT_PATH, "w", newline="", encoding="utf-8") as handle: writer = csv.DictWriter(handle, fieldnames=columns) writer.writeheader() writer.writerows(records)if __name__ == "__main__": main()solutions/adam-adex-uncollected/result.sas
Edit23 lines/* opensas reference solution for the yamaa benchmark adam-adex-uncollected. Reads the benchmark inputs and derives the requested output. Execute with the existing opensas runtime: opensas /app/output/result.sas. */data ex; length STUDYID DOMAIN USUBJID EXTRT EXDOSU EXSTDTC $1024; infile "/app/input/ex.csv" dsd dlm="," firstobs=2 truncover lrecl=32767; input STUDYID : $char1024. DOMAIN : $char1024. USUBJID : $char1024. EXSEQ EXTRT : $char1024. EXDOSE EXDOSU : $char1024. EXSTDTC : $char1024.; if not missing(EXDOSE) and EXDOSU ne 'mg' then abort return 1;run;data dm; length DOMAIN STUDYID USUBJID ARM $1024; infile "/app/input/dm.csv" dsd dlm="," firstobs=2 truncover lrecl=32767; input DOMAIN : $char1024. STUDYID : $char1024. USUBJID : $char1024. ARM : $char1024.;run;proc sql; create table totals as select STUDYID,USUBJID,sum(EXDOSE) as DOSECUM,count(*) as NDOSREC,count(EXDOSE) as NDOSVAL from ex group by STUDYID,USUBJID; create table result as select a.STUDYID,a.USUBJID,a.ARM as TRT01P,b.DOSECUM,b.NDOSREC,b.NDOSVAL from dm as a left join totals as b on a.STUDYID=b.STUDYID and a.USUBJID=b.USUBJID;quit;proc export data=result(keep=STUDYID USUBJID TRT01P DOSECUM NDOSREC NDOSVAL) outfile="/app/output/adex.csv" dbms=csv replace; run;
yamaa