Review ask

As a clinical trial statistician or programmer, answer three short questions in Your review: the task, the inputs and outputs, and the AI-assisted review. Agreeing with all three approves this benchmark; disagreeing with any needs a comment. Propose a fix with the Edit button on any source file, or add it to your comments.

We suggest spending no more than 5 minutes on a review. The other tabs beside Your review are background for assessment, not under review.

Summary

Lifecycle: draftEditUnder review
What this benchmark means
README.md

Public entries: Python and R. Passing coverage requires an installed inventory.

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

Human review and assessment

Your review

3 questions and your comments · View benchmark 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.72026-10-20yamaa docs buildRead a specification in the 1.0 surface as its 0.5 counterpart; state that missing values stay missing where a mapping declares no missing handler, and leave out a declared missing answer that restates a handler's default
1.62026-10-17yamaa docs buildDescribe collected date parts written as ISO 8601 date text and times of day counted in seconds since midnight
1.52026-10-17yamaa docs buildName collected precision in words instead of letter codes; state imputation fallbacks, minimum source precision, bounds ignored outside the collected period, and invalid text with no handler as an error; describe date and datetime shifts, imputation flag codes, and partial text giving no date part
1.42026-10-15yamaa docs buildState datetime precision codes through the hour and minute, and complete only the time parts a collected datetime lacks
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
28 lines

Following CDISC SDTM standards, use the provided AE_RAW and MEDDRA_SYNTHETIC datasets 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, AELLT, AELLTCD, AEDECOD, AEPTCD, AEHLT, AEHLTCD, AEHLGT, AEHLGTCD, AEBODSYS, AEBODSCD, AESOC, AESOCCD

DOMAIN is "AE". AETERM is the event text as reported, even when it differs from the dictionary name held in AELLT. AELLTCD is the lowest-level term code the medical coder assigned to the event, and AELLT is the dictionary name of that code in MEDDRA_SYNTHETIC. The coded hierarchy comes from the row of MEDDRA_SYNTHETIC that holds the record's AELLTCD on the primary path, the row whose PRIMARY_SOC is "Y". An LLT code can also have secondary paths, with the same preferred term but a different high-level term, high-level group term, and system organ class, and a secondary row can appear before the primary row in the extract; no hierarchy value comes from a secondary path. AEDECOD and AEPTCD are the preferred-term name and code of the primary path, AEHLT and AEHLTCD are its high-level term name and code, and AEHLGT and AEHLGTCD are its high-level group term name and code. AEBODSYS and AEBODSCD are the system organ class name and code of the primary path, and AESOC and AESOCCD repeat that same name and code. When the record's AELLTCD has no value or no row in MEDDRA_SYNTHETIC, AELLT and every hierarchy column have no value; AELLTCD keeps the assigned code as collected.

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
11 lines

Following CDISC SDTM standards, use the provided AE_RAW and MEDDRA_SYNTHETIC datasets 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, AELLT, AELLTCD, AEDECOD, AEPTCD, AEHLT, AEHLTCD, AEHLGT, AEHLGTCD, AEBODSYS, AEBODSCD, AESOC, AESOCCD

DOMAIN is "AE".

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
9 lines

Following CDISC SDTM standards, use the provided AE_RAW and MEDDRA_SYNTHETIC datasets 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, 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

Public calls generated from benchmark.yaml; results must match the expected output

R

Edit
3 lines
library(yamaa)yamaa_spec("spec.yaml")$run()$output

Python

Edit
3 lines
import yamaayamaa.spec("spec.yaml").run().output

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
95 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."""Build the SDTM AE dataset from AE_RAW and MEDDRA_SYNTHETIC.One record per adverse event. The coded hierarchy for each record comesfrom the MEDDRA_SYNTHETIC row that holds the record's AELLTCD on theprimary path (PRIMARY_SOC == "Y"); secondary paths are never used."""import polars as plINPUT_DIR = "/app/input"OUTPUT_DIR = "/app/output"COLUMNS = [    "DOMAIN",    "STUDYID",    "USUBJID",    "AESEQ",    "AETERM",    "AELLT",    "AELLTCD",    "AEDECOD",    "AEPTCD",    "AEHLT",    "AEHLTCD",    "AEHLGT",    "AEHLGTCD",    "AEBODSYS",    "AEBODSCD",    "AESOC",    "AESOCCD",]def main() -> None:    ae_raw = pl.read_csv(f"{INPUT_DIR}/ae_raw.csv", infer_schema=False)    meddra = pl.read_csv(        f"{INPUT_DIR}/meddra_synthetic.csv", infer_schema=False    )    # Primary path only: one row per LLT code.    hierarchy = {}    for row in meddra.filter(pl.col("PRIMARY_SOC") == "Y").iter_rows(named=True):        hierarchy[row["LLTCD"]] = row    records = []    for ae in ae_raw.iter_rows(named=True):        lltcd = ae["AELLTCD"] or None        med = hierarchy.get(lltcd) if lltcd else None        if med is None:            # No assigned code, or no dictionary row: AELLT and every            # hierarchy column are blank; AELLTCD keeps the code as            # collected.            llt = pt = ptcd = hlt = hltcd = None            hlgt = hlgtcd = soc = soccd = None        else:            llt = med["LLTNAME"]            pt, ptcd = med["PTNAME"], med["PTCD"]            hlt, hltcd = med["HLTNAME"], med["HLTCD"]            hlgt, hlgtcd = med["HLGTNAME"], med["HLGTCD"]            soc, soccd = med["SOCNAME"], med["SOCCD"]        records.append(            {                "DOMAIN": "AE",                "STUDYID": ae["STUDYID"],                "USUBJID": ae["USUBJID"],                "AESEQ": ae["AESEQ"],                "AETERM": ae["AETERM"],                "AELLT": llt,                "AELLTCD": lltcd,                "AEDECOD": pt,                "AEPTCD": ptcd,                "AEHLT": hlt,                "AEHLTCD": hltcd,                "AEHLGT": hlgt,                "AEHLGTCD": hlgtcd,                "AEBODSYS": soc,                "AEBODSCD": soccd,                "AESOC": soc,                "AESOCCD": soccd,            }        )    pl.DataFrame(records, schema={c: pl.Utf8 for c in COLUMNS}).write_csv(        f"{OUTPUT_DIR}/ae.csv"    )if __name__ == "__main__":    main()

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;