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: derive the start date of new anti-cancer therapy given during the study (NACTDT), its study day relative to the start of study treatment (NACTDY), and a flag marking subjects who started such therapy (NACTFL).

Input: one subject-level table carrying the treatment start date TRTSDT, alongside concomitant medication records carrying a category (CMCAT) and start date (CMSTDTC), plus procedure records carrying a category (PRCAT), subcategory (PRSCAT), and start date (PRSTDTC).

Variables:

  • NACTDT is the earlier of the first qualifying medication start (CMSTDTC with CMCAT equal to ON TREATMENT) and the first qualifying procedure start (PRSTDTC with PRCAT equal to CANCER RELATED and PRSCAT equal to ON TREATMENT); it is absent when the subject started no qualifying therapy during the study. Therapy recorded as PRIOR TREATMENT does not qualify, nor do procedures given for reasons other than the cancer. A qualifying record with no start date is skipped, and one that starts on the treatment start date itself counts, with study day 1.
  • NACTDY is the study day of NACTDT counted from TRTSDT, with the treatment start date itself as day 1; it is absent when NACTDT is absent.
  • NACTFL holds Y when NACTDT is present and is absent otherwise.

Note: a qualifying therapy must start on or after the treatment start date: each aggregate only considers records with CMSTDTC_IMP >= TRTSDT (or PRSTDTC >= TRTSDT), so a flagged therapy start always falls on or after the treatment start date by construction.

Note: the collected medication start CMSTDTC is text and may carry a partial date. The analysis-ready CMSTDTC_IMP completes it under a stated rule: a year-month start is completed to the 15th of that month, and a full date passes through unchanged. Subject 107's 2025-04 becomes 2025-04-15.

Inputs

Under review
3 source files

input/adsl.csv

Edit
7 rows
input/adsl.csv
STUDYIDUSUBJIDTRTSDT
YAMAA-012025-01-06
YAMAA-012025-01-13
YAMAA-012025-01-20
YAMAA-012025-02-03
YAMAA-012025-02-10
YAMAA-012025-03-03
YAMAA-012025-03-10

input/cm.csv

Edit
9 rows
input/cm.csv
STUDYIDUSUBJIDCMSEQCMCATCMSCATCMTRTCMSTDTCCMSTDTC_IMP
YAMAA-011ON TREATMENTCHEMOTHERAPYDOCETAXEL2025-03-102025-03-10
YAMAA-011PRIOR TREATMENTCHEMOTHERAPYCARBOPLATIN2024-11-042024-11-04
YAMAA-012ON TREATMENTCHEMOTHERAPYGEMCITABINE2025-05-052025-05-05
YAMAA-011PRIOR TREATMENTCHEMOTHERAPYCISPLATIN2024-10-222024-10-22
YAMAA-012ON TREATMENTCHEMOTHERAPYVINORELBINE2025-01-102025-01-10
YAMAA-011ON TREATMENTIMMUNOTHERAPYNIVOLUMAB2025-06-012025-06-01
YAMAA-012ON TREATMENTCHEMOTHERAPYPEMETREXED2025-04-152025-04-15
YAMAA-011ON TREATMENTIMMUNOTHERAPYPEMBROLIZUMAB——
YAMAA-011ON TREATMENTCHEMOTHERAPYTRASTUZUMAB2025-042025-04-15

input/pr.csv

Edit
5 rows
input/pr.csv
STUDYIDUSUBJIDPRSEQPRCATPRSCATPRTRTPRSTDTC
YAMAA-011CANCER RELATEDON TREATMENTTUMOUR RESECTION2025-02-20
YAMAA-011CANCER RELATEDON TREATMENTRADIOTHERAPY2025-04-02
YAMAA-011CANCER RELATEDPRIOR TREATMENTTUMOUR RESECTION2024-09-30
YAMAA-011CANCER RELATEDON TREATMENTRADIOTHERAPY2025-03-03
YAMAA-012OTHERON TREATMENTSKIN BIOPSY2025-03-05

Expected output

Under review
7 expected rows

expected/adsl.csv

