feat(compass): switch to annual SVD windows by default

- load_positions annual mode now selects actual annual window_ids
  ('2022', '2023', etc.) instead of Q4 quarterly approximations,
  with current_parliament appended as the most-recent anchor
- Sidebar radio defaults to 'Per jaar' (annual) instead of quarterly
- Dutch labels for window size radio: 'Per jaar' / 'Per kwartaal'
main
Sven Geboers 1 month ago
parent 96ea4c5522
commit c386073430
  1. 17
      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

Loading…
Cancel
Save