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: rank severity and flag the worst-graded clinical event
(CE) for each subject, adding ASEV, ASEVN, ATOXGRN and
AOCCFL.
Input: clinical event records carrying sequence number
(CESEQ), reported term (CETERM), collected severity
(CESEV), and analysis start date (ASTDT).
Variables:
ASEV: analysis severity, carrying the collected severity (CESEV); blank when none was collected.ASEVN: numeric rank ofASEV,1for MILD through3for SEVERE; blank when no severity was collected.ATOXGRN: toxicity grade, equal toASEVN, so a moderate event reads grade2; blank when no severity was collected.AOCCFL:Yon the graded event with the greatestATOXGRNfor the subject; blank otherwise. Ties break by earliestASTDT, then lowestCESEQ, so at most one event per subject is flagged.
Note: an event without a grade can never be flagged, so a subject with no graded event has no flagged event. Grading stays separate from flagging so the grade means the same thing on every event while the flag answers a question about the subject.
Inputs
Under review1 source fileinput/ce.csv
Edit11 rows| STUDYID | USUBJID | CESEQ | CETERM | CESEV | ASTDT |
|---|---|---|---|---|---|
| KN189 | 1 | FEVER | MILD | 2024-01-11 | |
| KN189 | 2 | FATIGUE | SEVERE | 2024-01-12 | |
| KN189 | 3 | CHILLS | SEVERE | 2024-01-13 | |
| KN189 | 4 | FATIGUE | SEVERE | 2024-01-12 | |
| KN189 | 1 | FEVER | — | 2024-02-06 | |
| KN189 | 2 | FEVER | MODERATE | 2024-02-06 | |
| KN189 | 1 | REDNESS | MODERATE | 2024-03-02 | |
| KN189 | 1 | FEVER | — | 2024-05-01 | |
| KN189 | 2 | HEADACHE | — | 2024-05-03 | |
| KN189 | 1 | PAIN | MODERATE | 2024-04-10 | |
| KN189 | 2 | HEADACHE | MODERATE | 2024-04-05 |
Expected output
Under review11 expected rowsexpected/adce.csv
Edit11 rows| STUDYID | USUBJID | CESEQ | CETERM | ASTDT | ASEV | ASEVN | ATOXGRN | AOCCFL |
|---|---|---|---|---|---|---|---|---|
| KN189 | 1 | FEVER | 2024-01-11 | MILD | 1 | 1 | — | |
| KN189 | 2 | FATIGUE | 2024-01-12 | SEVERE | 3 | 3 | Y | |
| KN189 | 3 | CHILLS | 2024-01-13 | SEVERE | 3 | 3 | — | |
| KN189 | 4 | FATIGUE | 2024-01-12 | SEVERE | 3 | 3 | — | |
| KN189 | 1 | FEVER | 2024-02-06 | — | — | — | — | |
| KN189 | 2 | FEVER | 2024-02-06 | MODERATE | 2 | 2 | Y | |
| KN189 | 1 | REDNESS | 2024-03-02 | MODERATE | 2 | 2 | Y | |
| KN189 | 1 | FEVER | 2024-05-01 | — | — | — | — | |
| KN189 | 2 | HEADACHE | 2024-05-03 | — | — | — | — | |
| KN189 | 1 | PAIN | 2024-04-10 | MODERATE | 2 | 2 | — | |
| KN189 | 2 | HEADACHE | 2024-04-05 | MODERATE | 2 | 2 | Y |
Human review and assessment
| Dataset Name | Variable Name | Variable Label | Type | Codelist/Controlled Terms | Core | Computational Method | Origin |
|---|---|---|---|---|---|---|---|
| ADCE | STUDYID | Study Identifier | character | Copy value from CE.STUDYID. | Predecessor | ||
| ADCE | USUBJID | Unique Subject Identifier | character | Copy value from CE.USUBJID. | Predecessor | ||
| ADCE | CESEQ | Sequence Number | numeric | Copy value from CE.CESEQ. | Predecessor | ||
| ADCE | CETERM | Reported Term for Clinical Event | character | Copy value from CE.CETERM. | Predecessor | ||
| ADCE | ASTDT | Analysis Start Date | numeric | ISO 8601 | Copy value from CE.ASTDT. | Predecessor | |
| ADCE | ASEV | Analysis Severity/Intensity | character | MILD, MODERATE, SEVERE | Copy value from CE.CESEV. | Predecessor | |
| ADCE | ASEVN | Analysis Severity/Intensity (N) | numeric | 1, 2, 3 | Recode ASEV: "MILD" → "1", "MODERATE" → "2", "SEVERE" → "3"; missing values stay missing; unlisted values are errors. | Derived | |
| ADCE | ATOXGRN | Analysis Toxicity Grade (N) | numeric | 1, 2, 3 | Copy value from ASEVN. | Derived | |
| ADCE | AOCCFL | Worst Grade Occurrence Flag | character | Y | "Y" when WGRSEQ = 1; blank otherwise. | Derived |
| Variable | Permitted values |
|---|---|
| ASEV | MILD, MODERATE, SEVERE |
| ASEVN | 1, 2, 3 |
| ATOXGRN | 1, 2, 3 |
| AOCCFL | Y |
| 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-adce-worst-toxicity/full.md
Edit19 linesFollowing CDISC ADaM standards, use the provided CE dataset to create an ADCE dataset with one record per clinical event.
The output dataset should contain the following columns in this order: STUDYID, USUBJID, CESEQ, CETERM, ASTDT, ASEV, ASEVN, ATOXGRN, AOCCFL
ASEV is the severity collected for the event, and has no value when no severity was collected. ASEVN is 1 for "MILD", 2 for "MODERATE", and 3 for "SEVERE", and has no value when no severity was collected. ATOXGRN is the same grade as ASEVN, and has no value when no severity was collected. AOCCFL is "Y" on the one event of each subject that has the greatest ATOXGRN, and has no value on every other event. When several of a subject's events share the greatest grade, the flagged event is the one with the earliest ASTDT, and the lowest CESEQ where the start dates also tie. An event with no grade is never flagged, so a subject whose events all have no grade has no flagged event.
Read the source datasets from /app/input and save the completed dataset as /app/output/adce.csv.
prompts/adam-adce-worst-toxicity/conventions.md
Edit11 linesFollowing CDISC ADaM standards, use the provided CE dataset to create an ADCE dataset with one record per clinical event.
The output dataset should contain the following columns in this order: STUDYID, USUBJID, CESEQ, CETERM, ASTDT, ASEV, ASEVN, ATOXGRN, AOCCFL
ASEVN is 1 for "MILD", 2 for "MODERATE", and 3 for "SEVERE", or has no value. AOCCFL is "Y" or has no value.
Read the source datasets from /app/input and save the completed dataset as /app/output/adce.csv.
prompts/adam-adce-worst-toxicity/brief.md
Edit8 linesFollowing CDISC ADaM standards, use the provided CE dataset to create an ADCE dataset with one record per clinical event.
The output dataset should contain the following columns in this order: STUDYID, USUBJID, CESEQ, CETERM, ASTDT, ASEV, ASEVN, ATOXGRN, AOCCFL
Read the source datasets from /app/input and save the completed dataset as /app/output/adce.csv.
R
Edit3 lineslibrary(yamaa)yamaa_spec("spec.yaml")$run()$outputPython
Edit3 linesimport yamaayamaa.spec("spec.yaml").run().outputsolutions/adam-adce-worst-toxicity/result.R
Edit41 lines# Reference solution for the yamaa benchmark adam-adce-worst-toxicity (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)ce <- read_csv( "/app/input/ce.csv", col_types = cols(CESEQ = col_integer(), ASTDT = col_date(), .default = col_character()))adce <- ce |> mutate( ASEV = CESEV, ASEVN = case_when( ASEV == "MILD" ~ 1L, ASEV == "MODERATE" ~ 2L, ASEV == "SEVERE" ~ 3L ), ATOXGRN = ASEVN )# The graded event with the greatest grade per subject; ties break by# earliest date, then lowest sequence, so at most one per subject.best <- adce |> filter(!is.na(ATOXGRN)) |> arrange(USUBJID, desc(ATOXGRN), ASTDT, CESEQ) |> distinct(USUBJID, .keep_all = TRUE) |> select(USUBJID, CESEQ) |> mutate(BEST = "Y")adce <- adce |> left_join(best, by = c("USUBJID", "CESEQ")) |> mutate(AOCCFL = BEST) |> select(STUDYID, USUBJID, CESEQ, CETERM, ASTDT, ASEV, ASEVN, ATOXGRN, AOCCFL)dir.create("/app/output", showWarnings = FALSE)write_csv(adce, "/app/output/adce.csv", na = "")solutions/adam-adce-worst-toxicity/result.py
Edit58 lines# Reference solution for the yamaa benchmark adam-adce-worst-toxicity (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 plce = ( pl.read_csv("/app/input/ce.csv", infer_schema=False) .with_columns( pl.col("CESEQ").cast(pl.Int64), pl.col("ASTDT").str.to_date(strict=False), ))adce = ce.with_columns( ASEV=pl.col("CESEV"), ASEVN=pl.when(pl.col("CESEV") == "MILD") .then(1) .when(pl.col("CESEV") == "MODERATE") .then(2) .when(pl.col("CESEV") == "SEVERE") .then(3) .otherwise(None) .cast(pl.Int64),).with_columns(ATOXGRN=pl.col("ASEVN"))# The graded event with the greatest grade per subject; ties break by# earliest date, then lowest sequence, so at most one per subject.best = ( adce.filter(pl.col("ATOXGRN").is_not_null()) .sort(["ATOXGRN", "ASTDT", "CESEQ"], descending=[True, False, False], nulls_last=True) .unique("USUBJID", keep="first", maintain_order=True) .select("USUBJID", "CESEQ") .with_columns(BEST=pl.lit("Y")))adce = ( adce.join(best, on=["USUBJID", "CESEQ"], how="left") .with_columns(AOCCFL=pl.col("BEST")) .select( "STUDYID", "USUBJID", "CESEQ", "CETERM", "ASTDT", "ASEV", "ASEVN", "ATOXGRN", "AOCCFL", ))Path("/app/output").mkdir(exist_ok=True)adce.write_csv("/app/output/adce.csv")solutions/adam-adce-worst-toxicity/result.sas
Edit24 lines/* opensas reference solution for the yamaa benchmark adam-adce-worst-toxicity. Reads the benchmark inputs and derives the requested output. Execute with the existing opensas runtime: opensas /app/output/result.sas. */data ce; length STUDYID USUBJID CETERM CESEV ASTDT $1024; infile "/app/input/ce.csv" dsd dlm="," firstobs=2 truncover lrecl=32767; input STUDYID : $char1024. USUBJID : $char1024. CESEQ CETERM : $char1024. CESEV : $char1024. ASTDT : $char1024.;run;data graded; length ASEV $1024; set ce; NODATE=missing(ASTDT); ASEV=CESEV; select(ASEV); when('MILD') ASEVN=1; when('MODERATE') ASEVN=2; when('SEVERE') ASEVN=3; otherwise ASEVN=.; end; ATOXGRN=ASEVN;run;proc sort data=graded(where=(not missing(ATOXGRN))) out=eligible; by STUDYID USUBJID descending ATOXGRN NODATE ASTDT CESEQ; run;data worst; set eligible; by STUDYID USUBJID; if first.USUBJID; keep STUDYID USUBJID CESEQ; run;proc sql; create table result as select a.*,case when not missing(b.CESEQ) then 'Y' else '' end as AOCCFL from graded as a left join worst as b on a.STUDYID=b.STUDYID and a.USUBJID=b.USUBJID and a.CESEQ=b.CESEQ; quit;proc sql; create table final as select STUDYID, USUBJID, CESEQ, CETERM, ASTDT, ASEV, ASEVN, ATOXGRN, AOCCFL from result;quit;proc export data=final outfile="/app/output/adce.csv" dbms=csv replace; run;
yamaa