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 SDTM: 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: derive AESER for each adverse event (AE) from its collected seriousness criteria while retaining the reported term and criterion flags.

Input: collected adverse event terms (AETERM) with Y or N flags for death (AESDTH), life threat (AESLIFE), required or prolonged hospitalization (AESHOSP), persistent or significant disability or incapacity (AESDISAB), congenital anomaly or birth defect (AESCONG), and another medically important serious event (AESMIE); any flag may be empty.

Variables:

  • AESER is Y when any seriousness criterion is Y; it is N when no criterion is Y, including when every criterion is empty.

Note: the term and the six criterion flags are kept as collected, so an empty flag stays empty rather than becoming N.

Inputs

Under review
1 source file

input/ae_raw.csv

Edit
4 rows
input/ae_raw.csv
STUDYIDUSUBJIDAESEQAETERMAESDTHAESLIFEAESHOSPAESDISABAESCONGAESMIE
CATH1APPENDICITISNNYNNN
CATH1ANAPHYLACTIC REACTIONNYYNNN
CATH1HEADACHENNNNNN
CATH1FATIGUE——————

Expected output

Under review
4 expected rows

expected/ae.csv

Edit
4 rows
expected/ae.csv
DOMAINSTUDYIDUSUBJIDAESEQAETERMAESERAESDTHAESLIFEAESHOSPAESDISABAESCONGAESMIE
AECATH1APPENDICITISYNNYNNN
AECATH1ANAPHYLACTIC REACTIONYNYYNNN
AECATH1HEADACHENNNNNNN
AECATH1FATIGUEN——————
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

Variable NameVariable LabelTypeLengthControlled Terms or FormatOriginCoreConversion DefinitionVariable TypeVariable OrderComments for Define
DOMAINDomain AbbreviationCharAssignedSet constant value "AE".SDTM1
STUDYIDStudy IdentifierCharCollectedCopy value from AE_RAW.STUDYID.SDTM2
USUBJIDUnique Subject IdentifierCharCollectedCopy value from AE_RAW.USUBJID.SDTM3
AESEQSequence NumberNumCollectedCopy value from AE_RAW.AESEQ.SDTM4
AETERMReported Term for the Adverse EventCharCollectedCopy value from AE_RAW.AETERM.SDTM5
AESERSerious EventCharY, NDerivedIf AE_RAW.AESDTH = 'Y' OR AE_RAW.AESLIFE = 'Y' OR AE_RAW.AESHOSP = 'Y' OR AE_RAW.AESDISAB = 'Y' OR AE_RAW.AESCONG = 'Y' OR AE_RAW.AESMIE = 'Y' then "Y"; otherwise "N".SDTM6
AESDTHResults in DeathCharY, NCollectedCopy value from AE_RAW.AESDTH.SDTM7
AESLIFEIs Life ThreateningCharY, NCollectedCopy value from AE_RAW.AESLIFE.SDTM8
AESHOSPRequires or Prolongs HospitalizationCharY, NCollectedCopy value from AE_RAW.AESHOSP.SDTM9
AESDISABPersist or Significant Disability/IncapacityCharY, NCollectedCopy value from AE_RAW.AESDISAB.SDTM10
AESCONGCongenital Anomaly or Birth DefectCharY, NCollectedCopy value from AE_RAW.AESCONG.SDTM11
AESMIEOther Medically Important Serious EventCharY, NCollectedCopy value from AE_RAW.AESMIE.SDTM12
VariablePermitted values
AESERY, N
AESDTHY, N
AESLIFEY, N
AESHOSPY, N
AESDISABY, N
AESCONGY, N
AESMIEY, N
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/sdtm-ae-seriousness/full.md

Edit
15 lines

Following CDISC SDTM standards, use the provided AE_RAW dataset to create an AE dataset with one record per adverse event.

The output dataset should contain the following columns in this order: DOMAIN, STUDYID, USUBJID, AESEQ, AETERM, AESER, AESDTH, AESLIFE, AESHOSP, AESDISAB, AESCONG, AESMIE

AESER is Y when any seriousness criterion is Y: death, life threat, required or prolonged hospitalization, disability, congenital anomaly, or another medically important event. It is N when no criterion is Y, including when every criterion is empty. The six criterion flags are kept as collected, so an empty flag stays empty rather than becoming N.

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

prompts/sdtm-ae-seriousness/conventions.md

Edit
11 lines

Following CDISC SDTM standards, use the provided AE_RAW dataset to create an AE dataset with one record per adverse event.

