FEST: in-repo flattener bundles slim.json; release builds auto-refresh when stale

Amends decision #8: the producer now lives in tools/fest_flatten.py
(stdlib Python, streaming iterparse over the 115 MB M30 XML) instead of
an out-of-repo server job. It pulls fest251.zip from dmp.no, flattens
8934 active human-use brand entries (name/strength/unit/form/ATC +
modal package size from pakningsinfo), and writes the asset checked in
at app/src/main/assets/fest/slim.json — so autocomplete works offline
out of the box. preReleaseBuild depends on refreshFestData: fast-exits
under 30 days, keeps the old file on download failure (offline release
builds never break). FestRepository: downloaded cache wins over the
bundled asset.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
Ole-Morten Duesund 2026-06-10 15:19:49 +02:00
commit 293ca212ec
6 changed files with 260 additions and 15 deletions

View file

@ -38,8 +38,9 @@ The name says the brief: nag me to take the dose *now*.
never lock me into this app. JCE AES-GCM is the baseline behind an interface; verify
age against the age test vectors before trusting it.
8. **FEST, not Felleskatalogen**, and **not** as a live API: its open Rekvirent extract
is a SOAP/WCF M30 XML dump. The phone reads a slim pre-flattened JSON synced from my
server (that job lives outside this repo) and does autocomplete offline.
is a SOAP/WCF M30 XML dump. `tools/fest_flatten.py` (in-repo, amended 2026-06) flattens
it into a slim JSON bundled as an APK asset; release builds auto-refresh it when >30
days old. Autocomplete is offline; a downloaded file via Settings can override the bundle.
9. Refill is **derived** from inventory + consumption. Prescription renewal
(`rxExpiryEpochDay`, `refillsRemaining`) is tracked **separately** from stock.