fix(explorer): normalise party name 'Nieuw Sociaal Contract' -> 'NSC'
This commit is contained in:
+7
-3
@@ -64,7 +64,6 @@ KNOWN_MAJOR_PARTIES = [
|
|||||||
"CDA",
|
"CDA",
|
||||||
"SP",
|
"SP",
|
||||||
"NSC",
|
"NSC",
|
||||||
"Nieuw Sociaal Contract",
|
|
||||||
"CU",
|
"CU",
|
||||||
"BBB",
|
"BBB",
|
||||||
]
|
]
|
||||||
@@ -165,11 +164,16 @@ def load_positions(
|
|||||||
|
|
||||||
@st.cache_data(show_spinner="Partijkaart laden…")
|
@st.cache_data(show_spinner="Partijkaart laden…")
|
||||||
def load_party_map(db_path: str) -> Dict[str, str]:
|
def load_party_map(db_path: str) -> Dict[str, str]:
|
||||||
"""Return {mp_name: party} mapping from mp_metadata (with vote-based fallback)."""
|
"""Return {mp_name: party} mapping, with party names normalised to abbreviations."""
|
||||||
from analysis.visualize import _load_party_map
|
from analysis.visualize import _load_party_map
|
||||||
|
|
||||||
|
_PARTY_ALIASES: Dict[str, str] = {
|
||||||
|
"Nieuw Sociaal Contract": "NSC",
|
||||||
|
}
|
||||||
|
|
||||||
try:
|
try:
|
||||||
return _load_party_map(db_path)
|
raw = _load_party_map(db_path)
|
||||||
|
return {mp: _PARTY_ALIASES.get(party, party) for mp, party in raw.items()}
|
||||||
except Exception:
|
except Exception:
|
||||||
logger.exception("Failed to load party map")
|
logger.exception("Failed to load party map")
|
||||||
return {}
|
return {}
|
||||||
|
|||||||
Reference in New Issue
Block a user