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: create one adverse event (AE) record per reported event from long-form Operational Data Model (ODM) item data.

Input: each collected item has its own ODM row. Items belonging to one event share the subject, visit, visit repeat, form, and form repeat identifiers.

Variables:

  • AESEQ numbers the subject's events from 1 in visit order (screening, then baseline), then by visit repeat and form repeat; an event at any other visit stops the run.
  • AETERM keeps the free-text term exactly as reported.
  • AESTDTC and AEENDTC come from the same event occurrence; a missing end date stays blank.
  • AESEV and AESER come from that occurrence's severity and seriousness items.

Note: each form occurrence is its own event, so a form repeat number reused at a later visit, or the same term reported in two occurrences, still gives separate records. Only AE forms are read, and an occurrence without a reported term contributes no AE record.

Inputs

Under review
1 source file

input/odm.csv

Edit
26 rows
input/odm.csv
StudyOIDMetaDataVersionOIDSubjectKeyStudyEventOIDStudyEventRepeatKeyFormOIDFormRepeatKeyItemGroupOIDItemGroupRepeatKeyItemOIDValue
YAMAA-01MDV.1YAMAA-01-0001SCREENING1FO.DM1IG.DM1IT.DM.SEXF
YAMAA-01MDV.1YAMAA-01-0001SCREENING1FO.AE1IG.AE1IT.AE.AETERMHeadache
YAMAA-01MDV.1YAMAA-01-0001SCREENING1FO.AE1IG.AE1IT.AE.AESTDTC2025-01-02
YAMAA-01MDV.1YAMAA-01-0001SCREENING1FO.AE1IG.AE1IT.AE.AEENDTC2025-01-03
YAMAA-01MDV.1YAMAA-01-0001SCREENING1FO.AE1IG.AE1IT.AE.AESEVMILD
YAMAA-01MDV.1YAMAA-01-0001SCREENING1FO.AE1IG.AE1IT.AE.AESERN
YAMAA-01MDV.1YAMAA-01-0001SCREENING1FO.AE1IG.AE2IT.AE.AETERMNausea
YAMAA-01MDV.1YAMAA-01-0001SCREENING1FO.AE1IG.AE2IT.AE.AESTDTC2025-01-04
YAMAA-01MDV.1YAMAA-01-0001SCREENING1FO.AE1IG.AE2IT.AE.AEENDTC—
YAMAA-01MDV.1YAMAA-01-0001SCREENING1FO.AE1IG.AE2IT.AE.AESEVMODERATE
YAMAA-01MDV.1YAMAA-01-0001SCREENING1FO.AE1IG.AE2IT.AE.AESERN
YAMAA-01MDV.1YAMAA-01-0001BASELINE1FO.AE1IG.AE1IT.AE.AETERMHeadache
YAMAA-01MDV.1YAMAA-01-0001BASELINE1FO.AE1IG.AE1IT.AE.AESTDTC2025-01-10
YAMAA-01MDV.1YAMAA-01-0001BASELINE1FO.AE1IG.AE1IT.AE.AEENDTC2025-01-11
YAMAA-01MDV.1YAMAA-01-0001BASELINE1FO.AE1IG.AE1IT.AE.AESEVMILD
YAMAA-01MDV.1YAMAA-01-0001BASELINE1FO.AE1IG.AE1IT.AE.AESERN
YAMAA-01MDV.1YAMAA-01-0002SCREENING1FO.AE1IG.AE1IT.AE.AETERMRash
YAMAA-01MDV.1YAMAA-01-0002SCREENING1FO.AE1IG.AE1IT.AE.AESTDTC2025-02-02
YAMAA-01MDV.1YAMAA-01-0002SCREENING1FO.AE1IG.AE1IT.AE.AEENDTC2025-02-05
YAMAA-01MDV.1YAMAA-01-0002SCREENING1FO.AE1IG.AE1IT.AE.AESEVSEVERE
YAMAA-01MDV.1YAMAA-01-0002SCREENING1FO.AE1IG.AE1IT.AE.AESERY
YAMAA-01MDV.1YAMAA-01-0002SCREENING1FO.AE1IG.AE2IT.AE.AETERM—
YAMAA-01MDV.1YAMAA-01-0002SCREENING1FO.AE1IG.AE2IT.AE.AESTDTC2025-02-03
YAMAA-01MDV.1YAMAA-01-0002SCREENING1FO.AE1IG.AE2IT.AE.AEENDTC—
YAMAA-01MDV.1YAMAA-01-0002SCREENING1FO.AE1IG.AE2IT.AE.AESEV—
YAMAA-01MDV.1YAMAA-01-0002SCREENING1FO.AE1IG.AE2IT.AE.AESERN

