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 first rescue medication in RESCTRT.

Input: one subject-level table listing the subjects, plus medication records carrying a treatment name (CMTRT), a category (CMCAT), a start date (CMSTDTC), and a sequence number (CMSEQ).

Variables:

  • RESCTRT is the treatment name of the subject's first rescue medication: a record whose category (CMCAT) is RESCUE MEDICATION, picked by the earliest start date (CMSTDTC), with the smaller sequence number (CMSEQ) breaking a tie. It is left blank, never filled with placeholder text, when the subject took no rescue medication, whether the subject took other medications or has no medication records at all. A rescue record with no recorded start date still counts; a duplicated record does not change the answer. A start date with only year and month compares as written, so it falls before any full date in the same month.

Inputs

Under review
2 source files

input/cm.csv

Edit
14 rows
input/cm.csv
STUDYIDUSUBJIDCMSEQCMTRTCMCATCMSTDTC
YAMAA-011LISINOPRILCONCOMITANT MEDICATION2025-02-10
YAMAA-012DEXAMETHASONERESCUE MEDICATION2025-03-20
YAMAA-013PREDNISONERESCUE MEDICATION2025-03-05
YAMAA-014NAPROXENRESCUE MEDICATION2025-03
YAMAA-011ATORVASTATINCONCOMITANT MEDICATION2025-02-15
YAMAA-012METFORMINCONCOMITANT MEDICATION2025-03-01
YAMAA-011ALBUTEROLRESCUE MEDICATION2025-04-01
YAMAA-012SALBUTAMOLRESCUE MEDICATION2025-04-01
YAMAA-013OMEPRAZOLECONCOMITANT MEDICATION2025-03-15
YAMAA-011ONDANSETRONRESCUE MEDICATION2025-05-12
YAMAA-011ONDANSETRONRESCUE MEDICATION2025-05-12
YAMAA-012LEVOTHYROXINECONCOMITANT MEDICATION2025-02-20
YAMAA-011LOPERAMIDERESCUE MEDICATION—
YAMAA-012IBUPROFENCONCOMITANT MEDICATION2025-06-01

input/dm.csv

Edit
6 rows
input/dm.csv
STUDYIDUSUBJID
YAMAA-01
YAMAA-01
YAMAA-01
YAMAA-01
YAMAA-01
YAMAA-01

Expected output

Under review
6 expected rows

expected/adsl.csv

Edit
6 rows
expected/adsl.csv
STUDYIDUSUBJIDRESCTRT
YAMAA-01NAPROXEN
YAMAA-01—
YAMAA-01ALBUTEROL
YAMAA-01ONDANSETRON
YAMAA-01—
YAMAA-01LOPERAMIDE
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
ADSLRESCTRTRescue MedicationcharacterCopy value from CM.CMTRT where CM.CMCAT = 'RESCUE MEDICATION', keeping the first ordered by CM.CMSTDTC then CM.CMSEQ.Predecessor
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-rescue-med/full.md

Edit
19 lines

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

The output dataset should contain the following columns in this order: STUDYID, USUBJID, RESCTRT

RESCTRT is the treatment name (CMTRT) of the subject's first rescue medication: a CM record whose category (CMCAT) is "RESCUE MEDICATION", chosen by the earliest start date (CMSTDTC), with the smaller CMSEQ breaking a tie between records with the same start date. RESCTRT has no value when the subject took no rescue medication, whether the subject took other medications or has no medication records at all, and it is never filled with placeholder text. A rescue record with no recorded start date still counts. A duplicated rescue record does not change the answer. A start date recorded with only a year and month compares as written, so it falls before any full date in the same month.

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

prompts/adam-adsl-rescue-med/conventions.md

Edit
12 lines

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

The output dataset should contain the following columns in this order: STUDYID, USUBJID, RESCTRT

RESCTRT is the treatment name (CMTRT) of the subject's first rescue medication, or has no value, and it is never filled with placeholder text.

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

prompts/adam-adsl-rescue-med/brief.md

Edit
8 lines

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

The output dataset should contain the following columns in this order: STUDYID, USUBJID, RESCTRT

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-rescue-med/result.R

