Initial development version.
derive_etcd() assigns ETCD to exposure records from Trial Arms, so derive_se() no longer requires the caller to supply an element code that EX does not carry. The subject’s arm selects its EPOCH == "TREATMENT" elements in TAETORD order; one element takes every dosing record, and n <= k records take the first n of k elements in start-date order. Limit: the rule uses ordering only. A design whose treatment elements are distinguished by dose, titration rule or branch is not resolved by it — attach ETCD yourself. Where ordering cannot decide (n > k > 1), or the arm has no treatment element in TA, or the subject is not in DM, it aborts and names the subjects.derive_se() builds Subject Elements from an element source, Trial Elements and (optionally) Trial Arms: collapses multiple source records per element, fills SEENDTC from the next element’s start and then from TEDUR, orders elements chronologically and assigns SESEQ. It calls derive_etcd() when exposure has no ETCD column, and aborts naming the gap when it cannot. Limit: an element start that the source gives is never moved, so boundaries differ from a study that snaps each element back to the previous element’s end date.derive_se() fills EPOCH from the element alone when the subject’s arm is not in TA at all — screen failures usually are not — but only where every arm containing that element agrees on its EPOCH. Elements TA does not place (CDISCPILOT01 defines no follow-up element in TA) keep EPOCH missing rather than being given a plausible one.derive_epoch() assigns EPOCH to any domain by interval join against SE. Both element ends are inclusive, with the later element winning on a shared boundary; unmatched records are returned with EPOCH missing rather than dropped. --DTC is inferred from the domain prefix when not named.derive_sv() builds Subject Visits from any set of collected domains, taking each visit’s window as the date range across all of them. Limit: collected dates only — planned visit windows from TV are not used.make_supp() builds a SUPPQUAL dataset from a domain and a spec, defaulting IDVAR to the parent’s --SEQ (blank when there is none, as for SUPPDM) and dropping records with a missing QVAL."2026", "2026-03") are handled throughout by widening each value to the leap-aware interval of instants it could denote; collected precision is preserved in the output. Limit: a record is placed at its date’s earliest possible instant, so a "2026-02" record may land in the earlier of two elements it could belong to.TEDUR accepts composite ISO 8601 durations — P1M15D, P1Y2M, P2W3D, P1Y2M3W4D — not just P<n>[DWMY]. Components resolve largest first: years, then months, then weeks and days at a fixed 7 and 1 day, then one day subtracted because the start date is day 1 of the element.P1M from 2026-01-31 now ends 2026-02-27 (the month step lands on 2026-02-28); it previously ended 2026-03-02. Leap years are respected: P1M from 2024-01-31 ends 2024-02-28.NA and leave the element open-ended — a time component (PT12H, P1DT12H), the alternate P0003-06-04 form, an all-zero duration, or a partial start date.sdtmgap_example(); the old bare names ("dm", "te", …) are gone.lzzt_* is CDISCPILOT01, the “LZZT” xanomeline Alzheimer’s study from the CDISC SDTM/ADaM pilot submission package, published by the CDISC Data Exchange Standards Team and coded to SDTMIG 3.1.2. Whole real datasets: lzzt_te, lzzt_ta, lzzt_tv, lzzt_ti, lzzt_ts, lzzt_dm, lzzt_ex, lzzt_se, lzzt_sv. lzzt_dm and lzzt_ex keep only the columns the examples use; text was transcoded from Windows-1252 to ASCII. Limit: lzzt_tv, lzzt_ti and lzzt_ts are bundled for completeness — no function reads them.edge_* is the former 7-subject fictional study, renamed so its purpose is unambiguous: it exists only to hold the awkward cases CDISCPILOT01 does not have (an element with no end date, a subject with no follow-up element, a screen failure with no elements, partial dates, a visit on a shared element boundary, a record dated before the study began). It is not a demonstration on real data.tests/testthat/test-lzzt.R asserts the agreement against the study’s own SE: EPOCH 3436/3436 = 100.0% on records both sides place, 3528/3559 = 99.1% over all SV records, element (ETCD) 3270/3544 = 92.3%, element start date 614/733 = 83.8%.sdtmgap_domain, a tibble subclass with a print method that reports the derivation notes.sdtm.oak is untested. sdtmgap does not depend on it, sdtm.oak is not installed on the machine this package was built and checked on, and no chain of the two has been run. The same applies to admiral, rtables and xportr: the plain-data-frame contract is a design intent here, not a verified claim.