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: carry each physical functioning item response into
PARAMCD, PARAM, and AVAL, and add a subscale score record
coded PFSCORE holding the mean answered-item response multiplied
by 25 (mean divided by four, times 100).
Input: collected questionnaire responses for the physical
functioning scale, with study, subject, and visit (STUDYID,
USUBJID, VISIT), category (QSCAT), test code and test name
(QSTESTCD, QSTEST), and numeric result (QSSTRESN) on the
zero to four answer scale. One record on the emotional
functioning scale is included and excluded from the output,
showing that only the physical functioning records feed the
dataset.
Variables:
PARAMCD: the test code (PF01throughPF04) on an item record, orPFSCOREon the added score record.PARAM: the test name on an item record, or the subscale name on the added score record.AVAL: on an item record, the numeric result on the zero to four answer scale, empty when the item was not answered; on the score record, the mean of the answered items at that visit multiplied by 25, empty when fewer than three of the four items were answered.
Note: every visit with a PF01 item record, answered or not,
carries a score record, so a visit with too few answers to score
keeps an empty score and stays apart from a visit with no records
at all.
Inputs
Under review1 source fileinput/qs.csv
Edit21 rows| STUDYID | USUBJID | VISIT | QSSEQ | QSCAT | QSTESTCD | QSTEST | QSSTRESN |
|---|---|---|---|---|---|---|---|
| PILOT7 | BASELINE | 1 | PHYSICAL FUNCTIONING SCALE | PF01 | Trouble with strenuous activity | 2 | |
| PILOT7 | BASELINE | 2 | PHYSICAL FUNCTIONING SCALE | PF02 | Trouble with a long walk | 0 | |
| PILOT7 | BASELINE | 3 | PHYSICAL FUNCTIONING SCALE | PF03 | Trouble with a short walk | 2 | |
| PILOT7 | BASELINE | 4 | PHYSICAL FUNCTIONING SCALE | PF04 | Needs to stay in bed or a chair | 1 | |
| PILOT7 | WEEK 12 | 5 | PHYSICAL FUNCTIONING SCALE | PF01 | Trouble with strenuous activity | 3 | |
| PILOT7 | WEEK 12 | 6 | PHYSICAL FUNCTIONING SCALE | PF02 | Trouble with a long walk | 3 | |
| PILOT7 | WEEK 12 | 7 | PHYSICAL FUNCTIONING SCALE | PF03 | Trouble with a short walk | — | |
| PILOT7 | WEEK 12 | 8 | PHYSICAL FUNCTIONING SCALE | PF04 | Needs to stay in bed or a chair | 3 | |
| PILOT7 | BASELINE | 1 | PHYSICAL FUNCTIONING SCALE | PF01 | Trouble with strenuous activity | 1 | |
| PILOT7 | BASELINE | 2 | PHYSICAL FUNCTIONING SCALE | PF02 | Trouble with a long walk | — | |
| PILOT7 | BASELINE | 3 | PHYSICAL FUNCTIONING SCALE | PF03 | Trouble with a short walk | — | |
| PILOT7 | BASELINE | 4 | PHYSICAL FUNCTIONING SCALE | PF04 | Needs to stay in bed or a chair | 2 | |
| PILOT7 | WEEK 12 | 5 | PHYSICAL FUNCTIONING SCALE | PF01 | Trouble with strenuous activity | — | |
| PILOT7 | WEEK 12 | 6 | PHYSICAL FUNCTIONING SCALE | PF02 | Trouble with a long walk | — | |
| PILOT7 | WEEK 12 | 7 | PHYSICAL FUNCTIONING SCALE | PF03 | Trouble with a short walk | — | |
| PILOT7 | WEEK 12 | 8 | PHYSICAL FUNCTIONING SCALE | PF04 | Needs to stay in bed or a chair | — | |
| PILOT7 | BASELINE | 1 | PHYSICAL FUNCTIONING SCALE | PF01 | Trouble with strenuous activity | 4 | |
| PILOT7 | BASELINE | 2 | PHYSICAL FUNCTIONING SCALE | PF02 | Trouble with a long walk | 4 | |
| PILOT7 | BASELINE | 3 | PHYSICAL FUNCTIONING SCALE | PF03 | Trouble with a short walk | 4 | |
| PILOT7 | BASELINE | 4 | PHYSICAL FUNCTIONING SCALE | PF04 | Needs to stay in bed or a chair | 4 | |
| PILOT7 | BASELINE | 5 | EMOTIONAL FUNCTIONING SCALE | EF01 | Feeling tense | 3 |
Expected output
Under review25 expected rowsexpected/adqs.csv
Edit25 rows| STUDYID | USUBJID | VISIT | PARAMCD | PARAM | AVAL |
|---|---|---|---|---|---|
| PILOT7 | BASELINE | PF01 | Trouble with strenuous activity | 2 | |
| PILOT7 | BASELINE | PF02 | Trouble with a long walk | 0 | |
| PILOT7 | BASELINE | PF03 | Trouble with a short walk | 2 | |
| PILOT7 | BASELINE | PF04 | Needs to stay in bed or a chair | 1 | |
| PILOT7 | WEEK 12 | PF01 | Trouble with strenuous activity | 3 | |
| PILOT7 | WEEK 12 | PF02 | Trouble with a long walk | 3 | |
| PILOT7 | WEEK 12 | PF03 | Trouble with a short walk | — | |
| PILOT7 | WEEK 12 | PF04 | Needs to stay in bed or a chair | 3 | |
| PILOT7 | BASELINE | PF01 | Trouble with strenuous activity | 1 | |
| PILOT7 | BASELINE | PF02 | Trouble with a long walk | — | |
| PILOT7 | BASELINE | PF03 | Trouble with a short walk | — | |
| PILOT7 | BASELINE | PF04 | Needs to stay in bed or a chair | 2 | |
| PILOT7 | WEEK 12 | PF01 | Trouble with strenuous activity | — | |
| PILOT7 | WEEK 12 | PF02 | Trouble with a long walk | — | |
| PILOT7 | WEEK 12 | PF03 | Trouble with a short walk | — | |
| PILOT7 | WEEK 12 | PF04 | Needs to stay in bed or a chair | — | |
| PILOT7 | BASELINE | PF01 | Trouble with strenuous activity | 4 | |
| PILOT7 | BASELINE | PF02 | Trouble with a long walk | 4 | |
| PILOT7 | BASELINE | PF03 | Trouble with a short walk | 4 | |
| PILOT7 | BASELINE | PF04 | Needs to stay in bed or a chair | 4 | |
| PILOT7 | BASELINE | PFSCORE | Physical Functioning Subscale Score | 31.25 | |
| PILOT7 | WEEK 12 | PFSCORE | Physical Functioning Subscale Score | 75 | |
| PILOT7 | BASELINE | PFSCORE | Physical Functioning Subscale Score | — | |
| PILOT7 | WEEK 12 | PFSCORE | Physical Functioning Subscale Score | — | |
| PILOT7 | BASELINE | PFSCORE | Physical Functioning Subscale Score | 100 |
Comments and assessment materials
| Dataset Name | Variable Name | Variable Label | Type | Codelist/Controlled Terms | Core | Computational Method | Origin |
|---|---|---|---|---|---|---|---|
| ADQS | STUDYID | Study Identifier | character | Copy value from QS.STUDYID. | Predecessor | ||
| ADQS | USUBJID | Unique Subject Identifier | character | Copy value from QS.USUBJID. | Predecessor | ||
| ADQS | VISIT | Visit Name | character | Copy value from QS.VISIT. | Predecessor | ||
| ADQS | PARAMCD | Parameter Code | character | PF01, PF02, PF03, PF04, PFSCORE | Set per constructed row; see the Row construction sheet. | Derived | |
| ADQS | PARAM | Parameter | character | Set per constructed row; see the Row construction sheet. | Derived | ||
| ADQS | AVAL | Analysis Value | numeric | If PARAMCD = 'PFSCORE' AND ITEMANS >= 3 then compute 100 * (ITEMSUM / ITEMANS) / 4; If PARAMCD = 'PFSCORE' then "None"; otherwise "ITEMRESN". | Derived |
| Template | Include when | PARAMCD | PARAM | ITEMRESN |
|---|---|---|---|---|
| item | QS.QSCAT = 'PHYSICAL FUNCTIONING SCALE' | Copy QS.QSTESTCD | Copy QS.QSTEST | Copy QS.QSSTRESN |
| subscale | QS.QSCAT = 'PHYSICAL FUNCTIONING SCALE' AND QS.QSTESTCD = 'PF01' | Constant "PFSCORE" | Constant "Physical Functioning Subscale Score" | Constant "None" |
| Variable | Permitted values |
|---|---|
| PARAMCD | PF01, PF02, PF03, PF04, PFSCORE |
| 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-adqs-subscale-score/full.md
Edit22 linesFollowing CDISC ADaM standards, use the provided QS dataset to create an ADQS dataset with one record per subject per visit per item, plus one score record per visit.
The output dataset should contain the following columns in this order: STUDYID, USUBJID, VISIT, PARAMCD, PARAM, AVAL
Carry each physical functioning item response into PARAMCD (PF01 through PF04), PARAM, and AVAL, keeping the numeric result on its zero to four answer scale, empty when the item was not answered. Records from any other scale leave no records.
Add one score record per visit that has a PF01 item record, answered or not, with PARAMCD "PFSCORE" and PARAM "Physical Functioning Subscale Score". Its value is the mean of the answered items at that visit, reported on a zero to one hundred scale; it has no value when fewer than three of the four items were answered. A visit with too few answers still gets its score record, with no value, while a visit with no records at all gets none.
Read the source datasets from /app/input and save the completed dataset as /app/output/adqs.csv.
prompts/adam-adqs-subscale-score/conventions.md
Edit16 linesFollowing CDISC ADaM standards, use the provided QS dataset to create an ADQS dataset with one record per subject per visit per item, plus one score record per visit.
The output dataset should contain the following columns in this order: STUDYID, USUBJID, VISIT, PARAMCD, PARAM, AVAL
The physical functioning items are PARAMCD PF01 through PF04, with AVAL on their zero to four answer scale.
The score record has PARAMCD "PFSCORE" and PARAM "Physical Functioning Subscale Score", and its value is reported on a zero to one hundred scale.
Read the source datasets from /app/input and save the completed dataset as /app/output/adqs.csv.
prompts/adam-adqs-subscale-score/brief.md
Edit9 linesFollowing CDISC ADaM standards, use the provided QS dataset to create an ADQS dataset with one record per subject per visit per item, plus one score record per visit.
The output dataset should contain the following columns in this order: STUDYID, USUBJID, VISIT, PARAMCD, PARAM, AVAL
Read the source datasets from /app/input and save the completed dataset as /app/output/adqs.csv.
run.R
Edit4 lineslibrary(yamaa)adqs <- yamaa_domain("spec.yaml")$outputadqsrun.py
Edit4 linesimport yamaaadqs = yamaa.yamaa_domain("spec.yaml").outputadqssolutions/adam-adqs-subscale-score/result.R
Edit60 lines# Reference solution for the yamaa benchmark adam-adqs-subscale-score (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)qs <- read_csv( "/app/input/qs.csv", col_types = cols( QSSEQ = col_integer(), QSSTRESN = col_double(), .default = col_character() ))# Each physical functioning item response, on its zero to four scale.items <- qs |> filter(QSTESTCD %in% c("PF01", "PF02", "PF03", "PF04")) |> mutate(PARAMCD = QSTESTCD, PARAM = QSTEST, AVAL = QSSTRESN) |> select(STUDYID, USUBJID, VISIT, PARAMCD, PARAM, AVAL)# One score record per visit with a PF01 item record: the mean of the# answered items on a zero to one hundred scale, with no value when fewer# than three of the four items were answered.visits <- items |> filter(PARAMCD %in% "PF01") |> distinct(STUDYID, USUBJID, VISIT)stats <- items |> group_by(STUDYID, USUBJID, VISIT) |> summarise( n_answered = sum(!is.na(AVAL)), mean_answered = mean(AVAL, na.rm = TRUE), .groups = "drop" ) |> mutate( mean_answered = if_else( n_answered < 3 | is.nan(mean_answered), NA_real_, mean_answered * 25 ) )scores <- visits |> left_join(stats, by = c("STUDYID", "USUBJID", "VISIT")) |> mutate( PARAMCD = "PFSCORE", PARAM = "Physical Functioning Subscale Score", AVAL = mean_answered ) |> select(STUDYID, USUBJID, VISIT, PARAMCD, PARAM, AVAL)adqs <- bind_rows(items, scores) |> arrange(STUDYID, USUBJID, VISIT, PARAMCD)dir.create("/app/output", showWarnings = FALSE)write_csv(adqs, "/app/output/adqs.csv", na = "")solutions/adam-adqs-subscale-score/result.py
Edit56 lines# Reference solution for the yamaa benchmark adam-adqs-subscale-score (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 plqs = pl.read_csv("/app/input/qs.csv", infer_schema=False).with_columns( pl.col("QSSEQ").cast(pl.Int64), pl.col("QSSTRESN").cast(pl.Float64),)# Each physical functioning item response, on its zero to four scale.items = ( qs.filter(pl.col("QSTESTCD").is_in(["PF01", "PF02", "PF03", "PF04"])) .with_columns( PARAMCD=pl.col("QSTESTCD"), PARAM=pl.col("QSTEST"), AVAL=pl.col("QSSTRESN") ) .select("STUDYID", "USUBJID", "VISIT", "PARAMCD", "PARAM", "AVAL"))# One score record per visit with a PF01 item record: the mean of the# answered items on a zero to one hundred scale, with no value when fewer# than three of the four items were answered.visits = items.filter(pl.col("PARAMCD") == "PF01").select( "STUDYID", "USUBJID", "VISIT").unique(maintain_order=True)stats = items.group_by(["STUDYID", "USUBJID", "VISIT"]).agg( n_answered=pl.col("AVAL").drop_nulls().len(), mean_answered=pl.col("AVAL").mean(),)scores = ( visits.join(stats, on=["STUDYID", "USUBJID", "VISIT"], how="left") .with_columns( AVAL=pl.when(pl.col("n_answered") >= 3) .then(pl.col("mean_answered") * 25) .otherwise(None) ) .with_columns( PARAMCD=pl.lit("PFSCORE"), PARAM=pl.lit("Physical Functioning Subscale Score"), ) .select("STUDYID", "USUBJID", "VISIT", "PARAMCD", "PARAM", "AVAL"))adqs = pl.concat([items, scores], how="diagonal").sort( ["STUDYID", "USUBJID", "VISIT", "PARAMCD"])Path("/app/output").mkdir(exist_ok=True)adqs.write_csv("/app/output/adqs.csv")solutions/adam-adqs-subscale-score/result.sas
Edit22 lines/* opensas reference solution for the yamaa benchmark adam-adqs-subscale-score. Reads the benchmark inputs and derives the requested output. Execute with the existing opensas runtime: opensas /app/output/result.sas. */data qs; length STUDYID USUBJID VISIT QSCAT QSTESTCD QSTEST $1024; infile "/app/input/qs.csv" dsd dlm="," firstobs=2 truncover lrecl=32767; input STUDYID : $char1024. USUBJID : $char1024. VISIT : $char1024. QSSEQ QSCAT : $char1024. QSTESTCD : $char1024. QSTEST : $char1024. QSSTRESN;run;proc sql; create table collected as select STUDYID,USUBJID,VISIT,QSTESTCD as PARAMCD,QSTEST as PARAM,QSSTRESN as AVAL from qs where QSTESTCD in ('PF01','PF02','PF03','PF04'); create table anchors as select distinct STUDYID,USUBJID,VISIT from collected where PARAMCD='PF01'; create table scores as select a.STUDYID,a.USUBJID,a.VISIT,'PFSCORE' as PARAMCD,'Physical Functioning Subscale Score' as PARAM, case when count(b.AVAL)>=3 then 25*mean(b.AVAL) else . end as AVAL from anchors as a left join collected as b on a.STUDYID=b.STUDYID and a.USUBJID=b.USUBJID and a.VISIT=b.VISIT group by a.STUDYID,a.USUBJID,a.VISIT;quit;data result; set collected scores; run;proc sql; create table final as select STUDYID, USUBJID, VISIT, PARAMCD, PARAM, AVAL from result;quit;proc export data=final outfile="/app/output/adqs.csv" dbms=csv replace; run;
yamaa
Comments
Signed in with GitHub; saved in repository Discussions