Expected output

Under review
4 expected rows

expected/ae.csv

Edit
4 rows
expected/ae.csv
DOMAINSTUDYIDUSUBJIDAESEQAETERMAESTDTCAEENDTCAESEVAESER
AEYAMAA-011Headache2025-01-022025-01-03MILDN
AEYAMAA-012Nausea2025-01-04—MODERATEN
AEYAMAA-013Headache2025-01-102025-01-11MILDN
AEYAMAA-011Rash2025-02-022025-02-05SEVEREY
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

Variable NameVariable LabelTypeLengthControlled Terms or FormatOriginCoreConversion DefinitionVariable TypeVariable OrderComments for Define
DOMAINDomain AbbreviationCharAssignedSet constant value "AE".SDTM1
STUDYIDStudy IdentifierCharCollectedCopy value from ODM.StudyOID.SDTM2
USUBJIDUnique Subject IdentifierCharCollectedCopy value from ODM.SubjectKey.SDTM3
AETERMReported Term for the Adverse EventCharDerivedSet per constructed row; see the Row construction sheet.SDTM4
AESTDTCStart Date/Time of Adverse EventCharISO 8601DerivedSet per constructed row; see the Row construction sheet.SDTM5
AEENDTCEnd Date/Time of Adverse EventCharISO 8601DerivedSet per constructed row; see the Row construction sheet.SDTM6
AESEVSeverity/IntensityCharMILD, MODERATE, SEVEREDerivedSet per constructed row; see the Row construction sheet.SDTM7
AESERSerious EventCharY, NDerivedSet per constructed row; see the Row construction sheet.SDTM8
AESEQSequence NumberNumDerivedRow number within each group of STUDYID, USUBJID, ordered by EVENTORD then EVENTREPEAT then REPEATKEY.SDTM9
TemplateInclude whenFORMAETERMAESTDTCAEENDTCAESEVAESER
collected-occurrenceFORM = 'IG.AE' AND AETERM IS NOT NULLCopy ODM.ItemGroupOIDRead collected ODM item IT.AE.AETERM; no identified record yields blankRead collected ODM item IT.AE.AESTDTC; no identified record yields blankRead collected ODM item IT.AE.AEENDTC; no identified record yields blankRead collected ODM item IT.AE.AESEV; no identified record yields blankRead collected ODM item IT.AE.AESER; no identified record yields blank
VariablePermitted values
AESEVMILD, MODERATE, SEVERE
AESERY, N
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/sdtm-ae-odm-repeated/full.md

Edit
20 lines

Following CDISC SDTM standards, use the provided ODM dataset to create an AE dataset with one record per reported event.

The output dataset should contain the following columns in this order: DOMAIN, STUDYID, USUBJID, AESEQ, AETERM, AESTDTC, AEENDTC, AESEV, AESER

STUDYID is the ODM study OID as given, and USUBJID is the ODM subject key as given. Items belonging to one event share the subject, visit, visit repeat, form, and form repeat identifiers. Only AE forms contribute records, and an occurrence without a reported term contributes no AE record. Each form occurrence is its own event, so a form repeat number reused at a later visit, or the same term reported in two occurrences, still gives separate records. AETERM holds the free-text term exactly as reported. AESTDTC and AEENDTC come from the same event occurrence, and AEENDTC has no value when that occurrence has no end date. AESEV and AESER come from that occurrence's severity and seriousness items. AESEQ numbers the subject's events from 1 in visit order (screening, then baseline), then by visit repeat and form repeat.

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

prompts/sdtm-ae-odm-repeated/conventions.md

Edit
8 lines

Following CDISC SDTM standards, use the provided ODM dataset to create an AE dataset with one record per reported event.

The output dataset should contain the following columns in this order: DOMAIN, STUDYID, USUBJID, AESEQ, AETERM, AESTDTC, AEENDTC, AESEV, AESER

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

prompts/sdtm-ae-odm-repeated/brief.md

Edit
8 lines

Following CDISC SDTM standards, use the provided ODM dataset to create an AE dataset with one record per reported event.

