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: 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:

  • TRT01P is the subject's planned treatment from DM.ARM, so a subject who was never dosed still has a record.
  • DOSECUM is 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.
  • NDOSREC is the number of the subject's exposure records; empty when the subject has no exposure record at all.
  • NDOSVAL is 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 review
2 source files

input/dm.csv

Edit
5 rows
input/dm.csv
DOMAINSTUDYIDUSUBJIDARM
DMYAMAA-01Carboplatin
DMYAMAA-01Cisplatin
DMYAMAA-01Carboplatin
DMYAMAA-01Cisplatin
DMYAMAA-01Carboplatin

input/ex.csv

Edit
7 rows
input/ex.csv
STUDYIDDOMAINUSUBJIDEXSEQEXTRTEXDOSEEXDOSUEXSTDTC
YAMAA-01EX1Carboplatin400mg2025-01-06
YAMAA-01EX2Carboplatin350mg2025-01-27
YAMAA-01EX1Cisplatin——2025-01-08
YAMAA-01EX2Cisplatin——2025-01-29
YAMAA-01EX1Carboplatin0mg2025-01-10
YAMAA-01EX2Carboplatin——2025-01-31
YAMAA-01EX1Carboplatin——2025-01-14

Expected output

Under review
5 expected rows

expected/adex.csv

Edit
5 rows
expected/adex.csv
STUDYIDUSUBJIDTRT01PDOSECUMNDOSRECNDOSVAL
YAMAA-01Carboplatin75022
YAMAA-01Cisplatin—20
YAMAA-01Carboplatin021
YAMAA-01Cisplatin———
YAMAA-01Carboplatin—10
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
ADEXSTUDYIDStudy IdentifiercharacterCopy value from DM.STUDYID.Predecessor
ADEXUSUBJIDUnique Subject IdentifiercharacterCopy value from DM.USUBJID.Predecessor
ADEXTRT01PPlanned Treatment for Period 01characterCopy value from DM.ARM.Predecessor
ADEXDOSECUMCumulative DosenumericAggregate SUM(EX.EXDOSE) over records matching on the shared output keys.Derived
ADEXNDOSRECNumber of Dose RecordsnumericAggregate COUNT(EX.*) over records matching on the shared output keys.Derived
ADEXNDOSVALNumber of Nonmissing DosesnumericAggregate COUNT(EX.EXDOSE) over records matching on the shared output keys.Derived
TemplateInclude whenSTUDYIDUSUBJIDTRT01PNDOSOTHER
exposure-unitsNDOSOTHER > 0Constant "(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')
subjectsNoneNoneNoneNone
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-adex-uncollected/full.md

Edit
22 lines

Following 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

Edit
8 lines

Following 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

Edit
8 lines

Following 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.

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

Edit
40 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

Edit
81 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

Edit
23 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;