outlier-explorer API reference

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. outlierExplorer(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, selectParticipant, 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

outlierExplorer([element], [settings])

Create a safety outlier explorer inside a container element. The control shell renders immediately; pass long-format result records to setData (or init) on the returned instance to validate the data and draw the chart.

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

Returns: SafetyOutlierExplorer — The live outlier-explorer instance.

Methods

init(data)

Load data and render: an alias for setData that keeps the pilot's two-step create-then-init call shape working (SOE-API-001).

ParamTypeDefaultDescription
dataArray.<Object>Long-format result records matching the outlier-explorer data contract.

Returns: SafetyOutlierExplorer — The instance, for chaining.

setData(data)

Replace the bound data and re-render. The data is validated against the settings mapping (throwing, and rendering the message into the target element, when required columns are missing), rows with missing or non-numeric results are removed with a console warning, and the controls are rebuilt from the new data's measures and filter values.

ParamTypeDefaultDescription
dataArray.<Object>Long-format result records matching the outlier-explorer data contract.

Returns: SafetyOutlierExplorer — The instance, for chaining.

setSettings(settings)

Merge setting overrides onto the current settings, re-normalize them (same rules as the factory), rebuild the controls, and re-render.

ParamTypeDefaultDescription
settingsOutlierExplorerSettingsSetting overrides to merge.

Returns: SafetyOutlierExplorer — The instance, for chaining.

render()

Redraw everything from the current data, settings, and control state: destroys the live chart, clears the listing and any selection, then draws the population lines, the normal-range band, the legend, and the counts. Called automatically by the controls and the data/settings setters.

Returns: void

selectParticipant(id)

Highlight one participant: draw the bold selection overlay, open the linked listing, and dispatch the participantsSelected event (SOE-FUNC-010, SOE-REG-013/014/016, SOE-API-003).

ParamTypeDefaultDescription
idstringParticipant identifier.

Returns: void

clearSelection()

Clear any participant selection and the linked listing (SOE-FUNC-010 click-outside behavior).

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 outlier 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
measure_colstring'TEST'Column holding the measure name; required in the data. Each distinct measure (with its unit) becomes an option in the Measure control.
value_colstring'STRESN'Column holding the numeric result; required in the data. Rows with missing or non-numeric values are removed with a console warning.
id_colstring'USUBJID'Participant identifier column; drives the participant counts, the one-line-per-participant series, and the linked listing.
unit_colstring'STRESU'Unit column, appended to the measure name in labels when present.
normal_col_lowstring'STNRLO'Lower-limit-of-normal column; feeds the LLN-ULN normal-range band.
normal_col_highstring'STNRHI'Upper-limit-of-normal column; feeds the LLN-ULN normal-range band.
normal_range_methodstring'LLN-ULN'Normal-range method: one of None, LLN-ULN, Standard Deviation, Quantiles (SOE-FUNC-007).
normal_range_sdnumber1.96Standard-deviation multiplier for the Standard Deviation method (SOE-CFG-007).
normal_range_quantile_lownumber0.05Lower quantile for the Quantiles method (SOE-CFG-008).
normal_range_quantile_highnumber0.95Upper quantile for the Quantiles method (SOE-CFG-009).
time_colsArray.<(string|Object)>[]Time-axis options: { value_col, label, type: 'linear'|'ordinal', order_col } specs. When empty, a derived "Measurement" sequence axis is used. More than one option renders the X-axis toggle (SOE-FUNC-004).
start_valuestring | nullnullMeasure selected on first render; falls back to the first measure (with a console warning) when absent from the data.
filtersArray.<(string|Object)>[]Filter controls: column names or { value_col, label, start } specs. A filter with a start value is initialized to it and offers no "All" option (SOE-REG-051..053).
groupsArray.<(string|Object)>[]Color-by options; a "None" option is always offered first (SOE-REG-048).
group_bystring'oe_none'Column the marks are colored by on first render; 'oe_none' disables grouping.
detailsArray.<(string|Object)> | nullnullColumns for the linked participant listing; when null, defaults to time, participant ID, result, normal limits, and unit.
tooltip_colsArray.<(string|Object)>[]Extra columns appended to the point tooltip (SOE-CFG-006).
line_attributesObjectPopulation line style: { color, width, opacity }.
point_attributesObjectPopulation point style: { color, radius, opacity }.
widthstring'100%'Widget width, carried over for the R widget bindings; the shell always spans its container.
heightnumber460Chart-area height in pixels, carried over for the R widget bindings; the shell fixes the chart area height.
page_sizenumber10Rows per page in the linked participant listing.

Data contract

safety.viz outlier-explorer data contract

Long-format results data: one record per participant per time point per measure (SOE-DATA-001). Column names are supplied by the settings mapping; the outlier-explorer removes missing/non-numeric results with a reported count (SOE-REG-037) and derives a per-participant measurement sequence when the data carries no visit/study-day column.

FieldTypeRequiredDefaultDescription
dataarrayyesd3.csv()-style records; every row carries the measure and result columns named in settings, one row per participant per time point per measure.
settingsobjectyesColumn mappings and rendering options; merged onto the module's DEFAULT_SETTINGS, so only overrides need to be supplied (SOE-DATA-003).
settings.measure_colstringyesTESTColumn holding the measure name; required in data.
settings.value_colstringyesSTRESNColumn holding the numeric result; required in data.
settings.id_colstringnoUSUBJIDParticipant identifier column; drives the one-line-per-participant series and counts.
settings.unit_colstringnoSTRESUOptional unit column, appended to measure labels.
settings.normal_col_lowstringnoSTNRLOOptional lower limit of normal; feeds the LLN-ULN normal-range band.
settings.normal_col_highstringnoSTNRHIOptional upper limit of normal; feeds the LLN-ULN normal-range band.
settings.normal_range_methodstringnoLLN-ULNNormal-range method: None, LLN-ULN, Standard Deviation, or Quantiles (SOE-FUNC-007).
settings.time_colsarraynoOptional time-axis options ({ value_col, label, type, order_col }); when omitted a derived Measurement sequence is used (SOE-FUNC-004).
settings.filtersarraynoOptional filter columns rendered as controls (SOE-CFG-004).
settings.groupsarraynoOptional color-by columns for grouping the marks (SOE-REG-048).
settings.detailsarraynoOptional listing columns; defaults derive from the other mappings (SOE-CFG-005).
settings.tooltip_colsarraynoOptional extra columns appended to the point tooltip (SOE-CFG-006).