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: reviewedEditUnder review
What this benchmark means
README.md

Public entries: Python and R. Passing coverage requires an installed inventory.

Goal: carry each subject's exposure start (STDT) and end (ENDT) dates, and derive whole-week (DURW) and whole-month (DURM) exposure durations.

Input: one demographic record per subject carrying the exposure start and end dates.

Variables:

  • DURW is the count of whole seven-day blocks from STDT to ENDT; a leftover partial week adds nothing.
  • DURM is the count of monthly anniversaries of STDT falling on or before ENDT; an anniversary keeps the start day, or the last day of the month when the month is too short.

Note: both durations are missing when either date is missing. When the end date falls before the start date, each duration is the negated count computed with the dates exchanged.

Inputs

Under review
1 source file

input/dm.csv

Edit
12 rows
input/dm.csv
STUDYIDUSUBJIDSTDTENDT
YAMAA-012025-01-312025-02-28
YAMAA-012024-02-292025-02-28
YAMAA-012025-01-312025-03-01
YAMAA-012025-01-062025-01-20
YAMAA-012025-03-102025-01-10
YAMAA-012025-01-01—
YAMAA-01—2025-01-15
YAMAA-012025-06-162025-06-23
YAMAA-012025-06-162025-06-29
YAMAA-012025-04-102025-04-10
YAMAA-012024-12-312025-01-01
YAMAA-01——

Expected output

Under review
12 expected rows

expected/adsl.csv

Edit
12 rows
expected/adsl.csv
STUDYIDUSUBJIDSTDTENDTDURWDURM
YAMAA-012025-01-312025-02-2841
YAMAA-012024-02-292025-02-285212
YAMAA-012025-01-312025-03-0141
YAMAA-012025-01-062025-01-2020
YAMAA-012025-03-102025-01-10-8-2
YAMAA-012025-01-01———
YAMAA-01—2025-01-15——
YAMAA-012025-06-162025-06-2310
YAMAA-012025-06-162025-06-2910
YAMAA-012025-04-102025-04-1000
YAMAA-012024-12-312025-01-0100
YAMAA-01————
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
ADSLSTUDYIDStudy IdentifiercharacterCopy value from DM.STUDYID.Predecessor
ADSLUSUBJIDUnique Subject IdentifiercharacterCopy value from DM.USUBJID.Predecessor
ADSLSTDTStart DatenumericISO 8601Copy value from DM.STDT.Predecessor
ADSLENDTEnd DatenumericISO 8601Copy value from DM.ENDT.Predecessor
ADSLDURWDuration in Whole WeeksnumericWhole weeks from STDT to ENDT, counting the end date but not the start.Derived
ADSLDURMDuration in Whole MonthsnumericWhole months from STDT to ENDT, counting the end date but not the start.Derived
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-adsl-duration/full.md

Edit
16 lines

Following CDISC ADaM standards, use the provided DM dataset to create an ADSL dataset with one record per subject.

The output dataset should contain the following columns in this order: STUDYID, USUBJID, STDT, ENDT, DURW, DURM

DURW is the count of whole seven-day blocks from STDT to ENDT; a leftover partial week adds nothing. DURM is the count of monthly anniversaries of STDT falling on or before ENDT, where an anniversary falls on the same day of the month as STDT, or on the last day of the month when that month has no such day. DURW and DURM have no value when STDT or ENDT has no value. When ENDT falls before STDT, each duration is the negative of the count with the two dates exchanged.

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

prompts/adam-adsl-duration/conventions.md

Edit
14 lines

Following CDISC ADaM standards, use the provided DM dataset to create an ADSL dataset with one record per subject.

The output dataset should contain the following columns in this order: STUDYID, USUBJID, STDT, ENDT, DURW, DURM

DURW is the count of whole seven-day blocks from STDT to ENDT; a leftover partial week adds nothing. DURM is the count of monthly anniversaries of STDT falling on or before ENDT, where an anniversary falls on the same day of the month as STDT, or on the last day of the month when that month has no such day.

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

prompts/adam-adsl-duration/brief.md

Edit
8 lines

Following CDISC ADaM standards, use the provided DM dataset to create an ADSL dataset with one record per subject.

The output dataset should contain the following columns in this order: STUDYID, USUBJID, STDT, ENDT, DURW, DURM

Read the source datasets from /app/input and save the completed dataset as /app/output/adsl.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-adsl-duration/result.R

