Review ask

As a clinical trial statistician or programmer, challenge anything in this benchmark: describe a problem in Comments, or propose a fix with the Edit button on any source file.

  1. Task: Would a real study need this derivation, specified this way? Does it follow CDISC ADaM: variable names, controlled terms, record structure? Flag any rule that is ambiguous or that a sponsor would handle differently.
  2. Inputs: Do they look like data collected in a real trial, and do they include the situations you would expect to meet in one?
  3. Expected output: Would independent QC programming reproduce every value from these inputs and rules?

The other tabs beside Comments are background for assessment, not under review.

Summary

Lifecycle: reviewedEditUnder review
What this benchmark means
README.md

Goal: rank severity and flag the worst-severity treatment-emergent event for each subject and preferred term (AEDECOD), adding ASEVN and AOCCPIFL.

Input: adverse event (AE) records carrying body system or organ class (AEBODSYS), dictionary-derived term (AEDECOD), analysis start date (ASTDT), severity (AESEV), and treatment-emergent flag (TRTEMFL).

Variables:

  • ASEVN: numeric rank of AESEV, 1 for MILD through 3 for SEVERE; blank when no severity was collected.
  • AOCCPIFL: Y on the eligible event with the greatest ASEVN for the subject and preferred term (AEDECOD); blank otherwise. Ties break by earliest ASTDT, then lowest AESEQ, so exactly one event per term is flagged.

Note: only a treatment-emergent event with a graded severity is eligible, so a preferred term (AEDECOD) whose events are all ineligible has no flagged event.

Inputs

Under review
1 source file

input/adae_raw.csv

Edit
12 rows
input/adae_raw.csv
STUDYIDUSUBJIDAESEQAEBODSYSAEDECODASTDTAESEVTRTEMFL
CATH1NERVOUS SYSTEM DISORDERSHEADACHE2025-01-12MILDY
CATH2NERVOUS SYSTEM DISORDERSHEADACHE2025-01-18SEVEREY
CATH3NERVOUS SYSTEM DISORDERSHEADACHE2025-01-20MODERATEY
CATH4GASTROINTESTINAL DISORDERSNAUSEA2025-01-15MODERATEY
CATH5SKIN AND SUBCUTANEOUS TISSUE DISORDERSRASH2025-01-05SEVERE—
CATH1NERVOUS SYSTEM DISORDERSHEADACHE2025-02-10MODERATEY
CATH2NERVOUS SYSTEM DISORDERSHEADACHE2025-02-10MODERATEY
CATH3GASTROINTESTINAL DISORDERSNAUSEA2025-02-12—Y
CATH1NERVOUS SYSTEM DISORDERSHEADACHE2025-03-10SEVEREY
CATH2NERVOUS SYSTEM DISORDERSHEADACHE2025-03-05SEVEREY
CATH3SKIN AND SUBCUTANEOUS TISSUE DISORDERSRASH2025-03-06MODERATE—
CATH4SKIN AND SUBCUTANEOUS TISSUE DISORDERSRASH2025-03-08—Y

Expected output

Under review
12 expected rows

expected/adae.csv

Edit
12 rows
expected/adae.csv
STUDYIDUSUBJIDAESEQAEBODSYSAEDECODASTDTAESEVTRTEMFLASEVNAOCCPIFL
CATH1NERVOUS SYSTEM DISORDERSHEADACHE2025-01-12MILDY1—
CATH2NERVOUS SYSTEM DISORDERSHEADACHE2025-01-18SEVEREY3Y
CATH3NERVOUS SYSTEM DISORDERSHEADACHE2025-01-20MODERATEY2—
CATH4GASTROINTESTINAL DISORDERSNAUSEA2025-01-15MODERATEY2Y
CATH5SKIN AND SUBCUTANEOUS TISSUE DISORDERSRASH2025-01-05SEVERE—3—
CATH1NERVOUS SYSTEM DISORDERSHEADACHE2025-02-10MODERATEY2Y
CATH2NERVOUS SYSTEM DISORDERSHEADACHE2025-02-10MODERATEY2—
CATH3GASTROINTESTINAL DISORDERSNAUSEA2025-02-12—Y——
CATH1NERVOUS SYSTEM DISORDERSHEADACHE2025-03-10SEVEREY3—
CATH2NERVOUS SYSTEM DISORDERSHEADACHE2025-03-05SEVEREY3Y
CATH3SKIN AND SUBCUTANEOUS TISSUE DISORDERSRASH2025-03-06MODERATE—2—
CATH4SKIN AND SUBCUTANEOUS TISSUE DISORDERSRASH2025-03-08—Y——
Shaded columns are derived— = missing value

Comments and assessment materials

Comments

Signed in with GitHub; saved in repository Discussions

