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: mark each Analysis Data Model (ADaM) adverse event record with AFTIDXFL when it starts after the subject's index event -- the subject's first occurrence of a designated term (in the sample data, COVID-19).

Input: one record per adverse event (AE), carrying the coded term AEDECOD and the event start date AESTDTC (kept in the output as ASTDT).

Variables:

  • AFTIDXFL: Y for an event ordered strictly after the subject's index event: a later start date, or the same start date with a higher sequence number. Blank otherwise: the index event itself, every record of a subject with no index event, and any record with no start date.

Note: ordering is within each subject by start date, with the sequence number (AESEQ) breaking ties on the same date.

Inputs

Under review
1 source file

input/ae.csv

Edit
11 rows
input/ae.csv
STUDYIDUSUBJIDAESEQAEDECODAESTDTC
YAMAA-011HEADACHE2023-01-10
YAMAA-012COVID-192023-01-15
YAMAA-013COUGH2023-01-15
YAMAA-014FATIGUE2023-01-20
YAMAA-015NAUSEA—
YAMAA-011NAUSEA2023-02-01
YAMAA-012FATIGUE2023-02-04
YAMAA-011COVID-192023-03-01
YAMAA-012COVID-192023-03-01
YAMAA-013PYREXIA2023-03-03
YAMAA-011COVID-192023-04-05

Expected output

Under review
11 expected rows

expected/adae.csv

Edit
11 rows
expected/adae.csv
STUDYIDUSUBJIDAESEQAEDECODASTDTAFTIDXFL
YAMAA-011HEADACHE2023-01-10—
YAMAA-012COVID-192023-01-15—
YAMAA-013COUGH2023-01-15Y
YAMAA-014FATIGUE2023-01-20Y
YAMAA-015NAUSEA——
YAMAA-011NAUSEA2023-02-01—
YAMAA-012FATIGUE2023-02-04—
YAMAA-011COVID-192023-03-01—
YAMAA-012COVID-192023-03-01Y
YAMAA-013PYREXIA2023-03-03Y
YAMAA-011COVID-192023-04-05—
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
ADAESTUDYIDStudy IdentifiercharacterCopy value from AE.STUDYID.Predecessor
ADAEUSUBJIDUnique Subject IdentifiercharacterCopy value from AE.USUBJID.Predecessor
ADAEAESEQSequence NumbernumericCopy value from AE.AESEQ.Predecessor
ADAEAEDECODDictionary-Derived TermcharacterCopy value from AE.AEDECOD.Predecessor
ADAEASTDTAnalysis Start DatenumericISO 8601Copy value from AE.AESTDTC.Predecessor
ADAEAFTIDXFLAfter Index Event Flagcharacter"Y" when ASTDT > AESTDTC OR (ASTDT = AESTDTC AND AESEQ > AESEQ), with AESTDTC taken from the first AE record matching on STUDYID and USUBJID, where AE.AEDECOD = 'COVID-19', ordered by AE.AESTDTC then AE.AESEQ, and no match yields blank and AESEQ taken from the first AE record matching on STUDYID and USUBJID, where AE.AEDECOD = 'COVID-19', ordered by AE.AESTDTC then AE.AESEQ, and no match yields blank; blank otherwise.Derived
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-adae-post-index/full.md

Edit
18 lines

Following CDISC ADaM standards, use the provided AE dataset 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, AEDECOD, ASTDT, AFTIDXFL

The index event for a subject is the subject's first record with AEDECOD "COVID-19", ordered within the subject by ASTDT, with AESEQ breaking ties between records that share a start date.

AFTIDXFL is "Y" for a record ordered strictly after the subject's index event: a record with a later ASTDT than the index event, or the same ASTDT and a higher AESEQ. AFTIDXFL has no value otherwise: for the index event itself, for every record of a subject with no index event, and for any record with no start date.

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

prompts/adam-adae-post-index/conventions.md

Edit
10 lines

Following CDISC ADaM standards, use the provided AE dataset 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, AEDECOD, ASTDT, AFTIDXFL

AFTIDXFL is "Y" or has no value.

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

prompts/adam-adae-post-index/brief.md

Edit
8 lines

Following CDISC ADaM standards, use the provided AE dataset 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, AEDECOD, ASTDT, AFTIDXFL

Read the source datasets from /app/input and save the completed dataset as /app/output/adae.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-adae-post-index/result.R

