chore: convert mindmodel from YAML to markdown and clean up

Delete 17 malformed YAML constraint files and 10 stale numbered
constraint files. Convert domain glossary, patterns, stack, and
anti-patterns to markdown format. Update manifest.yaml to reference
new markdown files.
This commit is contained in:
2026-04-12 21:02:56 +02:00
parent 910ef0dc3b
commit 88595c869b
35 changed files with 1107 additions and 1469 deletions
+67
View File
@@ -0,0 +1,67 @@
---
title: Tech Stack
category: stack
---
# Tech Stack
## Runtime & Language
- **Python >=3.13**
## Web Framework
- **Streamlit** - Multi-page app with Home, Stemwijzer, Explorer pages
## Data Layer
- **DuckDB** - Embedded OLAP database
- Tables: motions, mp_votes, svd_vectors, fused_embeddings, embeddings, user_sessions, party_results, mp_metadata
- **ibis** - ORM (referenced but DuckDB-native implementation used)
## AI / LLM
- **OpenRouter** - API abstraction for AI providers
- **QWEN** - Primary model
- Embeddings: `qwen/qwen3-embedding-4b`
- Chat: `qwen/qwen-2.5-72b-instruct`
- **requests** - HTTP client (not raw openai)
## ML / Analytics
- **scikit-learn** - KMeans clustering, cosine_similarity, StandardScaler
- **scipy** - SVD (scipy.linalg.svd), spatial.procrustes
- **umap-learn** - Dimensionality reduction (optional, graceful fallback to SVD)
- **numpy** - Numerical computing
## Visualization
- **Plotly** - Interactive charts (go.Figure, _DummyTrace fallback)
- **matplotlib** - Static plotting (optional)
## HTTP & Parsing
- **requests** - Session pooling, retry with backoff
- **beautifulsoup4** - HTML parsing
- **lxml** - XML/HTML processing
## Key Source Files
| File | Purpose |
|------|---------|
| `database.py` | MotionDatabase singleton, DuckDB connection, 9-table schema |
| `explorer.py` | Explorer page with 4 tabs (Motion, MP, Party, Evolution) |
| `explorer_helpers.py` | Pure helper functions, Plotly chart builders |
| `analysis/` | SVD pipeline, UMAP projection, clustering |
| `pipeline/` | Data fetch, transform, store pipeline |
| `pages/1_Stemwijzer.py` | Quiz page |
| `pages/2_Explorer.py` | Explorer page |
| `config.py` | Dataclass Config pattern |
| `ai_provider.py` | OpenRouter API wrapper with retry |
| `api_client.py` | TweedeKamer OData API client |
## Singleton Instances
| Module | Instance | Type |
|--------|----------|------|
| `database.py` | `db` | `MotionDatabase` |
| `config.py` | `config` | `Config` (dataclass) |
| `config.py` | `PARTY_COLOURS` | `dict[str, str]` |
## Environment
- Python >=3.13
- Environment variables via `.env` (DB path, API keys)
- No `.env` values in constraint files (security)
-41
View File
@@ -1,41 +0,0 @@
# Tech Stack
## Runtime & Language
- **Python ≥3.13** (type: runtime)
- Streamlit (type: web framework) - multi-page app: Home, Stemwijzer, Explorer (4 tabs)
## Data Layer
- **DuckDB** (type: database) - 9 tables: motions, mp_votes, svd_vectors, mp_party_history, etc.
- **ibis** (type: ORM) - DuckDB backend for Pythonic SQL
- Query mode: duckdb:// path or :memory: (see database.py:50-51)
## ML / Analytics
- **scikit-learn** (type: ML) - clustering, Procrustes alignment
- **UMAP** (type: dimensionality reduction) - 2D political compass projection
- **scipy** (type: scientific computing) - spatial/alignment algorithms
- **numpy** (type: numerical computing) - array operations
## Visualization
- **Plotly** (type: charting) - dual-layer interactive charts (scatter + annotations)
## Key Source Files
| File | Purpose |
|------|---------|
| `database.py` | MotionDatabase singleton, DuckDB connection, 9-table schema |
| `explorer.py` | Explorer page with 4 tabs (Motion, MP, Party, Evolution) |
| `explorer_helpers.py` | Pure helper functions, Plotly chart builders, coordinate computation |
| `analysis/` | SVD pipeline, UMAP projection, clustering algorithms |
| `pipeline/` | Data fetch → transform → store pipeline |
| `pages/1_🗳️_Stemwijzer.py` | Quiz page (thin wrapper) |
| `pages/2_🔍_Explorer.py` | Explorer page (thin wrapper) |
| `config.py` | Dataclass Config pattern |
## Database Tables
- `motions` - parliamentary motions with id, title, date, category
- `mp_votes` - individual MP votes on motions (1/0/-1)
- `svd_vectors` - SVD-computed political positions (entity_id, window, vector_2d)
- `mp_party_history` - MP-to-party mappings over time
- `party_centroids` - aggregated party positions
- `windows` - time period definitions
- `mp_trajectories` - MP position changes across windows
- Plus 2 additional tables (exact names vary)