Edit
7 rows
expected/adsl.csv
STUDYIDUSUBJIDTRTSDTNACTDTNACTDYNACTFL
YAMAA-012025-01-062025-02-2046Y
YAMAA-012025-01-132025-05-05113Y
YAMAA-012025-01-202025-04-0273Y
YAMAA-012025-02-03———
YAMAA-012025-02-102025-04-1565Y
YAMAA-012025-03-032025-03-031Y
YAMAA-012025-03-102025-04-1537Y
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 ADSL_RAW.STUDYID.Predecessor
ADSLUSUBJIDUnique Subject IdentifiercharacterCopy value from ADSL_RAW.USUBJID.Predecessor
ADSLTRTSDTDate of First Exposure to TreatmentnumericISO 8601Copy value from ADSL_RAW.TRTSDT.Predecessor
ADSLNACTDTNew Anti-Cancer Therapy Start DatenumericISO 8601Least of CMNACTDT and PRNACTDT.Derived
ADSLNACTDYNew Anti-Cancer Therapy Start Relative DaynumericCDISC study day of NACTDT against TRTSDT as day 1; there is no day zero.Derived
ADSLNACTFLNew Anti-Cancer Therapy FlagcharacterY"Y" when NACTDT IS NOT NULL; blank otherwise.Derived
VariablePermitted values
NACTFLY
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-new-therapy/full.md

Edit
23 lines

Following CDISC ADaM standards, use the provided ADSL, CM, and PR datasets to create an ADSL dataset with one record per subject.

The output dataset should contain the following columns in this order: STUDYID, USUBJID, TRTSDT, NACTDT, NACTDY, NACTFL

A medication record qualifies when its CMCAT is "ON TREATMENT", and a procedure record qualifies when its PRCAT is "CANCER RELATED" and its PRSCAT is "ON TREATMENT". Therapy recorded as "PRIOR TREATMENT" does not qualify, and neither does a procedure given for a reason other than the cancer. A qualifying record counts only when its start date is on or after TRTSDT. A qualifying record with no start date does not count. Where a medication start is recorded as a year and month only, the start date is the 15th of that month; a full recorded start date stands as recorded. NACTDT is the earlier of the subject's earliest qualifying medication start date and earliest qualifying procedure start date. NACTDT has no value when no qualifying record counts for the subject. NACTDY is the study day of NACTDT counted from TRTSDT, and has no value when NACTDT has no value. NACTFL is "Y" when NACTDT has a value and has no value otherwise.

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

prompts/adam-adsl-new-therapy/conventions.md

Edit
11 lines

Following CDISC ADaM standards, use the provided ADSL, CM, and PR datasets to create an ADSL dataset with one record per subject.

The output dataset should contain the following columns in this order: STUDYID, USUBJID, TRTSDT, NACTDT, NACTDY, NACTFL

NACTDY is the study day of NACTDT counted from TRTSDT. NACTFL is "Y" or has no value.

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

prompts/adam-adsl-new-therapy/brief.md

Edit
8 lines

Following CDISC ADaM standards, use the provided ADSL, CM, and PR datasets to create an ADSL dataset with one record per subject.

The output dataset should contain the following columns in this order: STUDYID, USUBJID, TRTSDT, NACTDT, NACTDY, NACTFL

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-new-therapy/result.R

