time-to-event API reference Experimental

Generated from the module's JSDoc and JSON-Schema data contract β€” npm run docs:api fails on undocumented surface.

Overview

Every safety.viz renderer is one factory call. timeToEvent(element, settings) empties the container, renders the shared control shell, and returns a chart instance; pass data to setData (or init) and the module validates it against its data contract, structures it, and draws. Settings are merged onto the module's defaults, so callers supply only overrides β€” column mappings follow ADaM naming out of the box. The same lifecycle (init, setData, setSettings, render, clearSelection, resize, destroy) is shared by every module and consumed unchanged by the gsm.safety R bindings. See Architecture for how the pieces fit together.

Factory

timeToEvent([element], [settings])

Create a Kaplan–Meier time-to-event explorer inside a container element. The control shell renders immediately; pass `{ events, population }` records to setData (or init) on the returned instance to validate the data and draw the curves.

ParamTypeDefaultDescription
element (optional)string | HTMLElement'body'Container node, or a CSS selector for it.
settings (optional)TimeToEventSettings{}Setting overrides, merged onto DEFAULT_SETTINGS and normalized.

Returns: SafetyTimeToEvent β€” The live time-to-event instance.

Methods

init(data)

Load data and render: an alias for setData that keeps the two-step create-then-init call shape working.

ParamTypeDefaultDescription
dataObjectβ€”Event-level and population records matching the time-to-event data contract.

Returns: SafetyTimeToEvent β€” The instance, for chaining.

setData(data)

Replace the bound data and re-render. Both datasets are validated against the settings mapping (throwing, and rendering the message into the target element, when required columns are missing) and the filter controls are rebuilt from the data.

ParamTypeDefaultDescription
dataObjectβ€”Event-level and population records matching the time-to-event data contract.

Returns: SafetyTimeToEvent β€” The instance, for chaining.

setSettings(settings)

Merge setting overrides onto the current settings, re-normalize, rebuild the controls, and re-render.

ParamTypeDefaultDescription
settingsTimeToEventSettingsβ€”Setting overrides to merge.

Returns: SafetyTimeToEvent β€” The instance, for chaining.

render()

Redraw everything from the current data, settings and control state.

Returns: void β€”

clearSelection()

Clear the event-step selection and dispatch the empty selection so external listeners follow.

Returns: void β€”

resize()

Resize the live chart to its container. For host layouts that change the container size without a window resize β€” e.g. the R htmlwidget bindings.

Returns: void β€”

destroy()

Tear the explorer down: destroy the Chart.js instance and empty the target element. The instance cannot be reused afterwards β€” create a new one via the factory instead.

Returns: void β€”

Settings

SettingTypeDefaultDescription
id_colstring'USUBJID'Participant identifier column, in both datasets: one row per participant in the population data, any number of event rows, and the key the participantsSelected event carries (TTE-CFG-001).
group_colstring | null'ARM'Population curve-grouping column (treatment arm). When the population has no such column the module draws one pooled curve (TTE-DATA-004).
fu_day_colstring'EOSDY'Population follow-up-end study day: the censoring time for participants with no qualifying event (TTE-DERIV-002). Event-free participants without a usable value are excluded with a counted reason.
censor_desc_colstring | null'EOSSTT'Optional population censoring description (e.g. end-of-study status), shown in censor-mark tooltips.
event_day_colstring'ASTDY'Event onset study day (day 1 = first dose). Event rows with a missing, non-numeric or non-positive day are excluded and counted (TTE-DATA-002).
event_desc_colstring | null'AEDECOD'Optional event description column, shown in event tooltips for the qualifying event.
event_filtersArray.<(string|Object)>['AEBODSYS','AEDECOD','AESER','AESEV']Multiselect filter controls over the event dataset β€” the endpoint composer (TTE-FILT-001): column names or { value_col, label } specs. A filter whose column is absent from the events is dropped with a console warning.
endpoint_labelstring'Time to first qualifying event'Display name for the composed endpoint, used in the notes.
filtersArray.<(string|Object)>[]Population filter controls (single-select): column names or { value_col, label } specs.
directionstring'incidence'`incidence` (1 βˆ’ KM, rising β€” the safety default, D2) or `survival` (falling). Anything else falls back to incidence.
cibooleantrueWhether to draw the pointwise 95% confidence band (D3).
time_unitstring'day'Axis label unit; display only, no rescaling.
widthstring'100%'Widget width, carried for the R widget bindings.
heightnumber560Chart-area height in pixels, carried for the R widget bindings; includes the in-canvas risk table.

