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: derive the parsed site, the site to use, and the display
reference (SITEIDP, SITEID, and SUBJREF) for each subject.
Input: demographics with the study identifier, the unique subject identifier, the collected subject number, and the collected site.
Variables:
SITEIDPis the site code read from the middle of the unique subject identifier when it has the formYAMAA-<site>-<four digits>; empty when the identifier has any other shape.SITEIDis the site to use: the parsed site when present, otherwise the collected site, otherwiseUNKNOWN.SUBJREFcombines the site to use and the collected subject number with a colon;UNKNOWNwhen the subject number is missing.
Note: keeping both the parsed and the final site shows which subjects fell back to the collected site and which had no usable site at all.
Inputs
Under review1 source fileinput/dm.csv
Edit8 rows| STUDYID | USUBJID | SUBJID | SITEID |
|---|---|---|---|
| YAMAA-01 | 0001 | UCSD | |
| YAMAA-01 | 0002 | UCSD | |
| YAMAA-01 | 0003 | UCSD | |
| YAMAA-01 | 0004 | UCSD | |
| YAMAA-01 | 0005 | — | |
| YAMAA-01 | 0006 | UCSD | |
| YAMAA-01 | 0007 | UCSD | |
| YAMAA-01 | — | UCSD |
Expected output
Under review8 expected rowsexpected/adsl.csv
Edit8 rows| STUDYID | USUBJID | SUBJID | SITEIDP | SITEID | SUBJREF |
|---|---|---|---|---|---|
| YAMAA-01 | 0001 | UCSD | UCSD | UCSD:0001 | |
| YAMAA-01 | 0002 | UCSD | UCSD | UCSD:0002 | |
| YAMAA-01 | 0003 | UCLA | UCLA | UCLA:0003 | |
| YAMAA-01 | 0004 | — | UCSD | UCSD:0004 | |
| YAMAA-01 | 0005 | — | UNKNOWN | UNKNOWN:0005 | |
| YAMAA-01 | 0006 | — | UCSD | UCSD:0006 | |
| YAMAA-01 | 0007 | — | UCSD | UCSD:0007 | |
| YAMAA-01 | — | UCSD | UCSD | UNKNOWN |
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 DM.STUDYID. | Predecessor | ||
| ADSL | USUBJID | Unique Subject Identifier | character | Copy value from DM.USUBJID. | Predecessor | ||
| ADSL | SUBJID | Subject Identifier for the Study | character | Copy value from DM.SUBJID. | Predecessor | ||
| ADSL | SITEIDP | Parsed Study Site Identifier | character | Extract capture group 1 matching ^YAMAA-([^-]+)-[0-9]{4}$ from USUBJID; a missing source → blank; no match → blank. | Derived | ||
| ADSL | SITEID | Study Site Identifier | character | First non-missing of SITEIDP and DM.SITEID; all missing → "UNKNOWN". | Derived | ||
| ADSL | SUBJREF | Subject Display Reference | character | Fill the template "{SITEID}:{SUBJID}"; a missing field → "UNKNOWN". | 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-adsl-site-parse/full.md
Edit18 linesFollowing CDISC ADaM standards, use the provided DM dataset to create an ADSL dataset with one record per subject.
The output dataset should contain the following columns in this order: STUDYID, USUBJID, SUBJID, SITEIDP, SITEID, SUBJREF
SITEIDP is the middle segment of the unique subject identifier when the identifier holds two dashes with exactly four digits after the last one; it has no value when the identifier has any other shape.
SITEID is the site to use: the parsed site when present, otherwise the collected site, otherwise UNKNOWN.
SUBJREF combines the site to use and the collected subject number with a colon; it is UNKNOWN when the subject number is missing.
Read the source datasets from /app/input and save the completed dataset as /app/output/adsl.csv.
prompts/adam-adsl-site-parse/conventions.md
Edit13 linesFollowing CDISC ADaM standards, use the provided DM dataset to create an ADSL dataset with one record per subject.
The output dataset should contain the following columns in this order: STUDYID, USUBJID, SUBJID, SITEIDP, SITEID, SUBJREF
SITEID is the site to use, or UNKNOWN.
SUBJREF combines the site to use and the collected subject number with a colon, or is UNKNOWN.
Read the source datasets from /app/input and save the completed dataset as /app/output/adsl.csv.
prompts/adam-adsl-site-parse/brief.md
Edit8 linesFollowing CDISC ADaM standards, use the provided DM dataset to create an ADSL dataset with one record per subject.
The output dataset should contain the following columns in this order: STUDYID, USUBJID, SUBJID, SITEIDP, SITEID, SUBJREF
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-site-parse/result.R
Edit29 lines# Reference solution for the yamaa benchmark adam-adsl-site-parse (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)library(stringr)dm <- read_csv( "/app/input/dm.csv", col_types = cols(.default = col_character()))adsl <- dm |> mutate( # The middle segment when the identifier holds two dashes with # exactly four digits after the last one. SITEIDP = str_match(USUBJID, "^[^-]+-([^-]+)-[0-9]{4}$")[, 2], SITEID = coalesce(SITEIDP, SITEID), SITEID = if_else(is.na(SITEID), "UNKNOWN", SITEID), SUBJREF = if_else(is.na(SUBJID), "UNKNOWN", paste0(SITEID, ":", SUBJID)) ) |> select(STUDYID, USUBJID, SUBJID, SITEIDP, SITEID, SUBJREF) |> arrange(USUBJID)dir.create("/app/output", showWarnings = FALSE)write_csv(adsl, "/app/output/adsl.csv", na = "")solutions/adam-adsl-site-parse/result.py
Edit32 lines# Reference solution for the yamaa benchmark adam-adsl-site-parse (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 pldm = pl.read_csv("/app/input/dm.csv", infer_schema=False, null_values="")adsl = ( dm.with_columns( # The middle segment when the identifier holds two dashes with # exactly four digits after the last one. SITEIDP=pl.col("USUBJID").str.extract(r"^[^-]+-([^-]+)-[0-9]{4}$", 1), ) .with_columns( SITEID=pl.coalesce("SITEIDP", "SITEID").fill_null("UNKNOWN"), ) .with_columns( SUBJREF=pl.when(pl.col("SUBJID").is_null()) .then(pl.lit("UNKNOWN")) .otherwise(pl.col("SITEID") + pl.lit(":") + pl.col("SUBJID")), ) .select("STUDYID", "USUBJID", "SUBJID", "SITEIDP", "SITEID", "SUBJREF") .sort("USUBJID"))Path("/app/output").mkdir(parents=True, exist_ok=True)adsl.write_csv("/app/output/adsl.csv", null_value="")solutions/adam-adsl-site-parse/result.sas
Edit23 lines/* opensas reference solution for the yamaa benchmark adam-adsl-site-parse. Reads the benchmark inputs and derives the requested output. Execute with the existing opensas runtime: opensas /app/output/result.sas. */data dm; length STUDYID USUBJID SUBJID SITEID $1024; infile "/app/input/dm.csv" dsd dlm="," firstobs=2 truncover lrecl=32767; input STUDYID : $char1024. USUBJID : $char1024. SUBJID : $char1024. SITEID : $char1024.;run;data result; length SITEIDP SUBJREF $1024; set dm; if prxmatch('/^[^-]+-([^-]+)-[0-9]{4}$/',strip(USUBJID)) then SITEIDP=scan(USUBJID,2,'-'); if not missing(SITEIDP) then SITEID=SITEIDP; else if missing(SITEID) then SITEID='UNKNOWN'; if missing(SUBJID) then SUBJREF='UNKNOWN'; else SUBJREF=catx(':',SITEID,SUBJID);run;proc sql; create table final as select STUDYID, USUBJID, SUBJID, SITEIDP, SITEID, SUBJREF 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