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
README.mdPublic entries: Python and R. Passing coverage requires an installed inventory.
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:
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 |
Human review and assessment
| 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, blank for a year or a year and month alone. | 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.7 | 2026-10-20 | yamaa docs build | Read 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.6 | 2026-10-17 | yamaa docs build | Describe collected date parts written as ISO 8601 date text and times of day counted in seconds since midnight | ||
| 1.5 | 2026-10-17 | yamaa docs build | Name 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.4 | 2026-10-15 | yamaa docs build | State datetime precision codes through the hour and minute, and complete only the time parts a collected datetime lacks | ||
| 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
Edit27 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 analysis start date, taken from the collected start date (AESTDTC) as it stands; it has no value when no start date was collected. ASTDT2 is the calendar date of the collected start datetime (AESTDTM); it has no value when no start datetime was collected.
REVIEWFL is "Y" when the event clears all three review checks, and "N" otherwise. The checks are a review window, a term pattern, and a score floor.
- the review window: the collected start date falls in January 2025, or the collected start datetime is at or after 09:30 on 1 February 2025;
- the term pattern: the reported term (AETERM) begins with the literal text "INF_", where the underscore is a literal character, so "INFXREACTION" does not qualify;
- the score floor: the protocol review score (SCORE) is -1.5 or higher.
An event with neither a start date nor a start datetime known cannot fall in a window, so its REVIEWFL is "N". An event whose score has no value does not clear the score check, so its REVIEWFL 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.
R
Edit3 lineslibrary(yamaa)yamaa_spec("spec.yaml")$run()$outputPython
Edit3 linesimport yamaayamaa.spec("spec.yaml").run().outputsolutions/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
Edit91 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."""Build ADAE from AE with protocol-review flags (ADaM)."""import csvfrom datetime import date, datetimeINPUT_CSV = "/app/input/ae.csv"OUTPUT_CSV = "/app/output/adae.csv"COLUMNS = ["STUDYID", "USUBJID", "AESEQ", "ASTDT", "ASTDT2", "REVIEWFL"]def parse_date(text): try: return date.fromisoformat(text) except ValueError: return Nonedef parse_datetime(text): try: return datetime.fromisoformat(text) except ValueError: return Nonedef in_window(aestdtc, aestdtm): if aestdtc: d = parse_date(aestdtc) if d is not None and d.year == 2025 and d.month == 1: return True if aestdtm: dt = parse_datetime(aestdtm) if dt is not None and dt >= datetime(2025, 2, 1, 9, 30): return True return Falsedef main(): with open(INPUT_CSV, newline="") as f: rows = list(csv.DictReader(f)) out_rows = [] for row in rows: aestdtc = (row.get("AESTDTC") or "").strip() aestdtm = (row.get("AESTDTM") or "").strip() aeterm = row.get("AETERM") or "" score_text = (row.get("SCORE") or "").strip() astdt = aestdtc astdt2 = "" if aestdtm: dt = parse_datetime(aestdtm) if dt is not None: astdt2 = dt.date().isoformat() window_ok = in_window(aestdtc, aestdtm) term_ok = aeterm.startswith("INF_") score_ok = False if score_text: try: score_ok = float(score_text) >= -1.5 except ValueError: score_ok = False reviewfl = "Y" if (window_ok and term_ok and score_ok) else "N" out_rows.append( { "STUDYID": row.get("STUDYID", ""), "USUBJID": row.get("USUBJID", ""), "AESEQ": row.get("AESEQ", ""), "ASTDT": astdt, "ASTDT2": astdt2, "REVIEWFL": reviewfl, } ) with open(OUTPUT_CSV, "w", newline="") as f: writer = csv.DictWriter(f, fieldnames=COLUMNS) writer.writeheader() writer.writerows(out_rows)if __name__ == "__main__": main()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