From cd47fd5a83d8ded3d35c4ce4ccff4e89a713a806 Mon Sep 17 00:00:00 2001 From: Sven Geboers Date: Thu, 16 Apr 2026 21:55:43 +0200 Subject: [PATCH] feat: hide current calendar year from window dropdowns (covered by current_parliament) --- explorer.py | 26 ++++++++++++++++++++++---- 1 file changed, 22 insertions(+), 4 deletions(-) diff --git a/explorer.py b/explorer.py index e441fe9..a8f484b 100644 --- a/explorer.py +++ b/explorer.py @@ -1416,7 +1416,16 @@ def build_compass_tab(db_path: str, window_size: str) -> None: active_mps = load_active_mps(db_path) # Sort windows: year windows first (ascending), current_parliament last. - year_windows = sorted(w for w in positions_by_window if w != "current_parliament") + # Exclude the current calendar year — it is already fully covered by current_parliament + # and showing both creates confusion (2026 ⊂ current_parliament). + import datetime as _dt + + _current_year = str(_dt.date.today().year) + year_windows = sorted( + w + for w in positions_by_window + if w != "current_parliament" and w != _current_year + ) has_current = "current_parliament" in positions_by_window windows = year_windows + (["current_parliament"] if has_current else []) @@ -2568,9 +2577,14 @@ def build_svd_components_tab(db_path: str) -> None: # Default party scores already loaded earlier for sidebar controls. # ALL components 1-10 use raw (non-aligned) SVD vectors. # The compass uses Procrustes-aligned PCA — separate visualization. - # Get available windows from svd_vectors + # Get available windows from svd_vectors; exclude current year (covered by current_parliament) + import datetime as _dt + + _current_year = str(_dt.date.today().year) available_windows = get_uniform_dim_windows(db_path) - year_windows = sorted(w for w in available_windows if w != "current_parliament") + year_windows = sorted( + w for w in available_windows if w != "current_parliament" and w != _current_year + ) has_current = "current_parliament" in available_windows svd_windows = year_windows + (["current_parliament"] if has_current else []) @@ -2718,7 +2732,11 @@ def build_svd_components_tab(db_path: str) -> None: if view_mode == "Tijdtraject" and selected_parties_for_trajectory: # Load party scores for all windows and render time trajectory available_windows = get_uniform_dim_windows(db_path) - year_windows = sorted(w for w in available_windows if w != "current_parliament") + year_windows = sorted( + w + for w in available_windows + if w != "current_parliament" and w != _current_year + ) has_current = "current_parliament" in available_windows all_windows = year_windows + (["current_parliament"] if has_current else [])