refactor: remove motion listings from compass view, keep voting discipline
Remove the '🔍 Wat bepaalt deze assen?' expander that showed individual motion titles (➕/➖) with axis labels and variance explanation. Only the Stemdiscipline analyse (Rice index) section remains. Also removes the now-unused _render_axis_motions() helper function.
This commit is contained in:
+12
-53
@@ -469,19 +469,6 @@ def _swap_axes(
|
|||||||
return projections.swap_axes(positions_by_window, axis_def)
|
return projections.swap_axes(positions_by_window, axis_def)
|
||||||
|
|
||||||
|
|
||||||
def _render_axis_motions(label: str, conf_pct: str, top: dict) -> None:
|
|
||||||
st.markdown(f"**{label}**{conf_pct}")
|
|
||||||
for sign, icon in (("+", "➕"), ("-", "➖")):
|
|
||||||
titles = top.get(sign, [])
|
|
||||||
if titles:
|
|
||||||
st.markdown(
|
|
||||||
" "
|
|
||||||
+ icon
|
|
||||||
+ " "
|
|
||||||
+ " · ".join(f"{t} ({d})" for t, d in titles[:3])
|
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
@st.cache_data(show_spinner="2D posities berekenen (kan even duren)…")
|
@st.cache_data(show_spinner="2D posities berekenen (kan even duren)…")
|
||||||
def load_positions(
|
def load_positions(
|
||||||
db_path: str, window_size: str = "annual"
|
db_path: str, window_size: str = "annual"
|
||||||
@@ -1576,47 +1563,19 @@ def build_compass_tab(db_path: str, window_size: str) -> None:
|
|||||||
):
|
):
|
||||||
st.caption(_y_interp)
|
st.caption(_y_interp)
|
||||||
|
|
||||||
# Motion expander — show which motions define each axis for this window
|
# Voting discipline analysis
|
||||||
x_top = axis_def.get("x_top_motions", {}).get(window_idx, {})
|
st.markdown("---")
|
||||||
y_top = axis_def.get("y_top_motions", {}).get(window_idx, {})
|
st.markdown(
|
||||||
x_conf = axis_def.get("x_label_confidence", {}).get(window_idx)
|
"**Stemdiscipline analyse:** De Rice-index meet hoe eensgezind partijen stemmen "
|
||||||
y_conf = axis_def.get("y_label_confidence", {}).get(window_idx)
|
"tijdens hoofdelijke stemmingen. Een score van 100% betekent dat alle MPs van "
|
||||||
evr = axis_def.get("explained_variance_ratio", [None, None])
|
"een partij hetzelfde stemden; 50% wijst op een gelijke splitsing binnen de partij. "
|
||||||
evr0 = evr[0] if evr else None
|
"Partijen met hoge discipline (>95%) zoals PVV en SGP stemmen als een blok, wat "
|
||||||
|
"wijst op sterke partijdiscipline en homogene membership. Lagere discipline (<85%) "
|
||||||
_has_motion_data = bool(
|
"bij partijen als PvdA of SP kan duiden op interne factiestrijd, gewetensvragen "
|
||||||
x_top.get("+") or x_top.get("-") or y_top.get("+") or y_top.get("-")
|
"bij ethische thema's, of een brede ideologische koers die ruimte laat voor "
|
||||||
|
"afwijkende meningen. De discipline varieert ook per onderwerp — ethische kwesties "
|
||||||
|
"tonen vaak meer interne verschillen dan economische thema's."
|
||||||
)
|
)
|
||||||
if _has_motion_data:
|
|
||||||
with st.expander("🔍 Wat bepaalt deze assen?"):
|
|
||||||
x_conf_pct = (
|
|
||||||
f" (vertrouwen: {x_conf:.0%})" if x_conf is not None else ""
|
|
||||||
)
|
|
||||||
y_conf_pct = (
|
|
||||||
f" (vertrouwen: {y_conf:.0%})" if y_conf is not None else ""
|
|
||||||
)
|
|
||||||
|
|
||||||
_render_axis_motions(f"Horizontale as: {_x_label}", x_conf_pct, x_top)
|
|
||||||
_render_axis_motions(f"Verticale as: {_y_label}", y_conf_pct, y_top)
|
|
||||||
|
|
||||||
if evr0 is not None:
|
|
||||||
st.caption(
|
|
||||||
f"De sterkste component verklaart {evr0:.1%} van de variantie in stemgedrag."
|
|
||||||
)
|
|
||||||
|
|
||||||
# Voting discipline analysis
|
|
||||||
st.markdown("---")
|
|
||||||
st.markdown(
|
|
||||||
"**Stemdiscipline analyse:** De Rice-index meet hoe eensgezind partijen stemmen "
|
|
||||||
"tijdens hoofdelijke stemmingen. Een score van 100% betekent dat alle MPs van "
|
|
||||||
"een partij hetzelfde stemden; 50% wijst op een gelijke splitsing binnen de partij. "
|
|
||||||
"Partijen met hoge discipline (>95%) zoals PVV en SGP stemmen als een blok, wat "
|
|
||||||
"wijst op sterke partijdiscipline en homogene membership. Lagere discipline (<85%) "
|
|
||||||
"bij partijen als PvdA of SP kan duiden op interne factiestrijd, gewetensvragen "
|
|
||||||
"bij ethische thema's, of een brede ideologische koers die ruimte laat voor "
|
|
||||||
"afwijkende meningen. De discipline varieert ook per onderwerp — ethische kwesties "
|
|
||||||
"tonen vaak meer interne verschillen dan economische thema's."
|
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
# ---------------------------------------------------------------------------
|
# ---------------------------------------------------------------------------
|
||||||
|
|||||||
Reference in New Issue
Block a user