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) with an analysis start and end
date/time (ASTDTM, AENDTM) completed from collected times that may stop
at the hour or the minute, and the time imputation flags (ASTTMF,
AENTMF) recording which parts of the time were supplied.
Input: adverse event records carrying the reported term (AETERM) and
the collected start and end (AESTDTC, AEENDTC): a date and time to the
second, to the minute or to the hour, a date alone, a year and month alone,
or nothing at all.
Variables:
ASTDTMis the analysis start date/time. A time collected to the second is used as it stands. Each part of the time that was not collected takes its earliest value, so a start collected at hour14becomes14:00:00and a date alone starts at00:00:00. A start collected without its day, or not collected at all, gives no analysis start.ASTTMFnames the first part of the time that was not collected and had to be imputed:Hwhen the hour was imputed (a date alone),Mwhen the minute was, andSwhen only the second was. It is empty when the time was collected to the second and when there is no analysis start.AENDTMis the analysis end date/time, completed the same way but with the latest value of each missing part: an end collected at hour16becomes16:59:59and a date alone ends at23:59:59.AENTMFflagsAENDTMthe wayASTTMFflags the start.
Note: a flag records what was collected, not whether the completed time
looks different. A start collected as 08:30 and one collected as
08:30:00 complete to the same moment, but only the first is flagged S;
a start collected at hour 00 is flagged M although it completes to
the same time as a date alone.
Inputs
Under review1 source fileinput/ae.csv
Edit9 rows| STUDYID | USUBJID | AESEQ | AETERM | AESTDTC | AEENDTC |
|---|---|---|---|---|---|
| YAMAA-01 | 1 | HEADACHE | 2025-03-04T08:30:00 | 2025-03-04T17:45:30 | |
| YAMAA-01 | 2 | NAUSEA | 2025-03-04T08:30 | 2025-03-04T11:05 | |
| YAMAA-01 | 3 | DIZZINESS | 2025-03-05T14 | 2025-03-05T16 | |
| YAMAA-01 | 4 | FATIGUE | 2025-03-06 | 2025-03-08 | |
| YAMAA-01 | 1 | RASH | 2025-04-10T07:05 | — | |
| YAMAA-01 | 2 | COUGH | 2025-04-11T23 | 2025-04-12T00:30:00 | |
| YAMAA-01 | 3 | INSOMNIA | 2025-04 | 2025-04-20T22 | |
| YAMAA-01 | 4 | BACK PAIN | — | 2025-04-15T10:10 | |
| YAMAA-01 | 1 | PYREXIA | 2025-05-16T00 | 2025-05-16T23:59 |
Expected output
Under review9 expected rowsexpected/adae.csv
Edit9 rows| STUDYID | USUBJID | AESEQ | AETERM | AESTDTC | ASTDTM | ASTTMF | AEENDTC | AENDTM | AENTMF |
|---|---|---|---|---|---|---|---|---|---|
| YAMAA-01 | 1 | HEADACHE | 2025-03-04T08:30:00 | 2025-03-04T08:30:00 | — | 2025-03-04T17:45:30 | 2025-03-04T17:45:30 | — | |
| YAMAA-01 | 2 | NAUSEA | 2025-03-04T08:30 | 2025-03-04T08:30:00 | S | 2025-03-04T11:05 | 2025-03-04T11:05:59 | S | |
| YAMAA-01 | 3 | DIZZINESS | 2025-03-05T14 | 2025-03-05T14:00:00 | M | 2025-03-05T16 | 2025-03-05T16:59:59 | M | |
| YAMAA-01 | 4 | FATIGUE | 2025-03-06 | 2025-03-06T00:00:00 | H | 2025-03-08 | 2025-03-08T23:59:59 | H | |
| YAMAA-01 | 1 | RASH | 2025-04-10T07:05 | 2025-04-10T07:05:00 | S | — | — | — | |
| YAMAA-01 | 2 | COUGH | 2025-04-11T23 | 2025-04-11T23:00:00 | M | 2025-04-12T00:30:00 | 2025-04-12T00:30:00 | — | |
| YAMAA-01 | 3 | INSOMNIA | 2025-04 | — | — | 2025-04-20T22 | 2025-04-20T22:59:59 | M | |
| YAMAA-01 | 4 | BACK PAIN | — | — | — | 2025-04-15T10:10 | 2025-04-15T10:10:59 | S | |
| YAMAA-01 | 1 | PYREXIA | 2025-05-16T00 | 2025-05-16T00:00:00 | M | 2025-05-16T23:59 | 2025-05-16T23:59:59 | S |
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 | AETERM | Reported Term for the Adverse Event | character | Copy value from AE.AETERM. | Predecessor | ||
| ADAE | AESTDTC | Start Date/Time of Adverse Event | character | Copy value from AE.AESTDTC. | Predecessor | ||
| ADAE | AEENDTC | End Date/Time of Adverse Event | character | Copy value from AE.AEENDTC. | Predecessor | ||
| ADAE | ASTDTM | Analysis Start Date/Time | numeric | ISO 8601 | Impute incomplete datetime from AESTDTC, giving each time part the source lacks its earliest value; a source without a complete date gives blank; invalid text → blank. | Derived | |
| ADAE | ASTTMF | Analysis Start Time Imputation Flag | character | H, M, S | Time imputation flag for ASTDTM: "H" when the whole time was imputed, "M" when the minutes and seconds were, "S" when only the seconds were; blank when the time was collected to the second. | Derived | |
| ADAE | AENDTM | Analysis End Date/Time | numeric | ISO 8601 | Impute incomplete datetime from AEENDTC, giving each time part the source lacks its latest value; a source without a complete date gives blank; invalid text → blank. | Derived | |
| ADAE | AENTMF | Analysis End Time Imputation Flag | character | H, M, S | Time imputation flag for AENDTM: "H" when the whole time was imputed, "M" when the minutes and seconds were, "S" when only the seconds were; blank when the time was collected to the second. | Derived |
| Variable | Permitted values |
|---|---|
| ASTTMF | H, M, S |
| AENTMF | H, M, S |
| 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-partial-times/full.md
Edit31 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, AETERM, AESTDTC, ASTDTM, ASTTMF, AEENDTC, AENDTM, AENTMF
ASTDTM is the analysis start date/time, completed from AESTDTC. A start collected to the second is used as it stands. Each part of the start time that was not collected takes its earliest value, so a start collected to the hour is at minute 00 and second 00, and a date alone starts at 00:00:00. ASTDTM has no value when AESTDTC was collected without its day or not collected at all. ASTTMF is "H" when the start was collected as a date alone, "M" when it was collected to the hour, and "S" when it was collected to the minute. ASTTMF has no value when the start was collected to the second or when ASTDTM has no value. AENDTM is the analysis end date/time, completed from AEENDTC in the same way but with the latest value of each part of the time that was not collected, so an end collected to the hour is at minute 59 and second 59, and a date alone ends at 23:59:59. An end collected to the second is used as it stands. AENDTM has no value when AEENDTC was collected without its day or not collected at all. AENTMF is "H" when the end was collected as a date alone, "M" when it was collected to the hour, and "S" when it was collected to the minute. AENTMF has no value when the end was collected to the second or when AENDTM has no value. Each flag records what was collected, not whether the completed time looks different: a start collected at hour 00 is flagged "M" although it completes to the same time as a date alone.
Read the source datasets from /app/input and save the completed dataset as /app/output/adae.csv.
prompts/adam-adae-partial-times/conventions.md
Edit12 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, AETERM, AESTDTC, ASTDTM, ASTTMF, AEENDTC, AENDTM, AENTMF
ASTTMF is "H", "M", or "S", or has no value. AENTMF is "H", "M", or "S", or has no value.
Read the source datasets from /app/input and save the completed dataset as /app/output/adae.csv.
prompts/adam-adae-partial-times/brief.md
Edit9 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, AETERM, AESTDTC, ASTDTM, ASTTMF, AEENDTC, AENDTM, AENTMF
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-partial-times/result.R
Edit53 lines# Reference solution for the yamaa benchmark adam-adae-partial-times (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()))# Complete a collected value by its length: the missing parts take their# earliest (start) or latest (end) values. A value without its day, or no# value at all, gives no analysis time.complete_time <- function(x, last) { n <- nchar(x) case_when( n == 19 ~ x, n == 16 ~ paste0(x, if (last) ":59" else ":00"), n == 13 ~ paste0(x, if (last) ":59:59" else ":00:00"), n == 10 ~ paste0(x, if (last) "T23:59:59" else "T00:00:00"), TRUE ~ NA_character_ )}# The flag names the coarsest part of the time that was supplied.time_flag <- function(x) { n <- nchar(x) case_when( n == 16 ~ "S", n == 13 ~ "M", n == 10 ~ "H", TRUE ~ NA_character_ )}adae <- ae |> mutate( ASTDTM = complete_time(AESTDTC, last = FALSE), ASTTMF = time_flag(AESTDTC), AENDTM = complete_time(AEENDTC, last = TRUE), AENTMF = time_flag(AEENDTC) ) |> select( STUDYID, USUBJID, AESEQ, AETERM, AESTDTC, ASTDTM, ASTTMF, AEENDTC, AENDTM, AENTMF )dir.create("/app/output", showWarnings = FALSE)write_csv(adae, "/app/output/adae.csv", na = "")solutions/adam-adae-partial-times/result.py
Edit94 lines# Reference solution for the yamaa benchmark adam-adae-partial-times (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."""Create ADAE from AE, completing partial start/end datetimes.ASTDTM completes AESTDTC with the earliest value of each uncollectedtime part; AENDTM completes AEENDTC with the latest value. The timeimputation flags record what was collected: "H" for a date alone,"M" for collection to the hour, "S" for collection to the minute,and no value when collected to the second or when no datetime canbe formed (day not collected)."""import csvimport reINPUT_PATH = "/app/input/ae.csv"OUTPUT_PATH = "/app/output/adae.csv"SECOND = re.compile(r"^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}$")MINUTE = re.compile(r"^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}$")HOUR = re.compile(r"^\d{4}-\d{2}-\d{2}T\d{2}$")DATE = re.compile(r"^\d{4}-\d{2}-\d{2}$")def complete(value, end): """Return (datetime_text, flag) completing a partial ISO datetime. `end` selects latest-value completion instead of earliest-value. """ value = (value or "").strip() if not value: return "", "" if SECOND.match(value): return value, "" if MINUTE.match(value): seconds = "59" if end else "00" return value + ":" + seconds, "S" if HOUR.match(value): tail = ":59:59" if end else ":00:00" return value + tail, "M" if DATE.match(value): tail = "T23:59:59" if end else "T00:00:00" return value + tail, "H" # Collected without its day (e.g. year-month only): no datetime. return "", ""def main(): with open(INPUT_PATH, newline="", encoding="utf-8") as f: rows = list(csv.DictReader(f)) out_rows = [] for row in rows: astdtm, asttmf = complete(row["AESTDTC"], end=False) aendtm, aentmf = complete(row["AEENDTC"], end=True) out_rows.append( { "STUDYID": row["STUDYID"], "USUBJID": row["USUBJID"], "AESEQ": row["AESEQ"], "AETERM": row["AETERM"], "AESTDTC": row["AESTDTC"], "ASTDTM": astdtm, "ASTTMF": asttmf, "AEENDTC": row["AEENDTC"], "AENDTM": aendtm, "AENTMF": aentmf, } ) fieldnames = [ "STUDYID", "USUBJID", "AESEQ", "AETERM", "AESTDTC", "ASTDTM", "ASTTMF", "AEENDTC", "AENDTM", "AENTMF", ] with open(OUTPUT_PATH, "w", newline="", encoding="utf-8") as f: writer = csv.DictWriter(f, fieldnames=fieldnames) writer.writeheader() writer.writerows(out_rows)if __name__ == "__main__": main()solutions/adam-adae-partial-times/result.sas
Edit34 lines/* opensas reference solution for the yamaa benchmark adam-adae-partial-times. 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 AESTDTC AEENDTC $1024; infile "/app/input/ae.csv" dsd dlm="," firstobs=2 truncover lrecl=32767; input STUDYID : $char1024. USUBJID : $char1024. AESEQ AETERM : $char1024. AESTDTC : $char1024. AEENDTC : $char1024.;run;/* Complete each collected value by its length: the missing parts take their earliest (start) or latest (end) values, and the flag names the coarsest part supplied. A value without its day, or no value, gives no time. */data result; length ASTDTM AENDTM $19 ASTTMF AENTMF $1; set ae; ASTDTM=''; ASTTMF=''; AENDTM=''; AENTMF=''; ls=lengthn(AESTDTC); if ls=19 then ASTDTM=AESTDTC; else if ls=16 then do; ASTDTM=cats(AESTDTC, ':00'); ASTTMF='S'; end; else if ls=13 then do; ASTDTM=cats(AESTDTC, ':00:00'); ASTTMF='M'; end; else if ls=10 then do; ASTDTM=cats(AESTDTC, 'T00:00:00'); ASTTMF='H'; end; le=lengthn(AEENDTC); if le=19 then AENDTM=AEENDTC; else if le=16 then do; AENDTM=cats(AEENDTC, ':59'); AENTMF='S'; end; else if le=13 then do; AENDTM=cats(AEENDTC, ':59:59'); AENTMF='M'; end; else if le=10 then do; AENDTM=cats(AEENDTC, 'T23:59:59'); AENTMF='H'; end;run;proc sql; create table final as select STUDYID, USUBJID, AESEQ, AETERM, AESTDTC, ASTDTM, ASTTMF, AEENDTC, AENDTM, AENTMF from result;quit;proc export data=final outfile="/app/output/adae.csv" dbms=csv replace; run;
yamaa