refactor: split ssr.py into package, enrich OG Online detail pages, fix travel upsert

- Split src/adapters/ssr.py (2160 LOC) into ssr/ package grouped by CMS:
  realworks.py, sure.py, schiedam.py, denhaag.py, overige.py
- Add _og_detail() to api.py; all OG Online scrapers now fall back to
  detail page fetch when energielabel/bouwjaar are missing from the API
- Fix run() to recalculate travel times for existing listings where
  fiets_mark IS NULL; upsert() now writes travel cols on existing rows too
- Update tests/cache.py to patch fetch_soup in every ssr submodule
- Update docs to reflect new package structure and mark API enrichment TODO done

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-04-11 23:39:35 +02:00
parent 1011d9cf87
commit f74e9bcfb0
14 changed files with 2478 additions and 2199 deletions

45
CLAUDE.md Normal file
View File

@@ -0,0 +1,45 @@
# Huizenbot
## Doel
Periodiek scrapen van makelaarswebsites in Delft en Schiedam, nieuwe woningen opslaan in SQLite, en pushnotificaties sturen via Home Assistant. Draait als één Docker container op homelab met cron.
Dit draait op het moment al, dus we zijn nu enkel bezig met uitbreidingen en verbeteringen.
# AIDE - An IDE for your Agent
This project uses AIDA to support agents, it increases the robustness of edits and reduces token costs.
You can always use `aide help` for further info, and use it also on each subcommand. If you do, edit what you learned into the agents.md so we don't have to spend tokens on it repeatedly.
## Using aide effectively
**Always start with aide for codebase exploration — not Read or Grep:**
- Use `aide outline <file>` first to get the function map of any file before reading it
- Use `aide source <file> <sym>` to read individual functions — never Read a whole large file just to find one function
- This is especially important for large files like `ssr.py` (84KB+) where Read truncates
**For edits:** `aide insert` is fragile with large inputs (see note above) — fall back to the `Edit` tool for anything non-trivial. `aide replace` is fine for small targeted changes.
## What aide can do (quick reference)
| Command | What it replaces |
|---------|-----------------|
| `aide outline <file\|dir>` | `Read` whole file for structure; `ls` + loop |
| `aide source <file> <sym>` | `Read` whole file for one function |
| `aide callers <sym>` | `Grep` for call sites |
| `aide search <term>` | `Grep` across the project |
| `aide replace <file> <sym> <msg>` | `Edit` / `sed` for symbol-level changes |
| `aide replace … --lines N-M <msg>` | `Edit` for intra-function line edits |
| `aide remove <file> <sym>` | Manual splice to delete a symbol |
| `aide insert <file> <msg> --after <sym>` | Manual splice to add a new symbol — **insert one function at a time**; large messages cause bash to be killed |
| `aide rename <file> <old> <new>` | Manual find-and-replace of a name |
| `aide log` | Log related to the undo command; see which files changed in which order |
| `aide annotate <file> <sym>` | Persist a non-obvious invariant or gotcha for a symbol |
| `aide context <file> <sym>` | Read the stored annotation before editing |
| `aide review [path]` | Check for annotations invalidated by recent edits |
Line numbers in `--lines N-M` are **1-based and relative to the symbol's first
line** (line 1 is the signature / opening line of the symbol). This means they
are stable across edits elsewhere in the file.