Edit
36 lines
# Reference solution for the yamaa benchmark adam-adsl-rescue-med (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)dm <- read_csv(  "/app/input/dm.csv",  col_types = cols(.default = col_character()))cm <- read_csv(  "/app/input/cm.csv",  col_types = cols(CMSEQ = col_integer(), .default = col_character()))# The first rescue medication by earliest start date, with the smaller# sequence number breaking a tie. A start holding only year and month# compares as written, so it falls before any full date in the same# month; a record with no start date still counts.first <- cm |>  filter(CMCAT == "RESCUE MEDICATION") |>  mutate(sortkey = coalesce(CMSTDTC, "")) |>  arrange(sortkey, CMSEQ) |>  distinct(STUDYID, USUBJID, .keep_all = TRUE) |>  select(STUDYID, USUBJID, RESCTRT = CMTRT)adsl <- dm |>  left_join(first, by = c("STUDYID", "USUBJID")) |>  select(STUDYID, USUBJID, RESCTRT) |>  arrange(USUBJID)dir.create("/app/output", showWarnings = FALSE)write_csv(adsl, "/app/output/adsl.csv", na = "")

solutions/adam-adsl-rescue-med/result.py

Edit
56 lines
# Reference solution for the yamaa benchmark adam-adsl-rescue-med (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 csvfrom pathlib import PathINPUT = Path("/app/input")OUTPUT = Path("/app/output")def read_rows(name):    with open(INPUT / name, newline="", encoding="utf-8") as f:        return list(csv.DictReader(f))def main():    dm = read_rows("dm.csv")    cm = read_rows("cm.csv")    rescue = {}    for row in cm:        if (row.get("CMCAT") or "") != "RESCUE MEDICATION":            continue        key = (row.get("STUDYID") or "", row.get("USUBJID") or "")        # Compare the start date as written: a year-month value such as        # "2025-03" sorts before any full date in the same month under        # plain string ordering. A missing date sorts as the empty string.        date_key = row.get("CMSTDTC") or ""        try:            seq_key = int(row.get("CMSEQ") or "")        except ValueError:            try:                seq_key = float(row.get("CMSEQ") or "")            except ValueError:                seq_key = 0        sort_key = (date_key, seq_key)        if key not in rescue or sort_key < rescue[key][0]:            rescue[key] = (sort_key, row.get("CMTRT") or "")    OUTPUT.mkdir(parents=True, exist_ok=True)    with open(OUTPUT / "adsl.csv", "w", newline="", encoding="utf-8") as f:        writer = csv.writer(f)        writer.writerow(["STUDYID", "USUBJID", "RESCTRT"])        for row in dm:            studyid = row.get("STUDYID") or ""            usubjid = row.get("USUBJID") or ""            entry = rescue.get((studyid, usubjid))            resctrt = entry[1] if entry else ""            writer.writerow([studyid, usubjid, resctrt])if __name__ == "__main__":    main()

solutions/adam-adsl-rescue-med/result.sas

Edit
22 lines
/* opensas reference solution for the yamaa benchmark adam-adsl-rescue-med.   Reads the benchmark inputs and derives the requested output.   Execute with the existing opensas runtime: opensas /app/output/result.sas. */data cm;  length STUDYID USUBJID CMTRT CMCAT CMSTDTC $1024;  infile "/app/input/cm.csv" dsd dlm="," firstobs=2 truncover lrecl=32767;  input STUDYID : $char1024. USUBJID : $char1024. CMSEQ CMTRT : $char1024. CMCAT : $char1024. CMSTDTC : $char1024.;run;data dm;  length STUDYID USUBJID $1024;  infile "/app/input/dm.csv" dsd dlm="," firstobs=2 truncover lrecl=32767;  input STUDYID : $char1024. USUBJID : $char1024.;run;data rescue; set cm; if CMCAT='RESCUE MEDICATION'; nodate=missing(CMSTDTC); run;proc sort data=rescue; by STUDYID USUBJID nodate CMSTDTC CMSEQ; run;data firstcm; set rescue; by STUDYID USUBJID; if first.USUBJID; run;proc sql; create table result as select a.*,b.CMTRT as RESCTRT from dm as a left join firstcm as b on a.STUDYID=b.STUDYID and a.USUBJID=b.USUBJID; quit;proc export data=result(keep=STUDYID USUBJID RESCTRT) outfile="/app/output/adsl.csv" dbms=csv replace; run;