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: number each subject's serious events (AESER is Y) in
onset order as SERSEQ, so the earliest serious event carries 1.
Input: adverse event records carrying the collection sequence
(AESEQ), the serious flag (AESER), and the onset date
(AESTDTC, carried as ASTDT; empty when the onset was never
collected).
Variables:
SERSEQholds the running number of the subject's serious events, ordered by onset date. Events sharing one onset date follow the order of their collection sequence, and a serious event with no onset date is numbered last. It stays empty for events that are not serious.
Note: numbering restarts for each subject, so a subject with no serious event keeps every record unnumbered.
Inputs
Under review1 source fileinput/ae.csv
Edit10 rows| STUDYID | USUBJID | AESEQ | AETERM | AESER | AESTDTC |
|---|---|---|---|---|---|
| PILOT7 | 1 | Nausea | N | 2023-02-11 | |
| PILOT7 | 2 | Pneumonitis | Y | 2023-03-04 | |
| PILOT7 | 3 | Neutropenia | Y | 2023-02-20 | |
| PILOT7 | 4 | Pneumonia | Y | 2023-02-20 | |
| PILOT7 | 5 | Anemia | Y | — | |
| PILOT7 | 1 | Fatigue | N | 2023-01-15 | |
| PILOT7 | 2 | Headache | N | 2023-02-02 | |
| PILOT7 | 3 | Dizziness | N | — | |
| PILOT7 | 1 | Rash | Y | 2023-05-10 | |
| PILOT7 | 2 | Vomiting | N | 2023-05-12 |
Expected output
Under review10 expected rowsexpected/adae.csv
Edit10 rows| STUDYID | USUBJID | AESEQ | AESER | ASTDT | SERSEQ |
|---|---|---|---|---|---|
| PILOT7 | 1 | N | 2023-02-11 | — | |
| PILOT7 | 2 | Y | 2023-03-04 | 3 | |
| PILOT7 | 3 | Y | 2023-02-20 | 1 | |
| PILOT7 | 4 | Y | 2023-02-20 | 2 | |
| PILOT7 | 5 | Y | — | 4 | |
| PILOT7 | 1 | N | 2023-01-15 | — | |
| PILOT7 | 2 | N | 2023-02-02 | — | |
| PILOT7 | 3 | N | — | — | |
| PILOT7 | 1 | Y | 2023-05-10 | 1 | |
| PILOT7 | 2 | N | 2023-05-12 | — |
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 | AESER | Serious Event | character | Y, N | Copy value from AE.AESER. | Predecessor | |
| ADAE | ASTDT | Analysis Start Date | numeric | ISO 8601 | Copy value from AE.AESTDTC. | Predecessor | |
| ADAE | SERSEQ | Serious Event Sequence Number | numeric | Row number within each group of STUDYID, USUBJID, ordered by ASTDT then AESEQ. | Derived |
| Variable | Permitted values |
|---|---|
| AESER | 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-serious-sequence/full.md
Edit15 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, AESER, ASTDT, SERSEQ
ASTDT is the onset date, and has no value when the onset was never collected. SERSEQ numbers the subject's serious events in onset order, so the earliest serious event carries 1. Events sharing one onset date follow collection sequence order, and a serious event with no onset date is numbered last. SERSEQ has no value for events that are not serious. Numbering restarts for each subject.
Read the source datasets from /app/input and save the completed dataset as /app/output/adae.csv.
prompts/adam-adae-serious-sequence/conventions.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, AESER, ASTDT, SERSEQ
Read the source datasets from /app/input and save the completed dataset as /app/output/adae.csv.
prompts/adam-adae-serious-sequence/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, AESER, ASTDT, SERSEQ
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-serious-sequence/result.R
Edit33 lines# Reference solution for the yamaa benchmark adam-adae-serious-sequence (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 <- read_csv( "/app/input/ae.csv", col_types = cols(AESEQ = col_integer(), .default = col_character()))# Number the subject's serious events in onset order, so the earliest# carries 1. Events sharing one onset date follow collection order, and# a serious event with no onset date is numbered last.numbered <- ae |> filter(AESER %in% "Y") |> mutate(ASTDT = if_else(is.na(AESTDTC) | AESTDTC == "", NA_character_, AESTDTC)) |> arrange(USUBJID, is.na(ASTDT), ASTDT, AESEQ) |> group_by(USUBJID) |> mutate(SERSEQ = row_number()) |> ungroup() |> select(USUBJID, AESEQ, SERSEQ)adae <- ae |> mutate(ASTDT = if_else(is.na(AESTDTC) | AESTDTC == "", NA_character_, AESTDTC)) |> left_join(numbered, by = c("USUBJID", "AESEQ")) |> select(STUDYID, USUBJID, AESEQ, AESER, ASTDT, SERSEQ)dir.create("/app/output", showWarnings = FALSE)write_csv(adae, "/app/output/adae.csv", na = "")solutions/adam-adae-serious-sequence/result.py
Edit34 lines# Reference solution for the yamaa benchmark adam-adae-serious-sequence (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))# Number the subject's serious events in onset order, so the earliest# carries 1. Events sharing one onset date follow collection order, and# a serious event with no onset date is numbered last. ISO dates sort# as text. Numbering restarts for each subject.numbered = ( ae.filter(pl.col("AESER") == "Y") .with_columns(ASTDT=pl.col("AESTDTC")) .sort(["USUBJID", "AESTDTC", "AESEQ"], nulls_last=True) .with_columns(SERSEQ=pl.col("AESEQ").cum_count().over("USUBJID")) .select("USUBJID", "AESEQ", "SERSEQ"))adae = ( ae.with_columns(ASTDT=pl.col("AESTDTC")) .join(numbered, on=["USUBJID", "AESEQ"], how="left", maintain_order="left") .select("STUDYID", "USUBJID", "AESEQ", "AESER", "ASTDT", "SERSEQ"))Path("/app/output").mkdir(exist_ok=True)adae.write_csv("/app/output/adae.csv")solutions/adam-adae-serious-sequence/result.sas
Edit24 lines/* opensas reference solution for the yamaa benchmark adam-adae-serious-sequence. 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 AETERM AESER AESTDTC $1024; infile "/app/input/ae.csv" dsd dlm="," firstobs=2 truncover lrecl=32767; input STUDYID : $char1024. USUBJID : $char1024. AESEQ AETERM : $char1024. AESER : $char1024. AESTDTC : $char1024.;run;data ordered; set ae; nodate=missing(AESTDTC); run;proc sort data=ordered; by STUDYID USUBJID nodate AESTDTC AESEQ; run;data result; length ASTDT $10; set ordered; by STUDYID USUBJID; if first.USUBJID then counter=0; ASTDT=AESTDTC; if AESER='Y' then do; counter+1; SERSEQ=counter; end;run;proc sql; create table final as select STUDYID, USUBJID, AESEQ, AESER, ASTDT, SERSEQ 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