panels.kg_context¶
KG Context panel: component seeding, subgraph topology, failure modes, events.
Reads the kg_context artifact to render a seed-match bar chart, an
interactive Pyvis subgraph (asset, components, failure modes, past events,
upstream paths), and filterable tables of failure modes, in-scope documents
(with extracted causal statements), and a past-event timeline.
Attributes¶
Functions¶
|
Build a bar chart of components grouped by |
|
Components, failure modes, optional asset + past events — from kg_context JSON only. |
|
|
|
Render the KG Context section. |
|
Stringify a value and truncate to |
Module Contents¶
- panels.kg_context.build_component_seed_chart(kg_context)[source]¶
Build a bar chart of components grouped by
seed_match_type.- @ In, kg_context, dict, the
kg_contextartifact; readscomponents[] seed_match_type/component_type
@ Out, fig, plotly.graph_objects.Figure, the chart, or None if no components
- Parameters:
kg_context (JsonDict)
- Return type:
Optional[Any]
- @ In, kg_context, dict, the
- panels.kg_context.build_pyvis_html(kg_context, height_px=480)[source]¶
Components, failure modes, optional asset + past events — from kg_context JSON only.
- Parameters:
kg_context (JsonDict)
height_px (int)
- Return type:
str
- panels.kg_context._cached_pyvis_html(kg_json, height_px)[source]¶
- Parameters:
kg_json (str)
height_px (int)
- Return type:
str
- panels.kg_context.render_kg_panel(kg_context)[source]¶
Render the KG Context section.
- @ In, kg_context, dict, the
kg_contextartifact; readscomponents, failure_modes,past_events,documents,upstream_paths,asset_id; None shows an info note
@ Out, None
- Parameters:
kg_context (Optional[JsonDict])
- Return type:
None
- @ In, kg_context, dict, the
- panels.kg_context.truncate_safe(val, n)[source]¶
Stringify a value and truncate to
ncharacters with an ellipsis.@ In, val, object, the value to stringify (None becomes “”) @ In, n, int, maximum length of the returned string @ Out, out, str, the (possibly truncated) string
- Parameters:
val (Any)
n (int)
- Return type:
str