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 ADaM: 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: group each adverse event by safety topic, showing which coded term falls under two Standardized MedDRA Query (SMQ) groupings and one sponsor-defined customized query (CQ) grouping.

Input: one row per collected adverse event with the reported term AETERM and the Medical Dictionary for Regulatory Activities (MedDRA) coded term AEDECOD. A query dictionary lists each coded term under its query groupings.

Variables:

Each query grouping has its own fixed set of columns.

  • SMQ01NAM: name of the first standardized query grouping the coded term belongs to; empty when the term is not in it.
  • SMQ01CD: dictionary code of the first standardized query grouping; empty when the term is not in it.
  • SMQ01SC: whether membership is broad or narrow scope (BROAD/NARROW); empty when the term is not in it.
  • SMQ02NAM: name of the second standardized query grouping the coded term belongs to; empty when the term is not in it.
  • SMQ02CD: dictionary code of the second standardized query grouping; empty when the term is not in it.
  • SMQ02SC: whether membership is broad or narrow scope (BROAD/NARROW); empty when the term is not in it.
  • CQ01NAM: name of the sponsor-defined grouping the term belongs to; empty when not listed. No code or scope applies.

Note: an event can sit in a standardized grouping and in the sponsor grouping at the same time, each shown in its own place: Stevens-Johnson syndrome carries both the skin-reaction grouping and the sponsor grouping. Two events with the same coded term always show the same grouping entries: both nausea events carry the sponsor grouping. An event still awaiting coding, with no AEDECOD, belongs to no grouping.

Inputs

Under review
2 source files

input/ae.csv

Edit
10 rows
input/ae.csv
STUDYIDUSUBJIDAESEQAETERMAEDECOD
PILOT71Rash all overRASH
PILOT72Feeling sickNAUSEA
PILOT71Jaundice and dark urineHEPATITIS
PILOT72Loose stoolsDIARRHOEA
PILOT71HeadacheHEADACHE
PILOT72Odd sensation in the left arm—
PILOT71Severe skin blisteringSTEVENS-JOHNSON SYNDROME
PILOT71Recurrent nauseaNAUSEA
PILOT72Acute liver failureHEPATIC FAILURE
PILOT73Target lesions on trunkERYTHEMA MULTIFORME

input/queries.csv

Edit
8 rows
input/queries.csv
PREFIXGRPNAMEGRPIDSCOPETERM
SMQ01Severe Cutaneous Adverse Reactions20000020BROADRASH
SMQ01Severe Cutaneous Adverse Reactions20000020BROADERYTHEMA MULTIFORME
SMQ01Severe Cutaneous Adverse Reactions20000020NARROWSTEVENS-JOHNSON SYNDROME
SMQ02Hepatic Disorders20000006NARROWHEPATITIS
SMQ02Hepatic Disorders20000006NARROWHEPATIC FAILURE
CQ01Sponsor Adverse Events of Special Interest——DIARRHOEA
CQ01Sponsor Adverse Events of Special Interest——NAUSEA
CQ01Sponsor Adverse Events of Special Interest——STEVENS-JOHNSON SYNDROME

Expected output

Under review
10 expected rows

expected/adae.csv

Edit
10 rows
expected/adae.csv
STUDYIDUSUBJIDAESEQAETERMAEDECODSMQ01NAMSMQ01CDSMQ01SCSMQ02NAMSMQ02CDSMQ02SCCQ01NAM
PILOT71Rash all overRASHSevere Cutaneous Adverse Reactions20000020BROAD————
PILOT72Feeling sickNAUSEA——————Sponsor Adverse Events of Special Interest
PILOT71Jaundice and dark urineHEPATITIS———Hepatic Disorders20000006NARROW—
PILOT72Loose stoolsDIARRHOEA——————Sponsor Adverse Events of Special Interest
PILOT71HeadacheHEADACHE———————
PILOT72Odd sensation in the left arm————————
PILOT71Severe skin blisteringSTEVENS-JOHNSON SYNDROMESevere Cutaneous Adverse Reactions20000020NARROW———Sponsor Adverse Events of Special Interest
PILOT71Recurrent nauseaNAUSEA——————Sponsor Adverse Events of Special Interest
PILOT72Acute liver failureHEPATIC FAILURE———Hepatic Disorders20000006NARROW—
PILOT73Target lesions on trunkERYTHEMA MULTIFORMESevere Cutaneous Adverse Reactions20000020BROAD————
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

