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 AE record per collected event, retaining the reported term and carrying the full coded MedDRA hierarchy from the LLT code assigned by a medical coder.
Input: event records with AETERM and a coder-assigned AELLTCD, plus a
small MedDRA-shaped extract with one row per LLT-to-SOC path. Its LLT, PT,
HLT, and HLGT names and all codes are invented; this is not an official
MedDRA release.
Variables:
AETERMis the event text as reported, even when it differs from the selected lowest-level term.AELLTCDis the coder-assigned lowest-level term code;AELLTis its dictionary name.AEPTCDandAEDECODare the preferred-term code and name.AEHLTCDandAEHLTare the high-level term code and name.AEHLGTCDandAEHLGTare the high-level group term code and name.AEBODSCDandAEBODSYSare the primary SOC code and name.AESOCCDandAESOCrepeat that primary SOC code and name.
Note: the first two coded LLTs share a PT with primary and secondary SOC
paths. The paths also have different HLT and HLGT values, so every hierarchy
field must come from the primary path. Each secondary row appears first in
the extract. An unknown or absent LLT code leaves the derived hierarchy
blank; an unknown assigned code remains visible in AELLTCD for review.
Inputs
Under review2 source filesinput/ae_raw.csv
Edit5 rows| STUDYID | USUBJID | AESEQ | AETERM | AELLTCD |
|---|---|---|---|---|
| YAMAA-01 | 1 | Pins in my left fingers | 99000101 | |
| YAMAA-01 | 2 | My hand feels buzzy | 99000102 | |
| YAMAA-01 | 1 | Queasy after lunch | 99000201 | |
| YAMAA-01 | 1 | Pins in my left fingers | 99000999 | |
| YAMAA-01 | 2 | Pins in my left fingers | — |
input/meddra_synthetic.csv
Edit5 rows| LLTCD | LLTNAME | PTCD | PTNAME | HLTCD | HLTNAME | HLGTCD | HLGTNAME | SOCCD | SOCNAME | PRIMARY_SOC |
|---|---|---|---|---|---|---|---|---|---|---|
| 99000101 | Left fingertip prickling | 99001001 | Distal paresthesia | 99010002 | General sensory complaints | 99100002 | General symptom findings | 99200002 | General disorders and administration site conditions | N |
| 99000101 | Left fingertip prickling | 99001001 | Distal paresthesia | 99010001 | Peripheral sensory changes | 99100001 | Nerve function findings | 99200001 | Nervous system disorders | Y |
| 99000102 | Hand buzzing sensation | 99001001 | Distal paresthesia | 99010002 | General sensory complaints | 99100002 | General symptom findings | 99200002 | General disorders and administration site conditions | N |
| 99000102 | Hand buzzing sensation | 99001001 | Distal paresthesia | 99010001 | Peripheral sensory changes | 99100001 | Nerve function findings | 99200001 | Nervous system disorders | Y |
| 99000201 | After-meal queasiness | 99001002 | Postprandial nausea | 99010003 | Stomach discomfort symptoms | 99100003 | Digestive symptom findings | 99200003 | Gastrointestinal disorders | Y |
Expected output
Under review5 expected rowsexpected/ae.csv
Edit5 rows| DOMAIN | STUDYID | USUBJID | AESEQ | AETERM | AELLT | AELLTCD | AEDECOD | AEPTCD | AEHLT | AEHLTCD | AEHLGT | AEHLGTCD | AEBODSYS | AEBODSCD | AESOC | AESOCCD |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| AE | YAMAA-01 | 1 | Pins in my left fingers | Left fingertip prickling | 99000101 | Distal paresthesia | 99001001 | Peripheral sensory changes | 99010001 | Nerve function findings | 99100001 | Nervous system disorders | 99200001 | Nervous system disorders | 99200001 | |
| AE | YAMAA-01 | 2 | My hand feels buzzy | Hand buzzing sensation | 99000102 | Distal paresthesia | 99001001 | Peripheral sensory changes | 99010001 | Nerve function findings | 99100001 | Nervous system disorders | 99200001 | Nervous system disorders | 99200001 | |
| AE | YAMAA-01 | 1 | Queasy after lunch | After-meal queasiness | 99000201 | Postprandial nausea | 99001002 | Stomach discomfort symptoms | 99010003 | Digestive symptom findings | 99100003 | Gastrointestinal disorders | 99200003 | Gastrointestinal disorders | 99200003 | |
| AE | YAMAA-01 | 1 | Pins in my left fingers | — | 99000999 | — | — | — | — | — | — | — | — | — | — | |
| AE | YAMAA-01 | 2 | Pins in my left fingers | — | — | — | — | — | — | — | — | — | — | — | — |
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 | ||||
| AELLTCD | Lowest Level Term Code | Char | Collected | Copy value from AE_RAW.AELLTCD. | SDTM | 6 | ||||
| AELLT | Lowest Level Term | Char | Derived | Take LLTNAME from the MEDDRA record whose LLTCD equals AE_RAW.AELLTCD, where MEDDRA.PRIMARY_SOC = 'Y', and no match yields blank. | SDTM | 7 | ||||
| AEPTCD | Preferred Term Code | Char | Derived | Take PTCD from the MEDDRA record whose LLTCD equals AE_RAW.AELLTCD, where MEDDRA.PRIMARY_SOC = 'Y', and no match yields blank. | SDTM | 8 | ||||
| AEDECOD | Dictionary-Derived Term | Char | Derived | Take PTNAME from the MEDDRA record whose LLTCD equals AE_RAW.AELLTCD, where MEDDRA.PRIMARY_SOC = 'Y', and no match yields blank. | SDTM | 9 | ||||
| AEHLTCD | High Level Term Code | Char | Derived | Take HLTCD from the MEDDRA record whose LLTCD equals AE_RAW.AELLTCD, where MEDDRA.PRIMARY_SOC = 'Y', and no match yields blank. | SDTM | 10 | ||||
| AEHLT | High Level Term | Char | Derived | Take HLTNAME from the MEDDRA record whose LLTCD equals AE_RAW.AELLTCD, where MEDDRA.PRIMARY_SOC = 'Y', and no match yields blank. | SDTM | 11 | ||||
| AEHLGTCD | High Level Group Term Code | Char | Derived | Take HLGTCD from the MEDDRA record whose LLTCD equals AE_RAW.AELLTCD, where MEDDRA.PRIMARY_SOC = 'Y', and no match yields blank. | SDTM | 12 | ||||
| AEHLGT | High Level Group Term | Char | Derived | Take HLGTNAME from the MEDDRA record whose LLTCD equals AE_RAW.AELLTCD, where MEDDRA.PRIMARY_SOC = 'Y', and no match yields blank. | SDTM | 13 | ||||
| AEBODSCD | Body System or Organ Class Code | Char | Derived | Take SOCCD from the MEDDRA record whose LLTCD equals AE_RAW.AELLTCD, where MEDDRA.PRIMARY_SOC = 'Y', and no match yields blank. | SDTM | 14 | ||||
| AEBODSYS | Body System or Organ Class | Char | Derived | Take SOCNAME from the MEDDRA record whose LLTCD equals AE_RAW.AELLTCD, where MEDDRA.PRIMARY_SOC = 'Y', and no match yields blank. | SDTM | 15 | ||||
| AESOCCD | Primary System Organ Class Code | Char | Derived | Take SOCCD from the MEDDRA record whose LLTCD equals AE_RAW.AELLTCD, where MEDDRA.PRIMARY_SOC = 'Y', and no match yields blank. | SDTM | 16 | ||||
| AESOC | Primary System Organ Class | Char | Derived | Take SOCNAME from the MEDDRA record whose LLTCD equals AE_RAW.AELLTCD, where MEDDRA.PRIMARY_SOC = 'Y', and no match yields blank. | SDTM | 17 |
| 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-meddra-hierarchy/full.md
Edit21 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, AELLT, AELLTCD, AEDECOD, AEPTCD, AEHLT, AEHLTCD, AEHLGT, AEHLGTCD, AEBODSYS, AEBODSCD, AESOC, AESOCCD
AETERM keeps the event text as reported, even when it differs from the selected lowest-level term. AELLTCD keeps the coder-assigned lowest-level term code. Every code is written as its digits alone, with no decimal point. AELLT, AEDECOD and AEPTCD, AEHLT and AEHLTCD, AEHLGT and AEHLGTCD, and AEBODSYS and AEBODSCD come from the dictionary path for that code. When the code has a primary and a secondary path, use the primary path for every hierarchy field; the extract marks the primary path with PRIMARY_SOC Y. AESOC and AESOCCD repeat the primary system organ class name and code. An unknown or absent code leaves the hierarchy with no value, while an unknown assigned code stays visible in AELLTCD.
Read the source datasets from /app/input and save the completed dataset as /app/output/ae.csv.
prompts/sdtm-ae-meddra-hierarchy/conventions.md
Edit12 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, AELLT, AELLTCD, AEDECOD, AEPTCD, AEHLT, AEHLTCD, AEHLGT, AEHLGTCD, AEBODSYS, AEBODSCD, AESOC, AESOCCD
Every code is written as its digits alone, with no decimal point.
Read the source datasets from /app/input and save the completed dataset as /app/output/ae.csv.
prompts/sdtm-ae-meddra-hierarchy/brief.md
Edit10 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, AELLT, AELLTCD, AEDECOD, AEPTCD, AEHLT, AEHLTCD, AEHLGT, AEHLGTCD, AEBODSYS, AEBODSCD, AESOC, AESOCCD
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-meddra-hierarchy/result.R
Edit47 lines# Reference solution for the yamaa benchmark sdtm-ae-meddra-hierarchy (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_synthetic.csv", col_types = cols(.default = col_character()))# Every hierarchy field comes from the primary path for the coder-assigned# code; the extract marks it with PRIMARY_SOC Y. An unknown or absent code# leaves the hierarchy empty, but the assigned code stays in AELLTCD.primary <- meddra |> filter(PRIMARY_SOC == "Y")ae <- ae_raw |> left_join(primary, by = c("AELLTCD" = "LLTCD")) |> mutate( DOMAIN = "AE", AELLT = LLTNAME, AEDECOD = PTNAME, AEPTCD = PTCD, AEHLT = HLTNAME, AEHLTCD = HLTCD, AEHLGT = HLGTNAME, AEHLGTCD = HLGTCD, AEBODSYS = SOCNAME, AEBODSCD = SOCCD, AESOC = SOCNAME, AESOCCD = SOCCD ) |> select( DOMAIN, STUDYID, USUBJID, AESEQ, AETERM, AELLT, AELLTCD, AEDECOD, AEPTCD, AEHLT, AEHLTCD, AEHLGT, AEHLGTCD, AEBODSYS, AEBODSCD, AESOC, AESOCCD )dir.create("/app/output", showWarnings = FALSE)write_csv(ae, "/app/output/ae.csv", na = "")solutions/sdtm-ae-meddra-hierarchy/result.py
Edit59 lines# Reference solution for the yamaa benchmark sdtm-ae-meddra-hierarchy (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_synthetic.csv", infer_schema=False)# Every hierarchy field comes from the primary path for the coder-assigned# code; the extract marks it with PRIMARY_SOC Y. An unknown or absent code# leaves the hierarchy empty, but the assigned code stays in AELLTCD.primary = meddra.filter(pl.col("PRIMARY_SOC") == "Y")ae = ( ae_raw.join(primary, left_on="AELLTCD", right_on="LLTCD", how="left") .with_columns( DOMAIN=pl.lit("AE"), AELLT=pl.col("LLTNAME"), AEDECOD=pl.col("PTNAME"), AEPTCD=pl.col("PTCD"), AEHLT=pl.col("HLTNAME"), AEHLTCD=pl.col("HLTCD"), AEHLGT=pl.col("HLGTNAME"), AEHLGTCD=pl.col("HLGTCD"), AEBODSYS=pl.col("SOCNAME"), AEBODSCD=pl.col("SOCCD"), AESOC=pl.col("SOCNAME"), AESOCCD=pl.col("SOCCD"), ) .select( "DOMAIN", "STUDYID", "USUBJID", "AESEQ", "AETERM", "AELLT", "AELLTCD", "AEDECOD", "AEPTCD", "AEHLT", "AEHLTCD", "AEHLGT", "AEHLGTCD", "AEBODSYS", "AEBODSCD", "AESOC", "AESOCCD", ))Path("/app/output").mkdir(exist_ok=True)ae.write_csv("/app/output/ae.csv")solutions/sdtm-ae-meddra-hierarchy/result.sas
Edit25 lines/* opensas reference solution for the yamaa benchmark sdtm-ae-meddra-hierarchy. 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 AELLTCD $1024; infile "/app/input/ae_raw.csv" dsd dlm="," firstobs=2 truncover lrecl=32767; input STUDYID : $char1024. USUBJID : $char1024. AESEQ AETERM : $char1024. AELLTCD : $char1024.;run;data meddra_synthetic; length LLTCD LLTNAME PTCD PTNAME HLTCD HLTNAME HLGTCD HLGTNAME SOCCD SOCNAME PRIMARY_SOC $1024; infile "/app/input/meddra_synthetic.csv" dsd dlm="," firstobs=2 truncover lrecl=32767; input LLTCD : $char1024. LLTNAME : $char1024. PTCD : $char1024. PTNAME : $char1024. HLTCD : $char1024. HLTNAME : $char1024. HLGTCD : $char1024. HLGTNAME : $char1024. SOCCD : $char1024. SOCNAME : $char1024. PRIMARY_SOC : $char1024.;run;proc sql; create table result as select 'AE' as DOMAIN,a.*,b.LLTNAME as AELLT,b.PTNAME as AEDECOD,b.PTCD as AEPTCD,b.HLTNAME as AEHLT,b.HLTCD as AEHLTCD,b.HLGTNAME as AEHLGT,b.HLGTCD as AEHLGTCD,b.SOCNAME as AEBODSYS,b.SOCCD as AEBODSCD,b.SOCNAME as AESOC,b.SOCCD as AESOCCD from ae_raw a left join meddra_synthetic b on a.AELLTCD=b.LLTCD and b.PRIMARY_SOC='Y';quit;proc sql; create table final as select DOMAIN, STUDYID, USUBJID, AESEQ, AETERM, AELLT, AELLTCD, AEDECOD, AEPTCD, AEHLT, AEHLTCD, AEHLGT, AEHLGTCD, AEBODSYS, AEBODSCD, AESOC, AESOCCD 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