mbdlyb_ui.functional.diagnoser

Copyright (c) 2023 - 2026 TNO-ESI All rights reserved.

Classes

DiagnoserPage

Display the diagnoser editing page.

UIDiagnoserData

Hold the diagnoser analysis and UI state.

Functions

create_evidence_select(...)

Create state selection inputs bound to the evidence mapping.

create_evidence_sliders(...)

Create probability sliders bound to the evidence mapping.

diagnoses(data)

Render ranked health diagnoses with the selected filters.

diagnostic_tests(data)

Render ranked diagnostic tests and evidence controls.

diagnostic_tests_plot(data, dialog)

Plot the costs and information gain of diagnostic tests.

direct_observables(data)

Render direct observable results and evidence controls.

evidence(data)

Render currently supplied evidence and removal controls.

export(→ export.bytes)

Export evidence, hardware health, and recommended tests to a spreadsheet.

operating_modes(data)

Display operating modes available as diagnostic evidence.

Module Contents

class mbdlyb_ui.functional.diagnoser.DiagnoserPage(cluster_id: str)

Bases: mbdlyb_ui.functional.base.FunctionalPage

Display the diagnoser editing page.

cluster: mbdlyb.functional.gdb.GCluster
data: UIDiagnoserData
class mbdlyb_ui.functional.diagnoser.UIDiagnoserData(cluster_id: str, auto_compute=False)

Hold the diagnoser analysis and UI state.

add_staging_evidence(*nodes: mbdlyb.functional.FunctionalNode)

Queue nodes whose evidence should be updated.

Parameters:

nodes – Nodes whose pending evidence state should change.

add_unstaging_evidence(*nodes: mbdlyb.functional.FunctionalNode)

Queue nodes whose evidence should be removed.

Parameters:

nodes – Nodes whose pending evidence state should change.

async compute(event=None)

Infer hardware health and rank diagnostic tests using current evidence.

Parameters:

event – Optional UI event whose sender is disabled during computation.

async compute_tests(event=None)

Re-sort suggested diagnostic tests and refresh their views.

Parameters:

event – Optional UI event whose sender is disabled during computation.

empty()

Clear diagnosis results, pending evidence, and reasoner state.

static refresh(refresh_diagnoses=True)

Refresh diagnosis, test, observable, mode, and evidence displays.

Parameters:

refresh_diagnoses – Whether to refresh diagnosis and test results as well as evidence.

async reset(event=None)

Clear analysis results and reload the cluster model.

Parameters:

event – Optional UI event whose sender is disabled during computation.

auto_compute: bool = True
balance: float
cluster: mbdlyb.functional.Cluster
diagnoser: mbdlyb.functional.Diagnoser | None = None
diagnostic_tests: pandas.DataFrame
direct_observables: pandas.DataFrame
entropy_limit: int = 10
filter_do: str | None = None
filter_dt: str | None = None
filter_hw: str | None = None
filter_opm: str | None = None
hardware_limit: int = 10
health_results: pandas.DataFrame
loss_function
operating_modes: pandas.DataFrame
soft_evidence: bool = False
property staging_evidence: set[mbdlyb.functional.FunctionalNode]

Return nodes awaiting evidence updates.

Returns:

Nodes awaiting evidence updates.

test_limit: int = 10
property unstaging_evidence: set[mbdlyb.functional.FunctionalNode]

Return nodes awaiting evidence removal.

Returns:

Nodes awaiting evidence removal.

mbdlyb_ui.functional.diagnoser.create_evidence_select(label: str, states: list[str], evidence: dict[str, str | list[float]], fqn: str) → list[nicegui.elements.mixins.value_element.ValueElement]

Create state selection inputs bound to the evidence mapping.

Parameters:
  • label – Label shown beside the input control.

  • states – States offered in the evidence selector.

  • evidence – Mapping of node names to supplied evidence.

  • fqn – Fully qualified name of the evidence node.

Returns:

UI input controls bound to the editable model.

mbdlyb_ui.functional.diagnoser.create_evidence_sliders(states: list[str], evidence: dict[str, str | list[float]], fqn: str, make_optional: bool = True, label: str | None = None) → list[nicegui.elements.mixins.value_element.ValueElement | list[nicegui.elements.mixins.value_element.ValueElement] | Tuple[nicegui.elements.mixins.value_element.ValueElement, nicegui.elements.mixins.value_element.ValueElement | list[nicegui.elements.mixins.value_element.ValueElement]]]

Create probability sliders bound to the evidence mapping.

Parameters:
  • states – States represented by probability sliders.

  • evidence – Mapping of node names to supplied evidence.

  • fqn – Fully qualified name of the evidence node.

  • make_optional – Whether a state selection may be left empty.

  • label – Label shown beside the input control.

Returns:

UI input controls bound to the editable model.

mbdlyb_ui.functional.diagnoser.diagnoses(data: UIDiagnoserData)

Render ranked health diagnoses with the selected filters.

Parameters:

data – Inferred hardware health results and diagnosis filters.

mbdlyb_ui.functional.diagnoser.diagnostic_tests(data: UIDiagnoserData)

Render ranked diagnostic tests and evidence controls.

Parameters:

data – Ranked diagnostic tests and evidence staging state.

mbdlyb_ui.functional.diagnoser.diagnostic_tests_plot(data: UIDiagnoserData, dialog: nicegui.ui.dialog)

Plot the costs and information gain of diagnostic tests.

Parameters:
  • data – Ranked tests and their entropy and cost values.

  • dialog – Settings dialog to populate.

mbdlyb_ui.functional.diagnoser.direct_observables(data: UIDiagnoserData)

Render direct observable results and evidence controls.

Parameters:

data – Observable results and current evidence state.

mbdlyb_ui.functional.diagnoser.evidence(data: UIDiagnoserData)

Render currently supplied evidence and removal controls.

Parameters:

data – Current reasoner evidence and entries pending removal.

mbdlyb_ui.functional.diagnoser.export(data: UIDiagnoserData) → export.bytes

Export evidence, hardware health, and recommended tests to a spreadsheet.

Parameters:

data – Diagnosis evidence, health results, and recommended tests to export.

Returns:

Spreadsheet bytes for the diagnosis.

mbdlyb_ui.functional.diagnoser.operating_modes(data: UIDiagnoserData)

Display operating modes available as diagnostic evidence.

Parameters:

data – Available operating modes and current evidence state.