causalexplain.gui package#

Subpackages#

Submodules#

NiceGUI app for local causalexplain workflows.

run_gui(host='127.0.0.1', port=8080)[source]#

Start the NiceGUI application.

Cytoscape helpers for NiceGUI graph rendering.

ensure_cytoscape_assets()[source]#

Expose Cytoscape asset registration for GUI apps.

Graph helper utilities for the GUI.

clean_node_name(name)[source]#

Normalize a node name by stripping whitespace and quotes.

normalize_graph(graph)[source]#

Return a cleaned directed graph with normalized node names.

dag_is_valid(graph, min_edges, max_edges)[source]#

Check that the graph is a DAG within the edge constraints.

graph_from_dot(path)[source]#

Load a DOT file into a normalized directed graph.

File and path utilities for the GUI.

ensure_file(path, suffixes)[source]#

Ensure the file exists and matches the expected suffixes.

ensure_output_dir(path)[source]#

Create the output directory for the given file path when needed.

normalize_output_value(raw_value, required_ext)[source]#

Normalize an output path by enforcing the required extension.

sanitize_output_name(name)[source]#

Strip extensions and whitespace from a dataset base name.

Rendering helpers for graphs and metrics in the GUI.

update_metrics_log(log_el, metrics)[source]#

Render metrics into a NiceGUI log element.

overlay_status_message(classes)[source]#

Return the overlay status message based on edge classes.

render_cytoscape_overlay(container, status_label, discoverer, ref_graph, *, persist_positions, height='420px')[source]#

Render an interactive overlay chart for predicted vs. reference DAGs.

render_cytoscape_graph(container, graph, *, height='420px')[source]#

Render a DAG in a NiceGUI container using Cytoscape.

Default settings and persistence helpers for the GUI.

default_train_settings()[source]#

Return default training settings for the GUI.

default_load_settings()[source]#

Return default load/evaluation settings for the GUI.

default_generate_settings()[source]#

Return default dataset generation settings for the GUI.

merge_settings(stored, defaults)[source]#

Merge persisted settings into the provided defaults.

Style helpers for the causalexplain GUI.

app_styles_path()[source]#

Return the absolute path to the GUI CSS file.

read_app_styles()[source]#

Read the GUI CSS content from disk.

register_app_styles()[source]#

Inject the GUI CSS into the NiceGUI head.

UI helper utilities for NiceGUI widgets.

update_settings(storage, settings_key, target, key, value)[source]#

Update a settings dict and persist it to NiceGUI storage.

bind_setting(element, storage, settings_key, settings_ref, field)[source]#

Bind UI change events to a settings dictionary.

set_input_value(input_el, value)[source]#

Update a NiceGUI input value and refresh the widget.

async save_upload(file_upload, upload_dir, suffix=None)[source]#

Persist an uploaded file to the GUI upload folder.

make_upload_handler(input_el, storage, settings_key, settings_ref, field, upload_dir, suffix=None, status_label=None)[source]#

Create an async upload handler that updates UI state.

normalize_output_path(input_el, storage, settings_key, settings_ref, field, required_ext)[source]#

Normalize a UI output path and persist the setting.

Module contents#

GUI entry points for causalexplain.

run_gui(*args, **kwargs)[source]#

Lazy import to avoid circular dependencies when loading GUI helpers.