Files
HealthAppRepositoryB/implemented_architecture/architecture.md
T

5.1 KiB
Raw Blame History

As-is software architecture

Context and runtime boundary

Patients authenticate and manage their own profile and blood-pressure observations. Healthcare professionals authenticate and read patients assigned in protected configuration. Anonymous clients can obtain measurement guidance and attempt login. Administrators install the application and provision its database, configuration, TLS material and service identity.

flowchart LR
  P[Patient client] -->|HTTPS / JSON| H[HealthApp ASP.NET Core host]
  C[Assigned professional client] -->|HTTPS / JSON| H
  A[Anonymous client] -->|Login or guidance| H
  H -->|Npgsql pooled connection| D[(PostgreSQL B database)]
  O[Administrator] --> I[Transient native installer and provisioner]
  I -->|Fresh schemas and roles| D
  I -->|Protected configuration, TLS, unit| H

The public host is src/HealthApp. Five module assemblies execute inside its process; they are not separately addressable services. PostgreSQL may be local or remote. There is no frontend application in the implemented solution. Reference/ArchitectureA is an archived behavioral reference excluded from the solution.

Components and responsibilities

Component Owns Calls / dependencies
HealthApp Controllers, authentication, access policy, admission and deadlines, host composition, health probes All modules, Contracts, Infrastructure
Profile Patient entities, account association, profile queries/commands, profile schema Contracts and Infrastructure
Observations Measurements, recorded context, owner-scoped queries/commands, observations schema Contracts and Infrastructure; runtime ProfileQueries for recording
Analytics Summary, numerical trends, comparability and preserved clinical policy ObservationQueries, ReferenceCatalog, RequestTransaction
Overview Composition of profile, latest overall observation and selected insight ProfileQueries, ObservationQueries, AnalyticsQueries
Guidance Static home-measurement guidance and reviewed reference catalog Contracts; no database
Contracts DTOs, requests, typed interfaces, authorized patient capability No module implementation
Infrastructure Shared connection/transaction mechanics Npgsql and EF Core; no health-table policy
HealthApp.Provisioning Installation secrets, TLS, fresh database/roles/migrations and verification Framework/Npgsql; separate transient executable
flowchart TD
  H[HealthApp host] --> P[Profile]
  H --> O[Observations]
  H --> A[Analytics]
  H --> V[Overview]
  H --> G[Guidance]
  V -. ProfileQueries .-> P
  V -. ObservationQueries .-> O
  V -. AnalyticsQueries .-> A
  A -. ObservationQueries .-> O
  A -. ReferenceCatalog .-> G
  O -. ProfileQueries .-> P
  P --> I[Infrastructure: RequestTransaction]
  O --> I
  A --> I
  I --> DB[(Single PostgreSQL database)]

Solid module-to-Infrastructure edges are assembly dependencies. Dotted edges are runtime interface calls resolved by host dependency injection, not project references to sibling implementations. All modules reference Contracts. Overview and Guidance do not reference Infrastructure. Profile and Observations use separate internal DbContexts sharing the request connection; Analytics has no DbContext. The host registers policies/catalog/admission/data source as singletons and facades/access/transaction as scoped services.

Implemented decisions and consequences

Decision Concrete realization Consequence / boundary
Consolidated application One Web SDK project and one systemd service Shared process failure boundary; no internal HTTP service credentials
Encapsulated persistence Internal entities/contexts, typed DTO facades Sibling modules cannot use each other's entity/context directly; some internals are exposed to tests
Central authorization Host issues AuthorizedPatientContext after account/assignment checks Module APIs are trusted in-process interfaces, not independent security endpoints
Shared read snapshot RepeatableRead request transaction Overview reads one coherent snapshot; connection released before calculation
Serialized mutation ReadCommitted writes, owner-scoped row locks and DB constraints Concurrent patches preserve disjoint edits; commits precede success responses
On-demand calculation Original formulas moved into Analytics policies No analytics database, background job, result cache or clinical algorithm replacement
Local references Guidance and reviewed catalog are bundled/versioned No publisher dependency; updating clinical outputs remains approval-sensitive
Fresh provisioning Independent B DB and schema owners/runtime role No live A import or production-data migration
Portable native deployment APT/DNF/pacman adapters and systemd Explicit intended distro support; executed verification narrower than intended support

These decisions implement Q1–Q5 in the approval. Detailed architectural conformance remains in the implementation register.