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-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 ofAESEV,1for MILD through3for SEVERE; blank when no severity was collected.AOCCPIFL:Yon the eligible event with the greatestASEVNfor the subject and preferred term (AEDECOD); blank otherwise. Ties break by earliestASTDT, then lowestAESEQ, 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 review1 source fileinput/adae_raw.csv
Edit12 rows| STUDYID | USUBJID | AESEQ | AEBODSYS | AEDECOD | ASTDT | AESEV | TRTEMFL |
|---|---|---|---|---|---|---|---|
| CATH | 1 | NERVOUS SYSTEM DISORDERS | HEADACHE | 2025-01-12 | MILD | Y | |
| CATH | 2 | NERVOUS SYSTEM DISORDERS | HEADACHE | 2025-01-18 | SEVERE | Y | |
| CATH | 3 | NERVOUS SYSTEM DISORDERS | HEADACHE | 2025-01-20 | MODERATE | Y | |
| CATH | 4 | GASTROINTESTINAL DISORDERS | NAUSEA | 2025-01-15 | MODERATE | Y | |
| CATH | 5 | SKIN AND SUBCUTANEOUS TISSUE DISORDERS | RASH | 2025-01-05 | SEVERE | — | |
| CATH | 1 | NERVOUS SYSTEM DISORDERS | HEADACHE | 2025-02-10 | MODERATE | Y | |
| CATH | 2 | NERVOUS SYSTEM DISORDERS | HEADACHE | 2025-02-10 | MODERATE | Y | |
| CATH | 3 | GASTROINTESTINAL DISORDERS | NAUSEA | 2025-02-12 | — | Y | |
| CATH | 1 | NERVOUS SYSTEM DISORDERS | HEADACHE | 2025-03-10 | SEVERE | Y | |
| CATH | 2 | NERVOUS SYSTEM DISORDERS | HEADACHE | 2025-03-05 | SEVERE | Y | |
| CATH | 3 | SKIN AND SUBCUTANEOUS TISSUE DISORDERS | RASH | 2025-03-06 | MODERATE | — | |
| CATH | 4 | SKIN AND SUBCUTANEOUS TISSUE DISORDERS | RASH | 2025-03-08 | — | Y |
Expected output
Under review12 expected rowsexpected/adae.csv
Edit12 rows| STUDYID | USUBJID | AESEQ | AEBODSYS | AEDECOD | ASTDT | AESEV | TRTEMFL | ASEVN | AOCCPIFL |
|---|---|---|---|---|---|---|---|---|---|
| CATH | 1 | NERVOUS SYSTEM DISORDERS | HEADACHE | 2025-01-12 | MILD | Y | 1 | — | |
| CATH | 2 | NERVOUS SYSTEM DISORDERS | HEADACHE | 2025-01-18 | SEVERE | Y | 3 | Y | |
| CATH | 3 | NERVOUS SYSTEM DISORDERS | HEADACHE | 2025-01-20 | MODERATE | Y | 2 | — | |
| CATH | 4 | GASTROINTESTINAL DISORDERS | NAUSEA | 2025-01-15 | MODERATE | Y | 2 | Y | |
| CATH | 5 | SKIN AND SUBCUTANEOUS TISSUE DISORDERS | RASH | 2025-01-05 | SEVERE | — | 3 | — | |
| CATH | 1 | NERVOUS SYSTEM DISORDERS | HEADACHE | 2025-02-10 | MODERATE | Y | 2 | Y | |
| CATH | 2 | NERVOUS SYSTEM DISORDERS | HEADACHE | 2025-02-10 | MODERATE | Y | 2 | — | |
| CATH | 3 | GASTROINTESTINAL DISORDERS | NAUSEA | 2025-02-12 | — | Y | — | — | |
| CATH | 1 | NERVOUS SYSTEM DISORDERS | HEADACHE | 2025-03-10 | SEVERE | Y | 3 | — | |
| CATH | 2 | NERVOUS SYSTEM DISORDERS | HEADACHE | 2025-03-05 | SEVERE | Y | 3 | Y | |
| CATH | 3 | SKIN AND SUBCUTANEOUS TISSUE DISORDERS | RASH | 2025-03-06 | MODERATE | — | 2 | — | |
| CATH | 4 | SKIN AND SUBCUTANEOUS TISSUE DISORDERS | RASH | 2025-03-08 | — | Y | — | — |
Human review and assessment
| Dataset Name | Variable Name | Variable Label | Type | Codelist/Controlled Terms | Core | Computational Method | Origin |
|---|---|---|---|---|---|---|---|
| ADAE | STUDYID | Study Identifier | character | Copy value from ADAE_RAW.STUDYID. | Predecessor | ||
| ADAE | USUBJID | Unique Subject Identifier | character | Copy value from ADAE_RAW.USUBJID. | Predecessor | ||
| ADAE | AESEQ | Sequence Number | numeric | Copy value from ADAE_RAW.AESEQ. | Predecessor | ||
| ADAE | AEBODSYS | Body System or Organ Class | character | Copy value from ADAE_RAW.AEBODSYS. | Predecessor | ||
| ADAE | AEDECOD | Dictionary-Derived Term | character | Copy value from ADAE_RAW.AEDECOD. | Predecessor | ||
| ADAE | ASTDT | Analysis Start Date | numeric | ISO 8601 | Copy value from ADAE_RAW.ASTDT. | Predecessor | |
| ADAE | AESEV | Severity/Intensity | character | MILD, MODERATE, SEVERE | Copy value from ADAE_RAW.AESEV. | Predecessor | |
| ADAE | TRTEMFL | Treatment Emergent Analysis Flag | character | Y | Copy value from ADAE_RAW.TRTEMFL. | Predecessor | |
| ADAE | ASEVN | Severity/Intensity (N) | numeric | Recode AESEV: "MILD" → "1", "MODERATE" → "2", "SEVERE" → "3"; missing values stay missing; unlisted values are errors. | Derived | ||
| ADAE | AOCCPIFL | First Occurrence of Maximum Severity Flag | character | "Y" when AWSRNK = 1; blank otherwise. | Derived |
| Variable | Permitted values |
|---|---|
| AESEV | MILD, MODERATE, SEVERE |
| TRTEMFL | 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-adae-worst-severity/full.md
Edit20 linesFollowing 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
Edit12 linesFollowing 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
Edit9 linesFollowing 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.
R
Edit3 lineslibrary(yamaa)yamaa_spec("spec.yaml")$run()$outputPython
Edit3 linesimport yamaayamaa.spec("spec.yaml").run().outputsolutions/adam-adae-worst-severity/result.R
Edit43 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
Edit96 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
Edit23 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;
yamaa