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: standardize the free text a site enters for each adverse event (the reported term and the causality) and pull the reference number out of the sponsor's identifier.

Input: the site's AE records (input/ae.csv) carrying the collected AESPID, AETERM, and AEREL.

Variables:

  • AEREFNUM is the number taken from AESPID values shaped like AE-001; a missing identifier gives 0 and any other shape gives -1.
  • AETERMLO is the reported term in lower case.
  • AERELLC is the causality in lower case; a missing causality gives not reported.
  • AREL is the analysis causality in upper case: RELATED, POSSIBLY RELATED, NOT RELATED, or NOT REPORTED.

Note: the identifier pattern accepts exactly three digits, so AE-000 gives 0 (the same value a missing identifier gives), while AE-1000 and a lowercase ae-007 each give -1.

Inputs

Under review
1 source file

input/ae.csv

Edit
10 rows
input/ae.csv
STUDYIDUSUBJIDAESEQAESPIDAETERMAEREL
CATH-011AE-001HeadacheRELATED
CATH-012—HEADACHEPossibly Related
CATH-013BAD-IDNausea—
CATH-011AE-104FatigueNOT RELATED
CATH-012—DizzinessNOT RELATED
CATH-013AE-999hEADACHErelated
CATH-011AE-000VomitingNOT RELATED
CATH-012AE-1000Abdominal PainPossibly Related
CATH-013ae-007Rash—
CATH-014AE-007PruritusNot Related

Expected output

Under review
10 expected rows

expected/adae.csv

Edit
10 rows
expected/adae.csv
STUDYIDUSUBJIDAESEQAESPIDAEREFNUMAETERMAETERMLOAERELLCAREL
CATH-011AE-0011HeadacheheadacherelatedRELATED
CATH-012—0HEADACHEheadachepossibly relatedPOSSIBLY RELATED
CATH-013BAD-ID-1Nauseanauseanot reportedNOT REPORTED
CATH-011AE-104104Fatiguefatiguenot relatedNOT RELATED
CATH-012—0Dizzinessdizzinessnot relatedNOT RELATED
CATH-013AE-999999hEADACHEheadacherelatedRELATED
CATH-011AE-0000Vomitingvomitingnot relatedNOT RELATED
CATH-012AE-1000-1Abdominal Painabdominal painpossibly relatedPOSSIBLY RELATED
CATH-013ae-007-1Rashrashnot reportedNOT REPORTED
CATH-014AE-0077Prurituspruritusnot relatedNOT RELATED
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
ADAEAESPIDSponsor-Defined IdentifiercharacterCopy value from AE.AESPID.Predecessor
ADAEAEREFNUMAdverse Event Reference NumbernumericExtract capture group 1 matching ^AE-([0-9]{3})$ from AESPID; a missing source → "0"; no match → "-1".Derived
ADAEAETERMReported Term for the Adverse EventcharacterCopy value from AE.AETERM.Predecessor
ADAEAETERMLOReported Term in Lower CasecharacterConvert AETERM to lower case.Derived
ADAEAERELLCCausality in Lower CasecharacterConvert AE.AEREL to lower case; a missing source → "not reported".Derived
ADAEARELAnalysis CausalitycharacterRELATED, POSSIBLY RELATED, NOT RELATED, NOT REPORTEDConvert AERELLC to upper case.Derived
VariablePermitted values
ARELRELATED, POSSIBLY RELATED, NOT RELATED, NOT REPORTED
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-text-cleanup/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, AESPID, AEREFNUM, AETERM, AETERMLO, AERELLC, AREL

AEREFNUM is the number taken from an AESPID made of the upper-case letters AE, a hyphen, and exactly three digits, so "AE-042" gives 42 and three zeroes give 0. A missing identifier gives 0, and any other shape, including lower-case letters or more or fewer digits, gives -1. AETERMLO is the reported term in lower case. AERELLC is the causality in lower case; a missing causality gives "not reported". AREL is the analysis causality in upper case: RELATED, POSSIBLY RELATED, NOT RELATED, or NOT REPORTED.

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

prompts/adam-adae-text-cleanup/conventions.md

