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: build one record per clinical site and treatment arm for a
Bioresearch Monitoring (BIMO) submission, with the site identifier
(SITEID), the treatment arm (ARM), the number of treated subjects
(SAFPOP), and the number of enrolled subjects (ENRLPOP) in that arm
at that site.
Input: one row per subject carrying the study identifier, the unique subject identifier, the site key, the subject's treatment arm, and the treated flag.
Variables:
SITEIDis the site key exactly as collected, leading zeros kept, so a site key of007and a site key of7are different sites.ARMis the treatment arm the subjects of the record were assigned to, treated or not.SAFPOPis the number of treated subjects in the arm at the site; it is zero for an arm whose subjects at the site were all untreated.ENRLPOPis the number of enrolled subjects in the arm at the site, treated or not.
Note: a site and arm appear in the dataset exactly when at least one subject row names both. A site with subjects in two arms gets two records, one for each arm. An arm with only untreated subjects at a site still gets a record, with a treated count of zero, while a site named by no subject row gets no record at all.
Inputs
Under review1 source fileinput/adsl.csv
Edit11 rows| STUDYID | USUBJID | SITENUM | ARM | SAFFL |
|---|---|---|---|---|
| YAMAA-01 | 007 | Placebo | Y | |
| YAMAA-01 | 007 | Drug A | Y | |
| YAMAA-01 | 007 | Drug A | Y | |
| YAMAA-01 | 7 | Drug A | N | |
| YAMAA-01 | 7 | Drug A | N | |
| YAMAA-01 | 012 | Drug A | Y | |
| YAMAA-01 | 012 | Drug A | Y | |
| YAMAA-01 | 3 | Placebo | Y | |
| YAMAA-01 | 104 | Drug A | N | |
| YAMAA-01 | 104 | Drug A | N | |
| YAMAA-01 | 104 | Placebo | Y |
Expected output
Under review7 expected rowsexpected/clinsite.csv
Edit7 rows| STUDYID | SITEID | ARM | SAFPOP | ENRLPOP |
|---|---|---|---|---|
| YAMAA-01 | 007 | Drug A | 2 | 2 |
| YAMAA-01 | 007 | Placebo | 1 | 1 |
| YAMAA-01 | 012 | Drug A | 2 | 2 |
| YAMAA-01 | 104 | Drug A | 0 | 2 |
| YAMAA-01 | 104 | Placebo | 1 | 1 |
| YAMAA-01 | 3 | Placebo | 1 | 1 |
| YAMAA-01 | 7 | Drug A | 0 | 2 |
Human review and assessment
| Variable Name | Variable Label | Type | Length | Controlled Terms or Format | Origin | Core | Conversion Definition | Variable Type | Variable Order | Comments for Define |
|---|---|---|---|---|---|---|---|---|---|---|
| STUDYID | Study Identifier | Char | Collected | Copy value from SUBJ.STUDYID. | SDTM | 1 | ||||
| SITEID | Study Site Identifier | Char | Collected | Copy value from SUBJ.SITENUM. | SDTM | 2 | ||||
| ARM | Description of Planned Arm | Char | Collected | Copy value from SUBJ.ARM. | SDTM | 3 | ||||
| SAFPOP | Number of Treated Subjects in Site Arm | Num | Derived | First non-missing of SAFPOP_RAW; all missing → "0". | SDTM | 4 | ||||
| ENRLPOP | Number of Enrolled Subjects in Site Arm | Num | Derived | Set per constructed row; see the Row construction sheet. | SDTM | 5 |
| Template | Include when | SAFPOP_RAW | ENRLPOP |
|---|---|---|---|
| site_arm | Aggregate COUNT(SUBJ.USUBJID) over records matching on the shared output keys, where SUBJ.SAFFL = 'Y' | Aggregate COUNT(SUBJ.USUBJID) over records matching on the shared output keys |
| Version | Date | Author | Description | Reviewer | Sign-off |
|---|---|---|---|---|---|
| 1.8 | 2026-11-19 | yamaa docs build | State open and closed range endpoints, including bounds of zero | ||
| 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-clinsite-site-level/full.md
Edit21 linesFollowing CDISC ADaM standards, use the provided ADSL dataset to create a CLINSITE dataset with one record per clinical site and treatment arm.
The output dataset should contain the following columns in this order: STUDYID, SITEID, ARM, SAFPOP, ENRLPOP
A subject counts as treated when its treated flag, SAFFL, is "Y". A site and arm appear in the dataset exactly when at least one subject row names both, so a site with subjects in two arms has two records, and a site named by no subject row does not appear. SITEID is the site key exactly as collected, leading zeros kept, so a site key of "007" and a site key of "7" are different sites. ARM is the treatment arm the subjects of the record were assigned to, treated or not. SAFPOP is the number of treated subjects in the arm at the site, and it is zero for an arm whose subjects at the site were all untreated. ENRLPOP is the number of enrolled subjects in the arm at the site, treated or not.
Read the source datasets from /app/input and save the completed dataset as /app/output/clinsite.csv.
prompts/adam-clinsite-site-level/conventions.md
Edit12 linesFollowing CDISC ADaM standards, use the provided ADSL dataset to create a CLINSITE dataset with one record per clinical site and treatment arm.
The output dataset should contain the following columns in this order: STUDYID, SITEID, ARM, SAFPOP, ENRLPOP
SAFFL "Y" marks a treated subject. SITEID is the site key exactly as collected, leading zeros kept, so a site key of "007" and a site key of "7" are different sites.
Read the source datasets from /app/input and save the completed dataset as /app/output/clinsite.csv.
prompts/adam-clinsite-site-level/brief.md
Edit8 linesFollowing CDISC ADaM standards, use the provided ADSL dataset to create a CLINSITE dataset with one record per clinical site and treatment arm.
The output dataset should contain the following columns in this order: STUDYID, SITEID, ARM, SAFPOP, ENRLPOP
Read the source datasets from /app/input and save the completed dataset as /app/output/clinsite.csv.
R
Edit3 lineslibrary(yamaa)yamaa_spec("spec.yaml")$run()$outputPython
Edit3 linesimport yamaayamaa.spec("spec.yaml").run().outputsolutions/adam-clinsite-site-level/result.R
Edit32 lines# Reference solution for the yamaa benchmark adam-clinsite-site-level (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)subj <- read_csv( "/app/input/adsl.csv", col_types = cols(.default = col_character()))clinsite <- subj |> # One record per site and arm; the site key stays text so leading zeros # survive. group_by(STUDYID, SITENUM, ARM) |> summarise( # Treated subjects, then all enrolled subjects, in the arm at the site. # A blank (missing) SAFFL counts as not "Y" so it cannot turn the # treated count missing. SAFPOP = sum(!is.na(SAFFL) & SAFFL == "Y"), ENRLPOP = n(), .groups = "drop" ) |> rename(SITEID = SITENUM) |> select(STUDYID, SITEID, ARM, SAFPOP, ENRLPOP) |> arrange(SITEID, ARM)dir.create("/app/output", showWarnings = FALSE)write_csv(clinsite, "/app/output/clinsite.csv", na = "")solutions/adam-clinsite-site-level/result.py
Edit65 lines# Reference solution for the yamaa benchmark adam-clinsite-site-level (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."""Build CLINSITE (one record per clinical site and arm) from ADSL.Reads /app/input/adsl.csv and writes /app/output/clinsite.csv withcolumns STUDYID, SITEID, ARM, SAFPOP, ENRLPOP.Rules:- A subject counts as treated when SAFFL is "Y".- A site and arm appear exactly when at least one subject row names both.- SITEID is the site key exactly as collected (SITENUM); leading zeros are kept, so "007" and "7" are different sites.- ARM is the treatment arm the subjects were assigned to, treated or not.- SAFPOP is the number of treated subjects in the arm at the site (0 when none).- ENRLPOP is the number of enrolled subjects in the arm at the site."""import csvimport osfrom collections import OrderedDictINPUT_DIR = "/app/input"OUTPUT_DIR = "/app/output"def main(): with open(os.path.join(INPUT_DIR, "adsl.csv"), newline="") as f: rows = list(csv.DictReader(f)) records = OrderedDict() for row in rows: key = (row["STUDYID"], row["SITENUM"], row["ARM"]) entry = records.setdefault(key, {"safpop": 0, "enrlpop": 0}) entry["enrlpop"] += 1 if row["SAFFL"] == "Y": entry["safpop"] += 1 out_rows = [] for (studyid, site, arm), entry in sorted(records.items()): out_rows.append( { "STUDYID": studyid, "SITEID": site, "ARM": arm, "SAFPOP": entry["safpop"], "ENRLPOP": entry["enrlpop"], } ) os.makedirs(OUTPUT_DIR, exist_ok=True) with open(os.path.join(OUTPUT_DIR, "clinsite.csv"), "w", newline="") as f: writer = csv.DictWriter( f, fieldnames=["STUDYID", "SITEID", "ARM", "SAFPOP", "ENRLPOP"] ) writer.writeheader() writer.writerows(out_rows)if __name__ == "__main__": main()solutions/adam-clinsite-site-level/result.sas
Edit15 lines/* opensas reference solution for the yamaa benchmark adam-clinsite-site-level. 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 SITENUM ARM SAFFL $1024; infile "/app/input/adsl.csv" dsd dlm="," firstobs=2 truncover lrecl=32767; input STUDYID : $char1024. USUBJID : $char1024. SITENUM : $char1024. ARM : $char1024. SAFFL : $char1024.;run;/* One record per site and arm, with the treated and enrolled counts. */proc sql;create table result as select STUDYID,SITENUM as SITEID,ARM,sum(case when SAFFL='Y' then 1 else 0 end) as SAFPOP,count(*) as ENRLPOP from adsl group by STUDYID,SITENUM,ARM order by SITEID,ARM;quit;proc export data=result(keep=STUDYID SITEID ARM SAFPOP ENRLPOP) outfile="/app/output/clinsite.csv" dbms=csv replace; run;
yamaa