Review ask

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

Lifecycle: draftEditUnder review
What this benchmark means
README.md

Public 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:

  • ASTDTM is 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 hour 14 becomes 14:00:00 and a date alone starts at 00:00:00. A start collected without its day, or not collected at all, gives no analysis start.
  • ASTTMF names the first part of the time that was not collected and had to be imputed: H when the hour was imputed (a date alone), M when the minute was, and S when only the second was. It is empty when the time was collected to the second and when there is no analysis start.
  • AENDTM is the analysis end date/time, completed the same way but with the latest value of each missing part: an end collected at hour 16 becomes 16:59:59 and a date alone ends at 23:59:59.
  • AENTMF flags AENDTM the way ASTTMF flags 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 review
1 source file

input/ae.csv

Edit
9 rows
input/ae.csv
STUDYIDUSUBJIDAESEQAETERMAESTDTCAEENDTC
YAMAA-011HEADACHE2025-03-04T08:30:002025-03-04T17:45:30
YAMAA-012NAUSEA2025-03-04T08:302025-03-04T11:05
YAMAA-013DIZZINESS2025-03-05T142025-03-05T16
YAMAA-014FATIGUE2025-03-062025-03-08
YAMAA-011RASH2025-04-10T07:05—
YAMAA-012COUGH2025-04-11T232025-04-12T00:30:00
YAMAA-013INSOMNIA2025-042025-04-20T22
YAMAA-014BACK PAIN—2025-04-15T10:10
YAMAA-011PYREXIA2025-05-16T002025-05-16T23:59

Expected output

Under review
9 expected rows

expected/adae.csv

Edit
9 rows
expected/adae.csv
STUDYIDUSUBJIDAESEQAETERMAESTDTCASTDTMASTTMFAEENDTCAENDTMAENTMF
YAMAA-011HEADACHE2025-03-04T08:30:002025-03-04T08:30:00—2025-03-04T17:45:302025-03-04T17:45:30—
YAMAA-012NAUSEA2025-03-04T08:302025-03-04T08:30:00S2025-03-04T11:052025-03-04T11:05:59S
YAMAA-013DIZZINESS2025-03-05T142025-03-05T14:00:00M2025-03-05T162025-03-05T16:59:59M
YAMAA-014FATIGUE2025-03-062025-03-06T00:00:00H2025-03-082025-03-08T23:59:59H
YAMAA-011RASH2025-04-10T07:052025-04-10T07:05:00S———
YAMAA-012COUGH2025-04-11T232025-04-11T23:00:00M2025-04-12T00:30:002025-04-12T00:30:00—
YAMAA-013INSOMNIA2025-04——2025-04-20T222025-04-20T22:59:59M
YAMAA-014BACK PAIN———2025-04-15T10:102025-04-15T10:10:59S
YAMAA-011PYREXIA2025-05-16T002025-05-16T00:00:00M2025-05-16T23:592025-05-16T23:59:59S
Shaded columns are derived— = missing value

Human review and assessment

Your review

3 questions and your comments · View benchmark 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
ADAEAETERMReported Term for the Adverse EventcharacterCopy value from AE.AETERM.Predecessor
ADAEAESTDTCStart Date/Time of Adverse EventcharacterCopy value from AE.AESTDTC.Predecessor
ADAEAEENDTCEnd Date/Time of Adverse EventcharacterCopy value from AE.AEENDTC.Predecessor
ADAEASTDTMAnalysis Start Date/TimenumericISO 8601Impute 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
ADAEASTTMFAnalysis Start Time Imputation FlagcharacterH, M, STime 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
ADAEAENDTMAnalysis End Date/TimenumericISO 8601Impute 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
ADAEAENTMFAnalysis End Time Imputation FlagcharacterH, M, STime 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
VariablePermitted values
ASTTMFH, M, S
AENTMFH, M, S
VersionDateAuthorDescriptionReviewerSign-off
1.72026-10-20yamaa docs buildRead 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.62026-10-17yamaa docs buildDescribe collected date parts written as ISO 8601 date text and times of day counted in seconds since midnight
1.52026-10-17yamaa docs buildName 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.42026-10-15yamaa docs buildState datetime precision codes through the hour and minute, and complete only the time parts a collected datetime lacks
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-partial-times/full.md

Edit
31 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, 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

Edit
12 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, 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

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, AETERM, AESTDTC, ASTDTM, ASTTMF, AEENDTC, AENDTM, AENTMF

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

yamaa code

Public calls generated from benchmark.yaml; results must match the expected output

R

Edit
3 lines
library(yamaa)yamaa_spec("spec.yaml")$run()$output

Python

Edit
3 lines
import yamaayamaa.spec("spec.yaml").run().output

Solution without yamaa

Written from the full prompt and the inputs alone; CI checks it reproduces the expected output

solutions/adam-adae-partial-times/result.R

Edit
53 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

Edit
94 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

Edit
34 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;