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

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
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.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-adae-worst-severity/full.md

Edit
20 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", 2 for "MODERATE", and 3 for "SEVERE". ASEVN has no value when AESEV has no value. An event is eligible for AOCCPIFL only when it is treatment-emergent (TRTEMFL is "Y") and has a graded severity (ASEVN has a value). For each subject and preferred term (AEDECOD), AOCCPIFL is "Y" on the eligible event with the greatest ASEVN. When eligible events tie on ASEVN, the event with the earliest ASTDT is flagged; a further tie goes to the event with the lowest AESEQ, so exactly one event is flagged for each subject and preferred term that has an eligible event. AOCCPIFL has no value on every other event.

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", 2 for "MODERATE", and 3 for "SEVERE", or has no value. AOCCPIFL is "Y" or has no value.

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

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-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
96 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."""Create the ADAE dataset from ADAE_RAW.One record per adverse event, with the numeric severity rank ASEVN andAOCCPIFL flagging, per subject and preferred term, the first occurrenceof the worst severity among treatment-emergent, severity-graded events."""import csvfrom pathlib import PathINPUT_DIR = Path("/app/input")OUTPUT_DIR = Path("/app/output")SEVERITY_RANK = {"MILD": 1, "MODERATE": 2, "SEVERE": 3}OUTPUT_COLUMNS = [    "STUDYID",    "USUBJID",    "AESEQ",    "AEBODSYS",    "AEDECOD",    "ASTDT",    "AESEV",    "TRTEMFL",    "ASEVN",    "AOCCPIFL",]def severity_rank(value):    """Numeric rank of an AESEV value; None when AESEV has no value."""    if value is None:        return None    return SEVERITY_RANK.get(value.strip())def sequence_key(value):    """Sort key for AESEQ so the lowest sequence number wins a tie."""    try:        return (0, int(value), "")    except (TypeError, ValueError):        return (1, 0, "" if value is None else str(value))def occurrence_key(record):    """Rank eligible events: worst severity, then earliest start date,    then lowest AESEQ. A missing start date never wins a date tie."""    astdt = (record.get("ASTDT") or "").strip()    return (        -record["ASEVN"],        1 if not astdt else 0,        astdt,        sequence_key(record.get("AESEQ")),    )def main():    with open(INPUT_DIR / "adae_raw.csv", newline="", encoding="utf-8") as handle:        records = list(csv.DictReader(handle))    for record in records:        record["ASEVN"] = severity_rank(record.get("AESEV"))        record["AOCCPIFL"] = ""    groups = {}    for index, record in enumerate(records):        eligible = (            (record.get("TRTEMFL") or "").strip() == "Y"            and record["ASEVN"] is not None        )        if eligible:            key = (record.get("USUBJID"), record.get("AEDECOD"))            groups.setdefault(key, []).append(index)    for indexes in groups.values():        winner = min(indexes, key=lambda i: occurrence_key(records[i]))        records[winner]["AOCCPIFL"] = "Y"    OUTPUT_DIR.mkdir(parents=True, exist_ok=True)    with open(OUTPUT_DIR / "adae.csv", "w", newline="", encoding="utf-8") as handle:        writer = csv.DictWriter(handle, fieldnames=OUTPUT_COLUMNS)        writer.writeheader()        for record in records:            row = {column: record.get(column) or "" for column in OUTPUT_COLUMNS}            row["ASEVN"] = "" if record["ASEVN"] is None else str(record["ASEVN"])            writer.writerow(row)if __name__ == "__main__":    main()

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;