A production-quality Go-based platform for integrating with Electronic Health Record (EHR) systems using the SMART on FHIR protocol. This sandbox demonstrates authentication, persistence, and dashboarding for patient and practitioner data.
- **SMART on FHIR Launch:** Supports the full SMART App Launch flow (EHR launch and standalone).
- **Identity Resolution:** Correctly handles practitioner identification from both `practitioner` and `user` (Practitioner/ID) fields in OAuth2 token responses.
- **SQLite Persistence:** Persists patient and practitioner data upon successful launch using a pure-Go SQLite driver (no CGO required).
- **Session Management:** Server-side sessions stored in SQLite with secure, HttpOnly cookies.
- **Responsive Dashboard:** A modern UI built with Go `html/template` that displays patient demographics and practitioner details.
- **Extensible Architecture:** Clean package separation (`handlers`, `db`, `fhir`, `models`, `middleware`, `config`) designed for growth.
## Architecture
The project is structured into modular packages under `/app`:
-`/db`: Database schema, migrations, and CRUD operations using `modernc.org/sqlite`.
-`/fhir`: FHIR R4 resource definitions and SMART discovery/client logic.
-`/handlers`: HTTP request handlers and template rendering.
-`/middleware`: Session loading and authentication guards.
-`/models`: Shared data structures.
-`/templates`: HTML templates with layout inheritance.