Data contract

safety.viz time-to-event data contract

Two datasets: event-level records (one row per event, e.g. an ADAE projection) and population records (one row per participant, e.g. an ADSL projection carrying the follow-up-end study day). The module composes the endpoint from the events passing the active multiselect filters (TTE-FILT-001), takes each participant's first qualifying event by onset day (TTE-DERIV-001), censors event-free participants at the population follow-up day (TTE-DERIV-002), and computes the Kaplan-Meier product-limit estimator, Greenwood variance and log-log pointwise 95% bounds from the derived observations. The derivation rule is fixed and stated in the clinical guide; records that cannot be used are counted and exported rather than dropped silently (TTE-DATA-002). Column names are supplied by the settings mapping.

FieldTypeRequiredDefaultDescription
eventsarrayyesβ€”d3.csv()-style event records; every row carries the participant id and onset-day columns named in settings, plus any descriptor columns the event filters use (body system, preferred term, seriousness, severity, ...). Rows with a missing, non-numeric or non-positive day, or a participant absent from the population data, are excluded with a counted, exportable reason (TTE-DATA-002).
populationarrayyesβ€”d3.csv()-style population records, one row per participant: the analysis denominator. Every row carries the participant id and follow-up-end day columns named in settings; the group column is optional (one pooled curve when absent, TTE-DATA-004). Later duplicate rows for a participant are excluded with a counted reason (TTE-DATA-003).
settingsobjectyesβ€”Column mappings and rendering options; merged onto the module's DEFAULT_SETTINGS, so only overrides need to be supplied.
settings.id_colstringnoUSUBJIDParticipant identifier column, required in both datasets, and the key the participantsSelected event carries (TTE-CFG-001).
settings.group_colstring,nullnoARMPopulation curve-grouping column (treatment arm). Optional: when the population has no such column, one pooled curve is drawn (TTE-DATA-004).
settings.fu_day_colstringnoEOSDYPopulation follow-up-end study day (day 1 = first dose): the censoring time for participants with no qualifying event (TTE-DERIV-002); required in population data. Event-free participants without a usable value are excluded with a counted reason.
settings.censor_desc_colstring,nullnoEOSSTTOptional population censoring description (e.g. end-of-study status), shown in censor-mark tooltips.
settings.event_day_colstringnoASTDYEvent onset study day (day 1 = first dose); required in event data. Missing, non-numeric or non-positive days exclude the row with a counted, exportable reason (TTE-DATA-002).
settings.event_desc_colstring,nullnoAEDECODOptional event description (e.g. the preferred term), shown in event tooltips for the qualifying event.
settings.event_filtersarraynoAEBODSYS,AEDECOD,AESER,AESEVMultiselect filter controls over the event dataset β€” the endpoint composer (TTE-FILT-001): column names or { value_col, label } specs. Which columns get a filter is configurable; which values qualify is the reviewer's live choice, never hard-coded. A filter whose column is absent from the events is dropped with a console warning.
settings.endpoint_labelstringnoTime to first qualifying eventDisplay name for the composed endpoint, used in the notes (TTE-FILT-003).
settings.filtersarraynoSingle-select filter controls over the population rows: column names or { value_col, label } specs. A filter whose column is absent from the population is dropped with a console warning.
settings.directionstringnoincidenceDisplay orientation: cumulative incidence (1 - KM, rising - the safety convention and the FDA ST&F figures' orientation, D2) or survival (falling). The y-axis names the estimator either way (TTE-CURV-004).
settings.cibooleannotrueWhether to draw the pointwise 95% confidence band (Greenwood variance, log-log transform, matching survival::survfit conf.type='log-log'; D3). The band is pointwise, not simultaneous, and is labelled as such (TTE-CURV-003).
settings.time_unitstringnodayAxis label unit; display only - the module never rescales times.
settings.widthstringno100%Widget width, carried for the R widget bindings; the shell always spans its container.
settings.heightnumberno560Chart-area height in pixels, including the in-canvas at-risk / cumulative-events table.