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
README.mdPublic 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:
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 | — | — | — | — | — | — | — | — | — | — | — | — |
Human review and assessment
| 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.7 | 2026-10-20 | yamaa docs build | Read 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.6 | 2026-10-17 | yamaa docs build | Describe collected date parts written as ISO 8601 date text and times of day counted in seconds since midnight | ||
| 1.5 | 2026-10-17 | yamaa docs build | Name 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.4 | 2026-10-15 | yamaa docs build | State datetime precision codes through the hour and minute, and complete only the time parts a collected datetime lacks | ||
| 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
Edit28 linesFollowing 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
Edit11 linesFollowing 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
Edit9 linesFollowing 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.
R
Edit3 lineslibrary(yamaa)yamaa_spec("spec.yaml")$run()$outputPython
Edit3 linesimport yamaayamaa.spec("spec.yaml").run().outputsolutions/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
Edit95 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
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