# Synthetic study specification

The study identifier is `BTISYN01`.
The observations are invented for method instruction and support no clinical claim.
The generator uses no CDISC pilot records, fitted parameters, resampling, or package example data.
The fixture data and study specification use CC0 1.0.

## Subjects and exposure

The study has 36 subjects with identifiers `BTISYN01-001` through `BTISYN01-036`.
Subjects 1 through 30 receive treatment.
Subjects 31 through 33 have assigned arms but receive no treatment.
Subjects 34 through 36 are screen failures.
The planned arms cycle through Placebo, Active Low, and Active High.
Subjects 1 and 2 exchange actual arms to demonstrate assignment differences.
Each actual arm retains ten treated subjects.
Every treated subject has two exposure intervals, from January 10 through January 16 and January 17 through January 23, 2025.
Placebo doses equal zero, and active doses equal 10 or 20 invented units.
The safety rule requires a positive active dose or a zero placebo dose.
The treatment duration includes both endpoints and equals 14 days.

## Laboratory observations

Every subject has ALB, CHOL, and ALT measurements at four scheduled visits.
The dates are January 3, January 9, January 17, and January 24, 2025.
The first two visits map to Baseline; the others map to Week 1 and Week 2.
The baseline is the last nonmissing value on or before the first dose.
Subjects divisible by five have missing values at the second baseline visit.
Subjects divisible by seven have missing values at Week 1.
The baseline for an untreated subject is missing because no first dose exists.
Change and percent change apply only to the post-baseline analysis visits.
CHOL values equal `4 + subject_number / 10 + visit_index / 5`.
ALT values equal `20 + subject_number + 2 * visit_index`.
ALB values equal `35 + subject_number %% 5 + visit_index` in g/L.
The original ALB values divide the standardized values by ten and use g/dL.

## Adverse events and other domains

Each treated subject has one pretreatment event and two repeated events with term A.
Subjects with even identifiers have event B.
Subjects whose identifiers are not divisible by four have event C.
Subjects whose identifiers are not divisible by five have event D after treatment.
Event dates are January 5, 11, 12, 15, 20, and 27, 2025.
The four terms are invented labels, `Synthetic event A` through `Synthetic event D`.
The categories are study labels and do not reproduce a MedDRA hierarchy.
An event is treatment-emergent when it starts on or after the first dose and no later than seven days after the last dose.
The pretreatment event is excluded, and the repeated event counts once per subject and term.
Every actual arm has ten subjects and every event term occurs in all three arms.
The selection rules create different event percentages across arms without modeling a treatment effect.
The fixture includes DM, VS, AE, LB, EX, MH, DS, CM, EG, TS, and SUPPDM.
The additional domains contain invented observations sufficient to demonstrate their record structures.
The raw medication extract uses invented medicine names and a small study dictionary.
The study dictionary maps `milligram` to `mg`, `gram` to `g`, and `prior` to `BEFORE`.
Its identifiers are `BTI_UNIT` and `BTI_TIME`; they are not CDISC codelist identifiers.

## Independent checks

The generator creates the reference ADSL and ADLB with base R operations.
It does not import admiral or call any admiral derivation.
The checks assert subject identities, foreign keys, unique sequence numbers, and date order.
Explicit cases cover treated subject 1, untreated subject 31, screen failure 34, and missing-baseline subject 5.
Subject 1 has CHOL baseline 4.5 and Week 1 change 0.2.
Subject 5 has CHOL baseline 4.7 because the second baseline observation is missing.
Their Week 1 percent changes equal `40 / 9` and `400 / 47`, respectively.
The expected-case assertions use numeric tolerances for decimal arithmetic.
The ADaM lesson compares every subject and every selected laboratory row with the independent reference.

## Reproduction

Run the generator in the section container with the section directory mounted at `/work`.
Run `Rscript prepare_synthetic_study.R` from that directory inside the container.
The generator writes the CSV fixtures, an RDS file with preserved column types, and a SHA-256 manifest.
Each page mounts the same fixture directory read-only at `/opt/fixtures/pharmaverse`.
The source manifest records the generator hash and the specification hash.
