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: draftEditUnder review
What this benchmark means
README.md

Goal: 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:

  • AETERM is the event text as reported, even when it differs from the selected lowest-level term.
  • AELLTCD is the coder-assigned lowest-level term code; AELLT is its dictionary name.
  • AEPTCD and AEDECOD are the preferred-term code and name.
  • AEHLTCD and AEHLT are the high-level term code and name.
  • AEHLGTCD and AEHLGT are the high-level group term code and name.
  • AEBODSCD and AEBODSYS are the primary SOC code and name.
  • AESOCCD and AESOC repeat 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 review
2 source files

input/ae_raw.csv

Edit
5 rows
input/ae_raw.csv
STUDYIDUSUBJIDAESEQAETERMAELLTCD
YAMAA-011Pins in my left fingers99000101
YAMAA-012My hand feels buzzy99000102
YAMAA-011Queasy after lunch99000201
YAMAA-011Pins in my left fingers99000999
YAMAA-012Pins in my left fingers—

input/meddra_synthetic.csv

Edit
5 rows
input/meddra_synthetic.csv
LLTCDLLTNAMEPTCDPTNAMEHLTCDHLTNAMEHLGTCDHLGTNAMESOCCDSOCNAMEPRIMARY_SOC
99000101Left fingertip prickling99001001Distal paresthesia99010002General sensory complaints99100002General symptom findings99200002General disorders and administration site conditionsN
99000101Left fingertip prickling99001001Distal paresthesia99010001Peripheral sensory changes99100001Nerve function findings99200001Nervous system disordersY
99000102Hand buzzing sensation99001001Distal paresthesia99010002General sensory complaints99100002General symptom findings99200002General disorders and administration site conditionsN
99000102Hand buzzing sensation99001001Distal paresthesia99010001Peripheral sensory changes99100001Nerve function findings99200001Nervous system disordersY
99000201After-meal queasiness99001002Postprandial nausea99010003Stomach discomfort symptoms99100003Digestive symptom findings99200003Gastrointestinal disordersY

Expected output

Under review
5 expected rows

expected/ae.csv

Edit
5 rows
expected/ae.csv
DOMAINSTUDYIDUSUBJIDAESEQAETERMAELLTAELLTCDAEDECODAEPTCDAEHLTAEHLTCDAEHLGTAEHLGTCDAEBODSYSAEBODSCDAESOCAESOCCD
AEYAMAA-011Pins in my left fingersLeft fingertip prickling99000101Distal paresthesia99001001Peripheral sensory changes99010001Nerve function findings99100001Nervous system disorders99200001Nervous system disorders99200001
AEYAMAA-012My hand feels buzzyHand buzzing sensation99000102Distal paresthesia99001001Peripheral sensory changes99010001Nerve function findings99100001Nervous system disorders99200001Nervous system disorders99200001
AEYAMAA-011Queasy after lunchAfter-meal queasiness99000201Postprandial nausea99001002Stomach discomfort symptoms99010003Digestive symptom findings99100003Gastrointestinal disorders99200003Gastrointestinal disorders99200003
AEYAMAA-011Pins in my left fingers—99000999——————————
AEYAMAA-012Pins in my left fingers————————————
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
AELLTCDLowest Level Term CodeCharCollectedCopy value from AE_RAW.AELLTCD.SDTM6
AELLTLowest Level TermCharDerivedTake LLTNAME from the MEDDRA record whose LLTCD equals AE_RAW.AELLTCD, where MEDDRA.PRIMARY_SOC = 'Y', and no match yields blank.SDTM7
AEPTCDPreferred Term CodeCharDerivedTake PTCD from the MEDDRA record whose LLTCD equals AE_RAW.AELLTCD, where MEDDRA.PRIMARY_SOC = 'Y', and no match yields blank.SDTM8
AEDECODDictionary-Derived TermCharDerivedTake PTNAME from the MEDDRA record whose LLTCD equals AE_RAW.AELLTCD, where MEDDRA.PRIMARY_SOC = 'Y', and no match yields blank.SDTM9
AEHLTCDHigh Level Term CodeCharDerivedTake HLTCD from the MEDDRA record whose LLTCD equals AE_RAW.AELLTCD, where MEDDRA.PRIMARY_SOC = 'Y', and no match yields blank.SDTM10
AEHLTHigh Level TermCharDerivedTake HLTNAME from the MEDDRA record whose LLTCD equals AE_RAW.AELLTCD, where MEDDRA.PRIMARY_SOC = 'Y', and no match yields blank.SDTM11
AEHLGTCDHigh Level Group Term CodeCharDerivedTake HLGTCD from the MEDDRA record whose LLTCD equals AE_RAW.AELLTCD, where MEDDRA.PRIMARY_SOC = 'Y', and no match yields blank.SDTM12
AEHLGTHigh Level Group TermCharDerivedTake HLGTNAME from the MEDDRA record whose LLTCD equals AE_RAW.AELLTCD, where MEDDRA.PRIMARY_SOC = 'Y', and no match yields blank.SDTM13
AEBODSCDBody System or Organ Class CodeCharDerivedTake SOCCD from the MEDDRA record whose LLTCD equals AE_RAW.AELLTCD, where MEDDRA.PRIMARY_SOC = 'Y', and no match yields blank.SDTM14
AEBODSYSBody System or Organ ClassCharDerivedTake SOCNAME from the MEDDRA record whose LLTCD equals AE_RAW.AELLTCD, where MEDDRA.PRIMARY_SOC = 'Y', and no match yields blank.SDTM15
AESOCCDPrimary System Organ Class CodeCharDerivedTake SOCCD from the MEDDRA record whose LLTCD equals AE_RAW.AELLTCD, where MEDDRA.PRIMARY_SOC = 'Y', and no match yields blank.SDTM16
AESOCPrimary System Organ ClassCharDerivedTake SOCNAME from the MEDDRA record whose LLTCD equals AE_RAW.AELLTCD, where MEDDRA.PRIMARY_SOC = 'Y', and no match yields blank.SDTM17
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-meddra-hierarchy/full.md

Edit
21 lines

Following 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

Edit
12 lines

Following 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

Edit
10 lines

Following 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.

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-meddra-hierarchy/result.R

Edit
47 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

Edit
59 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

Edit
25 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;