Edit
62 lines
# Reference solution for the yamaa benchmark adam-adsl-new-therapy (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)adsl_raw <- read_csv(  "/app/input/adsl.csv",  col_types = cols(TRTSDT = col_date(), .default = col_character()))cm <- read_csv(  "/app/input/cm.csv",  col_types = cols(CMSTDTC_IMP = col_date(), .default = col_character()))pr <- read_csv(  "/app/input/pr.csv",  col_types = cols(PRSTDTC = col_date(), .default = col_character()))# A qualifying medication starts on or after treatment start; a record# with no start date is skipped. The completed start fills a year-month# to the 15th, so the IMP column is the comparison date.cm_min <- cm |>  inner_join(select(adsl_raw, STUDYID, USUBJID, TRTSDT), by = c("STUDYID", "USUBJID")) |>  filter(CMCAT == "ON TREATMENT", !is.na(CMSTDTC_IMP), CMSTDTC_IMP >= TRTSDT) |>  group_by(STUDYID, USUBJID) |>  summarise(CMNACTDT = min(CMSTDTC_IMP), .groups = "drop")# A qualifying procedure is cancer related and on treatment, also on or# after treatment start.pr_min <- pr |>  inner_join(select(adsl_raw, STUDYID, USUBJID, TRTSDT), by = c("STUDYID", "USUBJID")) |>  filter(    PRCAT == "CANCER RELATED", PRSCAT == "ON TREATMENT",    !is.na(PRSTDTC), PRSTDTC >= TRTSDT  ) |>  group_by(STUDYID, USUBJID) |>  summarise(PRNACTDT = min(PRSTDTC), .groups = "drop")adsl <- adsl_raw |>  left_join(cm_min, by = c("STUDYID", "USUBJID")) |>  left_join(pr_min, by = c("STUDYID", "USUBJID")) |>  mutate(    NACTDT = case_when(      !is.na(CMNACTDT) & !is.na(PRNACTDT) ~ pmin(CMNACTDT, PRNACTDT),      !is.na(CMNACTDT) ~ CMNACTDT,      !is.na(PRNACTDT) ~ PRNACTDT,      .default = as.Date(NA)    )  ) |>  mutate(    NACTDY = as.integer(NACTDT - TRTSDT) + 1L,    NACTFL = if_else(is.na(NACTDT), NA_character_, "Y")  ) |>  select(STUDYID, USUBJID, TRTSDT, NACTDT, NACTDY, NACTFL) |>  arrange(USUBJID)dir.create("/app/output", showWarnings = FALSE)write_csv(adsl, "/app/output/adsl.csv", na = "")

solutions/adam-adsl-new-therapy/result.py

Edit
122 lines
# Reference solution for the yamaa benchmark adam-adsl-new-therapy (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 an ADSL dataset with new anticancer therapy variables.Reads the ADSL, CM and PR datasets from /app/input and writes/app/output/adsl.csv with one record per subject and the columnsSTUDYID, USUBJID, TRTSDT, NACTDT, NACTDY, NACTFL.A medication record qualifies when its CMCAT is "ON TREATMENT". Aprocedure record qualifies when its PRCAT is "CANCER RELATED" and itsPRSCAT is "ON TREATMENT". A qualifying record counts only when itsstart date is on or after TRTSDT; a qualifying record with no startdate does not count. A start recorded as a year and month only isimputed to the 15th of that month; a full recorded start date standsas recorded.NACTDT is the earlier of the subject's earliest qualifying medicationstart date and earliest qualifying procedure start date, and has novalue when no qualifying record counts. NACTDY is the study day ofNACTDT counted from TRTSDT (TRTSDT itself is day 1). NACTFL is "Y"when NACTDT has a value and has no value otherwise."""import csvfrom datetime import datefrom pathlib import PathINPUT_DIR = Path("/app/input")OUTPUT_DIR = Path("/app/output")def parse_start_date(value):    """Return a date from an ISO 8601 date string, or None.    A full date (YYYY-MM-DD) stands as recorded. A year-and-month    value (YYYY-MM) is imputed to the 15th of that month. A missing    value returns None.    """    value = (value or "").strip()    if not value:        return None    parts = value.split("-")    if len(parts) == 3:        year, month, day = (int(part) for part in parts)        return date(year, month, day)    if len(parts) == 2:        year, month = (int(part) for part in parts)        return date(year, month, 15)    return Nonedef read_csv(path):    with open(path, newline="", encoding="utf-8") as handle:        return list(csv.DictReader(handle))def main():    adsl = read_csv(INPUT_DIR / "adsl.csv")    cm = read_csv(INPUT_DIR / "cm.csv")    pr = read_csv(INPUT_DIR / "pr.csv")    trtsdt_by_subject = {        row["USUBJID"]: parse_start_date(row["TRTSDT"]) for row in adsl    }    # Earliest counting start date per subject across both sources.    earliest = {}    def consider(usubjid, start):        if start is None:            return        trtsdt = trtsdt_by_subject.get(usubjid)        if trtsdt is None or start < trtsdt:            return        if usubjid not in earliest or start < earliest[usubjid]:            earliest[usubjid] = start    for row in cm:        if (row.get("CMCAT") or "").strip() != "ON TREATMENT":            continue        consider(row["USUBJID"], parse_start_date(row.get("CMSTDTC", "")))    for row in pr:        if (row.get("PRCAT") or "").strip() != "CANCER RELATED":            continue        if (row.get("PRSCAT") or "").strip() != "ON TREATMENT":            continue        consider(row["USUBJID"], parse_start_date(row.get("PRSTDTC", "")))    OUTPUT_DIR.mkdir(parents=True, exist_ok=True)    fieldnames = ["STUDYID", "USUBJID", "TRTSDT", "NACTDT", "NACTDY", "NACTFL"]    with open(OUTPUT_DIR / "adsl.csv", "w", newline="", encoding="utf-8") as handle:        writer = csv.DictWriter(handle, fieldnames=fieldnames)        writer.writeheader()        for row in adsl:            usubjid = row["USUBJID"]            trtsdt = trtsdt_by_subject[usubjid]            nactdt = earliest.get(usubjid)            if nactdt is None:                nactdt_text, nactdy_text, nactfl = "", "", ""            else:                nactdt_text = nactdt.isoformat()                nactdy_text = str((nactdt - trtsdt).days + 1)                nactfl = "Y"            writer.writerow(                {                    "STUDYID": row["STUDYID"],                    "USUBJID": usubjid,                    "TRTSDT": row["TRTSDT"],                    "NACTDT": nactdt_text,                    "NACTDY": nactdy_text,                    "NACTFL": nactfl,                }            )if __name__ == "__main__":    main()

