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.
- 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.
- Inputs: Do they look like data collected in a real trial, and do they include the situations you would expect to meet in one?
- 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
README.mdGoal: 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:
ASTDTis the analysis start date, taken from the collected start date as it stands. It is empty when no start date was collected.ASTDT2is the calendar date of the collected start datetime. It is empty when no start datetime was collected.REVIEWFLisYwhen the event clears all three review checks; anything else isN.
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 review1 source fileinput/ae.csv
Edit12 rows| STUDYID | USUBJID | AESEQ | AESTDTC | AESTDTM | AETERM | SCORE |
|---|---|---|---|---|---|---|
| PILOT7 | 1 | 2025-01-15 | — | INF_REACTION | -1 | |
| PILOT7 | 2 | — | 2025-02-01T09:30 | INF_REACTION | -2 | |
| PILOT7 | 1 | — | — | INF_REACTION | 0 | |
| PILOT7 | 1 | 2025-01-20 | — | INFXREACTION | 0 | |
| PILOT7 | 2 | 2025-01-01 | — | INF_REACTION | -1.5 | |
| PILOT7 | 3 | 2025-01-31 | — | INF_ | 0 | |
| PILOT7 | 1 | 2024-12-31 | — | INF_REACTION | 0 | |
| PILOT7 | 2 | — | 2025-02-01T09:29 | INF_REACTION | 0 | |
| PILOT7 | 3 | — | 2025-02-01T09:30 | INF_REACTION | -1.5 | |
| PILOT7 | 1 | 2025-01-15 | — | INF | 0 | |
| PILOT7 | 2 | 2025-01-15 | — | INF_REACTION | — | |
| PILOT7 | 3 | 2025-01-15 | — | INF_REACTION | -1.6 |
Expected output
Under review12 expected rowsexpected/adae.csv
Edit12 rows| STUDYID | USUBJID | AESEQ | ASTDT | ASTDT2 | REVIEWFL |
|---|---|---|---|---|---|
| PILOT7 | 1 | 2025-01-15 | — | Y | |
| PILOT7 | 2 | — | 2025-02-01 | N | |
| PILOT7 | 1 | — | — | N | |
| PILOT7 | 1 | 2025-01-20 | — | N | |
| PILOT7 | 2 | 2025-01-01 | — | Y | |
| PILOT7 | 3 | 2025-01-31 | — | Y | |
| PILOT7 | 1 | 2024-12-31 | — | N | |
| PILOT7 | 2 | — | 2025-02-01 | N | |
| PILOT7 | 3 | — | 2025-02-01 | Y | |
| PILOT7 | 1 | 2025-01-15 | — | N | |
| PILOT7 | 2 | 2025-01-15 | — | N | |
| PILOT7 | 3 | 2025-01-15 | — | N |
Comments and assessment materials
| Dataset Name | Variable Name | Variable Label | Type | Codelist/Controlled Terms | Core | Computational Method | Origin |
|---|---|---|---|---|---|---|---|
| ADAE | STUDYID | Study Identifier | character | Copy value from AE.STUDYID. | Predecessor | ||
| ADAE | USUBJID | Unique Subject Identifier | character | Copy value from AE.USUBJID. | Predecessor | ||
| ADAE | AESEQ | Sequence Number | numeric | Copy value from AE.AESEQ. | Predecessor | ||
| ADAE | ASTDT | Analysis Start Date | numeric | ISO 8601 | Copy value from AE.AESTDTC. | Predecessor | |
| ADAE | ASTDT2 | Analysis Start Date from Datetime | numeric | ISO 8601 | Take the date part of AE.AESTDTM. | Derived | |
| ADAE | REVIEWFL | Protocol Review Flag | character | Y, N | If (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 |
| Variable | Permitted values |
|---|---|
| REVIEWFL | Y, N |
| Version | Date | Author | Description | Reviewer | Sign-off |
|---|---|---|---|---|---|
| 1.3 | 2026-09-29 | yamaa docs build | Show study codelist names, external dictionaries, and ISO 8601 formats in variable rows; list the document's codelist values and metadata | ||
| 1.2 | 2026-09-29 | yamaa docs build | Classify ADaM copies from a declared input as Predecessor and recodes as Derived, and SDTM recodes of locally derived columns as Derived | ||
| 1.1 | 2026-09-29 | yamaa docs build | Resolve lookups into the donor record they select, and give every derivation shape a plain-language rule instead of its raw YAML | ||
| 1.0 | yamaa docs build | Initial generation from spec.yaml |
prompts/adam-adae-protocol-review/full.md
Edit24 linesFollowing 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
Edit10 linesFollowing 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
Edit8 linesFollowing 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.
run.R
Edit4 lineslibrary(yamaa)adae <- yamaa_domain("spec.yaml")$outputadaerun.py
Edit4 linesimport yamaaadae = yamaa.yamaa_domain("spec.yaml").outputadaesolutions/adam-adae-protocol-review/result.R
Edit38 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
Edit47 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
Edit24 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;
yamaa
Comments
Signed in with GitHub; saved in repository Discussions