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: 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:
AEREFNUMis the number taken fromAESPIDvalues shaped likeAE-001; a missing identifier gives0and any other shape gives-1.AETERMLOis the reported term in lower case.AERELLCis the causality in lower case; a missing causality givesnot reported.ARELis the analysis causality in upper case:RELATED,POSSIBLY RELATED,NOT RELATED, orNOT 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 review1 source fileinput/ae.csv
Edit10 rows| STUDYID | USUBJID | AESEQ | AESPID | AETERM | AEREL |
|---|---|---|---|---|---|
| CATH-01 | 1 | AE-001 | Headache | RELATED | |
| CATH-01 | 2 | — | HEADACHE | Possibly Related | |
| CATH-01 | 3 | BAD-ID | Nausea | — | |
| CATH-01 | 1 | AE-104 | Fatigue | NOT RELATED | |
| CATH-01 | 2 | — | Dizziness | NOT RELATED | |
| CATH-01 | 3 | AE-999 | hEADACHE | related | |
| CATH-01 | 1 | AE-000 | Vomiting | NOT RELATED | |
| CATH-01 | 2 | AE-1000 | Abdominal Pain | Possibly Related | |
| CATH-01 | 3 | ae-007 | Rash | — | |
| CATH-01 | 4 | AE-007 | Pruritus | Not Related |
Expected output
Under review10 expected rowsexpected/adae.csv
Edit10 rows| STUDYID | USUBJID | AESEQ | AESPID | AEREFNUM | AETERM | AETERMLO | AERELLC | AREL |
|---|---|---|---|---|---|---|---|---|
| CATH-01 | 1 | AE-001 | 1 | Headache | headache | related | RELATED | |
| CATH-01 | 2 | — | 0 | HEADACHE | headache | possibly related | POSSIBLY RELATED | |
| CATH-01 | 3 | BAD-ID | -1 | Nausea | nausea | not reported | NOT REPORTED | |
| CATH-01 | 1 | AE-104 | 104 | Fatigue | fatigue | not related | NOT RELATED | |
| CATH-01 | 2 | — | 0 | Dizziness | dizziness | not related | NOT RELATED | |
| CATH-01 | 3 | AE-999 | 999 | hEADACHE | headache | related | RELATED | |
| CATH-01 | 1 | AE-000 | 0 | Vomiting | vomiting | not related | NOT RELATED | |
| CATH-01 | 2 | AE-1000 | -1 | Abdominal Pain | abdominal pain | possibly related | POSSIBLY RELATED | |
| CATH-01 | 3 | ae-007 | -1 | Rash | rash | not reported | NOT REPORTED | |
| CATH-01 | 4 | AE-007 | 7 | Pruritus | pruritus | not related | NOT RELATED |
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 | AESPID | Sponsor-Defined Identifier | character | Copy value from AE.AESPID. | Predecessor | ||
| ADAE | AEREFNUM | Adverse Event Reference Number | numeric | Extract capture group 1 matching ^AE-([0-9]{3})$ from AESPID; a missing source → "0"; no match → "-1". | Derived | ||
| ADAE | AETERM | Reported Term for the Adverse Event | character | Copy value from AE.AETERM. | Predecessor | ||
| ADAE | AETERMLO | Reported Term in Lower Case | character | Convert AETERM to lower case. | Derived | ||
| ADAE | AERELLC | Causality in Lower Case | character | Convert AE.AEREL to lower case; a missing source → "not reported". | Derived | ||
| ADAE | AREL | Analysis Causality | character | RELATED, POSSIBLY RELATED, NOT RELATED, NOT REPORTED | Convert AERELLC to upper case. | Derived |
| Variable | Permitted values |
|---|---|
| AREL | RELATED, POSSIBLY RELATED, NOT RELATED, NOT REPORTED |
| 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-text-cleanup/full.md
Edit16 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, AESPID, AEREFNUM, AETERM, AETERMLO, AERELLC, AREL
AEREFNUM is the number taken from AESPID when AESPID consists of "AE-" followed by exactly three digits, so "AE-001" gives 1. A missing AESPID gives 0, and an AESPID of any other shape gives -1. The pattern accepts exactly three digits, so "AE-000" gives 0, while "AE-1000" and a lower-case "ae-007" each give -1. AETERMLO is AETERM in lower case. AERELLC is AEREL in lower case, and a missing AEREL gives "not reported". AREL is AERELLC 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
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, AESPID, AEREFNUM, AETERM, AETERMLO, AERELLC, AREL
AREL is "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/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, AESPID, AEREFNUM, AETERM, AETERMLO, AERELLC, AREL
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-text-cleanup/result.R
Edit34 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
Edit68 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.import csvimport reINPUT = "/app/input/ae.csv"OUTPUT = "/app/output/adae.csv"COLUMNS = [ "STUDYID", "USUBJID", "AESEQ", "AESPID", "AEREFNUM", "AETERM", "AETERMLO", "AERELLC", "AREL",]REFNUM_PATTERN = re.compile(r"^AE-(\d{3})$")def aerefnum(aespid): if aespid is None or aespid == "": return 0 match = REFNUM_PATTERN.match(aespid) if match: return int(match.group(1)) return -1def main(): with open(INPUT, newline="", encoding="utf-8") as handle: rows = list(csv.DictReader(handle)) out_rows = [] for row in rows: aespid = row.get("AESPID") or "" aeterm = row.get("AETERM") or "" aerel = row.get("AEREL") or "" aerellc = aerel.lower() if aerel != "" else "not reported" out_rows.append( { "STUDYID": row.get("STUDYID") or "", "USUBJID": row.get("USUBJID") or "", "AESEQ": row.get("AESEQ") or "", "AESPID": aespid, "AEREFNUM": aerefnum(aespid), "AETERM": aeterm, "AETERMLO": aeterm.lower(), "AERELLC": aerellc, "AREL": aerellc.upper(), } ) with open(OUTPUT, "w", newline="", encoding="utf-8") as handle: writer = csv.DictWriter(handle, fieldnames=COLUMNS) writer.writeheader() writer.writerows(out_rows)if __name__ == "__main__": main()solutions/adam-adae-text-cleanup/result.sas
Edit25 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;
yamaa