Source: factory.core/extend.visual/ObjDecisionSwitchVisual.py
Render, visual, and export methods for decision
trees.
Extends ObjDecisionSwitch with diagram generation,
import/export (PMML, CSV, Excel), and SQL generation
...
| Method | Signature | Description |
|---|---|---|
| get_three_words | get_three_words(decision_name: str) -> str |
Generate a three-word identifier for a |
| diagram | diagram(direction: str = 'LR') -> str |
Generates a Mermaid diagram of the decision |
| diagram_terminal | diagram_terminal() -> str |
Generates a terminal tree diagram using |
| diagram_sankey | diagram_sankey(decision_name: str, guid: str = '') -> str |
Groups the outcomes of a simulation and |
| pmml_operator | pmml_operator(op: str) -> str |
Map a decision tree operator to its PMML |
| from_pmml_operator | from_pmml_operator(op: str) -> str |
Map a PMML operator back to a decision tree |
| save_pmml | save_pmml(file_path: str) -> None |
Saves the decision tree to a PMML file. |
| load_pmml | load_pmml(file_path: str) -> None |
Loads a decision tree from a PMML file and |
| save_csv | save_csv(file_path: str) -> None |
Exports the decision tree nodes to a CSV |
| load_csv | load_csv(file_path: str, decision_name: str, three_words: str = '', changed_by: str = '', change_notes: str = '', strict: bool = True, show_diff: bool = False) -> int |
Import a decision tree from CSV as a new |
| save_excel | save_excel(file_path: str) -> None |
Exports the decision tree to an Excel |
| map_operator_to_sql | map_operator_to_sql(op: str) -> str |
Map a decision tree operator to its SQL |
| generate_sql_statement | generate_sql_statement(decision_name: str, input_table: str = None) -> str |
Generates a single SQL statement that |
| generate_and_store_sql | generate_and_store_sql(decision_name: str, input_table: str | None = None) -> None |
Generates the decision logic SQL and stores |
| compare_simulation_with_sql | compare_simulation_with_sql(decision_name: str, input_table: str) -> None |
Runs a simulation and compares its results |
| generate_sankey_mermaid | generate_sankey_mermaid(outcome_volumes: dict[str, int] | None = None) -> str |
Generate a Mermaid sankey diagram. |
| generate_sankey_plotly | generate_sankey_plotly(outcome_volumes: dict[str, int] | None = None, width: int = 1200, height: int = 600) -> str |
Generate a Plotly sankey diagram as PNG. |
| send_email | send_email(decision_name: str, recipients: str = '', with_ai: bool = True) -> bool |
Send a decision tree report via email. |
| compute_outcome_distribution | compute_outcome_distribution(decision_name: str) -> list[dict] |
Run the decision tree SQL against the |
| build_combined_outcome_html | build_combined_outcome_html(decision_name: str, live_dist: list | None = None, sim_dist: dict | None = None, version: int | None = None) -> str |
Build a single combined table with |
| build_outcome_paths_html | build_outcome_paths_html(decision_name: str, version: int | None = None) -> str |
Build an HTML table showing the |
Generate a Mermaid diagram of the decision tree.
Display a terminal-based tree diagram.
Generate SQL statement implementing the tree.
Generate SQL and store it in the database.
Compare simulation results with SQL execution.
Display outcome distribution from simulation.
Export a decision tree to Excel, YAML, PMML,
Import a decision tree as a new version.
Send a decision tree report via email.