|
|
# Constraint Files Index
|
|
|
|
|
|
This directory contains all constraint files for the Stemwijzer codebase.
|
|
|
|
|
|
## Quick Navigation
|
|
|
|
|
|
| Category | File | Purpose |
|
|
|
|----------|------|---------|
|
|
|
| **Stack** | `../stack/stack.yaml` | Tech stack overview |
|
|
|
| **Architecture** | `../architecture/architecture.yaml` | Data flow, page routing, component relationships |
|
|
|
| **Conventions** | `../conventions/conventions.yaml` | Naming, error handling, code organization |
|
|
|
| **Domain** | `../domain/domain-glossary.yaml` | Dutch political terms, algorithm concepts |
|
|
|
| **Patterns** | `../patterns/patterns.yaml` | 10 code patterns (page wrapper, pipeline, etc.) |
|
|
|
| **Anti-Patterns** | `../anti-patterns/anti-patterns.yaml` | ⚠️ 7 issues including CRITICAL BUG |
|
|
|
| **Dependencies** | `../dependencies/dependencies.yaml` | Library wiring, singletons, imports |
|
|
|
|
|
|
## How to Use
|
|
|
|
|
|
1. **Before writing code**: Check `patterns/patterns.yaml` for how similar features are implemented
|
|
|
2. **When naming things**: Follow `conventions/conventions.yaml` (snake_case functions, PascalCase classes)
|
|
|
3. **When handling errors**: Avoid patterns in `anti-patterns/anti-patterns.yaml`
|
|
|
4. **When working with domain terms**: Reference `domain/domain-glossary.yaml`
|
|
|
5. **When connecting components**: See `dependencies/dependencies.yaml` for wiring
|
|
|
|
|
|
## Key Conventions Summary
|
|
|
|
|
|
- **Files**: snake_case (`explorer_helpers.py`)
|
|
|
- **Functions**: snake_case (`compute_party_coords`)
|
|
|
- **Classes**: PascalCase (`MotionDatabase`)
|
|
|
- **Constants**: UPPER_SNAKE_CASE (`PARTY_COLOURS`)
|
|
|
- **No bare `except:`** — always specify exception type
|
|
|
- **Pure functions** in helpers — no IO, no Streamlit calls
|
|
|
- **One singleton per module** — `db`, `config`, `PARTY_COLOURS`
|
|
|
|
|
|
## ⚠️ Critical Bug
|
|
|
|
|
|
**Read `../anti-patterns/anti-patterns.yaml` first.** Section 1 documents a critical bug in
|
|
|
`explorer_helpers.py:compute_party_coords` where party names in `svd_vectors` entity_id are
|
|
|
not recognized because `party_map` only contains MP-name keys.
|
|
|
|
|
|
## Files Generated
|
|
|
|
|
|
- `manifest.yaml` — lists all constraint files with group mappings
|
|
|
- `stack/stack.yaml` — tech stack
|
|
|
- `architecture/architecture.yaml` — data flow & components
|
|
|
- `conventions/conventions.yaml` — coding conventions
|
|
|
- `domain/domain-glossary.yaml` — domain terminology
|
|
|
- `patterns/patterns.yaml` — 10 code patterns with examples
|
|
|
- `anti-patterns/anti-patterns.yaml` — 7 anti-patterns including CRITICAL BUG
|
|
|
- `dependencies/dependencies.yaml` — library wiring
|
|
|
- `README.md` — this index
|
|
|
|