Review ask

As a clinical trial statistician or programmer, challenge anything in this benchmark: describe a problem in Comments, or propose a fix with the Edit button on any source file.

  1. Task: Would a real study need this derivation, specified this way? Does it follow CDISC ADaM: variable names, controlled terms, record structure? Flag any rule that is ambiguous or that a sponsor would handle differently.
  2. Inputs: Do they look like data collected in a real trial, and do they include the situations you would expect to meet in one?
  3. Expected output: Would independent QC programming reproduce every value from these inputs and rules?

The other tabs beside Comments are background for assessment, not under review.

Summary

Lifecycle: reviewedEditUnder review
What this benchmark means
README.md

Goal: one row per adverse event (AE), flagging the events a protocol reviewer needs to look at (REVIEWFL).

Input: adverse event records carrying the reported term (AETERM), a protocol review score (SCORE), the collected start date (AESTDTC, empty when never collected), and the collected start datetime (AESTDTM, empty when never collected).

Variables:

  • ASTDT is the analysis start date, taken from the collected start date as it stands. It is empty when no start date was collected.
  • ASTDT2 is the calendar date of the collected start datetime. It is empty when no start datetime was collected.
  • REVIEWFL is Y when the event clears all three review checks; anything else is N.

Note: the three checks are a review window, a term pattern, and a score floor. The window is either the collected start date falling in January 2025, or the collected start datetime falling at or after 09:30 on 1 February 2025. The reported term must begin with the literal text INF_ (the underscore is a literal character, so INFXREACTION does not match). The protocol review score must be -1.5 or higher. An event with neither a start date nor a start datetime known cannot fall in a window, so it is N.

Inputs

Under review
1 source file

input/ae.csv

Edit
12 rows
input/ae.csv
STUDYIDUSUBJIDAESEQAESTDTCAESTDTMAETERMSCORE
PILOT712025-01-15—INF_REACTION-1
PILOT72—2025-02-01T09:30INF_REACTION-2
PILOT71——INF_REACTION0
PILOT712025-01-20—INFXREACTION0
PILOT722025-01-01—INF_REACTION-1.5
PILOT732025-01-31—INF_0
PILOT712024-12-31—INF_REACTION0
PILOT72—2025-02-01T09:29INF_REACTION0
PILOT73—2025-02-01T09:30INF_REACTION-1.5
PILOT712025-01-15—INF0
PILOT722025-01-15—INF_REACTION—
PILOT732025-01-15—INF_REACTION-1.6

Expected output

Under review
12 expected rows

expected/adae.csv

Edit
12 rows
expected/adae.csv
STUDYIDUSUBJIDAESEQASTDTASTDT2REVIEWFL
PILOT712025-01-15—Y
PILOT72—2025-02-01N
PILOT71——N
PILOT712025-01-20—N
PILOT722025-01-01—Y
PILOT732025-01-31—Y
PILOT712024-12-31—N
PILOT72—2025-02-01N
PILOT73—2025-02-01Y
PILOT712025-01-15—N
PILOT722025-01-15—N
PILOT732025-01-15—N
Shaded columns are derived— = missing value

Comments and assessment materials

Comments

Signed in with GitHub; saved in repository 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
ADAEASTDTAnalysis Start DatenumericISO 8601Copy value from AE.AESTDTC.Predecessor
ADAEASTDT2Analysis Start Date from DatetimenumericISO 8601Take the date part of AE.AESTDTM.Derived
ADAEREVIEWFLProtocol Review FlagcharacterY, NIf (ASTDT BETWEEN DATE '2025-01-01' AND DATE '2025-01-31' OR AE.AESTDTM >= DATETIME '2025-02-01T09:30') AND AE.AETERM LIKE 'INF!_%' ESCAPE '!' AND AE.SCORE >= -1.5 then "Y"; otherwise "N".Derived
VariablePermitted values
REVIEWFLY, N
VersionDateAuthorDescriptionReviewerSign-off
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-protocol-review/full.md

Edit
24 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, ASTDT, ASTDT2, REVIEWFL

ASTDT is the collected start date as it stands, and has no value when no start date was collected. ASTDT2 is the calendar date of the collected start datetime, and has no value when no start datetime was collected.

REVIEWFL is Y when the event clears all three review checks, and N otherwise:

  • the review window: the collected start date falls in January 2025, or the collected start datetime falls at or after 09:30 on 1 February 2025;
  • the reported term begins with the literal text INF_, where the underscore is a literal character, so a term with any other character in that position does not match;
  • the protocol review score is -1.5 or higher. An event with neither a start date nor a start datetime known is N.

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

prompts/adam-adae-protocol-review/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, ASTDT, ASTDT2, REVIEWFL

REVIEWFL is Y or N.

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

prompts/adam-adae-protocol-review/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, ASTDT, ASTDT2, REVIEWFL

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

yamaa code

Runs the yamaa specification; its result must match the expected output

run.R

