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: flag each exposure administration whose dose was reduced
from the previous administration, adding DOSREDFL (Dose Reduced
Flag).
Input: exposure (EX) records carrying a sequence number
(EXSEQ), treatment start date/time (EXSTDTM), and collected dose
(EXDOSE).
Variables:
DOSREDFLisYwhen the current dose is lower than the previous dose for the same subject; empty otherwise, for the first record and whenever the current or the previous dose is zero or missing.
Note: the comparison runs in chronological treatment-start order within each subject, breaking timestamp ties by sequence number. The previous dose is always the administration just before, never an earlier nonzero dose, so a pause in dosing (a zero dose) is not flagged and neither is the administration after it.
Inputs
Under review1 source fileinput/ex.csv
Edit13 rows| STUDYID | USUBJID | EXSEQ | EXSTDTM | EXDOSE |
|---|---|---|---|---|
| YAMAA-01 | 1 | 2024-01-08T08:00 | 200.0 | |
| YAMAA-01 | 2 | 2024-01-15T08:00 | 200.0 | |
| YAMAA-01 | 3 | 2024-01-22T08:00 | 150.0 | |
| YAMAA-01 | 4 | 2024-01-29T08:00 | 0.0 | |
| YAMAA-01 | 5 | 2024-02-05T08:00 | 150.0 | |
| YAMAA-01 | 6 | 2024-02-12T08:00 | — | |
| YAMAA-01 | 7 | 2024-02-19T08:00 | 100.0 | |
| YAMAA-01 | 8 | 2024-02-26T08:00 | 80.0 | |
| YAMAA-01 | 1 | 2024-01-10T08:00 | 250.0 | |
| YAMAA-01 | 1 | 2024-01-09T08:00 | 200.0 | |
| YAMAA-01 | 2 | 2024-01-09T08:00 | 120.0 | |
| YAMAA-01 | 1 | 2024-01-11T08:00 | 0.0 | |
| YAMAA-01 | 2 | 2024-01-18T08:00 | 100.0 |
Expected output
Under review13 expected rowsexpected/adex.csv
Edit13 rows| STUDYID | USUBJID | EXSEQ | EXSTDTM | EXDOSE | DOSREDFL |
|---|---|---|---|---|---|
| YAMAA-01 | 1 | 2024-01-08T08:00:00 | 200 | — | |
| YAMAA-01 | 2 | 2024-01-15T08:00:00 | 200 | — | |
| YAMAA-01 | 3 | 2024-01-22T08:00:00 | 150 | Y | |
| YAMAA-01 | 4 | 2024-01-29T08:00:00 | 0 | — | |
| YAMAA-01 | 5 | 2024-02-05T08:00:00 | 150 | — | |
| YAMAA-01 | 6 | 2024-02-12T08:00:00 | — | — | |
| YAMAA-01 | 7 | 2024-02-19T08:00:00 | 100 | — | |
| YAMAA-01 | 8 | 2024-02-26T08:00:00 | 80 | Y | |
| YAMAA-01 | 1 | 2024-01-10T08:00:00 | 250 | — | |
| YAMAA-01 | 1 | 2024-01-09T08:00:00 | 200 | — | |
| YAMAA-01 | 2 | 2024-01-09T08:00:00 | 120 | Y | |
| YAMAA-01 | 1 | 2024-01-11T08:00:00 | 0 | — | |
| YAMAA-01 | 2 | 2024-01-18T08:00:00 | 100 | — |
Human review and assessment
| Dataset Name | Variable Name | Variable Label | Type | Codelist/Controlled Terms | Core | Computational Method | Origin |
|---|---|---|---|---|---|---|---|
| ADEX | STUDYID | Study Identifier | character | Copy value from EX.STUDYID. | Predecessor | ||
| ADEX | USUBJID | Unique Subject Identifier | character | Copy value from EX.USUBJID. | Predecessor | ||
| ADEX | EXSEQ | Sequence Number | numeric | Copy value from EX.EXSEQ. | Predecessor | ||
| ADEX | EXSTDTM | Start Date/Time of Treatment | numeric | ISO 8601 | Copy value from EX.EXSTDTM. | Predecessor | |
| ADEX | EXDOSE | Dose | numeric | Copy value from EX.EXDOSE. | Predecessor | ||
| ADEX | DOSREDFL | Dose Reduced Flag | character | "Y" when EXDOSE > 0 AND EXDOSE < PREVDOSE; blank otherwise. | Derived |
| 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-adex-dose-reduction/full.md
Edit18 linesFollowing CDISC ADaM standards, use the provided EX dataset to create an ADEX dataset with one record per exposure administration.
The output dataset should contain the following columns in this order: STUDYID, USUBJID, EXSEQ, EXSTDTM, EXDOSE, DOSREDFL
DOSREDFL is Y when the current dose (EXDOSE) is lower than the previous dose for the same subject, and has no value otherwise. Within each subject, administrations are ordered by treatment start date/time (EXSTDTM), with administrations that share a start date/time ordered by sequence number (EXSEQ), and the previous dose is the dose of the administration just before in that order. DOSREDFL has no value for the subject's first administration and whenever the current dose or the previous dose is zero or has no value. The previous dose is never an earlier nonzero dose: a pause in dosing, where the dose is zero, is not flagged, and neither is the administration after it.
Read the source datasets from /app/input and save the completed dataset as /app/output/adex.csv.
prompts/adam-adex-dose-reduction/conventions.md
Edit10 linesFollowing CDISC ADaM standards, use the provided EX dataset to create an ADEX dataset with one record per exposure administration.
The output dataset should contain the following columns in this order: STUDYID, USUBJID, EXSEQ, EXSTDTM, EXDOSE, DOSREDFL
DOSREDFL is Y or has no value.
Read the source datasets from /app/input and save the completed dataset as /app/output/adex.csv.
prompts/adam-adex-dose-reduction/brief.md
Edit8 linesFollowing CDISC ADaM standards, use the provided EX dataset to create an ADEX dataset with one record per exposure administration.
The output dataset should contain the following columns in this order: STUDYID, USUBJID, EXSEQ, EXSTDTM, EXDOSE, DOSREDFL
Read the source datasets from /app/input and save the completed dataset as /app/output/adex.csv.
R
Edit3 lineslibrary(yamaa)yamaa_spec("spec.yaml")$run()$outputPython
Edit3 linesimport yamaayamaa.spec("spec.yaml").run().outputsolutions/adam-adex-dose-reduction/result.R
Edit42 lines# Reference solution for the yamaa benchmark adam-adex-dose-reduction (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)ex <- read_csv( "/app/input/ex.csv", col_types = cols(EXSEQ = col_integer(), .default = col_character()))adex <- ex |> mutate( EXSTDTM = if_else( !is.na(EXSTDTM) & nchar(EXSTDTM) == 16L, paste0(EXSTDTM, ":00"), EXSTDTM ), EXDOSE = suppressWarnings(as.numeric(EXDOSE)) ) |> # Chronological treatment-start order within each subject, breaking # timestamp ties by sequence number. arrange(USUBJID, EXSTDTM, EXSEQ) |> group_by(USUBJID) |> mutate( PREVDOSE = lag(EXDOSE), # Y when the current dose is lower than the previous one; no value for # the first record and whenever either dose is zero or missing. The # previous dose is always the administration just before. DOSREDFL = if_else( !is.na(EXDOSE) & EXDOSE != 0 & !is.na(PREVDOSE) & PREVDOSE != 0 & EXDOSE < PREVDOSE, "Y", NA_character_ ) ) |> ungroup() |> select(STUDYID, USUBJID, EXSEQ, EXSTDTM, EXDOSE, DOSREDFL)dir.create("/app/output", showWarnings = FALSE)write_csv(adex, "/app/output/adex.csv", na = "")solutions/adam-adex-dose-reduction/result.py
Edit62 lines# Reference solution for the yamaa benchmark adam-adex-dose-reduction (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 ADEX from EX: flag administrations whose dose is lower than thedose of the subject's immediately preceding administration."""import csvINPUT = "/app/input/ex.csv"OUTPUT = "/app/output/adex.csv"COLUMNS = ["STUDYID", "USUBJID", "EXSEQ", "EXSTDTM", "EXDOSE", "DOSREDFL"]def parse_dose(text): """Return the numeric dose, or None when the value is missing.""" if text is None or text.strip() == "": return None return float(text)def main(): with open(INPUT, newline="") as f: rows = list(csv.DictReader(f)) # Order administrations within each subject by start date/time, # breaking ties by sequence number. ordered = sorted( rows, key=lambda r: (r["USUBJID"], r["EXSTDTM"], int(r["EXSEQ"])), ) previous = {} # subject -> numeric dose of the preceding administration for row in ordered: subject = row["USUBJID"] current = parse_dose(row["EXDOSE"]) flag = "" if subject in previous: prev = previous[subject] if ( current is not None and prev is not None and current != 0 and prev != 0 and current < prev ): flag = "Y" row["DOSREDFL"] = flag previous[subject] = current with open(OUTPUT, "w", newline="") as f: writer = csv.DictWriter(f, fieldnames=COLUMNS) writer.writeheader() for row in ordered: writer.writerow({col: row[col] for col in COLUMNS})if __name__ == "__main__": main()solutions/adam-adex-dose-reduction/result.sas
Edit24 lines/* opensas reference solution for the yamaa benchmark adam-adex-dose-reduction. Reads the benchmark inputs and derives the requested output. Execute with the existing opensas runtime: opensas /app/output/result.sas. */data ex; length STUDYID USUBJID EXSTDTM $1024; infile "/app/input/ex.csv" dsd dlm="," firstobs=2 truncover lrecl=32767; input STUDYID : $char1024. USUBJID : $char1024. EXSEQ EXSTDTM : $char1024. EXDOSE;run;proc sort data=ex out=ordered; by STUDYID USUBJID EXSTDTM EXSEQ; run;data result; length DOSREDFL $1; retain previous; set ordered; by STUDYID USUBJID; if first.USUBJID then previous=.; if EXDOSE>0 and previous>0 and EXDOSE<previous then DOSREDFL='Y'; previous=EXDOSE;run;proc sql; create table final as select STUDYID, USUBJID, EXSEQ, EXSTDTM, EXDOSE, DOSREDFL from result;quit;proc export data=final outfile="/app/output/adex.csv" dbms=csv replace; run;
yamaa