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 subjects who completed the study, adding COMPLFL
and carrying TRTSDT through.
Input: subject-level records carrying first treatment date
(TRTSDT) when treated, plus disposition records carrying a
category (DSCAT), standardized outcome (DSDECOD), collection
date (DSDTC), and epoch (EPOCH).
Variables:
COMPLFL:Ywhen the subject has a disposition event in the study (FOLLOW-UP) epoch with standardized outcomeCOMPLETED;Notherwise. A subject whose records carry only other outcomes, such asADVERSE EVENT, and a subject with no disposition record at all, are bothN. A subject with two such completion records stops the run rather than being flagged.
Note: the flag answers whether an end-of-study completion
record exists, not whether its collection date was filled in or
how an earlier period ended, so a subject who completed
treatment but discontinued the study is N.
Inputs
Under review2 source filesinput/adsl_raw.csv
Edit8 rows| STUDYID | USUBJID | TRTSDT |
|---|---|---|
| YAMAA-01 | 2024-01-15 | |
| YAMAA-01 | 2024-01-20 | |
| YAMAA-01 | 2024-02-02 | |
| YAMAA-01 | 2024-02-05 | |
| YAMAA-01 | — | |
| YAMAA-01 | 2024-02-12 | |
| YAMAA-01 | 2024-02-18 | |
| YAMAA-01 | 2024-03-01 |
input/ds.csv
Edit9 rows| STUDYID | USUBJID | DSSEQ | DSCAT | DSDECOD | DSDTC | EPOCH |
|---|---|---|---|---|---|---|
| YAMAA-01 | 1 | PROTOCOL MILESTONE | RANDOMIZED | 2024-01-12 | SCREENING | |
| YAMAA-01 | 2 | DISPOSITION EVENT | COMPLETED | 2024-02-10 | TREATMENT | |
| YAMAA-01 | 3 | DISPOSITION EVENT | DISCONTINUED | 2024-03-01 | FOLLOW-UP | |
| YAMAA-01 | 1 | DISPOSITION EVENT | COMPLETED | — | FOLLOW-UP | |
| YAMAA-01 | 1 | DISPOSITION EVENT | ADVERSE EVENT | 2024-02-20 | TREATMENT | |
| YAMAA-01 | 1 | DISPOSITION EVENT | ADVERSE EVENT | 2024-01-05 | FOLLOW-UP | |
| YAMAA-01 | 1 | DISPOSITION EVENT | COMPLETED | 2024-03-10 | FOLLOW-UP | |
| YAMAA-01 | 1 | PROTOCOL MILESTONE | SCREEN FAILURE | 2024-01-08 | SCREENING | |
| YAMAA-01 | 1 | DISPOSITION EVENT | COMPLETED | 2024-04-01 | FOLLOW-UP |
Expected output
Under review8 expected rowsexpected/adsl.csv
Edit8 rows| STUDYID | USUBJID | TRTSDT | COMPLFL |
|---|---|---|---|
| YAMAA-01 | 2024-01-15 | N | |
| YAMAA-01 | 2024-01-20 | Y | |
| YAMAA-01 | 2024-02-02 | N | |
| YAMAA-01 | 2024-02-05 | N | |
| YAMAA-01 | — | N | |
| YAMAA-01 | 2024-02-12 | Y | |
| YAMAA-01 | 2024-02-18 | N | |
| YAMAA-01 | 2024-03-01 | Y |
Comments and assessment materials
| Dataset Name | Variable Name | Variable Label | Type | Codelist/Controlled Terms | Core | Computational Method | Origin |
|---|---|---|---|---|---|---|---|
| ADSL | STUDYID | Study Identifier | character | Copy value from ADSL_RAW.STUDYID. | Predecessor | ||
| ADSL | USUBJID | Unique Subject Identifier | character | Copy value from ADSL_RAW.USUBJID. | Predecessor | ||
| ADSL | TRTSDT | Date of First Exposure to Treatment | numeric | ISO 8601 | Copy value from ADSL_RAW.TRTSDT. | Predecessor | |
| ADSL | COMPLFL | Completers Population Flag | character | Y, N | "Y" when COMPREC IS NOT NULL; "N" otherwise; "N" when the condition is unknown. | Derived |
| Variable | Permitted values |
|---|---|
| COMPLFL | Y, N |
| 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-adsl-completion-flag/full.md
Edit18 linesFollowing CDISC ADaM standards, use the provided ADSL_RAW and DS 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, COMPLFL
COMPLFL is Y when the subject has a disposition event in the study (FOLLOW-UP) epoch with standardized outcome COMPLETED; N otherwise. A subject whose records carry only other outcomes, such as ADVERSE EVENT, and a subject with no disposition record at all, are both N.
The flag answers whether an end-of-study completion record exists, not whether its collection date was filled in or how an earlier period ended, so a subject who completed treatment but discontinued the study is N.
Read the source datasets from /app/input and save the completed dataset as /app/output/adsl.csv.
prompts/adam-adsl-completion-flag/conventions.md
Edit10 linesFollowing CDISC ADaM standards, use the provided ADSL_RAW and DS 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, COMPLFL
COMPLFL is Y or N.
Read the source datasets from /app/input and save the completed dataset as /app/output/adsl.csv.
prompts/adam-adsl-completion-flag/brief.md
Edit8 linesFollowing CDISC ADaM standards, use the provided ADSL_RAW and DS 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, COMPLFL
Read the source datasets from /app/input and save the completed dataset as /app/output/adsl.csv.
run.R
Edit4 lineslibrary(yamaa)adsl <- yamaa_domain("spec.yaml")$outputadslrun.py
Edit4 linesimport yamaaadsl = yamaa.yamaa_domain("spec.yaml").outputadslsolutions/adam-adsl-completion-flag/result.R
Edit34 lines# Reference solution for the yamaa benchmark adam-adsl-completion-flag (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_raw.csv", col_types = cols(TRTSDT = col_date(), .default = col_character()))ds <- read_csv( "/app/input/ds.csv", col_types = cols(.default = col_character()))completed <- ds |> filter( DSCAT %in% "DISPOSITION EVENT", EPOCH %in% "FOLLOW-UP", DSDECOD %in% "COMPLETED" ) |> distinct(STUDYID, USUBJID) |> mutate(.completed = "Y")adsl <- adsl_raw |> left_join(completed, by = c("STUDYID", "USUBJID")) |> mutate(COMPLFL = if_else(!is.na(.completed), "Y", "N")) |> select(STUDYID, USUBJID, TRTSDT, COMPLFL)dir.create("/app/output", showWarnings = FALSE)write_csv(adsl, "/app/output/adsl.csv", na = "")solutions/adam-adsl-completion-flag/result.py
Edit36 lines# Reference solution for the yamaa benchmark adam-adsl-completion-flag (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 pladsl_raw = pl.read_csv("/app/input/adsl_raw.csv", infer_schema=False)ds = pl.read_csv("/app/input/ds.csv", infer_schema=False)completed = ( ds.filter( (pl.col("DSCAT") == "DISPOSITION EVENT") & (pl.col("EPOCH") == "FOLLOW-UP") & (pl.col("DSDECOD") == "COMPLETED") ) .select("STUDYID", "USUBJID") .unique() .with_columns(__completed=pl.lit("Y")))adsl = ( adsl_raw.join(completed, on=["STUDYID", "USUBJID"], how="left", maintain_order="left") .with_columns( COMPLFL=pl.when(pl.col("__completed") == "Y") .then(pl.lit("Y")) .otherwise(pl.lit("N")) ) .select("STUDYID", "USUBJID", "TRTSDT", "COMPLFL"))Path("/app/output").mkdir(parents=True, exist_ok=True)adsl.write_csv("/app/output/adsl.csv")solutions/adam-adsl-completion-flag/result.sas
Edit23 lines/* opensas reference solution for the yamaa benchmark adam-adsl-completion-flag. Reads the benchmark inputs and derives the requested output. Execute with the existing opensas runtime: opensas /app/output/result.sas. */data adsl_raw; length STUDYID USUBJID TRTSDT $1024; infile "/app/input/adsl_raw.csv" dsd dlm="," firstobs=2 truncover lrecl=32767; input STUDYID : $char1024. USUBJID : $char1024. TRTSDT : $char1024.;run;data ds; length STUDYID USUBJID DSCAT DSDECOD DSDTC EPOCH $1024; infile "/app/input/ds.csv" dsd dlm="," firstobs=2 truncover lrecl=32767; input STUDYID : $char1024. USUBJID : $char1024. DSSEQ DSCAT : $char1024. DSDECOD : $char1024. DSDTC : $char1024. EPOCH : $char1024.;run;proc sql;create table completed as select distinct STUDYID,USUBJID from ds where EPOCH='FOLLOW-UP' and DSDECOD='COMPLETED';create table result as select a.*,case when not missing(b.USUBJID) then 'Y' else 'N' end as COMPLFL from adsl_raw a left join completed b on a.STUDYID=b.STUDYID and a.USUBJID=b.USUBJID; quit;proc sql; create table final as select STUDYID, USUBJID, TRTSDT, COMPLFL from result;quit;proc export data=final outfile="/app/output/adsl.csv" dbms=csv replace; run;
yamaa
Comments
Signed in with GitHub; saved in repository Discussions