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'
This commit is contained in:
+14
-3
@@ -172,8 +172,14 @@ def load_positions(
|
|||||||
# Mixed-dim windows cause np.vstack to fail in compute_2d_axes.
|
# Mixed-dim windows cause np.vstack to fail in compute_2d_axes.
|
||||||
available = get_uniform_dim_windows(db_path)
|
available = get_uniform_dim_windows(db_path)
|
||||||
if window_size == "annual":
|
if window_size == "annual":
|
||||||
# Keep only Q4 windows (one representative window per year)
|
# Use actual annual windows (no "-Q" suffix, not "current_parliament").
|
||||||
available = [w for w in available if w.endswith("-Q4")]
|
# 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:
|
if not available:
|
||||||
return {}, {}
|
return {}, {}
|
||||||
@@ -1442,7 +1448,12 @@ def run_app() -> None:
|
|||||||
# Sidebar
|
# Sidebar
|
||||||
st.sidebar.title("Instellingen")
|
st.sidebar.title("Instellingen")
|
||||||
db_path = st.sidebar.text_input("DuckDB pad", value="data/motions.db")
|
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)
|
show_rejected = st.sidebar.checkbox("Toon verworpen moties", value=False)
|
||||||
|
|
||||||
# About section
|
# About section
|
||||||
|
|||||||
Reference in New Issue
Block a user