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: give one row for each adverse event and each medication that the related-records dataset relates to it: the event's sequence number and reported term (AESEQ, AETERM), the medication's sequence number and name (CMSEQ, CMTRT), and the relationship they share (RELID).

Input: collected adverse events (AE), concomitant medications (CM) and related records (RELREC), one record for each member of a relationship: the subject, the domain and sequence number of the related record and the relationship's identifier.

Variables:

  • AETERM: the reported term of the adverse event.
  • CMTRT: the reported name of the medication.
  • RELID: the identifier of the subject's relationship that relates the event and the medication.

Note: every event of a relationship pairs with every medication of the same subject's same relationship, so a relationship of two events and two medications gives four rows, and a medication related to two events through two relationships appears once with each. Relationship identifiers count within a subject: two subjects' relationships with the same identifier are different relationships.

Inputs

Under review
3 source files

input/ae.csv

Edit
5 rows
input/ae.csv
STUDYIDDOMAINUSUBJIDAESEQAETERM
TOYAE1HEADACHE
TOYAE2NAUSEA
TOYAE3RASH
TOYAE4PRURITUS
TOYAE1FEVER

input/cm.csv

Edit
5 rows
input/cm.csv
STUDYIDDOMAINUSUBJIDCMSEQCMTRT
TOYCM1PARACETAMOL
TOYCM2ONDANSETRON
TOYCM3LORATADINE
TOYCM1PARACETAMOL
TOYCM2IBUPROFEN

input/relrec.csv

Edit
11 rows
input/relrec.csv
STUDYIDRDOMAINUSUBJIDIDVARIDVARVALRELTYPERELID
TOYAEAESEQ1—1
TOYAEAESEQ2—1
TOYCMCMSEQ1—1
TOYCMCMSEQ2—1
TOYAEAESEQ3—2
TOYCMCMSEQ3—2
TOYAEAESEQ4—3
TOYCMCMSEQ3—3
TOYAEAESEQ1—1
TOYCMCMSEQ1—1
TOYCMCMSEQ2—1

Expected output

Under review
8 expected rows

expected/adaecm.csv

Edit
8 rows
expected/adaecm.csv
STUDYIDUSUBJIDAESEQAETERMCMSEQCMTRTRELID
TOY1HEADACHE1PARACETAMOL1
TOY1HEADACHE2ONDANSETRON1
TOY2NAUSEA1PARACETAMOL1
TOY2NAUSEA2ONDANSETRON1
TOY3RASH3LORATADINE2
TOY4PRURITUS3LORATADINE3
TOY1FEVER1PARACETAMOL1
TOY1FEVER2IBUPROFEN1
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

Dataset NameVariable NameVariable LabelTypeCodelist/Controlled TermsCoreComputational MethodOrigin
ADAECMSTUDYIDStudy IdentifiercharacterSet per constructed row; see the Row construction sheet.Derived
ADAECMUSUBJIDUnique Subject IdentifiercharacterSet per constructed row; see the Row construction sheet.Derived
ADAECMAESEQSequence Number of the Adverse EventnumericSet per constructed row; see the Row construction sheet.Derived
ADAECMCMSEQSequence Number of the MedicationnumericSet per constructed row; see the Row construction sheet.Derived
ADAECMRELIDRelationship IdentifiercharacterSet per constructed row; see the Row construction sheet.Derived
ADAECMAETERMReported Term for the Adverse EventcharacterCopy value from AE.AETERM.Predecessor
ADAECMCMTRTReported Name of Drug, Med, or TherapycharacterCopy value from CM.CMTRT.Predecessor
TemplateInclude whenSTUDYIDUSUBJIDAESEQCMSEQRELID
pairsCopy STUDYID from the AEMEM record matching on USUBJID and RELID, where STUDYID is derived as STUDYID from the RELREC record matching on the shared output keys, where RELREC.RDOMAIN = 'AE' AND RELREC.IDVAR = 'AESEQ', blank when unmatched, and no match yields blankCopy USUBJID from the AEMEM record matching on USUBJID and RELID, where USUBJID is derived as USUBJID from the RELREC record matching on the shared output keys, where RELREC.RDOMAIN = 'AE' AND RELREC.IDVAR = 'AESEQ', blank when unmatched, and no match yields blankCopy AESEQ from the AEMEM record matching on USUBJID and RELID, where AESEQ is derived as SEQ from the RELREC record matching on the shared output keys, where RELREC.RDOMAIN = 'AE' AND RELREC.IDVAR = 'AESEQ', blank when unmatched, and no match yields blankCopy CMSEQ from the AEMEM record matching on USUBJID and RELID, where CMSEQ is derived as SEQ from the RELREC record matching on the shared output keys, where RELREC.RDOMAIN = 'CM' AND RELREC.IDVAR = 'CMSEQ', blank when unmatched, and no match yields blankCopy RELID from the AEMEM record matching on USUBJID and RELID, where RELID is derived as RELID from the RELREC record matching on the shared output keys, where RELREC.RDOMAIN = 'AE' AND RELREC.IDVAR = 'AESEQ', blank when unmatched, and no match yields blank
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/adam-adaecm-related-pairs/full.md