Edit
13 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, AESPID, AEREFNUM, AETERM, AETERMLO, AERELLC, AREL

AEREFNUM is a number, or -1. AETERMLO is in lower case. AERELLC is in lower case, or is "not reported". AREL is the analysis causality in upper case, or NOT REPORTED.

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

prompts/adam-adae-text-cleanup/brief.md

Edit
9 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, AESPID, AEREFNUM, AETERM, AETERMLO, AERELLC, AREL

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-text-cleanup/result.R

Edit
34 lines
# Reference solution for the yamaa benchmark adam-adae-text-cleanup (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(), .default = col_character()))adae <- ae |>  mutate(    # AE, a hyphen, and exactly three digits; missing is 0, any other shape    # is -1, and the digits give the number.    AEREFNUM = case_when(      is.na(AESPID) | AESPID == "" ~ 0L,      str_detect(AESPID, "^AE-[0-9]{3}$") ~ suppressWarnings(as.integer(str_sub(AESPID, 4, 6))),      .default = -1L    ),    AETERMLO = tolower(AETERM),    AERELLC = if_else(is.na(AEREL) | AEREL == "", "not reported", tolower(AEREL)),    AREL = toupper(AERELLC)  ) |>  select(    STUDYID, USUBJID, AESEQ, AESPID, AEREFNUM, AETERM, AETERMLO, AERELLC, AREL  )dir.create("/app/output", showWarnings = FALSE)write_csv(adae, "/app/output/adae.csv", na = "")

solutions/adam-adae-text-cleanup/result.py

Edit
52 lines
# Reference solution for the yamaa benchmark adam-adae-text-cleanup (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))# AE, a hyphen, and exactly three digits; missing is 0, any other shape is# -1, and the digits give the number.aerefnum = (    pl.when(pl.col("AESPID").is_null() | (pl.col("AESPID") == ""))    .then(0)    .when(pl.col("AESPID").str.contains(r"^AE-[0-9]{3}$"))    .then(pl.col("AESPID").str.slice(3).cast(pl.Int64))    .otherwise(-1)    .cast(pl.Int64))aerellc = (    pl.when(pl.col("AEREL").is_null() | (pl.col("AEREL") == ""))    .then(pl.lit("not reported"))    .otherwise(pl.col("AEREL").str.to_lowercase()))adae = (    ae.with_columns(        AEREFNUM=aerefnum,        AETERMLO=pl.col("AETERM").str.to_lowercase(),        AERELLC=aerellc,    )    .with_columns(AREL=pl.col("AERELLC").str.to_uppercase())    .select(        "STUDYID",        "USUBJID",        "AESEQ",        "AESPID",        "AEREFNUM",        "AETERM",        "AETERMLO",        "AERELLC",        "AREL",    ))Path("/app/output").mkdir(exist_ok=True)adae.write_csv("/app/output/adae.csv")

solutions/adam-adae-text-cleanup/result.sas

Edit
25 lines
/* opensas reference solution for the yamaa benchmark adam-adae-text-cleanup.   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 AESPID AETERM AEREL $1024;  infile "/app/input/ae.csv" dsd dlm="," firstobs=2 truncover lrecl=32767;  input STUDYID : $char1024. USUBJID : $char1024. AESEQ AESPID : $char1024. AETERM : $char1024. AEREL : $char1024.;run;data result;  length AETERMLO AERELLC AREL $1024;  set ae;  if missing(AESPID) then AEREFNUM=0;  else if prxmatch('/^AE-[0-9]{3}$/',strip(AESPID)) then AEREFNUM=input(substr(AESPID,4,3),best32.);  else AEREFNUM=-1;  AETERMLO=lowcase(AETERM); AERELLC=lowcase(AEREL);  if missing(AEREL) then AERELLC='not reported';  AREL=upcase(AERELLC);run;proc sql;  create table final as select STUDYID, USUBJID, AESEQ, AESPID, AEREFNUM, AETERM, AETERMLO, AERELLC, AREL from result;quit;proc export data=final outfile="/app/output/adae.csv" dbms=csv replace; run;