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

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

  • AEDECOD is the preferred term of the dictionary entry whose lowest-level term matches the reported term.
  • AEBODSYS is 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 review
2 source files

input/ae_raw.csv

Edit
8 rows
input/ae_raw.csv
STUDYIDUSUBJIDAESEQAETERM
YAMAA-011Headache
YAMAA-012Nausea
YAMAA-011Dizziness
YAMAA-011Cephalgia
YAMAA-011Queasy
YAMAA-011Felt a bit off
YAMAA-011—
YAMAA-011headache

input/meddra_26_1.csv

Edit
5 rows
input/meddra_26_1.csv
LLTNAMEPTNAMESOCNAME
HeadacheHeadacheNervous system disorders
CephalgiaHeadacheNervous system disorders
NauseaNauseaGastrointestinal disorders
QueasyNauseaGastrointestinal disorders
DizzinessDizzinessNervous system disorders

Expected output

Under review
8 expected rows

expected/ae.csv

Edit
8 rows
expected/ae.csv
DOMAINSTUDYIDUSUBJIDAESEQAETERMAEDECODAEBODSYS
AEYAMAA-011HeadacheHeadacheNervous system disorders
AEYAMAA-012NauseaNauseaGastrointestinal disorders
AEYAMAA-011DizzinessDizzinessNervous system disorders
AEYAMAA-011CephalgiaHeadacheNervous system disorders
AEYAMAA-011QueasyNauseaGastrointestinal disorders
AEYAMAA-011Felt a bit offNOT CODEDNOT CODED
AEYAMAA-011—NOT CODEDNOT CODED
AEYAMAA-011headacheNOT CODEDNOT CODED
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 AbbreviationChar2AssignedReqSet constant value "AE".SDTM1
STUDYIDStudy IdentifierChar20ProtocolReqCopy value from AE_RAW.STUDYID.SDTM2
USUBJIDUnique Subject IdentifierChar30AssignedReqCopy value from AE_RAW.USUBJID.SDTM3
AESEQSequence NumberNum8AssignedReqCopy value from AE_RAW.AESEQ.SDTM4
AETERMReported Term for the Adverse EventChar200CollectedExpCopy value from AE_RAW.AETERM.SDTM5
AEDECODDictionary-Derived TermChar200Medical Dictionary for Regulatory Activities (MedDRA, version 26.1)AssignedExpTake PTNAME from the MEDDRA record whose LLTNAME equals AE_RAW.AETERM, and no match yields "NOT CODED".SDTM6
AEBODSYSBody System or Organ ClassChar200Medical Dictionary for Regulatory Activities (MedDRA, version 26.1)AssignedExpTake SOCNAME from the MEDDRA record whose LLTNAME equals AE_RAW.AETERM, and no match yields "NOT CODED".SDTM7
Codelist IDNameValueDecodeCodelist NCI aliasValue NCI aliasExtensibleExtended valueSAS formatDictionaryVersion
MEDDRAMedical Dictionary for Regulatory ActivitiesNoMedDRA26.1
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-coding/full.md

Edit
18 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, 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

Edit
13 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, 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

Edit
9 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, AEDECOD, AEBODSYS

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

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

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

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