Edit
4 lines
library(yamaa)adae <- yamaa_domain("spec.yaml")$outputadae

run.py

Edit
4 lines
import yamaaadae = yamaa.yamaa_domain("spec.yaml").outputadae

Solution without yamaa

Written from the full prompt and the inputs alone; CI checks it reproduces the expected output

solutions/adam-adae-protocol-review/result.R

Edit
38 lines
# Reference solution for the yamaa benchmark adam-adae-protocol-review (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(stringr)ae <- read_csv(  "/app/input/ae.csv",  col_types = cols(AESEQ = col_integer(), SCORE = col_double(), .default = col_character()))adae <- ae |>  mutate(    ASTDT = if_else(is.na(AESTDTC) | AESTDTC == "", NA_character_, AESTDTC),    # The calendar date of the collected start datetime.    ASTDT2 = if_else(      is.na(AESTDTM) | AESTDTM == "",      NA_character_,      str_extract(AESTDTM, "^\\d{4}-\\d{2}-\\d{2}")    ),    # The review window: the collected start date falls in January 2025,    # or the collected start datetime falls at or after 09:30 on    # 1 February 2025.    in_window = str_starts(coalesce(ASTDT, ""), "2025-01") |      (coalesce(AESTDTM, "") >= "2025-02-01T09:30" & !is.na(AESTDTM) & AESTDTM != ""),    # The reported term begins with the literal text INF_.    term_ok = str_starts(coalesce(AETERM, ""), "INF_"),    score_ok = !is.na(SCORE) & SCORE >= -1.5,    REVIEWFL = if_else(in_window & term_ok & score_ok, "Y", "N")  ) |>  select(STUDYID, USUBJID, AESEQ, ASTDT, ASTDT2, REVIEWFL)dir.create("/app/output", showWarnings = FALSE)write_csv(adae, "/app/output/adae.csv", na = "")

solutions/adam-adae-protocol-review/result.py

Edit
47 lines
# Reference solution for the yamaa benchmark adam-adae-protocol-review (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.from pathlib import Pathimport polars as plae = pl.read_csv("/app/input/ae.csv", infer_schema=False).with_columns(    pl.col("AESEQ").cast(pl.Int64), pl.col("SCORE").cast(pl.Float64))adae = (    ae.with_columns(        ASTDT=pl.when(pl.col("AESTDTC").is_not_null() & (pl.col("AESTDTC") != ""))        .then(pl.col("AESTDTC"))        .otherwise(None),        ASTDT2=pl.when(pl.col("AESTDTM").is_not_null() & (pl.col("AESTDTM") != ""))        .then(pl.col("AESTDTM").str.extract(r"^(\d{4}-\d{2}-\d{2})", group_index=1))        .otherwise(None),    )    .with_columns(        REVIEWFL=pl.when(            (                pl.col("ASTDT").is_not_null()                & pl.col("ASTDT").str.starts_with("2025-01")                | (                    pl.col("AESTDTM").is_not_null()                    & (pl.col("AESTDTM") != "")                    & (pl.col("AESTDTM") >= "2025-02-01T09:30")                )            )            & pl.col("AETERM").is_not_null()            & pl.col("AETERM").str.starts_with("INF_")            & pl.col("SCORE").is_not_null()            & (pl.col("SCORE") >= -1.5)        )        .then(pl.lit("Y"))        .otherwise(pl.lit("N"))    )    .select("STUDYID", "USUBJID", "AESEQ", "ASTDT", "ASTDT2", "REVIEWFL"))Path("/app/output").mkdir(exist_ok=True)adae.write_csv("/app/output/adae.csv")

solutions/adam-adae-protocol-review/result.sas

Edit
24 lines
/* opensas reference solution for the yamaa benchmark adam-adae-protocol-review.   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 AESTDTC AESTDTM AETERM SCORE $1024;  infile "/app/input/ae.csv" dsd dlm="," firstobs=2 truncover lrecl=32767;  input STUDYID : $char1024. USUBJID : $char1024. AESEQ AESTDTC : $char1024. AESTDTM : $char1024. AETERM : $char1024. SCORE : $char1024.;run;data result;  length ASTDT ASTDT2 $10 REVIEWFL $1;  set ae;  ASTDT=AESTDTC; ASTDT2=''; if lengthn(AESTDTM)>=10 then ASTDT2=substr(AESTDTM,1,10);  REVIEWFL='N';  INFTERM=0;  if lengthn(AETERM)>=4 then INFTERM=(substr(AETERM,1,4)='INF_');  if ((AESTDTC>='2025-01-01' and AESTDTC<='2025-01-31') or AESTDTM>='2025-02-01T09:30') and INFTERM=1 and not missing(SCORE) and input(SCORE,?? best32.)>=-1.5 then REVIEWFL='Y';run;proc sql;  create table final as select STUDYID, USUBJID, AESEQ, ASTDT, ASTDT2, REVIEWFL from result;quit;proc export data=final outfile="/app/output/adae.csv" dbms=csv replace; run;