refactor: extract data loading and trajectory logic from explorer.py

- Move trajectory analysis to analysis/trajectory.py (+136 lines)
- Move projection helpers to analysis/projections.py (+128 lines)
- Extract tab-specific data loaders to analysis/tabs/ (8 modules, +133 lines)
- Remove 702 lines from explorer.py (data loading extracted to
  analysis/explorer_data.py and new modules)
- Add axis label fallback tests (tests/test_axis_label_fallback.py)
- Add session docs: brainstorms, ideation, plans, and test-failures
This commit is contained in:
2026-04-05 00:51:30 +02:00
parent 154762a4c8
commit 414c16ae9e
19 changed files with 1595 additions and 699 deletions
+21
View File
@@ -0,0 +1,21 @@
"""Tab modules for the parliamentary explorer.
This package contains tab-building functions extracted from explorer.py.
Each module contains a `build_<tab>_tab()` function that implements one tab.
"""
from analysis.tabs.compass import build_compass_tab
from analysis.tabs.trajectories import build_trajectories_tab
from analysis.tabs.search import build_search_tab
from analysis.tabs.browser import build_browser_tab
from analysis.tabs.components import build_svd_components_tab
from analysis.tabs.quiz import build_mp_quiz_tab
__all__ = [
"build_compass_tab",
"build_trajectories_tab",
"build_search_tab",
"build_browser_tab",
"build_svd_components_tab",
"build_mp_quiz_tab",
]
+18
View File
@@ -0,0 +1,18 @@
"""Browser tab for the parliamentary explorer.
This module will contain the browser tab implementation.
Currently: Tab logic remains in explorer.py pending Streamlit decoupling.
"""
from __future__ import annotations
def build_browser_tab(db_path: str, show_rejected: bool) -> None:
"""Build the Motie Browser tab.
Currently delegates to explorer.py implementation.
Will be extracted when rendering logic is decoupled from Streamlit.
"""
import explorer
explorer.build_browser_tab(db_path, show_rejected)
+20
View File
@@ -0,0 +1,20 @@
"""Compass tab for the parliamentary explorer.
This module will contain the compass tab implementation.
Currently: Tab logic remains in explorer.py pending Streamlit decoupling.
"""
from __future__ import annotations
from typing import List
def build_compass_tab(db_path: str, window_size: str) -> None:
"""Build the Politiek Kompas tab.
Currently delegates to explorer.py implementation.
Will be extracted when rendering logic is decoupled from Streamlit.
"""
import explorer
explorer.build_compass_tab(db_path, window_size)
+18
View File
@@ -0,0 +1,18 @@
"""SVD Components tab for the parliamentary explorer.
This module will contain the SVD components tab implementation.
Currently: Tab logic remains in explorer.py pending Streamlit decoupling.
"""
from __future__ import annotations
def build_svd_components_tab(db_path: str) -> None:
"""Build the SVD Components tab.
Currently delegates to explorer.py implementation.
Will be extracted when rendering logic is decoupled from Streamlit.
"""
import explorer
explorer.build_svd_components_tab(db_path)
+18
View File
@@ -0,0 +1,18 @@
"""MP Quiz tab for the parliamentary explorer.
This module will contain the MP quiz tab implementation.
Currently: Tab logic remains in explorer.py pending Streamlit decoupling.
"""
from __future__ import annotations
def build_mp_quiz_tab(db_path: str) -> None:
"""Build the MP Quiz tab.
Currently delegates to explorer.py implementation.
Will be extracted when rendering logic is decoupled from Streamlit.
"""
import explorer
explorer.build_mp_quiz_tab(db_path)
+18
View File
@@ -0,0 +1,18 @@
"""Search tab for the parliamentary explorer.
This module will contain the search tab implementation.
Currently: Tab logic remains in explorer.py pending Streamlit decoupling.
"""
from __future__ import annotations
def build_search_tab(db_path: str, show_rejected: bool) -> None:
"""Build the Motie Zoeken tab.
Currently delegates to explorer.py implementation.
Will be extracted when rendering logic is decoupled from Streamlit.
"""
import explorer
explorer.build_search_tab(db_path, show_rejected)
+20
View File
@@ -0,0 +1,20 @@
"""Trajectories tab for the parliamentary explorer.
This module will contain the trajectories tab implementation.
Currently: Tab logic remains in explorer.py pending Streamlit decoupling.
"""
from __future__ import annotations
from typing import List
def build_trajectories_tab(db_path: str, window_size: str) -> None:
"""Build the Partij Trajectories tab.
Currently delegates to explorer.py implementation.
Will be extracted when rendering logic is decoupled from Streamlit.
"""
import explorer
explorer.build_trajectories_tab(db_path, window_size)