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: derive AESER for each adverse event (AE) from its collected
seriousness criteria while retaining the reported term and criterion flags.
Input: collected adverse event terms (AETERM) with Y or N
flags for death (AESDTH), life threat (AESLIFE), required or
prolonged hospitalization (AESHOSP), persistent or significant
disability or incapacity (AESDISAB), congenital anomaly or birth
defect (AESCONG), and another medically important serious event
(AESMIE); any flag may be empty.
Variables:
AESERisYwhen any seriousness criterion isY; it isNwhen no criterion isY, including when every criterion is empty.
Note: the term and the six criterion flags are kept as collected, so
an empty flag stays empty rather than becoming N.
Inputs
Under review1 source fileinput/ae_raw.csv
Edit4 rows| STUDYID | USUBJID | AESEQ | AETERM | AESDTH | AESLIFE | AESHOSP | AESDISAB | AESCONG | AESMIE |
|---|---|---|---|---|---|---|---|---|---|
| CATH | 1 | APPENDICITIS | N | N | Y | N | N | N | |
| CATH | 1 | ANAPHYLACTIC REACTION | N | Y | Y | N | N | N | |
| CATH | 1 | HEADACHE | N | N | N | N | N | N | |
| CATH | 1 | FATIGUE | — | — | — | — | — | — |
Expected output
Under review4 expected rowsexpected/ae.csv
Edit4 rows| DOMAIN | STUDYID | USUBJID | AESEQ | AETERM | AESER | AESDTH | AESLIFE | AESHOSP | AESDISAB | AESCONG | AESMIE |
|---|---|---|---|---|---|---|---|---|---|---|---|
| AE | CATH | 1 | APPENDICITIS | Y | N | N | Y | N | N | N | |
| AE | CATH | 1 | ANAPHYLACTIC REACTION | Y | N | Y | Y | N | N | N | |
| AE | CATH | 1 | HEADACHE | N | N | N | N | N | N | N | |
| AE | CATH | 1 | FATIGUE | N | — | — | — | — | — | — |
Human review and assessment
| Variable Name | Variable Label | Type | Length | Controlled Terms or Format | Origin | Core | Conversion Definition | Variable Type | Variable Order | Comments for Define |
|---|---|---|---|---|---|---|---|---|---|---|
| DOMAIN | Domain Abbreviation | Char | Assigned | Set constant value "AE". | SDTM | 1 | ||||
| STUDYID | Study Identifier | Char | Collected | Copy value from AE_RAW.STUDYID. | SDTM | 2 | ||||
| USUBJID | Unique Subject Identifier | Char | Collected | Copy value from AE_RAW.USUBJID. | SDTM | 3 | ||||
| AESEQ | Sequence Number | Num | Collected | Copy value from AE_RAW.AESEQ. | SDTM | 4 | ||||
| AETERM | Reported Term for the Adverse Event | Char | Collected | Copy value from AE_RAW.AETERM. | SDTM | 5 | ||||
| AESER | Serious Event | Char | Y, N | Derived | If AE_RAW.AESDTH = 'Y' OR AE_RAW.AESLIFE = 'Y' OR AE_RAW.AESHOSP = 'Y' OR AE_RAW.AESDISAB = 'Y' OR AE_RAW.AESCONG = 'Y' OR AE_RAW.AESMIE = 'Y' then "Y"; otherwise "N". | SDTM | 6 | |||
| AESDTH | Results in Death | Char | Y, N | Collected | Copy value from AE_RAW.AESDTH. | SDTM | 7 | |||
| AESLIFE | Is Life Threatening | Char | Y, N | Collected | Copy value from AE_RAW.AESLIFE. | SDTM | 8 | |||
| AESHOSP | Requires or Prolongs Hospitalization | Char | Y, N | Collected | Copy value from AE_RAW.AESHOSP. | SDTM | 9 | |||
| AESDISAB | Persist or Significant Disability/Incapacity | Char | Y, N | Collected | Copy value from AE_RAW.AESDISAB. | SDTM | 10 | |||
| AESCONG | Congenital Anomaly or Birth Defect | Char | Y, N | Collected | Copy value from AE_RAW.AESCONG. | SDTM | 11 | |||
| AESMIE | Other Medically Important Serious Event | Char | Y, N | Collected | Copy value from AE_RAW.AESMIE. | SDTM | 12 |
| Variable | Permitted values |
|---|---|
| AESER | Y, N |
| AESDTH | Y, N |
| AESLIFE | Y, N |
| AESHOSP | Y, N |
| AESDISAB | Y, N |
| AESCONG | Y, N |
| AESMIE | 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/sdtm-ae-seriousness/full.md
Edit14 linesFollowing CDISC SDTM standards, use the provided AE_RAW dataset to create an AE dataset with one record per adverse event.
The output dataset should contain the following columns in this order: DOMAIN, STUDYID, USUBJID, AESEQ, AETERM, AESER, AESDTH, AESLIFE, AESHOSP, AESDISAB, AESCONG, AESMIE
AESER is "Y" when any of the seriousness criteria AESDTH, AESLIFE, AESHOSP, AESDISAB, AESCONG, or AESMIE is "Y". AESER is "N" when no criterion is "Y", including when every criterion has no value. A criterion flag with no value stays empty rather than becoming "N".
Read the source datasets from /app/input and save the completed dataset as /app/output/ae.csv.
prompts/sdtm-ae-seriousness/conventions.md
Edit12 linesFollowing CDISC SDTM standards, use the provided AE_RAW dataset to create an AE dataset with one record per adverse event.
The output dataset should contain the following columns in this order: DOMAIN, STUDYID, USUBJID, AESEQ, AETERM, AESER, AESDTH, AESLIFE, AESHOSP, AESDISAB, AESCONG, AESMIE
AESER is "Y" or "N". AESDTH, AESLIFE, AESHOSP, AESDISAB, AESCONG, and AESMIE are each "Y" or have no value.
Read the source datasets from /app/input and save the completed dataset as /app/output/ae.csv.
prompts/sdtm-ae-seriousness/brief.md
Edit9 linesFollowing CDISC SDTM standards, use the provided AE_RAW dataset to create an AE dataset with one record per adverse event.
The output dataset should contain the following columns in this order: DOMAIN, STUDYID, USUBJID, AESEQ, AETERM, AESER, AESDTH, AESLIFE, AESHOSP, AESDISAB, AESCONG, AESMIE
Read the source datasets from /app/input and save the completed dataset as /app/output/ae.csv.
R
Edit3 lineslibrary(yamaa)yamaa_spec("spec.yaml")$run()$outputPython
Edit3 linesimport yamaayamaa.spec("spec.yaml").run().outputsolutions/sdtm-ae-seriousness/result.R
Edit32 lines# Reference solution for the yamaa benchmark sdtm-ae-seriousness (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)ae_raw <- read_csv( "/app/input/ae_raw.csv", col_types = cols(AESEQ = col_integer(), .default = col_character()))# Serious when any criterion is Y; otherwise not serious, even when every# criterion is empty. The criterion flags stay as collected.ae <- ae_raw |> mutate( DOMAIN = "AE", AESER = if_else( AESDTH == "Y" | AESLIFE == "Y" | AESHOSP == "Y" | AESDISAB == "Y" | AESCONG == "Y" | AESMIE == "Y", "Y", "N", missing = "N" ) ) |> select( DOMAIN, STUDYID, USUBJID, AESEQ, AETERM, AESER, AESDTH, AESLIFE, AESHOSP, AESDISAB, AESCONG, AESMIE )dir.create("/app/output", showWarnings = FALSE)write_csv(ae, "/app/output/ae.csv", na = "")solutions/sdtm-ae-seriousness/result.py
Edit66 lines# Reference solution for the yamaa benchmark sdtm-ae-seriousness (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 the SDTM AE dataset from AE_RAW.One record per adverse event. AESER is "Y" when any seriousnesscriterion (AESDTH, AESLIFE, AESHOSP, AESDISAB, AESCONG, AESMIE) is "Y",and "N" when no criterion is "Y", including when every criterion isblank. A criterion flag with no value stays empty."""import csvimport osINPUT_DIR = "/app/input"OUTPUT_DIR = "/app/output"CRITERIA = ["AESDTH", "AESLIFE", "AESHOSP", "AESDISAB", "AESCONG", "AESMIE"]OUTPUT_COLUMNS = [ "DOMAIN", "STUDYID", "USUBJID", "AESEQ", "AETERM", "AESER", "AESDTH", "AESLIFE", "AESHOSP", "AESDISAB", "AESCONG", "AESMIE",]def main(): with open(os.path.join(INPUT_DIR, "ae_raw.csv"), newline="") as f: raw_rows = list(csv.DictReader(f)) out_rows = [] for row in raw_rows: serious = any((row.get(col) or "") == "Y" for col in CRITERIA) out = { "DOMAIN": "AE", "STUDYID": row.get("STUDYID", ""), "USUBJID": row.get("USUBJID", ""), "AESEQ": row.get("AESEQ", ""), "AETERM": row.get("AETERM", ""), "AESER": "Y" if serious else "N", } for col in CRITERIA: out[col] = row.get(col) or "" out_rows.append(out) os.makedirs(OUTPUT_DIR, exist_ok=True) with open(os.path.join(OUTPUT_DIR, "ae.csv"), "w", newline="") as f: writer = csv.DictWriter(f, fieldnames=OUTPUT_COLUMNS) writer.writeheader() writer.writerows(out_rows)if __name__ == "__main__": main()solutions/sdtm-ae-seriousness/result.sas
Edit16 lines/* opensas reference solution for the yamaa benchmark sdtm-ae-seriousness. Reads the benchmark inputs and derives the requested output. Execute with the existing opensas runtime: opensas /app/output/result.sas. */data ae_raw; length STUDYID USUBJID AETERM AESDTH AESLIFE AESHOSP AESDISAB AESCONG AESMIE $1024; infile "/app/input/ae_raw.csv" dsd dlm="," firstobs=2 truncover lrecl=32767; input STUDYID : $char1024. USUBJID : $char1024. AESEQ AETERM : $char1024. AESDTH : $char1024. AESLIFE : $char1024. AESHOSP : $char1024. AESDISAB : $char1024. AESCONG : $char1024. AESMIE : $char1024.;run;data result; set ae_raw; length DOMAIN $2 AESER $1; DOMAIN='AE'; AESER='N';if AESDTH='Y' or AESLIFE='Y' or AESHOSP='Y' or AESDISAB='Y' or AESCONG='Y' or AESMIE='Y' then AESER='Y'; run;proc sql; create table final as select DOMAIN, STUDYID, USUBJID, AESEQ, AETERM, AESER, AESDTH, AESLIFE, AESHOSP, AESDISAB, AESCONG, AESMIE from result;quit;proc export data=final outfile="/app/output/ae.csv" dbms=csv replace; run;
yamaa