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: 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 review2 source filesinput/ae.csv
Edit10 rows| STUDYID | USUBJID | AESEQ | AETERM | AEDECOD |
|---|---|---|---|---|
| PILOT7 | 1 | Rash all over | RASH | |
| PILOT7 | 2 | Feeling sick | NAUSEA | |
| PILOT7 | 1 | Jaundice and dark urine | HEPATITIS | |
| PILOT7 | 2 | Loose stools | DIARRHOEA | |
| PILOT7 | 1 | Headache | HEADACHE | |
| PILOT7 | 2 | Odd sensation in the left arm | — | |
| PILOT7 | 1 | Severe skin blistering | STEVENS-JOHNSON SYNDROME | |
| PILOT7 | 1 | Recurrent nausea | NAUSEA | |
| PILOT7 | 2 | Acute liver failure | HEPATIC FAILURE | |
| PILOT7 | 3 | Target lesions on trunk | ERYTHEMA MULTIFORME |
input/queries.csv
Edit8 rows| PREFIX | GRPNAME | GRPID | SCOPE | TERM |
|---|---|---|---|---|
| SMQ01 | Severe Cutaneous Adverse Reactions | 20000020 | BROAD | RASH |
| SMQ01 | Severe Cutaneous Adverse Reactions | 20000020 | BROAD | ERYTHEMA MULTIFORME |
| SMQ01 | Severe Cutaneous Adverse Reactions | 20000020 | NARROW | STEVENS-JOHNSON SYNDROME |
| SMQ02 | Hepatic Disorders | 20000006 | NARROW | HEPATITIS |
| SMQ02 | Hepatic Disorders | 20000006 | NARROW | HEPATIC FAILURE |
| CQ01 | Sponsor Adverse Events of Special Interest | — | — | DIARRHOEA |
| CQ01 | Sponsor Adverse Events of Special Interest | — | — | NAUSEA |
| CQ01 | Sponsor Adverse Events of Special Interest | — | — | STEVENS-JOHNSON SYNDROME |
Expected output
Under review10 expected rowsexpected/adae.csv
Edit10 rows| STUDYID | USUBJID | AESEQ | AETERM | AEDECOD | SMQ01NAM | SMQ01CD | SMQ01SC | SMQ02NAM | SMQ02CD | SMQ02SC | CQ01NAM |
|---|---|---|---|---|---|---|---|---|---|---|---|
| PILOT7 | 1 | Rash all over | RASH | Severe Cutaneous Adverse Reactions | 20000020 | BROAD | — | — | — | — | |
| PILOT7 | 2 | Feeling sick | NAUSEA | — | — | — | — | — | — | Sponsor Adverse Events of Special Interest | |
| PILOT7 | 1 | Jaundice and dark urine | HEPATITIS | — | — | — | Hepatic Disorders | 20000006 | NARROW | — | |
| PILOT7 | 2 | Loose stools | DIARRHOEA | — | — | — | — | — | — | Sponsor Adverse Events of Special Interest | |
| PILOT7 | 1 | Headache | HEADACHE | — | — | — | — | — | — | — | |
| PILOT7 | 2 | Odd sensation in the left arm | — | — | — | — | — | — | — | — | |
| PILOT7 | 1 | Severe skin blistering | STEVENS-JOHNSON SYNDROME | Severe Cutaneous Adverse Reactions | 20000020 | NARROW | — | — | — | Sponsor Adverse Events of Special Interest | |
| PILOT7 | 1 | Recurrent nausea | NAUSEA | — | — | — | — | — | — | Sponsor Adverse Events of Special Interest | |
| PILOT7 | 2 | Acute liver failure | HEPATIC FAILURE | — | — | — | Hepatic Disorders | 20000006 | NARROW | — | |
| PILOT7 | 3 | Target lesions on trunk | ERYTHEMA MULTIFORME | Severe Cutaneous Adverse Reactions | 20000020 | BROAD | — | — | — | — |
Human review and assessment
| Dataset Name | Variable Name | Variable Label | Type | Codelist/Controlled Terms | Core | Computational Method | Origin |
|---|---|---|---|---|---|---|---|
| ADAE | STUDYID | Study Identifier | character | Copy value from AE.STUDYID. | Predecessor | ||
| ADAE | USUBJID | Unique Subject Identifier | character | Copy value from AE.USUBJID. | Predecessor | ||
| ADAE | AESEQ | Sequence Number | numeric | Copy value from AE.AESEQ. | Predecessor | ||
| ADAE | AETERM | Reported Term for the Adverse Event | character | Copy value from AE.AETERM. | Predecessor | ||
| ADAE | AEDECOD | Dictionary-Derived Term | character | Copy value from AE.AEDECOD. | Predecessor | ||
| ADAE | SMQ01NAM | Standardized MedDRA Query 01 Name | character | Take GRPNAME from the QUERY record whose TERM equals AEDECOD, where QUERY.PREFIX = 'SMQ01', and no match yields blank. | Derived | ||
| ADAE | SMQ01CD | Standardized MedDRA Query 01 Code | numeric | Take GRPID from the QUERY record whose TERM equals AEDECOD, where QUERY.PREFIX = 'SMQ01', and no match yields blank. | Derived | ||
| ADAE | SMQ01SC | Standardized MedDRA Query 01 Scope | character | BROAD, NARROW | Take SCOPE from the QUERY record whose TERM equals AEDECOD, where QUERY.PREFIX = 'SMQ01', and no match yields blank. | Derived | |
| ADAE | SMQ02NAM | Standardized MedDRA Query 02 Name | character | Take GRPNAME from the QUERY record whose TERM equals AEDECOD, where QUERY.PREFIX = 'SMQ02', and no match yields blank. | Derived | ||
| ADAE | SMQ02CD | Standardized MedDRA Query 02 Code | numeric | Take GRPID from the QUERY record whose TERM equals AEDECOD, where QUERY.PREFIX = 'SMQ02', and no match yields blank. | Derived | ||
| ADAE | SMQ02SC | Standardized MedDRA Query 02 Scope | character | BROAD, NARROW | Take SCOPE from the QUERY record whose TERM equals AEDECOD, where QUERY.PREFIX = 'SMQ02', and no match yields blank. | Derived | |
| ADAE | CQ01NAM | Customized Query 01 Name | character | Take GRPNAME from the QUERY record whose TERM equals AEDECOD, where QUERY.PREFIX = 'CQ01', and no match yields blank. | Derived |
| Variable | Permitted values |
|---|---|
| SMQ01SC | BROAD, NARROW |
| SMQ02SC | BROAD, NARROW |
| 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/adam-adae-query-flags/full.md
Edit28 linesFollowing CDISC ADaM standards, use the provided AE and QUERIES 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 QUERIES dataset is a query dictionary that lists coded terms under query groupings. Membership of an event in a grouping is decided by its AEDECOD: an event belongs to a grouping when the dictionary lists its coded term under that grouping, and two events with the same coded term always show the same grouping entries. A grouping entry in the dictionary gives the grouping's name, and for a standardized grouping also its code and whether the term's membership in it is "BROAD" or "NARROW" scope. SMQ01NAM, SMQ01CD, and SMQ01SC hold the name, code, and scope of the first standardized query grouping the event's coded term belongs to, and have no value when the coded term is not in that grouping. SMQ02NAM, SMQ02CD, and SMQ02SC hold the name, code, and scope of the second standardized query grouping in the same way. CQ01NAM holds the name of the sponsor-defined customized query grouping the event's coded term belongs to, and has no value when the coded term is not listed under it; no code or scope applies to that grouping. An event can belong to a standardized grouping and to the sponsor grouping at the same time, each shown in its own columns. An event with no AEDECOD belongs to no grouping, so all seven grouping columns have no value for it.
Read the source datasets from /app/input and save the completed dataset as /app/output/adae.csv.
prompts/adam-adae-query-flags/conventions.md
Edit11 linesFollowing CDISC ADaM standards, use the provided AE and QUERIES 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
SMQ01SC and SMQ02SC are "BROAD" or "NARROW", or 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/brief.md
Edit9 linesFollowing CDISC ADaM standards, use the provided AE and QUERIES 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.
R
Edit3 lineslibrary(yamaa)yamaa_spec("spec.yaml")$run()$outputPython
Edit3 linesimport yamaayamaa.spec("spec.yaml").run().outputsolutions/adam-adae-query-flags/result.R
Edit44 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
Edit102 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."""Create the ADAE dataset with query grouping columns from AE and QUERIES.Membership of an adverse event in a query grouping is decided by itsAEDECOD: the QUERIES dictionary lists coded terms under groupings, andevery event with the same coded term shows the same grouping entries.SMQ01/SMQ02 columns carry the name, code and scope of the first/secondstandardized query grouping for the term; CQ01NAM carries the name ofthe sponsor-defined customized query grouping. Events without anAEDECOD, or whose term is not listed under a grouping, get no value inthat grouping's columns."""import csvimport osINPUT_DIR = "/app/input"OUTPUT_DIR = "/app/output"def read_csv(path): with open(path, newline="", encoding="utf-8") as handle: return list(csv.DictReader(handle))def main(): ae_rows = read_csv(os.path.join(INPUT_DIR, "ae.csv")) query_rows = read_csv(os.path.join(INPUT_DIR, "queries.csv")) # Index the dictionary by prefix and coded term. A term appears at # most once under a given prefix; each entry gives the grouping # name, its code (standardized groupings only) and the scope of the # term's membership (standardized groupings only). dictionary = {} for row in query_rows: dictionary[(row["PREFIX"], row["TERM"])] = row def grouping(prefix, term): """Return (name, code, scope) for a term under a prefix.""" entry = dictionary.get((prefix, term)) if entry is None: return "", "", "" return entry["GRPNAME"], entry["GRPID"], entry["SCOPE"] out_rows = [] for ae in ae_rows: decod = ae["AEDECOD"] if decod: smq01nam, smq01cd, smq01sc = grouping("SMQ01", decod) smq02nam, smq02cd, smq02sc = grouping("SMQ02", decod) cq01nam, _, _ = grouping("CQ01", decod) else: smq01nam = smq01cd = smq01sc = "" smq02nam = smq02cd = smq02sc = "" cq01nam = "" out_rows.append( { "STUDYID": ae["STUDYID"], "USUBJID": ae["USUBJID"], "AESEQ": ae["AESEQ"], "AETERM": ae["AETERM"], "AEDECOD": decod, "SMQ01NAM": smq01nam, "SMQ01CD": smq01cd, "SMQ01SC": smq01sc, "SMQ02NAM": smq02nam, "SMQ02CD": smq02cd, "SMQ02SC": smq02sc, "CQ01NAM": cq01nam, } ) columns = [ "STUDYID", "USUBJID", "AESEQ", "AETERM", "AEDECOD", "SMQ01NAM", "SMQ01CD", "SMQ01SC", "SMQ02NAM", "SMQ02CD", "SMQ02SC", "CQ01NAM", ] os.makedirs(OUTPUT_DIR, exist_ok=True) with open( os.path.join(OUTPUT_DIR, "adae.csv"), "w", newline="", encoding="utf-8" ) as handle: writer = csv.DictWriter(handle, fieldnames=columns) writer.writeheader() writer.writerows(out_rows)if __name__ == "__main__": main()solutions/adam-adae-query-flags/result.sas
Edit30 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;
yamaa