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: reviewedEditUnder review
What this benchmark means
README.md

Public entries: Python and R. Passing coverage requires an installed inventory.

Goal: number each subject's serious events (AESER is Y) in onset order as SERSEQ, so the earliest serious event carries 1.

Input: adverse event records carrying the collection sequence (AESEQ), the serious flag (AESER), and the onset date (AESTDTC, carried as ASTDT; empty when the onset was never collected).

Variables:

  • SERSEQ holds the running number of the subject's serious events, ordered by onset date. Events sharing one onset date follow the order of their collection sequence, and a serious event with no onset date is numbered last. It stays empty for events that are not serious.

Note: numbering restarts for each subject, so a subject with no serious event keeps every record unnumbered.

Inputs

Under review
1 source file

input/ae.csv

Edit
10 rows
input/ae.csv
STUDYIDUSUBJIDAESEQAETERMAESERAESTDTC
PILOT71NauseaN2023-02-11
PILOT72PneumonitisY2023-03-04
PILOT73NeutropeniaY2023-02-20
PILOT74PneumoniaY2023-02-20
PILOT75AnemiaY—
PILOT71FatigueN2023-01-15
PILOT72HeadacheN2023-02-02
PILOT73DizzinessN—
PILOT71RashY2023-05-10
PILOT72VomitingN2023-05-12

Expected output

Under review
10 expected rows

expected/adae.csv

Edit
10 rows
expected/adae.csv
STUDYIDUSUBJIDAESEQAESERASTDTSERSEQ
PILOT71N2023-02-11—
PILOT72Y2023-03-043
PILOT73Y2023-02-201
PILOT74Y2023-02-202
PILOT75Y—4
PILOT71N2023-01-15—
PILOT72N2023-02-02—
PILOT73N——
PILOT71Y2023-05-101
PILOT72N2023-05-12—
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
ADAEAESERSerious EventcharacterY, NCopy value from AE.AESER.Predecessor
ADAEASTDTAnalysis Start DatenumericISO 8601Copy value from AE.AESTDTC.Predecessor
ADAESERSEQSerious Event Sequence NumbernumericRow number within each group of STUDYID, USUBJID, ordered by ASTDT, nulls last then AESEQ.Derived
VariablePermitted values
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/adam-adae-serious-sequence/full.md

Edit
17 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, AESER, ASTDT, SERSEQ

SERSEQ is the running number of a subject's serious events, the records with AESER equal to "Y", ordered by ASTDT: a subject's earliest serious event is 1, and each later serious event takes the next number. Serious events that share one ASTDT follow the order of AESEQ. A serious event with no ASTDT is numbered after every serious event of that subject that has one, and serious events with no ASTDT follow the order of AESEQ among themselves. SERSEQ has no value for a record that is not serious, and a subject with no serious event has no numbered record.

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

prompts/adam-adae-serious-sequence/conventions.md

Edit
15 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, AESER, ASTDT, SERSEQ

SERSEQ is the running number of a subject's records, ordered by ASTDT: a subject's earliest record is 1, and each later record takes the next number. Records that share one ASTDT follow the order of AESEQ. A record with no ASTDT is numbered after every record of that subject that has one, and records with no ASTDT follow the order of AESEQ among themselves.

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

prompts/adam-adae-serious-sequence/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, AESER, ASTDT, SERSEQ

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-serious-sequence/result.R

Edit
33 lines
# Reference solution for the yamaa benchmark adam-adae-serious-sequence (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()))# Number the subject's serious events in onset order, so the earliest# carries 1. Events sharing one onset date follow collection order, and# a serious event with no onset date is numbered last.numbered <- ae |>  filter(AESER %in% "Y") |>  mutate(ASTDT = if_else(is.na(AESTDTC) | AESTDTC == "", NA_character_, AESTDTC)) |>  arrange(USUBJID, is.na(ASTDT), ASTDT, AESEQ) |>  group_by(USUBJID) |>  mutate(SERSEQ = row_number()) |>  ungroup() |>  select(USUBJID, AESEQ, SERSEQ)adae <- ae |>  mutate(ASTDT = if_else(is.na(AESTDTC) | AESTDTC == "", NA_character_, AESTDTC)) |>  left_join(numbered, by = c("USUBJID", "AESEQ")) |>  select(STUDYID, USUBJID, AESEQ, AESER, ASTDT, SERSEQ)dir.create("/app/output", showWarnings = FALSE)write_csv(adae, "/app/output/adae.csv", na = "")

solutions/adam-adae-serious-sequence/result.py

Edit
49 lines
# Reference solution for the yamaa benchmark adam-adae-serious-sequence (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")def main():    with open(INPUT_DIR / "ae.csv", newline="") as f:        rows = list(csv.DictReader(f))    # ASTDT is the start date collected in AESTDTC, blank when none.    for row in rows:        row["ASTDT"] = (row.get("AESTDTC") or "").strip()        row["SERSEQ"] = ""    # SERSEQ numbers each subject's serious events (AESER "Y") from 1,    # ordered by ASTDT with AESEQ breaking ties; serious events with no    # ASTDT come after every dated one, in AESEQ order among themselves.    serious = {}    for idx, row in enumerate(rows):        if (row.get("AESER") or "").strip() == "Y":            serious.setdefault(row["USUBJID"], []).append(idx)    for idxs in serious.values():        def sort_key(i):            r = rows[i]            return (0 if r["ASTDT"] else 1, r["ASTDT"], int(r["AESEQ"]))        for n, i in enumerate(sorted(idxs, key=sort_key), start=1):            rows[i]["SERSEQ"] = str(n)    fieldnames = ["STUDYID", "USUBJID", "AESEQ", "AESER", "ASTDT", "SERSEQ"]    OUTPUT_DIR.mkdir(parents=True, exist_ok=True)    with open(OUTPUT_DIR / "adae.csv", "w", newline="") as f:        writer = csv.DictWriter(f, fieldnames=fieldnames)        writer.writeheader()        for row in rows:            writer.writerow({k: row.get(k, "") for k in fieldnames})if __name__ == "__main__":    main()

solutions/adam-adae-serious-sequence/result.sas

Edit
24 lines
/* opensas reference solution for the yamaa benchmark adam-adae-serious-sequence.   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 AESER AESTDTC $1024;  infile "/app/input/ae.csv" dsd dlm="," firstobs=2 truncover lrecl=32767;  input STUDYID : $char1024. USUBJID : $char1024. AESEQ AETERM : $char1024. AESER : $char1024. AESTDTC : $char1024.;run;data ordered; set ae; nodate=missing(AESTDTC); run;proc sort data=ordered; by STUDYID USUBJID nodate AESTDTC AESEQ; run;data result;  length ASTDT $10;  set ordered; by STUDYID USUBJID;  if first.USUBJID then counter=0;  ASTDT=AESTDTC;  if AESER='Y' then do; counter+1; SERSEQ=counter; end;run;proc sql;  create table final as select STUDYID, USUBJID, AESEQ, AESER, ASTDT, SERSEQ from result;quit;proc export data=final outfile="/app/output/adae.csv" dbms=csv replace; run;