Review ask

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.

  1. 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.
  2. Inputs: Do they look like data collected in a real trial, and do they include the situations you would expect to meet in one?
  3. 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

Lifecycle: reviewedEditUnder review
What this benchmark means
README.md

Goal: 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:

  • SITEIDP is the site code read from the middle of the unique subject identifier when it has the form YAMAA-<site>-<four digits>; empty 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; UNKNOWN when 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 review
1 source file

input/dm.csv

Edit
8 rows
input/dm.csv
STUDYIDUSUBJIDSUBJIDSITEID
YAMAA-010001UCSD
YAMAA-010002UCSD
YAMAA-010003UCSD
YAMAA-010004UCSD
YAMAA-010005—
YAMAA-010006UCSD
YAMAA-010007UCSD
YAMAA-01—UCSD

Expected output

Under review
8 expected rows

expected/adsl.csv

Edit
8 rows
expected/adsl.csv
STUDYIDUSUBJIDSUBJIDSITEIDPSITEIDSUBJREF
YAMAA-010001UCSDUCSDUCSD:0001
YAMAA-010002UCSDUCSDUCSD:0002
YAMAA-010003UCLAUCLAUCLA:0003
YAMAA-010004—UCSDUCSD:0004
YAMAA-010005—UNKNOWNUNKNOWN:0005
YAMAA-010006—UCSDUCSD:0006
YAMAA-010007—UCSDUCSD:0007
YAMAA-01—UCSDUCSDUNKNOWN
Shaded columns are derived— = missing value

Comments and assessment materials

Comments

Signed in with GitHub; saved in repository Discussions

Mapping spec

Generated from the benchmark YAML; do not edit by hand

Dataset NameVariable NameVariable LabelTypeCodelist/Controlled TermsCoreComputational MethodOrigin
ADSLSTUDYIDStudy IdentifiercharacterCopy value from DM.STUDYID.Predecessor
ADSLUSUBJIDUnique Subject IdentifiercharacterCopy value from DM.USUBJID.Predecessor
ADSLSUBJIDSubject Identifier for the StudycharacterCopy value from DM.SUBJID.Predecessor
ADSLSITEIDPParsed Study Site IdentifiercharacterExtract capture group 1 matching ^YAMAA-([^-]+)-[0-9]{4}$ from USUBJID; a missing source → blank; no match → blank.Derived
ADSLSITEIDStudy Site IdentifiercharacterFirst non-missing of SITEIDP and DM.SITEID; all missing → "UNKNOWN".Derived
ADSLSUBJREFSubject Display ReferencecharacterFill the template "{SITEID}:{SUBJID}"; a missing field → "UNKNOWN".Derived
VersionDateAuthorDescriptionReviewerSign-off
1.32026-09-29yamaa docs buildShow study codelist names, external dictionaries, and ISO 8601 formats in variable rows; list the document's codelist values and metadata
1.22026-09-29yamaa docs buildClassify ADaM copies from a declared input as Predecessor and recodes as Derived, and SDTM recodes of locally derived columns as Derived
1.12026-09-29yamaa docs buildResolve lookups into the donor record they select, and give every derivation shape a plain-language rule instead of its raw YAML
1.0yamaa docs buildInitial generation from spec.yaml

Agent prompt

The request an agent receives with the input files; each tier states no more than the one above

prompts/adam-adsl-site-parse/full.md

Edit
18 lines

Following 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

Edit
13 lines

Following 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

Edit
8 lines

Following 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.

yamaa code

Runs the yamaa specification; its result must match the expected output

run.R

Edit
4 lines
library(yamaa)adsl <- yamaa_domain("spec.yaml")$outputadsl

run.py

Edit
4 lines
import yamaaadsl = yamaa.yamaa_domain("spec.yaml").outputadsl

Solution without yamaa

Written from the full prompt and the inputs alone; CI checks it reproduces the expected output

solutions/adam-adsl-site-parse/result.R

Edit
29 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

Edit
32 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

Edit
23 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;