Mapping spec

Generated from the benchmark YAML; do not edit by hand

Dataset NameVariable NameVariable LabelTypeCodelist/Controlled TermsCoreComputational MethodOrigin
ADAESTUDYIDStudy IdentifiercharacterCopy value from ADAE_RAW.STUDYID.Predecessor
ADAEUSUBJIDUnique Subject IdentifiercharacterCopy value from ADAE_RAW.USUBJID.Predecessor
ADAEAESEQSequence NumbernumericCopy value from ADAE_RAW.AESEQ.Predecessor
ADAEAEBODSYSBody System or Organ ClasscharacterCopy value from ADAE_RAW.AEBODSYS.Predecessor
ADAEAEDECODDictionary-Derived TermcharacterCopy value from ADAE_RAW.AEDECOD.Predecessor
ADAEASTDTAnalysis Start DatenumericISO 8601Copy value from ADAE_RAW.ASTDT.Predecessor
ADAEAESEVSeverity/IntensitycharacterMILD, MODERATE, SEVERECopy value from ADAE_RAW.AESEV.Predecessor
ADAETRTEMFLTreatment Emergent Analysis FlagcharacterYCopy value from ADAE_RAW.TRTEMFL.Predecessor
ADAEASEVNSeverity/Intensity (N)numericRecode AESEV: "MILD" → "1", "MODERATE" → "2", "SEVERE" → "3"; missing values stay missing; unlisted values are errors.Derived
ADAEAOCCPIFLFirst Occurrence of Maximum Severity Flagcharacter"Y" when AWSRNK = 1; blank otherwise.Derived
VariablePermitted values
AESEVMILD, MODERATE, SEVERE
TRTEMFLY
VersionDateAuthorDescriptionReviewerSign-off
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-adae-worst-severity/full.md

Edit
17 lines

Following CDISC ADaM standards, use the provided ADAE_RAW dataset to create an ADAE dataset with one record per adverse event.

The output dataset should contain the following columns in this order: STUDYID, USUBJID, AESEQ, AEBODSYS, AEDECOD, ASTDT, AESEV, TRTEMFL, ASEVN, AOCCPIFL

ASEVN is the numeric rank of AESEV: 1 for MILD through 3 for SEVERE, and has no value when no severity was collected. AOCCPIFL is Y on the eligible event with the greatest ASEVN for the subject and preferred term. Only a treatment-emergent event with a graded severity is eligible, so a preferred term whose events are all ineligible has no flagged event. Ties break by earliest ASTDT, then lowest AESEQ, so exactly one event per term is flagged.

Read the source datasets from /app/input and save the completed dataset as /app/output/adae.csv.

prompts/adam-adae-worst-severity/conventions.md

Edit
12 lines

Following CDISC ADaM standards, use the provided ADAE_RAW dataset to create an ADAE dataset with one record per adverse event.

The output dataset should contain the following columns in this order: STUDYID, USUBJID, AESEQ, AEBODSYS, AEDECOD, ASTDT, AESEV, TRTEMFL, ASEVN, AOCCPIFL

ASEVN is the numeric rank of AESEV: 1 for MILD through 3 for SEVERE. AOCCPIFL is Y on a flagged event.

Read the source datasets from /app/input and save the completed dataset as /app/output/adae.csv.

prompts/adam-adae-worst-severity/brief.md

Edit
9 lines

Following CDISC ADaM standards, use the provided ADAE_RAW dataset to create an ADAE dataset with one record per adverse event.

The output dataset should contain the following columns in this order: STUDYID, USUBJID, AESEQ, AEBODSYS, AEDECOD, ASTDT, AESEV, TRTEMFL, ASEVN, AOCCPIFL

Read the source datasets from /app/input and save the completed dataset as /app/output/adae.csv.

yamaa code

Runs the yamaa specification; its result must match the expected output

run.R

Edit
4 lines
library(yamaa)adae <- yamaa_domain("spec.yaml")$outputadae

run.py

Edit
4 lines
import yamaaadae = yamaa.yamaa_domain("spec.yaml").outputadae

Solution without yamaa

Written from the full prompt and the inputs alone; CI checks it reproduces the expected output

solutions/adam-adae-worst-severity/result.R