Dataset NameVariable NameVariable LabelTypeCodelist/Controlled TermsCoreComputational MethodOrigin
ADAESTUDYIDStudy IdentifiercharacterCopy value from AE.STUDYID.Predecessor
ADAEUSUBJIDUnique Subject IdentifiercharacterCopy value from AE.USUBJID.Predecessor
ADAEAESEQSequence NumbernumericCopy value from AE.AESEQ.Predecessor
ADAEAETERMReported Term for the Adverse EventcharacterCopy value from AE.AETERM.Predecessor
ADAEAEDECODDictionary-Derived TermcharacterCopy value from AE.AEDECOD.Predecessor
ADAESMQ01NAMStandardized MedDRA Query 01 NamecharacterTake GRPNAME from the QUERY record whose TERM equals AEDECOD, where QUERY.PREFIX = 'SMQ01', and no match yields blank.Derived
ADAESMQ01CDStandardized MedDRA Query 01 CodenumericTake GRPID from the QUERY record whose TERM equals AEDECOD, where QUERY.PREFIX = 'SMQ01', and no match yields blank.Derived
ADAESMQ01SCStandardized MedDRA Query 01 ScopecharacterBROAD, NARROWTake SCOPE from the QUERY record whose TERM equals AEDECOD, where QUERY.PREFIX = 'SMQ01', and no match yields blank.Derived
ADAESMQ02NAMStandardized MedDRA Query 02 NamecharacterTake GRPNAME from the QUERY record whose TERM equals AEDECOD, where QUERY.PREFIX = 'SMQ02', and no match yields blank.Derived
ADAESMQ02CDStandardized MedDRA Query 02 CodenumericTake GRPID from the QUERY record whose TERM equals AEDECOD, where QUERY.PREFIX = 'SMQ02', and no match yields blank.Derived
ADAESMQ02SCStandardized MedDRA Query 02 ScopecharacterBROAD, NARROWTake SCOPE from the QUERY record whose TERM equals AEDECOD, where QUERY.PREFIX = 'SMQ02', and no match yields blank.Derived
ADAECQ01NAMCustomized Query 01 NamecharacterTake GRPNAME from the QUERY record whose TERM equals AEDECOD, where QUERY.PREFIX = 'CQ01', and no match yields blank.Derived
VariablePermitted values
SMQ01SCBROAD, NARROW
SMQ02SCBROAD, NARROW
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/adam-adae-query-flags/full.md

Edit
18 lines

Following CDISC ADaM standards, use the provided AE and QUERY datasets to create an ADAE dataset with one record per adverse event.

The output dataset should contain the following columns in this order: STUDYID, USUBJID, AESEQ, AETERM, AEDECOD, SMQ01NAM, SMQ01CD, SMQ01SC, SMQ02NAM, SMQ02CD, SMQ02SC, CQ01NAM

Show each coded term's entries from the query dictionary in their own slots. Each standardized slot shows its grouping name, dictionary code, and scope together: BROAD or NARROW. The sponsor slot shows the grouping name only. An event can sit in a standardized grouping and in the sponsor grouping at the same time, each shown in its own place. Two events with the same coded term always show the same grouping entries. An event still awaiting coding, with no AEDECOD, belongs to no grouping, so the grouping columns have no value.

Read the source datasets from /app/input and save the completed dataset as /app/output/adae.csv.

prompts/adam-adae-query-flags/conventions.md

Edit
11 lines

Following CDISC ADaM standards, use the provided AE and QUERY datasets to create an ADAE dataset with one record per adverse event.

The output dataset should contain the following columns in this order: STUDYID, USUBJID, AESEQ, AETERM, AEDECOD, SMQ01NAM, SMQ01CD, SMQ01SC, SMQ02NAM, SMQ02CD, SMQ02SC, CQ01NAM

The scope of each standardized slot is BROAD or NARROW.

Read the source datasets from /app/input and save the completed dataset as /app/output/adae.csv.

prompts/adam-adae-query-flags/brief.md

Edit
9 lines

Following CDISC ADaM standards, use the provided AE and QUERY datasets to create an ADAE dataset with one record per adverse event.

The output dataset should contain the following columns in this order: STUDYID, USUBJID, AESEQ, AETERM, AEDECOD, SMQ01NAM, SMQ01CD, SMQ01SC, SMQ02NAM, SMQ02CD, SMQ02SC, CQ01NAM

Read the source datasets from /app/input and save the completed dataset as /app/output/adae.csv.

yamaa code

Runs the yamaa specification; its result must match the expected output

run.R

Edit
4 lines
library(yamaa)adae <- yamaa_domain("spec.yaml")$outputadae

run.py

Edit
4 lines
import yamaaadae = yamaa.yamaa_domain("spec.yaml").outputadae

Solution without yamaa

Written from the full prompt and the inputs alone; CI checks it reproduces the expected output

solutions/adam-adae-query-flags/result.R

