Files
drk-blutspende-orte/docs/dev-notes.md
T
Paddy 37c9642877 Initial commit: Arbeitsorte-Logger + data-safety/robustness/input work
Existing app (single-file Tkinter/ttkbootstrap desktop tool for logging
blood-drive work assignments and mapping them) plus the first round of
improvements:

- Data safety: atomic CSV writes (tmp + fsync + os.replace), rotating
  backups in data/backups/ (startup + before every change, keep 20),
  fallback to empty/backup on missing/empty/corrupt orte.csv.
- Geocoder robustness: per-item try/except so the worker thread survives
  failures; GeocodingUnavailable + one-time "service unreachable" dialog.
- Input: DateEntry calendar picker with parse_date() validation; manual
  lat/lon fields in the edit dialog; Tab 2 highlights/filters rows without
  coordinates and adds a right-click "Koordinaten suchen".
- Logging to data/app.log; shared autocomplete helpers; config constants;
  map fit_bounds.

docs/ describes current state, architecture, data model, setup (Linux Mint),
and the full improvement roadmap. data/orte.csv is gitignored for now.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-09-07 18:28:28 +02:00

36 lines
1.6 KiB
Markdown

# Dev notes — assumptions that turned out wrong
Running list so the same mistakes aren't repeated. Add to it whenever reality
contradicts an assumption.
## The GUI does not run on the development Mac (2026-09-07)
The macOS **CommandLineTools** Python 3.9 (`/Library/Developer/CommandLineTools/
.../python3.9`) ships **Tk 8.5.9**. `ttkbootstrap` 1.10.1 requires **Tk 8.6+**.
Symptoms when trying to launch `App()` there:
- `_tkinter.TclError: couldn't recognize image data` (ttkbootstrap's window icon
is a PNG; Tk 8.5 can't decode it), and
- `_tkinter.TclError: unknown option "-style"` on `ttk.Scrollbar`.
Consequences:
- `app.py` **cannot be smoke-tested through the GUI on this machine.** Logic is
covered by a non-GUI script (constructs `DataStore`, exercises helpers and the
worker with monkey-patched paths).
- The **Linux Mint target is unaffected** — its system Tk is 8.6.
- If GUI testing on macOS is ever needed, install a Homebrew
`python-tk@3.x` / `tcl-tk` combo, or use `pyenv` with `--with-tcltk`.
## `pandas` reads everything as strings by design
`DataStore._load` uses `dtype={...: str}` for `postal_code`, `lat`, `lon`.
Numeric parsing is deliberately deferred to `get_map_data` (`pd.to_numeric(...,
errors="coerce")`). Don't "fix" columns to float on load — blank coordinates and
leading-zero PLZ both depend on the string representation.
## Nominatim query order matters
`geocode_city` returns the **first** hit, trying PLZ-qualified first, then each
region in `GEOCODE_REGIONS`, then a bare `", Germany"`. Reordering changes which
coordinates ambiguous town names resolve to.