The output dataset should contain the following columns in this order: DOMAIN, STUDYID, USUBJID, AESEQ, AETERM, AESER, AESDTH, AESLIFE, AESHOSP, AESDISAB, AESCONG, AESMIE

AESER is Y or N.

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

prompts/sdtm-ae-seriousness/brief.md

Edit
9 lines

Following CDISC SDTM standards, use the provided AE_RAW dataset to create an AE dataset with one record per adverse event.

The output dataset should contain the following columns in this order: DOMAIN, STUDYID, USUBJID, AESEQ, AETERM, AESER, AESDTH, AESLIFE, AESHOSP, AESDISAB, AESCONG, AESMIE

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

yamaa code

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

run.R

Edit
4 lines
library(yamaa)ae <- yamaa_domain("spec.yaml")$outputae

run.py

Edit
4 lines
import yamaaae = yamaa.yamaa_domain("spec.yaml").outputae

Solution without yamaa

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

solutions/sdtm-ae-seriousness/result.R

Edit
32 lines
# Reference solution for the yamaa benchmark sdtm-ae-seriousness (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)ae_raw <- read_csv(  "/app/input/ae_raw.csv",  col_types = cols(AESEQ = col_integer(), .default = col_character()))# Serious when any criterion is Y; otherwise not serious, even when every# criterion is empty. The criterion flags stay as collected.ae <- ae_raw |>  mutate(    DOMAIN = "AE",    AESER = if_else(      AESDTH == "Y" | AESLIFE == "Y" | AESHOSP == "Y" |        AESDISAB == "Y" | AESCONG == "Y" | AESMIE == "Y",      "Y", "N", missing = "N"    )  ) |>  select(    DOMAIN, STUDYID, USUBJID, AESEQ, AETERM, AESER,    AESDTH, AESLIFE, AESHOSP, AESDISAB, AESCONG, AESMIE  )dir.create("/app/output", showWarnings = FALSE)write_csv(ae, "/app/output/ae.csv", na = "")

solutions/sdtm-ae-seriousness/result.py

Edit
39 lines
# Reference solution for the yamaa benchmark sdtm-ae-seriousness (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 plae_raw = pl.read_csv("/app/input/ae_raw.csv", infer_schema=False).with_columns(    pl.col("AESEQ").cast(pl.Int64))criteria = ["AESDTH", "AESLIFE", "AESHOSP", "AESDISAB", "AESCONG", "AESMIE"]# Serious when any criterion is Y; otherwise not serious, even when every# criterion is empty. The criterion flags stay as collected.ae = (    ae_raw.with_columns(        AESER=pl.when(            pl.any_horizontal(pl.col(criteria) == "Y")        )        .then(pl.lit("Y"))        .otherwise(pl.lit("N")),        DOMAIN=pl.lit("AE"),    ).select(        "DOMAIN",        "STUDYID",        "USUBJID",        "AESEQ",        "AETERM",        "AESER",        *criteria,    ))Path("/app/output").mkdir(exist_ok=True)ae.write_csv("/app/output/ae.csv")

solutions/sdtm-ae-seriousness/result.sas

Edit
16 lines
/* opensas reference solution for the yamaa benchmark sdtm-ae-seriousness.   Reads the benchmark inputs and derives the requested output.   Execute with the existing opensas runtime: opensas /app/output/result.sas. */data ae_raw;  length STUDYID USUBJID AETERM AESDTH AESLIFE AESHOSP AESDISAB AESCONG AESMIE $1024;  infile "/app/input/ae_raw.csv" dsd dlm="," firstobs=2 truncover lrecl=32767;  input STUDYID : $char1024. USUBJID : $char1024. AESEQ AETERM : $char1024. AESDTH : $char1024. AESLIFE : $char1024. AESHOSP : $char1024. AESDISAB : $char1024. AESCONG : $char1024. AESMIE : $char1024.;run;data result; set ae_raw; length DOMAIN $2 AESER $1; DOMAIN='AE'; AESER='N';if AESDTH='Y' or AESLIFE='Y' or AESHOSP='Y' or AESDISAB='Y' or AESCONG='Y' or AESMIE='Y' then AESER='Y'; run;proc sql;  create table final as select DOMAIN, STUDYID, USUBJID, AESEQ, AETERM, AESER, AESDTH, AESLIFE, AESHOSP, AESDISAB, AESCONG, AESMIE from result;quit;proc export data=final outfile="/app/output/ae.csv" dbms=csv replace; run;