Edit
28 lines

Following CDISC ADaM standards, use the provided AE, CM, and RELREC datasets to create an ADAECM dataset with one record per adverse event and medication related to it, per relationship that relates them.

The output dataset should contain the following columns in this order: STUDYID, USUBJID, AESEQ, AETERM, CMSEQ, CMTRT, RELID

Each RELREC record is one member of a subject's relationship: a record with RDOMAIN "AE" and IDVAR "AESEQ" names an adverse event by the AESEQ in IDVARVAL, and a record with RDOMAIN "CM" and IDVAR "CMSEQ" names a medication by its CMSEQ.

  • Every event of a relationship pairs with every medication of the same subject's same relationship, so a relationship of two events and two medications gives four records.
  • A medication related to two events through two relationships appears once with each.
  • Relationship identifiers count within a subject: two subjects' relationships with the same identifier are different relationships.
  • AESEQ and CMSEQ are the sequence numbers of the event in AE and of the medication in CM, as RELREC names them; they are not renumbered.
  • AETERM is the reported term of the adverse event, and CMTRT is the reported name of the medication.
  • RELID is the identifier of the subject's relationship that relates the event and the medication, exactly as RELREC holds it.

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

prompts/adam-adaecm-related-pairs/conventions.md

Edit
12 lines

Following CDISC ADaM standards, use the provided AE, CM, and RELREC datasets to create an ADAECM dataset with one record per adverse event and medication related to it, per relationship that relates them.

The output dataset should contain the following columns in this order: STUDYID, USUBJID, AESEQ, AETERM, CMSEQ, CMTRT, RELID

RELID is the identifier of the subject's relationship, exactly as RELREC holds it.

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

prompts/adam-adaecm-related-pairs/brief.md

Edit
9 lines

Following CDISC ADaM standards, use the provided AE, CM, and RELREC datasets to create an ADAECM dataset with one record per adverse event and medication related to it, per relationship that relates them.

The output dataset should contain the following columns in this order: STUDYID, USUBJID, AESEQ, AETERM, CMSEQ, CMTRT, RELID

Read the source datasets from /app/input and save the completed dataset as /app/output/adaecm.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/adam-adaecm-related-pairs/result.R

Edit
48 lines
# Reference solution for the yamaa benchmark adam-adaecm-related-pairs (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.read_text <- function(name) {  read.csv(    file.path("/app/input", name),    colClasses = "character",    na.strings = character(0),    check.names = FALSE  )}ae <- read_text("ae.csv")cm <- read_text("cm.csv")relrec <- read_text("relrec.csv")events <- relrec[relrec$RDOMAIN == "AE" & relrec$IDVAR == "AESEQ",                 c("STUDYID", "USUBJID", "RELID", "IDVARVAL")]names(events)[4] <- "AESEQ"medications <- relrec[relrec$RDOMAIN == "CM" & relrec$IDVAR == "CMSEQ",                      c("STUDYID", "USUBJID", "RELID", "IDVARVAL")]names(medications)[4] <- "CMSEQ"# Every event of a relationship with every medication of the same subject's# same relationship.pairs <- merge(events, medications, by = c("STUDYID", "USUBJID", "RELID"))pairs$AESEQ <- as.integer(pairs$AESEQ)pairs$CMSEQ <- as.integer(pairs$CMSEQ)pairs$AETERM <- ae$AETERM[match(  paste(pairs$STUDYID, pairs$USUBJID, pairs$AESEQ, sep = "\r"),  paste(ae$STUDYID, ae$USUBJID, as.integer(ae$AESEQ), sep = "\r"))]pairs$CMTRT <- cm$CMTRT[match(  paste(pairs$STUDYID, pairs$USUBJID, pairs$CMSEQ, sep = "\r"),  paste(cm$STUDYID, cm$USUBJID, as.integer(cm$CMSEQ), sep = "\r"))]adaecm <- pairs[order(pairs$STUDYID, pairs$USUBJID, pairs$AESEQ, pairs$CMSEQ,                      method = "radix"),                c("STUDYID", "USUBJID", "AESEQ", "AETERM", "CMSEQ", "CMTRT",                  "RELID")]dir.create("/app/output", showWarnings = FALSE, recursive = TRUE)write.csv(adaecm, "/app/output/adaecm.csv", row.names = FALSE, na = "")

solutions/adam-adaecm-related-pairs/result.py