Edit
65 lines
# Reference solution for the yamaa benchmark adam-adsl-duration (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(lubridate, warn.conflicts = FALSE)library(readr)dm <- read_csv(  "/app/input/dm.csv",  col_types = cols(STDT = col_date(), ENDT = col_date(), .default = col_character()))add_months <- function(day, n) {  total <- as.integer(format(day, "%m")) - 1L + n  year <- as.integer(format(day, "%Y")) + total %/% 12L  month <- total %% 12L + 1L  last <- days_in_month(make_date(year, month, 1L))  pmin_day <- min(as.integer(format(day, "%d")), last)  make_date(year, month, pmin_day)}# Monthly anniversaries of the start on or before the end, keeping the# start day or the month's last day when the month is too short; negated# with the dates exchanged when the end falls before the start.whole_months <- function(start, end) {  if (is.na(start) || is.na(end)) {    return(NA_integer_)  }  if (end < start) {    return(-whole_months(end, start))  }  months <- (as.integer(format(end, "%Y")) - as.integer(format(start, "%Y"))) * 12L +    (as.integer(format(end, "%m")) - as.integer(format(start, "%m")))  while (months > 0L && add_months(start, months) > end) {    months <- months - 1L  }  while (add_months(start, months + 1L) <= end) {    months <- months + 1L  }  months}# Whole seven-day blocks from start to end, dropping any leftover partial# week; negated with the dates exchanged when the end falls before the start.whole_weeks <- function(start, end) {  if (is.na(start) || is.na(end)) {    return(NA_integer_)  }  if (end < start) {    return(-whole_weeks(end, start))  }  as.integer(trunc(as.numeric(end - start) / 7))}adsl <- dm |>  rowwise() |>  mutate(DURW = whole_weeks(STDT, ENDT), DURM = whole_months(STDT, ENDT)) |>  ungroup() |>  select(STUDYID, USUBJID, STDT, ENDT, DURW, DURM)dir.create("/app/output", showWarnings = FALSE)write_csv(adsl, "/app/output/adsl.csv", na = "")

solutions/adam-adsl-duration/result.py

Edit
76 lines
# Reference solution for the yamaa benchmark adam-adsl-duration (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 calendarfrom datetime import dateIN_DIR = "/app/input"OUT_DIR = "/app/output"def parse_date(text):    text = (text or "").strip()    if not text:        return None    return date.fromisoformat(text)def add_months(d, months):    """Date `months` months after d, on the same day of month, or on the    last day of the target month when it has no such day."""    total = (d.year * 12 + (d.month - 1)) + months    year, month0 = divmod(total, 12)    month = month0 + 1    day = min(d.day, calendar.monthrange(year, month)[1])    return date(year, month, day)def durations(start, end):    """(DURW, DURM) from start to end; both blank if either is missing."""    if start is None or end is None:        return "", ""    sign = 1    lo, hi = start, end    if hi < lo:        sign = -1        lo, hi = hi, lo    durw = (hi - lo).days // 7    durm = 0    while add_months(lo, durm + 1) <= hi:        durm += 1    return sign * durw, sign * durmdef main():    with open(f"{IN_DIR}/dm.csv", newline="") as f:        rows = list(csv.DictReader(f))    out_rows = []    for row in rows:        stdt = parse_date(row.get("STDT"))        endt = parse_date(row.get("ENDT"))        durw, durm = durations(stdt, endt)        out_rows.append(            {                "STUDYID": row.get("STUDYID", ""),                "USUBJID": row.get("USUBJID", ""),                "STDT": row.get("STDT", ""),                "ENDT": row.get("ENDT", ""),                "DURW": durw,                "DURM": durm,            }        )    fieldnames = ["STUDYID", "USUBJID", "STDT", "ENDT", "DURW", "DURM"]    with open(f"{OUT_DIR}/adsl.csv", "w", newline="") as f:        writer = csv.DictWriter(f, fieldnames=fieldnames)        writer.writeheader()        writer.writerows(out_rows)if __name__ == "__main__":    main()

solutions/adam-adsl-duration/result.sas

Edit
21 lines
/* opensas reference solution for the yamaa benchmark adam-adsl-duration.   Reads the benchmark inputs and derives the requested output.   Execute with the existing opensas runtime: opensas /app/output/result.sas. */data dm;  length STUDYID USUBJID STDT ENDT $1024;  infile "/app/input/dm.csv" dsd dlm="," firstobs=2 truncover lrecl=32767;  input STUDYID : $char1024. USUBJID : $char1024. STDT : $char1024. ENDT : $char1024.;run;data result;  set dm;  start=input(STDT,yymmdd10.); finish=input(ENDT,yymmdd10.);  if not missing(start) and not missing(finish) then do;    lo=min(start,finish); hi=max(start,finish); sign=1;    if finish<start then sign=-1;  DURW=sign*floor((hi-lo)/7); DURM=sign*intck('month',lo,hi,'continuous');  end;run;proc export data=result(keep=STUDYID USUBJID STDT ENDT DURW DURM) outfile="/app/output/adsl.csv" dbms=csv replace; run;