diff --git a/explorer.py b/explorer.py index 8993186..5bc6f8d 100644 --- a/explorer.py +++ b/explorer.py @@ -172,8 +172,14 @@ def load_positions( # Mixed-dim windows cause np.vstack to fail in compute_2d_axes. available = get_uniform_dim_windows(db_path) if window_size == "annual": - # Keep only Q4 windows (one representative window per year) - available = [w for w in available if w.endswith("-Q4")] + # Use actual annual windows (no "-Q" suffix, not "current_parliament"). + # These are window_ids like "2022", "2023", etc. computed over full calendar years. + # Always include current_parliament as the most-recent anchor. + annual = [w for w in available if "-Q" not in w and w != "current_parliament"] + # Sort so current_parliament comes last (after all year windows) + available = sorted(annual) + ( + ["current_parliament"] if "current_parliament" in available else [] + ) if not available: return {}, {} @@ -1442,7 +1448,12 @@ def run_app() -> None: # Sidebar st.sidebar.title("Instellingen") db_path = st.sidebar.text_input("DuckDB pad", value="data/motions.db") - window_size = st.sidebar.radio("Venstergrootte", ["quarterly", "annual"], index=0) + window_size = st.sidebar.radio( + "Venstergrootte", + options=["annual", "quarterly"], + format_func=lambda x: "Per jaar" if x == "annual" else "Per kwartaal", + index=0, + ) show_rejected = st.sidebar.checkbox("Toon verworpen moties", value=False) # About section