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: 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 of ASEV, 1 for MILD through 3 for SEVERE; blank when no severity was collected.
  • ATOXGRN: toxicity grade, equal to ASEVN, so a moderate event reads grade 2; blank when no severity was collected.
  • AOCCFL: Y on the graded event with the greatest ATOXGRN for the subject; blank otherwise. Ties break by earliest ASTDT, then lowest CESEQ, 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 review
1 source file

input/ce.csv

Edit
11 rows
input/ce.csv
STUDYIDUSUBJIDCESEQCETERMCESEVASTDT
KN1891FEVERMILD2024-01-11
KN1892FATIGUESEVERE2024-01-12
KN1893CHILLSSEVERE2024-01-13
KN1894FATIGUESEVERE2024-01-12
KN1891FEVER—2024-02-06
KN1892FEVERMODERATE2024-02-06
KN1891REDNESSMODERATE2024-03-02
KN1891FEVER—2024-05-01
KN1892HEADACHE—2024-05-03
KN1891PAINMODERATE2024-04-10
KN1892HEADACHEMODERATE2024-04-05

Expected output

Under review
11 expected rows

expected/adce.csv

Edit
11 rows
expected/adce.csv
STUDYIDUSUBJIDCESEQCETERMASTDTASEVASEVNATOXGRNAOCCFL
KN1891FEVER2024-01-11MILD11—
KN1892FATIGUE2024-01-12SEVERE33Y
KN1893CHILLS2024-01-13SEVERE33—
KN1894FATIGUE2024-01-12SEVERE33—
KN1891FEVER2024-02-06————
KN1892FEVER2024-02-06MODERATE22Y
KN1891REDNESS2024-03-02MODERATE22Y
KN1891FEVER2024-05-01————
KN1892HEADACHE2024-05-03————
KN1891PAIN2024-04-10MODERATE22—
KN1892HEADACHE2024-04-05MODERATE22Y
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
ADCESTUDYIDStudy IdentifiercharacterCopy value from CE.STUDYID.Predecessor
ADCEUSUBJIDUnique Subject IdentifiercharacterCopy value from CE.USUBJID.Predecessor
ADCECESEQSequence NumbernumericCopy value from CE.CESEQ.Predecessor
ADCECETERMReported Term for Clinical EventcharacterCopy value from CE.CETERM.Predecessor
ADCEASTDTAnalysis Start DatenumericISO 8601Copy value from CE.ASTDT.Predecessor
ADCEASEVAnalysis Severity/IntensitycharacterMILD, MODERATE, SEVERECopy value from CE.CESEV.Predecessor
ADCEASEVNAnalysis Severity/Intensity (N)numeric1, 2, 3Recode ASEV: "MILD" → "1", "MODERATE" → "2", "SEVERE" → "3"; missing values stay missing; unlisted values are errors.Derived
ADCEATOXGRNAnalysis Toxicity Grade (N)numeric1, 2, 3Copy value from ASEVN.Derived
ADCEAOCCFLWorst Grade Occurrence FlagcharacterY"Y" when WGRSEQ = 1; blank otherwise.Derived
VariablePermitted values
ASEVMILD, MODERATE, SEVERE
ASEVN1, 2, 3
ATOXGRN1, 2, 3
AOCCFLY
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-adce-worst-toxicity/full.md

Edit
19 lines

Following 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

Edit
11 lines

Following 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

Edit
8 lines

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

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-adce-worst-toxicity/result.R

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

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

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