Files

43 lines
4.5 KiB
Markdown

# Health App Architecture B
Architecture B implements the approved modular monolith: one ASP.NET Core HTTPS application, typed Profile/Observations/Analytics/Overview/Guidance modules, and one PostgreSQL database with owned schemas. API/access enforces normalized patient/professional identity and actual resource ownership. Numerical calculations, clinical content and public REST/JSON semantics are preserved from the pinned Architecture A reference, with the approved US-16 and dependency-failure revisions.
Approval and implementation evidence are in [ImplementationPlan](ImplementationPlan/implementation-plan.md); the authoritative target remains [ArchitectureProposal](ArchitectureProposal/software-architecture.md). [Approval decisions](Docs/ApprovalRequirements/architecture-b-implementation-approval.md) include portable Linux installation. Input requirements/diagrams and the original repository remain unchanged. No frontend, identity server, background worker, broker or clinical-result store was introduced.
## Build and test
Use the .NET 10 SDK selected by `global.json`:
```bash
dotnet restore HealthApp.slnx
dotnet build HealthApp.slnx -c Release
TEST_POSTGRES_CONNECTION='Host=127.0.0.1;Database=postgres;Username=TEST_ADMIN;Password=YOUR_TEST_PASSWORD' \
dotnet test HealthApp.slnx -c Release
```
Optional automatic disposable-server harness: `HEALTHAPP_DOTNET=/path/to/dotnet python3 tools/run-disposable-tests.py` (requires administrative Docker access for test infrastructure only).
Use only a disposable test PostgreSQL server with create/drop database and role permissions. Fixtures create isolated databases and DML-only runtime roles, apply module schema scripts twice, exercise real Kestrel HTTP, and remove their own resources. Do not point tests at Architecture A or production databases. Framework/provider/EF/xUnit versions remain pinned; no algorithm replacement or technology migration is included.
The unchanged executable source/test baseline lives under [Reference/ArchitectureA](Reference/README.md), copied from `2117236366130775214d9fd2611984d4348f2b79`. It is excluded from the final B solution and preserves original architecture-specific tests. Never build/test in `../HealthAppRepository/`.
## Deploy and run
```bash
bash deploy/build-release.sh --output NEW_RELEASE_DIRECTORY
# In the new bundle on a supported systemd Linux host:
sudo bash install.sh --host YOUR_DNS_OR_IP
```
The installer supplies dependencies, fresh database/roles/schemas, protected secrets/configuration, generated or supplied HTTPS certificate, persistent token keys, migrations and `healthapp-b.service`. It verifies representative operations and application stop/restart without stopping PostgreSQL. Remote database mode requires verified TLS/hostname and installs no local PostgreSQL. See [installation guide](deploy/INSTALLATION.md).
For an already provisioned B development database, supply external accounts/assignments, connection, key directory and HTTPS settings through `HEALTHAPP_CONFIGURATION_FILE=/absolute/protected/appsettings.json` or normal .NET configuration. [Configuration example](deploy/appsettings.example.json) is illustrative, not a prepared credential file. Production rejects plain HTTP. Use `dotnet run --project src/HealthApp -c Release`; the app never applies migrations itself.
[Trend methods](src/TRENDS.md) describe unchanged formulas, timestamp ties, full-period direction/variation and clinical limits. [Conformance](ImplementationPlan/architecture-conformance.md), [functional verification](ImplementationPlan/functional-equivalence.md) and [test adaptations](ImplementationPlan/test-adaptations.md) distinguish executed evidence from limitations. Native Debian 12 systemd local/remote installation was exercised in isolated Linux environments; other distribution adapters are intended support with explicit prerequisites.
This repository remains part of the thesis research. Installation/testing is not an energy experiment or clinical certification. [Measurement context](ImplementationPlan/measurement-context.md) records environment differences and equivalent reproducible synthetic dataset setup. Clinical classifications are preserved for comparison; uncertain provenance is documented without asserting new clinical validity.
## JMeter workloads
[Architecture B JMeter tooling](tools/energy-jmeter/README.md) preserves the public-API scenarios and 30-minute warmup/four-hour measurement defaults. Account preparation uses B JSON configuration. See [compatibility findings and verification](tools/energy-jmeter/ARCHITECTURE-B.md) before preparing a disposable test installation.