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.
- 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.
- Inputs: Do they look like data collected in a real trial, and do they include the situations you would expect to meet in one?
- 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
README.mdGoal: 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:
AESERisYwhen any seriousness criterion isY; it isNwhen no criterion isY, 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 review1 source fileinput/ae_raw.csv
Edit4 rows| STUDYID | USUBJID | AESEQ | AETERM | AESDTH | AESLIFE | AESHOSP | AESDISAB | AESCONG | AESMIE |
|---|---|---|---|---|---|---|---|---|---|
| CATH | 1 | APPENDICITIS | N | N | Y | N | N | N | |
| CATH | 1 | ANAPHYLACTIC REACTION | N | Y | Y | N | N | N | |
| CATH | 1 | HEADACHE | N | N | N | N | N | N | |
| CATH | 1 | FATIGUE | — | — | — | — | — | — |
Expected output
Under review4 expected rowsexpected/ae.csv
Edit4 rows| DOMAIN | STUDYID | USUBJID | AESEQ | AETERM | AESER | AESDTH | AESLIFE | AESHOSP | AESDISAB | AESCONG | AESMIE |
|---|---|---|---|---|---|---|---|---|---|---|---|
| AE | CATH | 1 | APPENDICITIS | Y | N | N | Y | N | N | N | |
| AE | CATH | 1 | ANAPHYLACTIC REACTION | Y | N | Y | Y | N | N | N | |
| AE | CATH | 1 | HEADACHE | N | N | N | N | N | N | N | |
| AE | CATH | 1 | FATIGUE | N | — | — | — | — | — | — |
Comments and assessment materials
| Variable Name | Variable Label | Type | Length | Controlled Terms or Format | Origin | Core | Conversion Definition | Variable Type | Variable Order | Comments for Define |
|---|---|---|---|---|---|---|---|---|---|---|
| DOMAIN | Domain Abbreviation | Char | Assigned | Set constant value "AE". | SDTM | 1 | ||||
| STUDYID | Study Identifier | Char | Collected | Copy value from AE_RAW.STUDYID. | SDTM | 2 | ||||
| USUBJID | Unique Subject Identifier | Char | Collected | Copy value from AE_RAW.USUBJID. | SDTM | 3 | ||||
| AESEQ | Sequence Number | Num | Collected | Copy value from AE_RAW.AESEQ. | SDTM | 4 | ||||
| AETERM | Reported Term for the Adverse Event | Char | Collected | Copy value from AE_RAW.AETERM. | SDTM | 5 | ||||
| AESER | Serious Event | Char | Y, N | Derived | If 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". | SDTM | 6 | |||
| AESDTH | Results in Death | Char | Y, N | Collected | Copy value from AE_RAW.AESDTH. | SDTM | 7 | |||
| AESLIFE | Is Life Threatening | Char | Y, N | Collected | Copy value from AE_RAW.AESLIFE. | SDTM | 8 | |||
| AESHOSP | Requires or Prolongs Hospitalization | Char | Y, N | Collected | Copy value from AE_RAW.AESHOSP. | SDTM | 9 | |||
| AESDISAB | Persist or Significant Disability/Incapacity | Char | Y, N | Collected | Copy value from AE_RAW.AESDISAB. | SDTM | 10 | |||
| AESCONG | Congenital Anomaly or Birth Defect | Char | Y, N | Collected | Copy value from AE_RAW.AESCONG. | SDTM | 11 | |||
| AESMIE | Other Medically Important Serious Event | Char | Y, N | Collected | Copy value from AE_RAW.AESMIE. | SDTM | 12 |
| Variable | Permitted values |
|---|---|
| AESER | Y, N |
| AESDTH | Y, N |
| AESLIFE | Y, N |
| AESHOSP | Y, N |
| AESDISAB | Y, N |
| AESCONG | Y, N |
| AESMIE | Y, N |
| Version | Date | Author | Description | Reviewer | Sign-off |
|---|---|---|---|---|---|
| 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/sdtm-ae-seriousness/full.md
Edit15 linesFollowing 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
Edit11 linesFollowing 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
Edit9 linesFollowing 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.
run.R
Edit4 lineslibrary(yamaa)ae <- yamaa_domain("spec.yaml")$outputaerun.py
Edit4 linesimport yamaaae = yamaa.yamaa_domain("spec.yaml").outputaesolutions/sdtm-ae-seriousness/result.R
Edit32 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
Edit39 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
Edit16 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;
yamaa
Comments
Signed in with GitHub; saved in repository Discussions