Edit
67 lines
# Reference solution for the yamaa benchmark adam-adaecm-related-pairs (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.import csvfrom pathlib import PathINPUT_DIR = Path("/app/input")OUTPUT_DIR = Path("/app/output")COLUMNS = ["STUDYID", "USUBJID", "AESEQ", "AETERM", "CMSEQ", "CMTRT", "RELID"]def read(name: str) -> list[dict[str, str]]:    with open(INPUT_DIR / name, newline="", encoding="utf-8") as handle:        return list(csv.DictReader(handle))def main() -> None:    ae = read("ae.csv")    cm = read("cm.csv")    relrec = read("relrec.csv")    terms = {(r["STUDYID"], r["USUBJID"], int(r["AESEQ"])): r["AETERM"] for r in ae}    names = {(r["STUDYID"], r["USUBJID"], int(r["CMSEQ"])): r["CMTRT"] for r in cm}    events = [r for r in relrec if r["RDOMAIN"] == "AE" and r["IDVAR"] == "AESEQ"]    medications = [        r for r in relrec if r["RDOMAIN"] == "CM" and r["IDVAR"] == "CMSEQ"    ]    # Every event of a relationship with every medication of the same    # subject's same relationship.    rows = []    for event in events:        for medication in medications:            if (event["STUDYID"], event["USUBJID"], event["RELID"]) != (                medication["STUDYID"],                medication["USUBJID"],                medication["RELID"],            ):                continue            aeseq = int(event["IDVARVAL"])            cmseq = int(medication["IDVARVAL"])            rows.append(                {                    "STUDYID": event["STUDYID"],                    "USUBJID": event["USUBJID"],                    "AESEQ": aeseq,                    "AETERM": terms[(event["STUDYID"], event["USUBJID"], aeseq)],                    "CMSEQ": cmseq,                    "CMTRT": names[(event["STUDYID"], event["USUBJID"], cmseq)],                    "RELID": event["RELID"],                }            )    rows.sort(key=lambda r: (r["STUDYID"], r["USUBJID"], r["AESEQ"], r["CMSEQ"]))    OUTPUT_DIR.mkdir(parents=True, exist_ok=True)    with open(OUTPUT_DIR / "adaecm.csv", "w", newline="", encoding="utf-8") as handle:        writer = csv.writer(handle, lineterminator="\n")        writer.writerow(COLUMNS)        for row in rows:            writer.writerow([row[column] for column in COLUMNS])if __name__ == "__main__":    main()

solutions/adam-adaecm-related-pairs/result.sas

Edit
70 lines
/* opensas reference solution for the yamaa benchmark adam-adaecm-related-pairs.   Reads the benchmark inputs and derives the requested output.   Execute with the existing opensas runtime: opensas /app/output/result.sas. */data ae;  length STUDYID DOMAIN USUBJID $40 AETERM $200;  infile "/app/input/ae.csv" dsd dlm="," firstobs=2 truncover lrecl=32767;  input STUDYID : $char40. DOMAIN : $char40. USUBJID : $char40. AESEQ        AETERM : $char200.;run;data cm;  length STUDYID DOMAIN USUBJID $40 CMTRT $200;  infile "/app/input/cm.csv" dsd dlm="," firstobs=2 truncover lrecl=32767;  input STUDYID : $char40. DOMAIN : $char40. USUBJID : $char40. CMSEQ        CMTRT : $char200.;run;data relrec;  length STUDYID RDOMAIN USUBJID IDVAR IDVARVAL RELTYPE RELID $40;  infile "/app/input/relrec.csv" dsd dlm="," firstobs=2 truncover lrecl=32767;  input STUDYID : $char40. RDOMAIN : $char40. USUBJID : $char40.        IDVAR : $char40. IDVARVAL : $char40. RELTYPE : $char40.        RELID : $char40.;run;/* The events and the medications each relationship names, with their   numeric sequence numbers. Function calls in join predicates were rejected   by the release, and comparisons between identically named columns of a   self-join gave incorrect results, so the two member lists are separate   tables with their keys calculated before joining. */data relae;  set relrec;  if RDOMAIN = 'AE' and IDVAR = 'AESEQ';  AESEQ = input(IDVARVAL, best32.);  keep STUDYID USUBJID RELID AESEQ;run;data relcm;  set relrec;  if RDOMAIN = 'CM' and IDVAR = 'CMSEQ';  CMSEQ = input(IDVARVAL, best32.);  keep STUDYID USUBJID RELID CMSEQ;run;proc sql;  /* Every event of a relationship with every medication of the same     subject's same relationship. */  create table pairs as    select e.STUDYID, e.USUBJID, e.AESEQ, m.CMSEQ, e.RELID    from relae as e inner join relcm as m      on m.STUDYID = e.STUDYID and m.USUBJID = e.USUBJID         and m.RELID = e.RELID;  /* The event's reported term. */  create table aepairs as    select p.STUDYID, p.USUBJID, p.AESEQ, a.AETERM, p.CMSEQ, p.RELID    from pairs as p left join ae as a      on a.STUDYID = p.STUDYID and a.USUBJID = p.USUBJID         and a.AESEQ = p.AESEQ;  /* The medication's reported name. */  create table adaecm as    select p.STUDYID, p.USUBJID, p.AESEQ, p.AETERM, p.CMSEQ, c.CMTRT,           p.RELID    from aepairs as p left join cm as c      on c.STUDYID = p.STUDYID and c.USUBJID = p.USUBJID         and c.CMSEQ = p.CMSEQ    order by p.STUDYID, p.USUBJID, p.AESEQ, p.CMSEQ, p.RELID;quit;proc export data=adaecm outfile='/app/output/adaecm.csv' dbms=csv replace; run;