The output dataset should contain the following columns in this order: DOMAIN, STUDYID, USUBJID, AESEQ, AETERM, AESTDTC, AEENDTC, AESEV, AESER

Read the source datasets from /app/input and save the completed dataset as /app/output/ae.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/sdtm-ae-odm-repeated/result.R

Edit
60 lines
# Reference solution for the yamaa benchmark sdtm-ae-odm-repeated (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)library(tidyr)odm <- read_csv(  "/app/input/odm.csv",  col_types = cols(.default = col_character()))# One event per AE item group occurrence: subject, visit, visit repeat, item# group, and item group repeat key. An occurrence without a reported term# gives no record; a repeat key reused at a later visit starts a new event.events <- odm |>  filter(ItemGroupOID == "IG.AE") |>  pivot_wider(    id_cols = c(      StudyOID, SubjectKey, StudyEventOID, StudyEventRepeatKey,      ItemGroupRepeatKey    ),    names_from = ItemOID,    values_from = Value,    values_fn = first  ) |>  mutate(    AETERM = `IT.AE.AETERM`,    AESTDTC = `IT.AE.AESTDTC`,    AEENDTC = `IT.AE.AEENDTC`,    AESEV = `IT.AE.AESEV`,    AESER = `IT.AE.AESER`  ) |>  filter(!is.na(AETERM) & AETERM != "") |>  # Visit order is screening, then baseline; then visit repeat and item  # group repeat key. The same term in two occurrences stays two records.  mutate(    VISITORD = case_when(      StudyEventOID == "SCREENING" ~ 0L,      StudyEventOID == "BASELINE" ~ 1L,      .default = 2L    ),    VISITREP = as.integer(StudyEventRepeatKey),    IGREP = as.integer(ItemGroupRepeatKey)  ) |>  arrange(SubjectKey, VISITORD, VISITREP, IGREP) |>  group_by(SubjectKey) |>  mutate(AESEQ = row_number()) |>  ungroup() |>  mutate(DOMAIN = "AE", STUDYID = StudyOID, USUBJID = SubjectKey) |>  select(    DOMAIN, STUDYID, USUBJID, AESEQ, AETERM,    AESTDTC, AEENDTC, AESEV, AESER  )dir.create("/app/output", showWarnings = FALSE)write_csv(events, "/app/output/ae.csv", na = "")

solutions/sdtm-ae-odm-repeated/result.py

Edit
112 lines
# Reference solution for the yamaa benchmark sdtm-ae-odm-repeated (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 the ODM long-format extract.One record per reported event: an event is one item-group occurrence on anAE form occurrence (subject, visit, visit repeat, form, form repeat).Occurrences without a reported term contribute no record."""import csvINPUT_PATH = "/app/input/odm.csv"OUTPUT_PATH = "/app/output/ae.csv"ITEM_NAMES = {    "IT.AE.AETERM": "AETERM",    "IT.AE.AESTDTC": "AESTDTC",    "IT.AE.AEENDTC": "AEENDTC",    "IT.AE.AESEV": "AESEV",    "IT.AE.AESER": "AESER",}VISIT_ORDER = {"SCREENING": 0, "BASELINE": 1}def repeat_number(value):    try:        return int(value)    except (TypeError, ValueError):        return 0def main():    with open(INPUT_PATH, newline="", encoding="utf-8") as handle:        rows = list(csv.DictReader(handle))    # Group the AE form items by event occurrence, keeping first-appearance    # order of visits for any visit not in the known visit order.    events = {}    visit_rank_seen = {}    for row in rows:        if row["FormOID"] != "FO.AE":            continue        visit = row["StudyEventOID"]        if visit not in visit_rank_seen:            visit_rank_seen[visit] = len(visit_rank_seen)        key = (            row["StudyOID"],            row["SubjectKey"],            visit,            row["StudyEventRepeatKey"],            row["FormOID"],            row["FormRepeatKey"],            row["ItemGroupOID"],            row["ItemGroupRepeatKey"],        )        event = events.setdefault(key, {})        field = ITEM_NAMES.get(row["ItemOID"])        if field is not None:            event[field] = row["Value"]    def sort_key(item):        key, _event = item        (_study, _subject, visit, visit_repeat, _form, form_repeat,         _group, group_repeat) = key        visit_rank = VISIT_ORDER.get(visit, 100 + visit_rank_seen[visit])        return (            visit_rank,            repeat_number(visit_repeat),            repeat_number(form_repeat),            repeat_number(group_repeat),        )    records_by_subject = {}    for key, event in events.items():        term = event.get("AETERM", "")        if term == "":            continue        studyid, usubjid = key[0], key[1]        records_by_subject.setdefault((studyid, usubjid), []).append(            (key, event))    output_rows = []    for (studyid, usubjid), subject_events in records_by_subject.items():        subject_events.sort(key=sort_key)        for seq, (_key, event) in enumerate(subject_events, start=1):            output_rows.append({                "DOMAIN": "AE",                "STUDYID": studyid,                "USUBJID": usubjid,                "AESEQ": seq,                "AETERM": event.get("AETERM", ""),                "AESTDTC": event.get("AESTDTC", ""),                "AEENDTC": event.get("AEENDTC", ""),                "AESEV": event.get("AESEV", ""),                "AESER": event.get("AESER", ""),            })    fieldnames = ["DOMAIN", "STUDYID", "USUBJID", "AESEQ", "AETERM",                  "AESTDTC", "AEENDTC", "AESEV", "AESER"]    with open(OUTPUT_PATH, "w", newline="", encoding="utf-8") as handle:        writer = csv.DictWriter(handle, fieldnames=fieldnames)        writer.writeheader()        writer.writerows(output_rows)if __name__ == "__main__":    main()

