mining: introduce a declarative miner parameter contract and a generic controller #48

Open
opened 2026-10-06 13:52:34 +00:00 by ffrauenberger · 0 comments
Owner

Severity: improvement (medium)

Where

  • app/mining_algorithms/mining_interface.py
  • All generate_graph signatures
  • All app/ui/*_miner_ui/*_controller.py and *_view.py

Problem

  • MiningInterface does not declare generate_graph, its parameters or its getters. Every miner has its own positional signature, and controllers rely on matching keyword names (dependency_threshold, edge_freq_threshold_normalized, …). A typo only shows up at runtime as a TypeError.
  • Adding a parameter to an algorithm touches several places: a controller attribute, process_algorithm_parameters, have_parameters_changed, get_sidebar_values, the view widget, perform_mining and a model getter. Genetic and Fuzzy repeat this for 7–8 parameters each, and inconsistencies already exist (fitness_threshold has no getter and is read as an attribute; noise_threshold is read via getattr(..., 0.2)).
  • Session-state keys are global strings shared between algorithms (threshold, edge_freq_threshold_normalized). This only works because navigation clears the whole session state.

Fix

  • Each miner exposes a declarative parameter schema (name, type, default, min/max, widget type, help text) and a single generate_graph(params: dict) method
  • One generic controller/view renders the sidebar, detects changes (dict comparison) and calls the miner, removing several hundred lines of near-duplicate code
  • Session keys are namespaced per algorithm

from issues/ARCH-003-no-explicit-miner-contract-and-duplicated-controller-boilerplate.md (code analysis of commit 6bcc646, 2026-10-03)

**Severity:** improvement (medium) ## Where - `app/mining_algorithms/mining_interface.py` - All `generate_graph` signatures - All `app/ui/*_miner_ui/*_controller.py` and `*_view.py` ## Problem - `MiningInterface` does not declare `generate_graph`, its parameters or its getters. Every miner has its own positional signature, and controllers rely on matching keyword names (`dependency_threshold`, `edge_freq_threshold_normalized`, …). A typo only shows up at runtime as a `TypeError`. - Adding a parameter to an algorithm touches several places: a controller attribute, `process_algorithm_parameters`, `have_parameters_changed`, `get_sidebar_values`, the view widget, `perform_mining` and a model getter. Genetic and Fuzzy repeat this for 7–8 parameters each, and inconsistencies already exist (`fitness_threshold` has no getter and is read as an attribute; `noise_threshold` is read via `getattr(..., 0.2)`). - Session-state keys are global strings shared between algorithms (`threshold`, `edge_freq_threshold_normalized`). This only works because navigation clears the whole session state. ## Fix - Each miner exposes a declarative parameter schema (name, type, default, min/max, widget type, help text) and a single `generate_graph(params: dict)` method - One generic controller/view renders the sidebar, detects changes (dict comparison) and calls the miner, removing several hundred lines of near-duplicate code - Session keys are namespaced per algorithm --- from `issues/ARCH-003-no-explicit-miner-contract-and-duplicated-controller-boilerplate.md` (code analysis of commit 6bcc646, 2026-10-03)
Sign in to join this conversation.
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
ffrauenberger/ProcessIntel#48
No description provided.