Edit
43 lines
# Reference solution for the yamaa benchmark adam-adae-worst-severity (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)adae_raw <- read_csv(  "/app/input/adae_raw.csv",  col_types = cols(AESEQ = col_integer(), ASTDT = col_date(), .default = col_character()))adae <- adae_raw |>  mutate(    ASEVN = case_when(      AESEV == "MILD" ~ 1L,      AESEV == "MODERATE" ~ 2L,      AESEV == "SEVERE" ~ 3L    )  )# The eligible event with the greatest rank per subject and term; ties break# by earliest date, then lowest sequence. Only a treatment-emergent event# with a graded severity is eligible.best <- adae |>  filter(TRTEMFL == "Y", !is.na(ASEVN)) |>  arrange(USUBJID, AEDECOD, desc(ASEVN), ASTDT, AESEQ) |>  distinct(USUBJID, AEDECOD, .keep_all = TRUE) |>  select(USUBJID, AEDECOD, AESEQ) |>  mutate(BEST = "Y")adae <- adae |>  left_join(best, by = c("USUBJID", "AEDECOD", "AESEQ")) |>  mutate(AOCCPIFL = BEST) |>  select(    STUDYID, USUBJID, AESEQ, AEBODSYS, AEDECOD, ASTDT, AESEV, TRTEMFL,    ASEVN, AOCCPIFL  )dir.create("/app/output", showWarnings = FALSE)write_csv(adae, "/app/output/adae.csv", na = "")

solutions/adam-adae-worst-severity/result.py

Edit
59 lines
# Reference solution for the yamaa benchmark adam-adae-worst-severity (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 pladae_raw = (    pl.read_csv("/app/input/adae_raw.csv", infer_schema=False)    .with_columns(        pl.col("AESEQ").cast(pl.Int64),        pl.col("ASTDT").str.to_date(strict=False),    ))adae = adae_raw.with_columns(    ASEVN=pl.when(pl.col("AESEV") == "MILD")    .then(1)    .when(pl.col("AESEV") == "MODERATE")    .then(2)    .when(pl.col("AESEV") == "SEVERE")    .then(3)    .otherwise(None)    .cast(pl.Int64))# The eligible event with the greatest rank per subject and term; ties break# by earliest date, then lowest sequence. Only a treatment-emergent event# with a graded severity is eligible. ISO dates sort as text.best = (    adae.filter(pl.col("TRTEMFL") == "Y", pl.col("ASEVN").is_not_null())    .sort(["ASEVN", "ASTDT", "AESEQ"], descending=[True, False, False], nulls_last=True)    .unique(["USUBJID", "AEDECOD"], keep="first", maintain_order=True)    .select("USUBJID", "AEDECOD", "AESEQ")    .with_columns(BEST=pl.lit("Y")))adae = (    adae.join(best, on=["USUBJID", "AEDECOD", "AESEQ"], how="left")    .with_columns(AOCCPIFL=pl.col("BEST"))    .select(        "STUDYID",        "USUBJID",        "AESEQ",        "AEBODSYS",        "AEDECOD",        "ASTDT",        "AESEV",        "TRTEMFL",        "ASEVN",        "AOCCPIFL",    ))Path("/app/output").mkdir(exist_ok=True)adae.write_csv("/app/output/adae.csv")

solutions/adam-adae-worst-severity/result.sas

Edit
23 lines
/* opensas reference solution for the yamaa benchmark adam-adae-worst-severity.   Reads the benchmark inputs and derives the requested output.   Execute with the existing opensas runtime: opensas /app/output/result.sas. */data adae_raw;  length STUDYID USUBJID AEBODSYS AEDECOD ASTDT AESEV TRTEMFL $1024;  infile "/app/input/adae_raw.csv" dsd dlm="," firstobs=2 truncover lrecl=32767;  input STUDYID : $char1024. USUBJID : $char1024. AESEQ AEBODSYS : $char1024. AEDECOD : $char1024. ASTDT : $char1024. AESEV : $char1024. TRTEMFL : $char1024.;run;data graded;  length ASEV $20;  set adae_raw; NODATE=missing(ASTDT); ASEV=AESEV;  select(ASEV); when('MILD') ASEVN=1; when('MODERATE') ASEVN=2; when('SEVERE') ASEVN=3; when('LIFE-THREATENING') ASEVN=4; otherwise ASEVN=.; end;run;proc sort data=graded(where=(TRTEMFL='Y' and not missing(ASEVN))) out=eligible; by STUDYID USUBJID AEDECOD descending ASEVN NODATE ASTDT AESEQ; run;data worst; set eligible; by STUDYID USUBJID AEDECOD; if first.AEDECOD; keep STUDYID USUBJID AESEQ; run;proc sql; create table result as select a.*,case when not missing(b.AESEQ) then 'Y' else '' end as AOCCPIFL from graded as a left join worst as b on a.STUDYID=b.STUDYID and a.USUBJID=b.USUBJID and a.AESEQ=b.AESEQ; quit;proc sql;  create table final as select STUDYID, USUBJID, AESEQ, AEBODSYS, AEDECOD, ASTDT, AESEV, TRTEMFL, ASEVN, AOCCPIFL from result;quit;proc export data=final outfile="/app/output/adae.csv" dbms=csv replace; run;