solutions/adam-adsl-new-therapy/result.sas

Edit
51 lines
/* opensas reference solution for the yamaa benchmark adam-adsl-new-therapy.   Reads the benchmark inputs and derives the requested output.   Execute with the existing opensas runtime: opensas /app/output/result.sas. */data adsl;  length STUDYID USUBJID TRTSDT $1024;  infile "/app/input/adsl.csv" dsd dlm="," firstobs=2 truncover lrecl=32767;  input STUDYID : $char1024. USUBJID : $char1024. TRTSDT : $char1024.;run;data cm;  length STUDYID USUBJID CMCAT CMSCAT CMTRT CMSTDTC CMSTDTC_IMP $1024;  infile "/app/input/cm.csv" dsd dlm="," firstobs=2 truncover lrecl=32767;  input STUDYID : $char1024. USUBJID : $char1024. CMSEQ CMCAT : $char1024. CMSCAT : $char1024. CMTRT : $char1024. CMSTDTC : $char1024. CMSTDTC_IMP : $char1024.;run;data pr;  length STUDYID USUBJID PRCAT PRSCAT PRTRT PRSTDTC $1024;  infile "/app/input/pr.csv" dsd dlm="," firstobs=2 truncover lrecl=32767;  input STUDYID : $char1024. USUBJID : $char1024. PRSEQ PRCAT : $char1024. PRSCAT : $char1024. PRTRT : $char1024. PRSTDTC : $char1024.;run;data medication;  length therapy $10;  set cm;  if CMCAT='ON TREATMENT';  /* Use the supplied completed date, including its collected corrections. */  therapy='';  if lengthn(CMSTDTC_IMP)>=10 then therapy=substr(CMSTDTC_IMP,1,10);run;data procedure;  length therapy $10;  set pr;  if PRCAT='CANCER RELATED' and PRSCAT='ON TREATMENT';  therapy=substr(PRSTDTC,1,10);run;data therapies; set medication procedure; keep STUDYID USUBJID therapy; run;proc sql;  create table firsttherapy as select a.STUDYID,a.USUBJID,min(b.therapy) as NACTDT from adsl as a inner join therapies as b on a.STUDYID=b.STUDYID and a.USUBJID=b.USUBJID where a.TRTSDT ne '' and b.therapy ne '' and b.therapy>=a.TRTSDT group by a.STUDYID,a.USUBJID;  create table joined as select a.*,b.NACTDT from adsl as a left join firsttherapy as b on a.STUDYID=b.STUDYID and a.USUBJID=b.USUBJID;quit;data result;  length NACTFL $1; set joined;  NACTFL=''; NACTDY=.;  if not missing(NACTDT) then do; NACTFL='Y'; NACTDY=input(NACTDT,yymmdd10.)-input(TRTSDT,yymmdd10.)+1; end;run;proc sql;  create table final as select STUDYID, USUBJID, TRTSDT, NACTDT, NACTDY, NACTFL from result;quit;proc export data=final outfile="/app/output/adsl.csv" dbms=csv replace; run;