As a clinical trial statistician or programmer, challenge anything in this benchmark: describe a problem in Comments, or propose a fix with the Edit button on any source file.
- Task: Would a real study need this derivation, specified this way? Does it follow CDISC ADaM: variable names, controlled terms, record structure? Flag any rule that is ambiguous or that a sponsor would handle differently.
- Inputs: Do they look like data collected in a real trial, and do they include the situations you would expect to meet in one?
- Expected output: Would independent QC programming reproduce every value from these inputs and rules?
The other tabs beside Comments are background for assessment, not under review.
Summary
README.mdGoal: 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 | — |
Comments and assessment materials
| 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.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
Edit16 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 is lower than the previous dose for the same subject, and has no value otherwise: for the first record, and whenever the current or the previous dose is zero or missing. Compare 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 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.
run.R
Edit4 lineslibrary(yamaa)adex <- yamaa_domain("spec.yaml")$outputadexrun.py
Edit4 linesimport yamaaadex = yamaa.yamaa_domain("spec.yaml").outputadexsolutions/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
Edit44 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.from pathlib import Pathimport polars as plex = pl.read_csv("/app/input/ex.csv", infer_schema=False).with_columns( pl.col("EXSEQ").cast(pl.Int64))adex = ( ex.with_columns( EXSTDTM=pl.when(pl.col("EXSTDTM").str.len_chars() == 16) .then(pl.col("EXSTDTM") + ":00") .otherwise(pl.col("EXSTDTM")), EXDOSE=pl.col("EXDOSE").cast(pl.Float64, strict=False), ) # Chronological treatment-start order within each subject, breaking # timestamp ties by sequence number. ISO datetimes sort as text. .sort(["USUBJID", "EXSTDTM", "EXSEQ"]) .with_columns(PREVDOSE=pl.col("EXDOSE").shift(1).over("USUBJID")) # 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. .with_columns( DOSREDFL=pl.when( pl.col("EXDOSE").is_not_null() & (pl.col("EXDOSE") != 0) & pl.col("PREVDOSE").is_not_null() & (pl.col("PREVDOSE") != 0) & (pl.col("EXDOSE") < pl.col("PREVDOSE")) ) .then(pl.lit("Y")) .otherwise(None) ) .select("STUDYID", "USUBJID", "EXSEQ", "EXSTDTM", "EXDOSE", "DOSREDFL"))Path("/app/output").mkdir(exist_ok=True)adex.write_csv("/app/output/adex.csv")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
Comments
Signed in with GitHub; saved in repository Discussions