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.
| Param | Type | Default | Description |
|---|---|---|---|
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).
| Param | Type | Default | Description |
|---|---|---|---|
data | Array.<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.
| Param | Type | Default | Description |
|---|---|---|---|
data | Array.<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.
| Param | Type | Default | Description |
|---|---|---|---|
settings | OutlierExplorerSettings | — | Setting 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).
| Param | Type | Default | Description |
|---|---|---|---|
id | string | — | Participant 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
| Setting | Type | Default | Description |
|---|---|---|---|
measure_col | string | 'TEST' | Column holding the measure name; required in the data. Each distinct measure (with its unit) becomes an option in the Measure control. |
value_col | string | 'STRESN' | Column holding the numeric result; required in the data. Rows with missing or non-numeric values are removed with a console warning. |
id_col | string | 'USUBJID' | Participant identifier column; drives the participant counts, the one-line-per-participant series, and the linked listing. |
unit_col | string | 'STRESU' | Unit column, appended to the measure name in labels when present. |
normal_col_low | string | 'STNRLO' | Lower-limit-of-normal column; feeds the LLN-ULN normal-range band. |
normal_col_high | string | 'STNRHI' | Upper-limit-of-normal column; feeds the LLN-ULN normal-range band. |
normal_range_method | string | 'LLN-ULN' | Normal-range method: one of None, LLN-ULN, Standard Deviation, Quantiles (SOE-FUNC-007). |
normal_range_sd | number | 1.96 | Standard-deviation multiplier for the Standard Deviation method (SOE-CFG-007). |
normal_range_quantile_low | number | 0.05 | Lower quantile for the Quantiles method (SOE-CFG-008). |
normal_range_quantile_high | number | 0.95 | Upper quantile for the Quantiles method (SOE-CFG-009). |
time_cols | Array.<(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_value | string | null | null | Measure selected on first render; falls back to the first measure (with a console warning) when absent from the data. |
filters | Array.<(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). |
groups | Array.<(string|Object)> | [] | Color-by options; a "None" option is always offered first (SOE-REG-048). |
group_by | string | 'oe_none' | Column the marks are colored by on first render; 'oe_none' disables grouping. |
details | Array.<(string|Object)> | null | null | Columns for the linked participant listing; when null, defaults to time, participant ID, result, normal limits, and unit. |
tooltip_cols | Array.<(string|Object)> | [] | Extra columns appended to the point tooltip (SOE-CFG-006). |
line_attributes | Object | — | Population line style: { color, width, opacity }. |
point_attributes | Object | — | Population point style: { color, radius, opacity }. |
width | string | '100%' | Widget width, carried over for the R widget bindings; the shell always spans its container. |
height | number | 460 | Chart-area height in pixels, carried over for the R widget bindings; the shell fixes the chart area height. |
page_size | number | 10 | Rows 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.
| Field | Type | Required | Default | Description |
|---|---|---|---|---|
data | array | yes | — | d3.csv()-style records; every row carries the measure and result columns named in settings, one row per participant per time point per measure. |
settings | object | yes | — | Column mappings and rendering options; merged onto the module's DEFAULT_SETTINGS, so only overrides need to be supplied (SOE-DATA-003). |
settings.measure_col | string | yes | TEST | Column holding the measure name; required in data. |
settings.value_col | string | yes | STRESN | Column holding the numeric result; required in data. |
settings.id_col | string | no | USUBJID | Participant identifier column; drives the one-line-per-participant series and counts. |
settings.unit_col | string | no | STRESU | Optional unit column, appended to measure labels. |
settings.normal_col_low | string | no | STNRLO | Optional lower limit of normal; feeds the LLN-ULN normal-range band. |
settings.normal_col_high | string | no | STNRHI | Optional upper limit of normal; feeds the LLN-ULN normal-range band. |
settings.normal_range_method | string | no | LLN-ULN | Normal-range method: None, LLN-ULN, Standard Deviation, or Quantiles (SOE-FUNC-007). |
settings.time_cols | array | no | — | Optional time-axis options ({ value_col, label, type, order_col }); when omitted a derived Measurement sequence is used (SOE-FUNC-004). |
settings.filters | array | no | — | Optional filter columns rendered as controls (SOE-CFG-004). |
settings.groups | array | no | — | Optional color-by columns for grouping the marks (SOE-REG-048). |
settings.details | array | no | — | Optional listing columns; defaults derive from the other mappings (SOE-CFG-005). |
settings.tooltip_cols | array | no | — | Optional extra columns appended to the point tooltip (SOE-CFG-006). |