Edit
44 lines
# Reference solution for the yamaa benchmark adam-adae-query-flags (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 <- read_csv(  "/app/input/ae.csv",  col_types = cols(AESEQ = col_integer(), .default = col_character()))queries <- read_csv(  "/app/input/queries.csv",  col_types = cols(GRPID = col_integer(), .default = col_character()))# Each standardized slot shows its grouping name, dictionary code, and# scope together; the sponsor slot shows the grouping name only. Two# events with the same coded term always show the same entries.smq01 <- queries |>  filter(PREFIX %in% "SMQ01") |>  select(TERM, SMQ01NAM = GRPNAME, SMQ01CD = GRPID, SMQ01SC = SCOPE)smq02 <- queries |>  filter(PREFIX %in% "SMQ02") |>  select(TERM, SMQ02NAM = GRPNAME, SMQ02CD = GRPID, SMQ02SC = SCOPE)cq01 <- queries |>  filter(PREFIX %in% "CQ01") |>  select(TERM, CQ01NAM = GRPNAME)adae <- ae |>  left_join(smq01, by = c("AEDECOD" = "TERM")) |>  left_join(smq02, by = c("AEDECOD" = "TERM")) |>  left_join(cq01, by = c("AEDECOD" = "TERM")) |>  select(    STUDYID, USUBJID, AESEQ, AETERM, AEDECOD, SMQ01NAM, SMQ01CD, SMQ01SC,    SMQ02NAM, SMQ02CD, SMQ02SC, CQ01NAM  )dir.create("/app/output", showWarnings = FALSE)write_csv(adae, "/app/output/adae.csv", na = "")

solutions/adam-adae-query-flags/result.py

Edit
50 lines
# Reference solution for the yamaa benchmark adam-adae-query-flags (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 = pl.read_csv("/app/input/ae.csv", infer_schema=False).with_columns(    pl.col("AESEQ").cast(pl.Int64))queries = pl.read_csv("/app/input/queries.csv", infer_schema=False).with_columns(    pl.col("GRPID").cast(pl.Int64))# Each standardized slot shows its grouping name, dictionary code, and# scope together; the sponsor slot shows the grouping name only. Two# events with the same coded term always show the same entries.smq01 = queries.filter(pl.col("PREFIX") == "SMQ01").select(    "TERM", SMQ01NAM="GRPNAME", SMQ01CD="GRPID", SMQ01SC="SCOPE")smq02 = queries.filter(pl.col("PREFIX") == "SMQ02").select(    "TERM", SMQ02NAM="GRPNAME", SMQ02CD="GRPID", SMQ02SC="SCOPE")cq01 = queries.filter(pl.col("PREFIX") == "CQ01").select("TERM", CQ01NAM="GRPNAME")adae = (    ae.join(smq01, left_on="AEDECOD", right_on="TERM", how="left", maintain_order="left")    .join(smq02, left_on="AEDECOD", right_on="TERM", how="left", maintain_order="left")    .join(cq01, left_on="AEDECOD", right_on="TERM", how="left", maintain_order="left")    .select(        "STUDYID",        "USUBJID",        "AESEQ",        "AETERM",        "AEDECOD",        "SMQ01NAM",        "SMQ01CD",        "SMQ01SC",        "SMQ02NAM",        "SMQ02CD",        "SMQ02SC",        "CQ01NAM",    ))Path("/app/output").mkdir(exist_ok=True)adae.write_csv("/app/output/adae.csv")

solutions/adam-adae-query-flags/result.sas

Edit
30 lines
/* opensas reference solution for the yamaa benchmark adam-adae-query-flags.   Reads the benchmark inputs and derives the requested output.   Execute with the existing opensas runtime: opensas /app/output/result.sas. */data ae;  length STUDYID USUBJID AETERM AEDECOD $1024;  infile "/app/input/ae.csv" dsd dlm="," firstobs=2 truncover lrecl=32767;  input STUDYID : $char1024. USUBJID : $char1024. AESEQ AETERM : $char1024. AEDECOD : $char1024.;run;data queries;  length PREFIX GRPNAME GRPID SCOPE TERM $1024;  infile "/app/input/queries.csv" dsd dlm="," firstobs=2 truncover lrecl=32767;  input PREFIX : $char1024. GRPNAME : $char1024. GRPID : $char1024. SCOPE : $char1024. TERM : $char1024.;run;proc sql;  create table result as select a.*,    b.GRPNAME as SMQ01NAM,b.GRPID as SMQ01CD,b.SCOPE as SMQ01SC,    c.GRPNAME as SMQ02NAM,c.GRPID as SMQ02CD,c.SCOPE as SMQ02SC,    d.GRPNAME as CQ01NAM  from ae as a left join queries as b on a.AEDECOD=b.TERM and b.PREFIX='SMQ01' and a.AEDECOD ne ''    left join queries as c on a.AEDECOD=c.TERM and c.PREFIX='SMQ02' and a.AEDECOD ne ''    left join queries as d on a.AEDECOD=d.TERM and d.PREFIX='CQ01' and a.AEDECOD ne '';quit;proc sql;  create table final as select STUDYID, USUBJID, AESEQ, AETERM, AEDECOD, SMQ01NAM, SMQ01CD, SMQ01SC, SMQ02NAM, SMQ02CD, SMQ02SC, CQ01NAM from result;quit;proc export data=final outfile="/app/output/adae.csv" dbms=csv replace; run;