refactor: extract data loading and trajectory logic from explorer.py

- Move trajectory analysis to analysis/trajectory.py (+136 lines)
- Move projection helpers to analysis/projections.py (+128 lines)
- Extract tab-specific data loaders to analysis/tabs/ (8 modules, +133 lines)
- Remove 702 lines from explorer.py (data loading extracted to
  analysis/explorer_data.py and new modules)
- Add axis label fallback tests (tests/test_axis_label_fallback.py)
- Add session docs: brainstorms, ideation, plans, and test-failures
This commit is contained in:
2026-04-05 00:51:30 +02:00
parent 154762a4c8
commit 414c16ae9e
19 changed files with 1595 additions and 699 deletions
+10 -8
View File
@@ -10,8 +10,8 @@ def test_display_label_for_modal():
y_label = axis_classifier.display_label_for_modal(None, "y")
# Should return component 1 and 2 labels from SVD_THEMES
assert "EU-integratie" in x_label or "Nationalisme" in x_label
assert "Populistisch" in y_label or "Institutioneel" in y_label
assert "Rechts kabinetsbeleid" in x_label or "links oppositiebeleid" in x_label
assert "PVV/FVD-populisme" in y_label or "mainstream-partijen" in y_label
def test_display_label_for_modal_maps_as_labels():
@@ -20,8 +20,8 @@ def test_display_label_for_modal_maps_as_labels():
y_label = axis_classifier.display_label_for_modal("As 2", "y")
# Should return component 1 and 2 labels
assert "EU-integratie" in x_label or "Nationalisme" in x_label
assert "Populistisch" in y_label or "Institutioneel" in y_label
assert "Rechts kabinetsbeleid" in x_label or "links oppositiebeleid" in x_label
assert "PVV/FVD-populisme" in y_label or "mainstream-partijen" in y_label
def test_display_label_for_modal_stempatroon():
@@ -30,8 +30,8 @@ def test_display_label_for_modal_stempatroon():
y_label = axis_classifier.display_label_for_modal("Stempatroon As 2", "y")
# Should return component 1 and 2 labels
assert "EU-integratie" in x_label or "Nationalisme" in x_label
assert "Populistisch" in y_label or "Institutioneel" in y_label
assert "Rechts kabinetsbeleid" in x_label or "links oppositiebeleid" in x_label
assert "PVV/FVD-populisme" in y_label or "mainstream-partijen" in y_label
def test_classify_axes_modal_fallback(monkeypatch, tmp_path):
@@ -84,8 +84,10 @@ def test_classify_axes_modal_fallback(monkeypatch, tmp_path):
# Should now return SVD component labels instead of hardcoded values
assert (
"EU-integratie" in enriched["x_label"] or "Nationalisme" in enriched["x_label"]
"Rechts kabinetsbeleid" in enriched["x_label"]
or "links oppositiebeleid" in enriched["x_label"]
)
assert (
"Populistisch" in enriched["y_label"] or "Institutioneel" in enriched["y_label"]
"PVV/FVD-populisme" in enriched["y_label"]
or "mainstream-partijen" in enriched["y_label"]
)