solutions/sdtm-ae-odm-repeated/result.sas

Edit
41 lines
/* opensas reference solution for the yamaa benchmark sdtm-ae-odm-repeated.   Reads the benchmark inputs and derives the requested output.   Execute with the existing opensas runtime: opensas /app/output/result.sas. */data odm;  length StudyOID MetaDataVersionOID SubjectKey StudyEventOID StudyEventRepeatKey FormOID FormRepeatKey ItemGroupOID ItemGroupRepeatKey ItemOID Value $1024;  infile "/app/input/odm.csv" dsd dlm="," firstobs=2 truncover lrecl=32767;  input StudyOID : $char1024. MetaDataVersionOID : $char1024. SubjectKey : $char1024. StudyEventOID : $char1024. StudyEventRepeatKey : $char1024. FormOID : $char1024. FormRepeatKey : $char1024. ItemGroupOID : $char1024. ItemGroupRepeatKey : $char1024. ItemOID : $char1024. Value : $char1024.;run;proc sort data=odm out=ordered; by StudyOID SubjectKey StudyEventOID StudyEventRepeatKey ItemGroupOID ItemGroupRepeatKey; run;data wide;  length AETERM AESTDTC AEENDTC AESEV AESER $1024;  retain AETERM AESTDTC AEENDTC AESEV AESER;  set ordered;  where ItemGroupOID='IG.AE';  by StudyOID SubjectKey StudyEventOID StudyEventRepeatKey ItemGroupOID ItemGroupRepeatKey;  if first.ItemGroupRepeatKey then do;    AETERM=''; AESTDTC=''; AEENDTC=''; AESEV=''; AESER='';  end;    if ItemOID='IT.AE.AETERM' then AETERM=Value;  if ItemOID='IT.AE.AESTDTC' then AESTDTC=Value;  if ItemOID='IT.AE.AEENDTC' then AEENDTC=Value;  if ItemOID='IT.AE.AESEV' then AESEV=Value;  if ItemOID='IT.AE.AESER' then AESER=Value;  if last.ItemGroupRepeatKey then output;run;data prepared; set wide; if not missing(AETERM);length DOMAIN $2 STUDYID USUBJID $1024; DOMAIN='AE'; STUDYID=StudyOID; USUBJID=SubjectKey;VISITORD=2; if StudyEventOID='SCREENING' then VISITORD=0; if StudyEventOID='BASELINE' then VISITORD=1;VISITREP=input(StudyEventRepeatKey,best32.); IGREP=input(ItemGroupRepeatKey,best32.); run;proc sort data=prepared; by STUDYID USUBJID VISITORD VISITREP IGREP; run;data result; set prepared; by STUDYID USUBJID; retain AESEQ;  if first.USUBJID then AESEQ=0;  AESEQ+1;run;proc sql;  create table final as select DOMAIN, STUDYID, USUBJID, AESEQ, AETERM, AESTDTC, AEENDTC, AESEV, AESER from result;quit;proc export data=final outfile="/app/output/ae.csv" dbms=csv replace; run;