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 one record per collected adverse event, keeping
the reported term (AETERM) and adding the coded preferred term
(AEDECOD) and body system (AEBODSYS).
Input: collected adverse-event rows carrying the reported term, plus a Medical Dictionary for Regulatory Activities (MedDRA) extract carrying the lowest-level, preferred, and body-system names.
Variables:
AEDECODis the preferred term of the dictionary entry whose lowest-level term matches the reported term.AEBODSYSis the body system of that same entry.
Note: a reported term codes only when it equals a lowest-level
term exactly, including letter case; the preferred term comes from
the matched dictionary entry, so it can differ from the reported
term. A term with no exact match, or a blank term, gives NOT CODED in both coded variables. NOT CODED is not a MedDRA term:
it marks an event whose coding must be resolved before delivery.
The coded terms follow the recorded dictionary, MedDRA version
26.1, since the same reported term can code differently between
releases.
Inputs
Under review2 source filesinput/ae_raw.csv
Edit8 rows| STUDYID | USUBJID | AESEQ | AETERM |
|---|---|---|---|
| YAMAA-01 | 1 | Headache | |
| YAMAA-01 | 2 | Nausea | |
| YAMAA-01 | 1 | Dizziness | |
| YAMAA-01 | 1 | Cephalgia | |
| YAMAA-01 | 1 | Queasy | |
| YAMAA-01 | 1 | Felt a bit off | |
| YAMAA-01 | 1 | — | |
| YAMAA-01 | 1 | headache |
input/meddra_26_1.csv
Edit5 rows| LLTNAME | PTNAME | SOCNAME |
|---|---|---|
| Headache | Headache | Nervous system disorders |
| Cephalgia | Headache | Nervous system disorders |
| Nausea | Nausea | Gastrointestinal disorders |
| Queasy | Nausea | Gastrointestinal disorders |
| Dizziness | Dizziness | Nervous system disorders |
Expected output
Under review8 expected rowsexpected/ae.csv
Edit8 rows| DOMAIN | STUDYID | USUBJID | AESEQ | AETERM | AEDECOD | AEBODSYS |
|---|---|---|---|---|---|---|
| AE | YAMAA-01 | 1 | Headache | Headache | Nervous system disorders | |
| AE | YAMAA-01 | 2 | Nausea | Nausea | Gastrointestinal disorders | |
| AE | YAMAA-01 | 1 | Dizziness | Dizziness | Nervous system disorders | |
| AE | YAMAA-01 | 1 | Cephalgia | Headache | Nervous system disorders | |
| AE | YAMAA-01 | 1 | Queasy | Nausea | Gastrointestinal disorders | |
| AE | YAMAA-01 | 1 | Felt a bit off | NOT CODED | NOT CODED | |
| AE | YAMAA-01 | 1 | — | NOT CODED | NOT CODED | |
| AE | YAMAA-01 | 1 | headache | NOT CODED | NOT CODED |
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 | 2 | Assigned | Req | Set constant value "AE". | SDTM | 1 | ||
| STUDYID | Study Identifier | Char | 20 | Protocol | Req | Copy value from AE_RAW.STUDYID. | SDTM | 2 | ||
| USUBJID | Unique Subject Identifier | Char | 30 | Assigned | Req | Copy value from AE_RAW.USUBJID. | SDTM | 3 | ||
| AESEQ | Sequence Number | Num | 8 | Assigned | Req | Copy value from AE_RAW.AESEQ. | SDTM | 4 | ||
| AETERM | Reported Term for the Adverse Event | Char | 200 | Collected | Exp | Copy value from AE_RAW.AETERM. | SDTM | 5 | ||
| AEDECOD | Dictionary-Derived Term | Char | 200 | Medical Dictionary for Regulatory Activities (MedDRA, version 26.1) | Assigned | Exp | Take PTNAME from the MEDDRA record whose LLTNAME equals AE_RAW.AETERM, and no match yields "NOT CODED". | SDTM | 6 | |
| AEBODSYS | Body System or Organ Class | Char | 200 | Medical Dictionary for Regulatory Activities (MedDRA, version 26.1) | Assigned | Exp | Take SOCNAME from the MEDDRA record whose LLTNAME equals AE_RAW.AETERM, and no match yields "NOT CODED". | SDTM | 7 |
| Codelist ID | Name | Value | Decode | Codelist NCI alias | Value NCI alias | Extensible | Extended value | SAS format | Dictionary | Version |
|---|---|---|---|---|---|---|---|---|---|---|
| MEDDRA | Medical Dictionary for Regulatory Activities | No | MedDRA | 26.1 |
| 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-coding/full.md
Edit18 linesFollowing CDISC SDTM standards, use the provided AE_RAW and MEDDRA datasets to create an AE dataset with one record per collected adverse event.
The output dataset should contain the following columns in this order: DOMAIN, STUDYID, USUBJID, AESEQ, AETERM, AEDECOD, AEBODSYS
AEDECOD is the preferred term of the dictionary entry whose lowest-level term equals the reported term exactly, including letter case. AEBODSYS is the body system of that same entry. The preferred term comes from the matched entry, so it can differ from the reported term. A reported term with no exact match, or a blank term, gives NOT CODED in both AEDECOD and AEBODSYS. NOT CODED is not a dictionary term: it marks an event whose coding must be resolved before delivery. The coded terms follow the recorded dictionary, MedDRA version 26.1.
Read the source datasets from /app/input and save the completed dataset as /app/output/ae.csv.
prompts/sdtm-ae-coding/conventions.md
Edit13 linesFollowing CDISC SDTM standards, use the provided AE_RAW and MEDDRA datasets to create an AE dataset with one record per collected adverse event.
The output dataset should contain the following columns in this order: DOMAIN, STUDYID, USUBJID, AESEQ, AETERM, AEDECOD, AEBODSYS
AEDECOD is a preferred term and AEBODSYS a body system, or both hold NOT CODED. The coded terms follow the recorded dictionary, MedDRA version 26.1.
Read the source datasets from /app/input and save the completed dataset as /app/output/ae.csv.
prompts/sdtm-ae-coding/brief.md
Edit9 linesFollowing CDISC SDTM standards, use the provided AE_RAW and MEDDRA datasets to create an AE dataset with one record per collected adverse event.
The output dataset should contain the following columns in this order: DOMAIN, STUDYID, USUBJID, AESEQ, AETERM, AEDECOD, AEBODSYS
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-coding/result.R
Edit36 lines# Reference solution for the yamaa benchmark sdtm-ae-coding (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()))meddra <- read_csv( "/app/input/meddra_26_1.csv", col_types = cols(.default = col_character()))# The preferred term and body system of the entry whose lowest-level term# equals the reported term exactly, including letter case. A blank term or# one with no exact match is not coded.ae <- ae_raw |> left_join(meddra, by = c("AETERM" = "LLTNAME")) |> mutate( DOMAIN = "AE", AEDECOD = if_else( is.na(AETERM) | AETERM == "" | is.na(PTNAME), "NOT CODED", PTNAME ), AEBODSYS = if_else( is.na(AETERM) | AETERM == "" | is.na(SOCNAME), "NOT CODED", SOCNAME ) ) |> select(DOMAIN, STUDYID, USUBJID, AESEQ, AETERM, AEDECOD, AEBODSYS)dir.create("/app/output", showWarnings = FALSE)write_csv(ae, "/app/output/ae.csv", na = "")solutions/sdtm-ae-coding/result.py
Edit38 lines# Reference solution for the yamaa benchmark sdtm-ae-coding (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))meddra = pl.read_csv("/app/input/meddra_26_1.csv", infer_schema=False)# The preferred term and body system of the entry whose lowest-level term# equals the reported term exactly, including letter case. A blank term or# one with no exact match is not coded.ae = ( ae_raw.join(meddra, left_on="AETERM", right_on="LLTNAME", how="left") .with_columns( AEDECOD=pl.when( (pl.col("AETERM").fill_null("") == "") | pl.col("PTNAME").is_null() ) .then(pl.lit("NOT CODED")) .otherwise(pl.col("PTNAME")), AEBODSYS=pl.when( (pl.col("AETERM").fill_null("") == "") | pl.col("SOCNAME").is_null() ) .then(pl.lit("NOT CODED")) .otherwise(pl.col("SOCNAME")), DOMAIN=pl.lit("AE"), ) .select("DOMAIN", "STUDYID", "USUBJID", "AESEQ", "AETERM", "AEDECOD", "AEBODSYS"))Path("/app/output").mkdir(exist_ok=True)ae.write_csv("/app/output/ae.csv")solutions/sdtm-ae-coding/result.sas
Edit25 lines/* opensas reference solution for the yamaa benchmark sdtm-ae-coding. 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 $1024; infile "/app/input/ae_raw.csv" dsd dlm="," firstobs=2 truncover lrecl=32767; input STUDYID : $char1024. USUBJID : $char1024. AESEQ AETERM : $char1024.;run;data meddra_26_1; length LLTNAME PTNAME SOCNAME $1024; infile "/app/input/meddra_26_1.csv" dsd dlm="," firstobs=2 truncover lrecl=32767; input LLTNAME : $char1024. PTNAME : $char1024. SOCNAME : $char1024.;run;proc sql; create table result as select 'AE' as DOMAIN,a.*,coalescec(b.PTNAME,'NOT CODED') as AEDECOD,coalescec(b.SOCNAME,'NOT CODED') as AEBODSYS from ae_raw a left join meddra_26_1 b on a.AETERM=b.LLTNAME;quit;proc sql; create table final as select DOMAIN, STUDYID, USUBJID, AESEQ, AETERM, AEDECOD, AEBODSYS 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