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: one row per collected ophthalmic examination (OE)
measurement, adding AFEYE.
Input: ophthalmic measurements carrying sequence number
(OESEQ), test code (PARAMCD), laterality (OELAT), and
numeric result (AVAL), together with the subject's assigned
eye from the subject-level analysis dataset (ADSL). A
measurement collected without a value is kept with its value
empty.
Variables:
AFEYEis the eye's role in the study:Study Eyewhen the measured eye matches the subject's assigned eye,Both Eyesfor a bilateral measurement when the subject has an assigned eye, andFellow Eyefor the opposite eye. Either eye counts as the study eye when both eyes are assigned and the collected laterality is present. When the assigned eye or the collected laterality is missing,AFEYEstays empty.
Note: the assigned eye belongs to the subject, so the same eye is the study eye at every visit; only the collected laterality moves a record between roles.
Inputs
Under review2 source filesinput/adsl.csv
Edit4 rows| STUDYID | USUBJID | STUDYEYE |
|---|---|---|
| YAMAA-01 | LEFT | |
| YAMAA-01 | RIGHT | |
| YAMAA-01 | BILATERAL | |
| YAMAA-01 | LEFT |
input/oe.csv
Edit10 rows| STUDYID | USUBJID | OESEQ | OETESTCD | OELAT | OESTRESN |
|---|---|---|---|---|---|
| YAMAA-01 | 1 | IOP | LEFT | 18 | |
| YAMAA-01 | 2 | IOP | RIGHT | 24 | |
| YAMAA-01 | 1 | IOP | LEFT | 16 | |
| YAMAA-01 | 2 | IOP | RIGHT | 15 | |
| YAMAA-01 | 1 | IOP | LEFT | 21 | |
| YAMAA-01 | 2 | IOP | RIGHT | 20 | |
| YAMAA-01 | 3 | IOP | BILATERAL | — | |
| YAMAA-01 | 1 | IOP | LEFT | 19 | |
| YAMAA-01 | 2 | IOP | BILATERAL | — | |
| YAMAA-01 | 1 | IOP | — | 22 |
Expected output
Under review10 expected rowsexpected/adoe.csv
Edit10 rows| STUDYID | USUBJID | OESEQ | PARAMCD | OELAT | AVAL | AFEYE |
|---|---|---|---|---|---|---|
| YAMAA-01 | 1 | IOP | LEFT | 18 | Study Eye | |
| YAMAA-01 | 2 | IOP | RIGHT | 24 | Fellow Eye | |
| YAMAA-01 | 1 | IOP | LEFT | 16 | Fellow Eye | |
| YAMAA-01 | 2 | IOP | RIGHT | 15 | Study Eye | |
| YAMAA-01 | 1 | IOP | LEFT | 21 | Study Eye | |
| YAMAA-01 | 2 | IOP | RIGHT | 20 | Study Eye | |
| YAMAA-01 | 3 | IOP | BILATERAL | — | Both Eyes | |
| YAMAA-01 | 1 | IOP | LEFT | 19 | — | |
| YAMAA-01 | 2 | IOP | BILATERAL | — | — | |
| YAMAA-01 | 1 | IOP | — | 22 | — |
Comments and assessment materials
| Dataset Name | Variable Name | Variable Label | Type | Codelist/Controlled Terms | Core | Computational Method | Origin |
|---|---|---|---|---|---|---|---|
| ADOE | STUDYID | Study Identifier | character | Copy value from OE.STUDYID. | Predecessor | ||
| ADOE | USUBJID | Unique Subject Identifier | character | Copy value from OE.USUBJID. | Predecessor | ||
| ADOE | OESEQ | Sequence Number | numeric | Copy value from OE.OESEQ. | Predecessor | ||
| ADOE | PARAMCD | Parameter Code | character | Copy value from OE.OETESTCD. | Predecessor | ||
| ADOE | OELAT | Laterality | character | LEFT, RIGHT, BILATERAL | Copy value from OE.OELAT. | Predecessor | |
| ADOE | AVAL | Analysis Value | numeric | Copy value from OE.OESTRESN. | Predecessor | ||
| ADOE | AFEYE | Analysis Eye | character | Study Eye, Fellow Eye, Both Eyes | If OELAT = 'BILATERAL' AND STUDYEYE IS NOT NULL then "Both Eyes"; If STUDYEYE = 'BILATERAL' AND OELAT IS NOT NULL then "Study Eye"; If OELAT = STUDYEYE then "Study Eye"; If STUDYEYE IS NOT NULL AND OELAT IS NOT NULL then "Fellow Eye"; otherwise blank. | Derived |
| Variable | Permitted values |
|---|---|
| OELAT | LEFT, RIGHT, BILATERAL |
| AFEYE | Study Eye, Fellow Eye, Both Eyes |
| 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-adoe-study-eye/full.md
Edit22 linesFollowing CDISC ADaM standards, use the provided OE and ADSL datasets to create an ADOE dataset with one row per collected ophthalmic measurement.
The output dataset should contain the following columns in this order: STUDYID, USUBJID, OESEQ, PARAMCD, OELAT, AVAL, AFEYE
AFEYE is the eye's role in the study: Study Eye when the measured eye matches the subject's assigned eye, Both Eyes for a bilateral measurement when the subject has an assigned eye, and Fellow Eye for the opposite eye. Either eye counts as the study eye when both eyes are assigned and the collected laterality is present. When the assigned eye or the collected laterality is missing, AFEYE has no value.
The assigned eye belongs to the subject, so the same eye is the study eye at every visit; only the collected laterality moves a record between roles. A measurement collected without a value is kept with its value empty.
Read the source datasets from /app/input and save the completed dataset as /app/output/adoe.csv.
prompts/adam-adoe-study-eye/conventions.md
Edit11 linesFollowing CDISC ADaM standards, use the provided OE and ADSL datasets to create an ADOE dataset with one row per collected ophthalmic measurement.
The output dataset should contain the following columns in this order: STUDYID, USUBJID, OESEQ, PARAMCD, OELAT, AVAL, AFEYE
AFEYE is Study Eye, Both Eyes, or Fellow Eye, or has no value.
Read the source datasets from /app/input and save the completed dataset as /app/output/adoe.csv.
prompts/adam-adoe-study-eye/brief.md
Edit9 linesFollowing CDISC ADaM standards, use the provided OE and ADSL datasets to create an ADOE dataset with one row per collected ophthalmic measurement.
The output dataset should contain the following columns in this order: STUDYID, USUBJID, OESEQ, PARAMCD, OELAT, AVAL, AFEYE
Read the source datasets from /app/input and save the completed dataset as /app/output/adoe.csv.
run.R
Edit4 lineslibrary(yamaa)adoe <- yamaa_domain("spec.yaml")$outputadoerun.py
Edit4 linesimport yamaaadoe = yamaa.yamaa_domain("spec.yaml").outputadoesolutions/adam-adoe-study-eye/result.R
Edit43 lines# Reference solution for the yamaa benchmark adam-adoe-study-eye (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 <- read_csv( "/app/input/adsl.csv", col_types = cols(.default = col_character()))oe <- read_csv( "/app/input/oe.csv", col_types = cols( OESEQ = col_integer(), OESTRESN = col_double(), .default = col_character() ))# The assigned eye belongs to the subject, so the join is by subject; a# subject without an assigned eye keeps its measurements with no role.adoe <- oe |> left_join(select(adsl, USUBJID, STUDYEYE), by = "USUBJID") |> mutate( PARAMCD = OETESTCD, AVAL = OESTRESN, AFEYE = case_when( is.na(STUDYEYE) | STUDYEYE == "" ~ NA_character_, is.na(OELAT) | OELAT == "" ~ NA_character_, OELAT == "BILATERAL" ~ "Both Eyes", STUDYEYE == "BILATERAL" ~ "Study Eye", OELAT == STUDYEYE ~ "Study Eye", .default = "Fellow Eye" ) ) |> select(STUDYID, USUBJID, OESEQ, PARAMCD, OELAT, AVAL, AFEYE) |> arrange(USUBJID, OESEQ)dir.create("/app/output", showWarnings = FALSE)write_csv(adoe, "/app/output/adoe.csv", na = "")solutions/adam-adoe-study-eye/result.py
Edit44 lines# Reference solution for the yamaa benchmark adam-adoe-study-eye (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 = pl.read_csv("/app/input/adsl.csv", infer_schema=False)oe = pl.read_csv("/app/input/oe.csv", infer_schema=False).with_columns( pl.col("OESEQ").cast(pl.Int64), pl.col("OESTRESN").cast(pl.Float64),)# The assigned eye belongs to the subject, so the join is by subject; a# subject without an assigned eye keeps its measurements with no role.base = oe.join( adsl.select("USUBJID", "STUDYEYE"), on="USUBJID", how="left")study_missing = pl.col("STUDYEYE").is_null() | (pl.col("STUDYEYE") == "")collected_missing = pl.col("OELAT").is_null() | (pl.col("OELAT") == "")afeye = ( pl.when(study_missing | collected_missing) .then(None) .when(pl.col("OELAT") == "BILATERAL") .then(pl.lit("Both Eyes")) .when(pl.col("STUDYEYE") == "BILATERAL") .then(pl.lit("Study Eye")) .when(pl.col("OELAT") == pl.col("STUDYEYE")) .then(pl.lit("Study Eye")) .otherwise(pl.lit("Fellow Eye")))adoe = ( base.with_columns(PARAMCD=pl.col("OETESTCD"), AVAL=pl.col("OESTRESN"), AFEYE=afeye) .select("STUDYID", "USUBJID", "OESEQ", "PARAMCD", "OELAT", "AVAL", "AFEYE") .sort(["USUBJID", "OESEQ"]))Path("/app/output").mkdir(exist_ok=True)adoe.write_csv("/app/output/adoe.csv")solutions/adam-adoe-study-eye/result.sas
Edit25 lines/* opensas reference solution for the yamaa benchmark adam-adoe-study-eye. 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 STUDYEYE $1024; infile "/app/input/adsl.csv" dsd dlm="," firstobs=2 truncover lrecl=32767; input STUDYID : $char1024. USUBJID : $char1024. STUDYEYE : $char1024.;run;data oe; length STUDYID USUBJID OETESTCD OELAT $1024; infile "/app/input/oe.csv" dsd dlm="," firstobs=2 truncover lrecl=32767; input STUDYID : $char1024. USUBJID : $char1024. OESEQ OETESTCD : $char1024. OELAT : $char1024. OESTRESN;run;proc sql; create table result as select a.*,a.OETESTCD as PARAMCD,a.OESTRESN as AVAL,case when missing(a.OELAT) or missing(b.STUDYEYE) then '' when a.OELAT='BILATERAL' then 'Both Eyes' when b.STUDYEYE='BILATERAL' or a.OELAT=b.STUDYEYE then 'Study Eye' else 'Fellow Eye' end as AFEYE from oe as a left join adsl as b on a.STUDYID=b.STUDYID and a.USUBJID=b.USUBJID;quit;proc sql; create table final as select STUDYID, USUBJID, OESEQ, PARAMCD, OELAT, AVAL, AFEYE from result;quit;proc export data=final outfile="/app/output/adoe.csv" dbms=csv replace; run;
yamaa
Comments
Signed in with GitHub; saved in repository Discussions