When families or patient advocates track hospital observation stays, Medicare three-midnight inpatient rules, and time-sensitive appeal deadlines, privacy isn't just a nice checkbox: medical billing dates and scanned hospital notices simply should not live on a third-party SaaS server unless the user explicitly exports them.
In ObservationStay , every care episode, midnight status log, and paper notice attachment lives strictly inside an encrypted-at-rest local SQLite vault with zero analytics SDKs. Here are three concrete Swift engineering patterns that keep offline local storage, multi-page PDF evidence packets, and StoreKit 2 entitlements reliable across app updates.
1. Non-Destructive Schema v2 Migrations via PRAGMA user_version
Using Apple's system SQLite3 C API directly avoids heavy ORM overhead and makes incremental column additions explicit and atomic.β¦