Edit
37 lines
# Reference solution for the yamaa benchmark adam-adae-post-index (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()))# Each subject's index event: the earliest start date, with the# higher sequence number ordered after on the same date.first_index <- ae |>  filter(AEDECOD %in% "COVID-19", !is.na(AESTDTC), AESTDTC != "") |>  arrange(USUBJID, AESTDTC, AESEQ) |>  distinct(USUBJID, .keep_all = TRUE) |>  select(USUBJID, FIRST_DT = AESTDTC, FIRST_SEQ = AESEQ)adae <- ae |>  left_join(first_index, by = "USUBJID") |>  mutate(    ASTDT = if_else(is.na(AESTDTC) | AESTDTC == "", NA_character_, AESTDTC),    AFTIDXFL = if_else(      !is.na(ASTDT) & !is.na(FIRST_DT) &        (ASTDT > FIRST_DT | (ASTDT == FIRST_DT & AESEQ > FIRST_SEQ)),      "Y",      NA_character_    )  ) |>  select(STUDYID, USUBJID, AESEQ, AEDECOD, ASTDT, AFTIDXFL)dir.create("/app/output", showWarnings = FALSE)write_csv(adae, "/app/output/adae.csv", na = "")

solutions/adam-adae-post-index/result.py

Edit
78 lines
# Reference solution for the yamaa benchmark adam-adae-post-index (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 ADAE from AE: flag records strictly after each subject'sindex event (first COVID-19 record by ASTDT, AESEQ breaking ties)."""import csvfrom datetime import dateINPUT_AE = "/app/input/ae.csv"OUTPUT_ADAE = "/app/output/adae.csv"COLUMNS = ["STUDYID", "USUBJID", "AESEQ", "AEDECOD", "ASTDT", "AFTIDXFL"]def parse_date(text):    text = (text or "").strip()    if not text:        return None    return date.fromisoformat(text)def main():    with open(INPUT_AE, newline="", encoding="utf-8") as f:        rows = list(csv.DictReader(f))    for row in rows:        row["_astdt"] = parse_date(row["AESTDTC"])        row["_aeseq"] = int(row["AESEQ"])    # Index event per subject: first COVID-19 record ordered by ASTDT,    # AESEQ breaking ties; records with no start date order last.    index = {}    for row in rows:        if row["AEDECOD"] != "COVID-19":            continue        key = (            row["_astdt"] is None,            row["_astdt"] or date.min,            row["_aeseq"],        )        subject = row["USUBJID"]        if subject not in index or key < index[subject][0]:            index[subject] = (key, row)    out = []    for row in rows:        flag = ""        subject = row["USUBJID"]        if subject in index and row["_astdt"] is not None:            _, idx = index[subject]            if row["_astdt"] > idx["_astdt"] or (                row["_astdt"] == idx["_astdt"]                and row["_aeseq"] > idx["_aeseq"]            ):                flag = "Y"        out.append(            {                "STUDYID": row["STUDYID"],                "USUBJID": row["USUBJID"],                "AESEQ": row["AESEQ"],                "AEDECOD": row["AEDECOD"],                "ASTDT": row["_astdt"].isoformat() if row["_astdt"] else "",                "AFTIDXFL": flag,            }        )    with open(OUTPUT_ADAE, "w", newline="", encoding="utf-8") as f:        writer = csv.DictWriter(f, fieldnames=COLUMNS)        writer.writeheader()        writer.writerows(out)if __name__ == "__main__":    main()

solutions/adam-adae-post-index/result.sas

Edit
22 lines
/* opensas reference solution for the yamaa benchmark adam-adae-post-index.   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 AEDECOD AESTDTC $1024;  infile "/app/input/ae.csv" dsd dlm="," firstobs=2 truncover lrecl=32767;  input STUDYID : $char1024. USUBJID : $char1024. AESEQ AEDECOD : $char1024. AESTDTC : $char1024.;run;proc sort data=ae(where=(AEDECOD='COVID-19' and AESTDTC ne '')) out=indices; by STUDYID USUBJID AESTDTC AESEQ; run;data firstindex; set indices; by STUDYID USUBJID; if first.USUBJID; run;proc sql;  create table result as select a.*,a.AESTDTC as ASTDT,  case when not missing(a.AESTDTC) and not missing(b.AESTDTC) and (a.AESTDTC>b.AESTDTC or (a.AESTDTC=b.AESTDTC and a.AESEQ>b.AESEQ)) then 'Y' else '' end as AFTIDXFL  from ae as a left join firstindex as b on a.STUDYID=b.STUDYID and a.USUBJID=b.USUBJID;quit;proc sql;  create table final as select STUDYID, USUBJID, AESEQ, AEDECOD, ASTDT, AFTIDXFL from result;quit;proc export data=final outfile="/app/output/adae.csv" dbms=csv replace; run;