Compare commits

..
15 Commits
Author SHA1 Message Date
Steffen b76897d8f8 Calculate energy from recorded power samples 2026-11-23 00:01:07 +01:00
Steffen 2117236366 documented the architecture and design as is 2026-10-14 00:44:26 +02:00
Steffen 5d9371388c Normalize generated measurement evidence formatting 2026-10-09 12:29:01 +02:00
Steffen e5f00796af Document measured rationale and headroom for 26-thread experiments 2026-10-09 12:28:27 +02:00
Steffen d69fcf8c76 Use Gaussian request delays with 500 ms minimum and one-second mean 2026-10-08 23:28:59 +02:00
Steffen 453e37b3c3 Support read-only shared-account capacity trials through request errors 2026-10-08 18:36:12 +02:00
Steffen 743674a022 Report aligned per-second CPU power requests latency and errors 2026-10-08 12:59:43 +02:00
Steffen 17f3b0dbd3 Sample CPU and Shelly power every second for energy runs 2026-10-08 12:41:48 +02:00
Steffen 79bb6a11cd Provide four-hour idle baseline without application requests 2026-10-08 08:25:17 +02:00
Steffen e50cf0a011 Collect Shelly plug power live in JMeter energy experiments 2026-10-07 22:12:58 +02:00
Steffen a69b9b2118 Collect NUC host metrics live in all JMeter energy scenarios 2026-10-07 21:03:19 +02:00
Steffen 45a040f3a2 Add four-hour JMeter energy workloads with Gaussian user pacing 2026-10-07 18:23:20 +02:00
Steffen 23a824dd81 US-16 Detect Debian-family dependencies instead of fixed OS versions 2026-10-07 16:49:48 +02:00
Steffen 7dc4ee60f0 US-16 Support Ubuntu 26.04 dependency provisioning 2026-10-07 16:41:20 +02:00
Steffen dd68d16eba added README.MD 2026-10-07 13:02:36 +02:00
62 changed files with 45064 additions and 22 deletions

No files matched your search

+7
View File
@@ -6,3 +6,10 @@ TestResults/
# Draw.io backup files
Docs/Architecture/.*.bkp
# Private workload credentials and generated measurement results
tools/energy-jmeter/.private/
tools/energy-jmeter/results/
tools/energy-jmeter/hash-tool/
jmeter.log
__pycache__/
+38
View File
@@ -0,0 +1,38 @@
# HealthApp as-built architecture
Snapshot: **2026-10-12**, repository commit `5d9371388c15066eeb2bc124ed227659c644dab5`. This describes the checked-out implementation, not a proposed architecture or a certification of a running installation.
## Documents
| Document | Contents |
| --- | --- |
| [Software architecture](software-architecture.md) | Runtime structure, contracts, data, security, deployment and failures |
| [Architecture decisions](architecture-decisions.md) | Observable decisions, evidence, rationale provenance and consequences |
| [Requirements traceability](requirements-traceability.md) | US-01–US-16 implementation and test mapping; coverage limits |
| [Discrepancies](discrepancies.md) | Historical differences, current omissions and unresolved uncertainties |
| [Evidence inventory](evidence-inventory.md) | Source/configuration/test inventory and inspection boundaries |
| [Validation](validation.md) | Deliverable, diagram, link and preservation checks |
| [Class-diagram coverage](class-diagram-coverage.md) | Every declared service type mapped to an individual UML classifier and source file |
## Editable diagrams
Open these files directly in diagrams.net / Draw.io. They contain native shapes, text and connectors, rather than embedded screenshots. Page tabs separate detailed views.
| File | Pages / purpose |
| --- | --- |
| [01-system-context.drawio](diagrams/01-system-context.drawio) | Actors, system boundary and optional experiment infrastructure |
| [02-logical-services.drawio](diagrams/02-logical-services.drawio) | Five processes, gateway routing and local layers |
| [03-domain-model.drawio](diagrams/03-domain-model.drawio) | Complete application domain: health, access, assignments, guidance, assessments and references; separate supporting deployment domain |
| [ApiGateway class diagram](diagrams/04-class-ApiGateway.drawio) | All 16 declared types, including controllers, security and nested records |
| [PatientProfileService class diagram](diagrams/04-class-PatientProfileService.drawio) | All 14 declared types; runtime and EF migration pages |
| [ObservationService class diagram](diagrams/04-class-ObservationService.drawio) | All 17 declared types; runtime and EF migration pages |
| [InsightsService class diagram](diagrams/04-class-InsightsService.drawio) | All 16 declared types, including individual DTO/result/reference records |
| [HealthOverviewService class diagram](diagrams/04-class-HealthOverviewService.drawio) | All 15 declared types, including distinct abstract/HTTP clients and DTOs |
| [04-design-classes.drawio](diagrams/04-design-classes.drawio) | Combined copy of the five service diagrams, plus the administrative provisioning view |
| [05-data-ownership.drawio](diagrams/05-data-ownership.drawio) | Physical tables, file/configuration ownership and transient results |
| [06-deployment.drawio](diagrams/06-deployment.drawio) | Colocated and distributed Linux topologies; Windows/macOS adapters |
| [07-sequences.drawio](diagrams/07-sequences.drawio) | Login/create, record, read/update/delete ownership, calculations, overview, professional access and installation |
## Interpretation
**Verified** means directly observable in repository implementation or configuration; a cited test demonstrates the intended check, not that it was executed in this documentation task. **Inferred** labels a consequence or rationale derived from that evidence. **Unknown** labels something the repository cannot establish. Existing specifications and functionality were preserved. No application code was generated or changed, and no live host was accessed.
@@ -0,0 +1,30 @@
# Observable architecture decisions
These records describe existing choices. They are not new approvals or proposed ADRs. **Documented rationale** is stated in a repository document; **inferred rationale/consequence** is analysis of the code; **unknown rationale** means no reason was found. Each decision is verified independently from implementation evidence.
| ID | Implemented decision and evidence | Rationale provenance | Consequences / limits |
| --- | --- | --- | --- |
| AB-01 | Five independent ASP.NET Core processes; no production service-to-service project references. [Solution](../HealthApp.slnx), [release build](../deploy/build-release.sh) | Documented: independent boundaries and location-independent deployment in [US-16](<../Docs/Requirements/US16 easy installation and deployment installer.txt>) and [service architecture](../Docs/Architecture/02_microservice_architecture.jpg) | Each service publishes/configures/stops separately. Availability dependencies still exist through HTTP. |
| AB-02 | All business HTTP between services goes through Gateway. [Observation](../src/ObservationService/Program.cs), [Insights](../src/InsightsService/Program.cs), [Overview](../src/HealthOverviewService/Program.cs) | Documented path in [architecture correction](../Docs/Architecture/us10-insights-correction.md) and existing service diagram. Additional rationale beyond that choice is unknown. | Inferred: extra hops and centralized availability/load; no direct aggregator-to-source shortcuts. |
| AB-03 | Controllers explicitly forward requests using named HttpClients. [Gateway Observation controller](../src/ApiGateway/Controllers/ObservationController.cs) | Unknown: no separate ADR explaining selection over a proxy library | Routes/header handling are explicit; forwarding implementation is duplicated, and only selected response headers survive. |
| AB-04 | Patient/Profile and Observation own separate PostgreSQL DBs/roles; context stored in same observation row. [contexts](../src/ObservationService/Persistence/ObservationDbContext.cs), [DB provisioning](../deploy/HealthApp.Provisioning/DatabaseProvisioning.cs) | Documented independent ownership in [addendum](../Docs/Requirements/us16-addendum). Same-row context is documented in [implementation README](../src/README.md); original logical model explicitly permits physical mapping choices. | No cross-service FK or DB joins. Context deletion is naturally row deletion. Optional preparation details do not require another table. |
| AB-05 | Account association resides in `patient.account_id`, with unique index. [migration](../src/PatientProfileService/Persistence/Migrations/20261005082209_AccountProfileAssociation.cs), [SQL repository](../src/PatientProfileService/Persistence/SqlPatientRepository.cs) | Documented: [authentication implementation](../src/AUTHENTICATION.md) explains single-row consistency and restart persistence | Concurrent creation cannot produce two non-null associations for one account. Existing nullable legacy associations are not backfilled. |
| AB-06 | Insights and Overview have no own DB/repository/result persistence. [Insights application](../src/InsightsService/Application/InsightsApplicationService.cs), [Overview application](../src/HealthOverviewService/Application/HealthOverviewApplicationService.cs) | Documented: [Insights correction](../Docs/Architecture/us10-insights-correction.md), [Overview implementation](../src/OVERVIEW.md) | New requests use current source data. No generated result ID/cache invalidation. Multi-service reads are not one snapshot. |
| AB-07 | Framework protected opaque bearer tickets; password hashing only at login. [login](../src/ApiGateway/Controllers/AuthenticationController.cs), [accounts](../src/ApiGateway/Security/PrototypeAccounts.cs), [startup](../src/ApiGateway/Program.cs) | Documented: [authentication design](../Docs/Design/authentication-and-access-control-design.md) separates credentials/token/policy, excludes custom crypto and repeated password verification. Concrete mechanism/lifetime recorded in [AUTHENTICATION.md](../src/AUTHENTICATION.md). | No JWT issuer/audience configuration, identity server or refresh workflow. Default 30-minute expiry requires new login. Token keys are persistent local files. |
| AB-08 | Gateway establishes ownership by protected HTTP reads and evaluates configured professional assignments. [middleware](../src/ApiGateway/Security/PatientAccessMiddleware.cs) | Documented: [authentication design](../Docs/Design/authentication-and-access-control-design.md) requires actual owner lookup and separated access policy | No ownership inside bearer token. Additional per-request lookup cost/dependency. Empty 404 hides cross-patient existence; professionals cannot write. |
| AB-09 | Backend shared-key guards; distinct callback keys with GET-only whitelist. [internal handler](../src/ApiGateway/Security/InternalServiceAuthenticationHandler.cs), [backend](../src/ObservationService/Program.cs) | Documented: [AUTHENTICATION.md](../src/AUTHENTICATION.md) selects prototype protection satisfying gateway-only enforcement | HTTPS protects key transport. Trusted backend incoming keys bypass end-user checks there; callback credentials have cross-patient access on their limited read routes. No mTLS or user delegation. |
| AB-10 | Require HTTPS outside Development; disable HTTP redirects in business clients. [Gateway Program](../src/ApiGateway/Program.cs), [Observation Program](../src/ObservationService/Program.cs) | HTTPS rationale documented in [authentication design](../Docs/Design/authentication-and-access-control-design.md). Credential redirect protection documented in [AUTHENTICATION.md](../src/AUTHENTICATION.md). | HTTP development is explicit. HTTP is rejected rather than automatically redirected; reverse-proxy forwarded-header support is absent. |
| AB-11 | UTC clock values stored in timestamp-without-timezone columns; offset normalization. [Observation application](../src/ObservationService/Application/ObservationApplicationService.cs) | Documented in [src README](../src/README.md): preserve original TIMESTAMP design while making instants/offset-free interpretation deterministic | Clients must interpret offset-free output as UTC. No local-zone interpretation or stored original offset. |
| AB-12 | Inclusive selection, deterministic latest UUID tie; history sorted by measurement time/UUID. [repository](../src/ObservationService/Persistence/SqlObservationRepository.cs) | Requirements prescribe inclusivity and deterministic ties; concrete final UUID order documented in [src README](../src/README.md) | Recording/edit order cannot override measurement-time precedence. Equal timestamps remain valid. No pagination/size bound. |
| AB-13 | Setter presence flags implement PATCH omission vs null; full numeric PUT remains. [patch](../src/ObservationService/Contracts/PatchObservationRequest.cs), [repository](../src/ObservationService/Persistence/SqlObservationRepository.cs) | Documented [US-08](../Docs/Requirements/us08-update-observation.md) requires preservation/clearing. Exact mechanism rationale inferred: distinguishes omitted JSON members from explicit clearing without a patch library. | Unknown PATCH/PUT fields rejected. No external JSON Patch dependency. No ETag/concurrency token. |
| AB-14 | Decimal final-only summary rounding; timestamp-grouped direction and OLS trend; static sourced references. [calculators](../src/InsightsService/Domain/InsightCalculator.Trends.cs) | Documented methods, clinical limits and cautious inference basis in [TRENDS.md](../src/TRENDS.md), required reproducibility in [US-11](../Docs/Requirements/us11-health-trend.md) | No prediction/significance test/diagnosis. Numerical evidence survives limited context; phrase detection cannot understand arbitrary narratives. Clinical applicability has not been independently validated by this task. |
| AB-15 | Overview reads profile → latest → insight sequentially; context selection applies only to insight. [application](../src/HealthOverviewService/Application/HealthOverviewApplicationService.cs) | Selection distinction documented in [US-12](../Docs/Requirements/us12-health-overview.md); lack of snapshot documented in [OVERVIEW.md](../src/OVERVIEW.md). Rationale for sequential execution is unknown. | Partial absence can still return available profile/latest; source failure returns failure. Inferred: latency follows dependent calls and writes may interleave. |
| AB-16 | External startup account/assignment config; no account/assignment administration API. [accounts](../src/ApiGateway/Security/PrototypeAccounts.cs), [assignments](../src/ApiGateway/Security/ProfessionalAssignments.cs) | Documented prototype scope in [US-13](../Docs/Requirements/us13-patient-authentication.md), [US-14](../Docs/Requirements/us14-professional-access.md) | No credential/assignment DB; changes require process restart. Existing token role/account claims are not rechecked against current account records every request. |
| AB-17 | Portable framework-dependent DLLs plus OS-specific package/service adapters. [build](../deploy/build-release.sh), [Linux](../deploy/installer/install.sh), [Windows](../deploy/installer/install.ps1), [macOS](../deploy/installer/install-macos.sh) | Documented in [INSTALLATION.md](../deploy/INSTALLATION.md): native deployment without combining processes, container requirement or host-generated apphost | Target runtime/native administration remain platform-specific. Non-Debian Linux automation is absent. Native-host execution evidence is limited. |
| AB-18 | Single generated topology plan; scoped SSH/SCP distribution; prototype CA + per-service certificates. [prepare](../deploy/HealthApp.Provisioning/Deployment.cs), [distribute](../deploy/HealthApp.Provisioning/Distribution.cs) | Documented normal-install automation in [US-16 addendum](../Docs/Requirements/us16-addendum), scoped distribution in [INSTALLATION.md](../deploy/INSTALLATION.md) | Compatible keys are automatic; separate independently prepared plans will not interoperate. CA signing private key is not retained. Admin access/network reachability still prerequisite. |
| AB-19 | Fail closed on ownership/upstream failure; absent aggregate data distinguished from dependency failure. [middleware](../src/ApiGateway/Security/PatientAccessMiddleware.cs), [Overview controller](../src/HealthOverviewService/Controllers/HealthOverviewController.cs) | Documented security requirement and [Overview error contract](../src/OVERVIEW.md) | 502/504 mapping, with generic 500 for some malformed ownership shapes. No resilience policy/circuit breaker. |
| AB-20 | Generated PostgreSQL connections disable pooling and use SSL Prefer. [Deployment.ConnectionString](../deploy/HealthApp.Provisioning/Deployment.cs) | Unknown: no explicit rationale found for these settings | Inferred: connection establishment recurs rather than using the driver pool; DB TLS is opportunistic rather than enforced. External configuration can change both. |
| AB-21 | Complete verification creates/reuses synthetic patient/observation then reads overview. [verification](../deploy/HealthApp.Provisioning/InstallationVerification.cs) | Documented in [INSTALLATION.md](../deploy/INSTALLATION.md), required representative workflow in US-16 | Installation can leave labelled test data; it is not a read-only check. No automatic native stop/restart cycle. |
| AB-22 | Public static guidance separate from observation writes. [controller](../src/ApiGateway/Controllers/MeasurementGuidanceController.cs) | Documented in [US-15](../Docs/Requirements/us15-measurement-guidance.md) | Available before records/login. No guidance read creates/certifies an observation. Sources are metadata, not runtime dependencies. |
No rationale has been invented for absent caching, missing optimistic concurrency, default business HTTP timeouts or the lack of deployment rollback. These are observable properties/limits, not necessarily deliberate tradeoffs documented by the authors.
@@ -0,0 +1,102 @@
# Implementation class-diagram coverage
Corrected after review: each service has its own UML class-diagram file. Every source-declared class, record and interface under that service is represented as an individual classifier. Nested types are named with their enclosing type; partial declarations count as one type. EF migrations, migration designers and model snapshots are included on separate persistence-support pages. No controller, DTO or request class is merged into a domain box.
Classifier compartments show actual attributes and operations with UML visibility. Record positional parameters are attributes plus a constructor. Primary-constructor parameters appear as constructor operations, with dependency links to local parameter types. They are not represented as invented C# fields. Explicit local attribute types supply associations; declared base classes/interfaces supply generalization/realization. The observation/context composition is justified by its EF-owned mapping. Inherited/automatically compiler-generated members are not enumerated.
Framework base types appear as labelled references, outside the service-defined type inventory. A same-service reference repeated on another page is marked as a reference and does not count as a second implementation type. Program registration dependencies do not mean shared cross-service memory or direct calls.
| Service | Declared types | Diagram |
| --- | --- | --- |
| ApiGateway | 16 | [ApiGateway](diagrams/04-class-ApiGateway.drawio) |
| PatientProfileService | 14 | [PatientProfileService](diagrams/04-class-PatientProfileService.drawio) |
| ObservationService | 17 | [ObservationService](diagrams/04-class-ObservationService.drawio) |
| InsightsService | 16 | [InsightsService](diagrams/04-class-InsightsService.drawio) |
| HealthOverviewService | 15 | [HealthOverviewService](diagrams/04-class-HealthOverviewService.drawio) |
## Exact inventory
| Service | Fully qualified source type | Kind | Source files | Page |
| --- | --- | --- | --- | --- |
| ApiGateway | `ApiGateway.Controllers.AuthenticationController` | class | [src/ApiGateway/Controllers/AuthenticationController.cs](../src/ApiGateway/Controllers/AuthenticationController.cs) | implementation classes |
| ApiGateway | `ApiGateway.Controllers.AuthenticationController.LoginRequest` | record | [src/ApiGateway/Controllers/AuthenticationController.cs](../src/ApiGateway/Controllers/AuthenticationController.cs) | implementation classes |
| ApiGateway | `ApiGateway.Controllers.HealthOverviewController` | class | [src/ApiGateway/Controllers/HealthOverviewController.cs](../src/ApiGateway/Controllers/HealthOverviewController.cs) | implementation classes |
| ApiGateway | `ApiGateway.Controllers.InsightsController` | class | [src/ApiGateway/Controllers/InsightsController.cs](../src/ApiGateway/Controllers/InsightsController.cs) | implementation classes |
| ApiGateway | `ApiGateway.Controllers.MeasurementGuidanceController` | class | [src/ApiGateway/Controllers/MeasurementGuidanceController.cs](../src/ApiGateway/Controllers/MeasurementGuidanceController.cs) | implementation classes |
| ApiGateway | `ApiGateway.Controllers.MeasurementGuidanceController.GuidanceSource` | record | [src/ApiGateway/Controllers/MeasurementGuidanceController.cs](../src/ApiGateway/Controllers/MeasurementGuidanceController.cs) | implementation classes |
| ApiGateway | `ApiGateway.Controllers.MeasurementGuidanceController.GuidanceStep` | record | [src/ApiGateway/Controllers/MeasurementGuidanceController.cs](../src/ApiGateway/Controllers/MeasurementGuidanceController.cs) | implementation classes |
| ApiGateway | `ApiGateway.Controllers.ObservationController` | class | [src/ApiGateway/Controllers/ObservationController.cs](../src/ApiGateway/Controllers/ObservationController.cs) | implementation classes |
| ApiGateway | `ApiGateway.Controllers.PatientController` | class | [src/ApiGateway/Controllers/PatientController.cs](../src/ApiGateway/Controllers/PatientController.cs) | implementation classes |
| ApiGateway | `ApiGateway.Controllers.ProfessionalController` | class | [src/ApiGateway/Controllers/ProfessionalController.cs](../src/ApiGateway/Controllers/ProfessionalController.cs) | implementation classes |
| ApiGateway | `ApiGateway.Program` | class | [src/ApiGateway/Program.cs](../src/ApiGateway/Program.cs) | implementation classes |
| ApiGateway | `ApiGateway.Security.InternalServiceAuthenticationHandler` | class | [src/ApiGateway/Security/InternalServiceAuthenticationHandler.cs](../src/ApiGateway/Security/InternalServiceAuthenticationHandler.cs) | implementation classes |
| ApiGateway | `ApiGateway.Security.PatientAccessMiddleware` | class | [src/ApiGateway/Security/PatientAccessMiddleware.cs](../src/ApiGateway/Security/PatientAccessMiddleware.cs) | implementation classes |
| ApiGateway | `ApiGateway.Security.ProfessionalAssignments` | class | [src/ApiGateway/Security/ProfessionalAssignments.cs](../src/ApiGateway/Security/ProfessionalAssignments.cs) | implementation classes |
| ApiGateway | `ApiGateway.Security.PrototypeAccount` | class | [src/ApiGateway/Security/PrototypeAccounts.cs](../src/ApiGateway/Security/PrototypeAccounts.cs) | implementation classes |
| ApiGateway | `ApiGateway.Security.PrototypeAccounts` | class | [src/ApiGateway/Security/PrototypeAccounts.cs](../src/ApiGateway/Security/PrototypeAccounts.cs) | implementation classes |
| PatientProfileService | `PatientProfileService.Application.PatientApplicationService` | class | [src/PatientProfileService/Application/PatientApplicationService.cs](../src/PatientProfileService/Application/PatientApplicationService.cs) | implementation classes |
| PatientProfileService | `PatientProfileService.Application.PatientRepository` | interface | [src/PatientProfileService/Application/PatientRepository.cs](../src/PatientProfileService/Application/PatientRepository.cs) | implementation classes |
| PatientProfileService | `PatientProfileService.Application.ProfileAlreadyExistsException` | class | [src/PatientProfileService/Application/ProfileAlreadyExistsException.cs](../src/PatientProfileService/Application/ProfileAlreadyExistsException.cs) | implementation classes |
| PatientProfileService | `PatientProfileService.Contracts.CreatePatientRequest` | record | [src/PatientProfileService/Contracts/CreatePatientRequest.cs](../src/PatientProfileService/Contracts/CreatePatientRequest.cs) | implementation classes |
| PatientProfileService | `PatientProfileService.Contracts.PatientDto` | record | [src/PatientProfileService/Contracts/PatientDto.cs](../src/PatientProfileService/Contracts/PatientDto.cs) | implementation classes |
| PatientProfileService | `PatientProfileService.Contracts.UpdatePatientRequest` | record | [src/PatientProfileService/Contracts/UpdatePatientRequest.cs](../src/PatientProfileService/Contracts/UpdatePatientRequest.cs) | implementation classes |
| PatientProfileService | `PatientProfileService.Controllers.PatientController` | class | [src/PatientProfileService/Controllers/PatientController.cs](../src/PatientProfileService/Controllers/PatientController.cs) | implementation classes |
| PatientProfileService | `PatientProfileService.Domain.Patient` | class | [src/PatientProfileService/Domain/Patient.cs](../src/PatientProfileService/Domain/Patient.cs) | implementation classes |
| PatientProfileService | `PatientProfileService.Persistence.Migrations.AccountProfileAssociation` | class | [src/PatientProfileService/Persistence/Migrations/20261005082209_AccountProfileAssociation.Designer.cs](../src/PatientProfileService/Persistence/Migrations/20261005082209_AccountProfileAssociation.Designer.cs)<br>[src/PatientProfileService/Persistence/Migrations/20261005082209_AccountProfileAssociation.cs](../src/PatientProfileService/Persistence/Migrations/20261005082209_AccountProfileAssociation.cs) | EF migration classes |
| PatientProfileService | `PatientProfileService.Persistence.Migrations.InitialPatientSchema` | class | [src/PatientProfileService/Persistence/Migrations/20260930200031_InitialPatientSchema.Designer.cs](../src/PatientProfileService/Persistence/Migrations/20260930200031_InitialPatientSchema.Designer.cs)<br>[src/PatientProfileService/Persistence/Migrations/20260930200031_InitialPatientSchema.cs](../src/PatientProfileService/Persistence/Migrations/20260930200031_InitialPatientSchema.cs) | EF migration classes |
| PatientProfileService | `PatientProfileService.Persistence.Migrations.PatientDbContextModelSnapshot` | class | [src/PatientProfileService/Persistence/Migrations/PatientDbContextModelSnapshot.cs](../src/PatientProfileService/Persistence/Migrations/PatientDbContextModelSnapshot.cs) | EF migration classes |
| PatientProfileService | `PatientProfileService.Persistence.PatientDbContext` | class | [src/PatientProfileService/Persistence/PatientDbContext.cs](../src/PatientProfileService/Persistence/PatientDbContext.cs) | implementation classes |
| PatientProfileService | `PatientProfileService.Persistence.SqlPatientRepository` | class | [src/PatientProfileService/Persistence/SqlPatientRepository.cs](../src/PatientProfileService/Persistence/SqlPatientRepository.cs) | implementation classes |
| PatientProfileService | `PatientProfileService.Program` | class | [src/PatientProfileService/Program.cs](../src/PatientProfileService/Program.cs) | implementation classes |
| ObservationService | `ObservationService.Application.ObservationApplicationService` | class | [src/ObservationService/Application/ObservationApplicationService.cs](../src/ObservationService/Application/ObservationApplicationService.cs) | implementation classes |
| ObservationService | `ObservationService.Application.ObservationRepository` | interface | [src/ObservationService/Application/ObservationRepository.cs](../src/ObservationService/Application/ObservationRepository.cs) | implementation classes |
| ObservationService | `ObservationService.Contracts.MeasurementContextPatch` | record | [src/ObservationService/Contracts/MeasurementContextPatch.cs](../src/ObservationService/Contracts/MeasurementContextPatch.cs) | implementation classes |
| ObservationService | `ObservationService.Contracts.ObservationDto` | record | [src/ObservationService/Contracts/ObservationDto.cs](../src/ObservationService/Contracts/ObservationDto.cs) | implementation classes |
| ObservationService | `ObservationService.Contracts.PatchObservationRequest` | record | [src/ObservationService/Contracts/PatchObservationRequest.cs](../src/ObservationService/Contracts/PatchObservationRequest.cs) | implementation classes |
| ObservationService | `ObservationService.Contracts.RecordObservationRequest` | record | [src/ObservationService/Contracts/RecordObservationRequest.cs](../src/ObservationService/Contracts/RecordObservationRequest.cs) | implementation classes |
| ObservationService | `ObservationService.Contracts.UpdateObservationRequest` | record | [src/ObservationService/Contracts/UpdateObservationRequest.cs](../src/ObservationService/Contracts/UpdateObservationRequest.cs) | implementation classes |
| ObservationService | `ObservationService.Controllers.ObservationController` | class | [src/ObservationService/Controllers/ObservationController.cs](../src/ObservationService/Controllers/ObservationController.cs) | implementation classes |
| ObservationService | `ObservationService.Domain.BloodPressureObservation` | class | [src/ObservationService/Domain/BloodPressureObservation.cs](../src/ObservationService/Domain/BloodPressureObservation.cs) | implementation classes |
| ObservationService | `ObservationService.Domain.ContextSelection` | record | [src/ObservationService/Domain/ContextSelection.cs](../src/ObservationService/Domain/ContextSelection.cs) | implementation classes |
| ObservationService | `ObservationService.Domain.MeasurementContext` | record | [src/ObservationService/Domain/MeasurementContext.cs](../src/ObservationService/Domain/MeasurementContext.cs) | implementation classes |
| ObservationService | `ObservationService.Persistence.Migrations.InitialObservationSchema` | class | [src/ObservationService/Persistence/Migrations/20261001095222_InitialObservationSchema.Designer.cs](../src/ObservationService/Persistence/Migrations/20261001095222_InitialObservationSchema.Designer.cs)<br>[src/ObservationService/Persistence/Migrations/20261001095222_InitialObservationSchema.cs](../src/ObservationService/Persistence/Migrations/20261001095222_InitialObservationSchema.cs) | EF migration classes |
| ObservationService | `ObservationService.Persistence.Migrations.ObservationDbContextModelSnapshot` | class | [src/ObservationService/Persistence/Migrations/ObservationDbContextModelSnapshot.cs](../src/ObservationService/Persistence/Migrations/ObservationDbContextModelSnapshot.cs) | EF migration classes |
| ObservationService | `ObservationService.Persistence.Migrations.RecordedMeasurementContext` | class | [src/ObservationService/Persistence/Migrations/20261005094632_RecordedMeasurementContext.Designer.cs](../src/ObservationService/Persistence/Migrations/20261005094632_RecordedMeasurementContext.Designer.cs)<br>[src/ObservationService/Persistence/Migrations/20261005094632_RecordedMeasurementContext.cs](../src/ObservationService/Persistence/Migrations/20261005094632_RecordedMeasurementContext.cs) | EF migration classes |
| ObservationService | `ObservationService.Persistence.ObservationDbContext` | class | [src/ObservationService/Persistence/ObservationDbContext.cs](../src/ObservationService/Persistence/ObservationDbContext.cs) | implementation classes |
| ObservationService | `ObservationService.Persistence.SqlObservationRepository` | class | [src/ObservationService/Persistence/SqlObservationRepository.cs](../src/ObservationService/Persistence/SqlObservationRepository.cs) | implementation classes |
| ObservationService | `ObservationService.Program` | class | [src/ObservationService/Program.cs](../src/ObservationService/Program.cs) | implementation classes |
| InsightsService | `InsightsService.Application.InsightsApplicationService` | class | [src/InsightsService/Application/InsightsApplicationService.cs](../src/InsightsService/Application/InsightsApplicationService.cs) | implementation classes |
| InsightsService | `InsightsService.Clients.HttpObservationServiceClient` | class | [src/InsightsService/Clients/HttpObservationServiceClient.cs](../src/InsightsService/Clients/HttpObservationServiceClient.cs) | implementation classes |
| InsightsService | `InsightsService.Clients.ObservationServiceClient` | interface | [src/InsightsService/Clients/ObservationServiceClient.cs](../src/InsightsService/Clients/ObservationServiceClient.cs) | implementation classes |
| InsightsService | `InsightsService.Contracts.HealthInsightDto` | record | [src/InsightsService/Contracts/HealthInsightDto.cs](../src/InsightsService/Contracts/HealthInsightDto.cs) | implementation classes |
| InsightsService | `InsightsService.Contracts.MeasurementContextDto` | record | [src/InsightsService/Contracts/ObservationDto.cs](../src/InsightsService/Contracts/ObservationDto.cs) | implementation classes |
| InsightsService | `InsightsService.Contracts.ObservationDto` | record | [src/InsightsService/Contracts/ObservationDto.cs](../src/InsightsService/Contracts/ObservationDto.cs) | implementation classes |
| InsightsService | `InsightsService.Controllers.InsightsController` | class | [src/InsightsService/Controllers/InsightsController.cs](../src/InsightsService/Controllers/InsightsController.cs) | implementation classes |
| InsightsService | `InsightsService.Domain.ClinicalReference` | record | [src/InsightsService/Domain/TrendAssessment.cs](../src/InsightsService/Domain/TrendAssessment.cs) | implementation classes |
| InsightsService | `InsightsService.Domain.ComparabilityAssessment` | record | [src/InsightsService/Domain/TrendAssessment.cs](../src/InsightsService/Domain/TrendAssessment.cs) | implementation classes |
| InsightsService | `InsightsService.Domain.ContextSelection` | record | [src/InsightsService/Domain/ContextSelection.cs](../src/InsightsService/Domain/ContextSelection.cs) | implementation classes |
| InsightsService | `InsightsService.Domain.HealthInsight` | record | [src/InsightsService/Domain/HealthInsight.cs](../src/InsightsService/Domain/HealthInsight.cs) | implementation classes |
| InsightsService | `InsightsService.Domain.InsightCalculator` | class | [src/InsightsService/Domain/InsightCalculator.Trends.cs](../src/InsightsService/Domain/InsightCalculator.Trends.cs)<br>[src/InsightsService/Domain/InsightCalculator.cs](../src/InsightsService/Domain/InsightCalculator.cs) | implementation classes |
| InsightsService | `InsightsService.Domain.MeasurementAssessment` | record | [src/InsightsService/Domain/TrendAssessment.cs](../src/InsightsService/Domain/TrendAssessment.cs) | implementation classes |
| InsightsService | `InsightsService.Domain.ReferenceSource` | record | [src/InsightsService/Domain/TrendAssessment.cs](../src/InsightsService/Domain/TrendAssessment.cs) | implementation classes |
| InsightsService | `InsightsService.Domain.TrendAssessment` | record | [src/InsightsService/Domain/TrendAssessment.cs](../src/InsightsService/Domain/TrendAssessment.cs) | implementation classes |
| InsightsService | `InsightsService.Program` | class | [src/InsightsService/Program.cs](../src/InsightsService/Program.cs) | implementation classes |
| HealthOverviewService | `HealthOverviewService.Application.HealthOverviewApplicationService` | class | [src/HealthOverviewService/Application/HealthOverviewApplicationService.cs](../src/HealthOverviewService/Application/HealthOverviewApplicationService.cs) | implementation classes |
| HealthOverviewService | `HealthOverviewService.Clients.HttpInsightsServiceClient` | class | [src/HealthOverviewService/Clients/InsightsServiceClient.cs](../src/HealthOverviewService/Clients/InsightsServiceClient.cs) | implementation classes |
| HealthOverviewService | `HealthOverviewService.Clients.HttpObservationServiceClient` | class | [src/HealthOverviewService/Clients/ObservationServiceClient.cs](../src/HealthOverviewService/Clients/ObservationServiceClient.cs) | implementation classes |
| HealthOverviewService | `HealthOverviewService.Clients.HttpPatientProfileServiceClient` | class | [src/HealthOverviewService/Clients/PatientProfileServiceClient.cs](../src/HealthOverviewService/Clients/PatientProfileServiceClient.cs) | implementation classes |
| HealthOverviewService | `HealthOverviewService.Clients.InsightsServiceClient` | class | [src/HealthOverviewService/Clients/InsightsServiceClient.cs](../src/HealthOverviewService/Clients/InsightsServiceClient.cs) | implementation classes |
| HealthOverviewService | `HealthOverviewService.Clients.ObservationServiceClient` | class | [src/HealthOverviewService/Clients/ObservationServiceClient.cs](../src/HealthOverviewService/Clients/ObservationServiceClient.cs) | implementation classes |
| HealthOverviewService | `HealthOverviewService.Clients.PatientProfileServiceClient` | class | [src/HealthOverviewService/Clients/PatientProfileServiceClient.cs](../src/HealthOverviewService/Clients/PatientProfileServiceClient.cs) | implementation classes |
| HealthOverviewService | `HealthOverviewService.Contracts.ContextSelection` | record | [src/HealthOverviewService/Contracts/HealthOverviewDto.cs](../src/HealthOverviewService/Contracts/HealthOverviewDto.cs) | implementation classes |
| HealthOverviewService | `HealthOverviewService.Contracts.HealthInsightDto` | record | [src/HealthOverviewService/Contracts/HealthOverviewDto.cs](../src/HealthOverviewService/Contracts/HealthOverviewDto.cs) | implementation classes |
| HealthOverviewService | `HealthOverviewService.Contracts.HealthOverviewDto` | record | [src/HealthOverviewService/Contracts/HealthOverviewDto.cs](../src/HealthOverviewService/Contracts/HealthOverviewDto.cs) | implementation classes |
| HealthOverviewService | `HealthOverviewService.Contracts.MeasurementContextDto` | record | [src/HealthOverviewService/Contracts/HealthOverviewDto.cs](../src/HealthOverviewService/Contracts/HealthOverviewDto.cs) | implementation classes |
| HealthOverviewService | `HealthOverviewService.Contracts.ObservationDto` | record | [src/HealthOverviewService/Contracts/HealthOverviewDto.cs](../src/HealthOverviewService/Contracts/HealthOverviewDto.cs) | implementation classes |
| HealthOverviewService | `HealthOverviewService.Contracts.PatientDto` | record | [src/HealthOverviewService/Contracts/HealthOverviewDto.cs](../src/HealthOverviewService/Contracts/HealthOverviewDto.cs) | implementation classes |
| HealthOverviewService | `HealthOverviewService.Controllers.HealthOverviewController` | class | [src/HealthOverviewService/Controllers/HealthOverviewController.cs](../src/HealthOverviewService/Controllers/HealthOverviewController.cs) | implementation classes |
| HealthOverviewService | `HealthOverviewService.Program` | class | [src/HealthOverviewService/Program.cs](../src/HealthOverviewService/Program.cs) | implementation classes |
## Validation
Source declarations were enumerated independently and compared with each per-service diagram’s `sourceType` attributes. A merged partial type is expected once per service file. All source-defined types must match exactly, with no extras or omissions. The combined `04-design-classes.drawio` contains the same corrected service views plus the administrative provisioning view; the standalone files are the primary per-service navigation targets.
@@ -0,0 +1,50 @@
<?xml version='1.0' encoding='utf-8'?>
<mxfile host="app.diagrams.net" version="24.7.17" compressed="false">
<diagram id="p1" name="System context">
<mxGraphModel dx="1700" dy="1500" grid="1" gridSize="10" guides="1" tooltips="1" connect="1" arrows="1" fold="1" page="1" pageScale="1" pageWidth="1500" pageHeight="1100" math="0" shadow="0">
<root>
<mxCell id="0" />
<mxCell id="1" parent="0" />
<mxCell id="c1" value="System context" style="text;html=0;fontSize=24;fontStyle=1;align=left;verticalAlign=middle;" vertex="1" parent="1">
<mxGeometry as="geometry" x="30" y="15" width="1440" height="45" />
</mxCell>
<mxCell id="c2" value="Patient&#10;Pre-created account&#10;Creates own profile; records/reviews own measurements" style="rounded=0;whiteSpace=wrap;html=0;fillColor=#d5e8d4;strokeColor=#666666;fontSize=14;align=left;verticalAlign=top;spacing=12;" vertex="1" parent="1">
<mxGeometry as="geometry" x="30" y="130" width="300" height="170" />
</mxCell>
<mxCell id="c3" value="Healthcare professional&#10;Pre-created account&#10;Reads assigned patients; never writes" style="rounded=0;whiteSpace=wrap;html=0;fillColor=#d5e8d4;strokeColor=#666666;fontSize=14;align=left;verticalAlign=top;spacing=12;" vertex="1" parent="1">
<mxGeometry as="geometry" x="30" y="400" width="300" height="170" />
</mxCell>
<mxCell id="c4" value="HealthApp backend boundary&#10;Gateway + four application services&#10;REST/JSON over HTTPS&#10;Patient/Profile and Observation own persistence&#10;No product frontend in this repository" style="rounded=0;whiteSpace=wrap;html=0;fillColor=#dae8fc;strokeColor=#666666;fontSize=14;align=left;verticalAlign=top;spacing=12;" vertex="1" parent="1">
<mxGeometry as="geometry" x="530" y="230" width="400" height="250" />
</mxCell>
<mxCell id="c5" value="Administrator / build machine&#10;Builds portable release&#10;Selects topology and installs native services&#10;Provides host administrative access" style="rounded=0;whiteSpace=wrap;html=0;fillColor=#d5e8d4;strokeColor=#666666;fontSize=14;align=left;verticalAlign=top;spacing=12;" vertex="1" parent="1">
<mxGeometry as="geometry" x="1100" y="150" width="330" height="190" />
</mxCell>
<mxCell id="c6" value="Clinical reference publishers&#10;Sundhed.dk&#10;Source URLs/review dates compiled into code&#10;No runtime HTTP dependency" style="rounded=0;whiteSpace=wrap;html=0;fillColor=#f5f5f5;strokeColor=#666666;fontSize=14;align=left;verticalAlign=top;spacing=12;" vertex="1" parent="1">
<mxGeometry as="geometry" x="1100" y="430" width="330" height="180" />
</mxCell>
<mxCell id="c7" value="HTTPS login + own-data APIs" style="edgeStyle=orthogonalEdgeStyle;rounded=0;html=0;fontSize=12;labelBackgroundColor=#ffffff;endArrow=classic;" edge="1" parent="1" source="c2" target="c4">
<mxGeometry as="geometry" relative="1" />
</mxCell>
<mxCell id="c8" value="HTTPS login + assigned reads" style="edgeStyle=orthogonalEdgeStyle;rounded=0;html=0;fontSize=12;labelBackgroundColor=#ffffff;endArrow=classic;" edge="1" parent="1" source="c3" target="c4">
<mxGeometry as="geometry" relative="1" />
</mxCell>
<mxCell id="c9" value="Native installation / configuration" style="edgeStyle=orthogonalEdgeStyle;rounded=0;html=0;fontSize=12;labelBackgroundColor=#ffffff;endArrow=open;dashed=1;" edge="1" parent="1" source="c5" target="c4">
<mxGeometry as="geometry" relative="1" />
</mxCell>
<mxCell id="c10" value="Reference metadata only" style="edgeStyle=orthogonalEdgeStyle;rounded=0;html=0;fontSize=12;labelBackgroundColor=#ffffff;endArrow=open;dashed=1;" edge="1" parent="1" source="c4" target="c6">
<mxGeometry as="geometry" relative="1" />
</mxCell>
<mxCell id="c11" value="Optional experiment system (outside product)&#10;JMeter generator → Gateway APIs&#10;JMeter ← PerfMon ServerAgent host telemetry&#10;JMeter ← Shelly plug HTTP power&#10;Idle scenario sends zero HealthApp requests" style="rounded=0;whiteSpace=wrap;html=0;fillColor=#fff2cc;strokeColor=#666666;fontSize=14;align=left;verticalAlign=top;spacing=12;" vertex="1" parent="1">
<mxGeometry as="geometry" x="420" y="710" width="600" height="190" />
</mxCell>
<mxCell id="c12" value="Synthetic workload only" style="edgeStyle=orthogonalEdgeStyle;rounded=0;html=0;fontSize=12;labelBackgroundColor=#ffffff;endArrow=classic;" edge="1" parent="1" source="c11" target="c4">
<mxGeometry as="geometry" relative="1" />
</mxCell>
<mxCell id="c13" value="Evidence: HealthApp.slnx; src/*/Program.cs; MeasurementGuidanceController; InsightCalculator.Trends; deploy/installer/*; tools/energy-jmeter. See software-architecture.md §§2, 6, 9, 11. Web/mobile clients are context actors, not implemented UI." style="rounded=0;whiteSpace=wrap;html=0;fillColor=#fff2cc;strokeColor=#666666;fontSize=14;align=left;verticalAlign=top;spacing=12;" vertex="1" parent="1">
<mxGeometry as="geometry" x="30" y="960" width="1400" height="100" />
</mxCell>
</root>
</mxGraphModel>
</diagram>
</mxfile>
@@ -0,0 +1,65 @@
<?xml version='1.0' encoding='utf-8'?>
<mxfile host="app.diagrams.net" version="24.7.17" compressed="false">
<diagram id="p1" name="Service processes and communication">
<mxGraphModel dx="1700" dy="1500" grid="1" gridSize="10" guides="1" tooltips="1" connect="1" arrows="1" fold="1" page="1" pageScale="1" pageWidth="1750" pageHeight="1250" math="0" shadow="0">
<root>
<mxCell id="0" />
<mxCell id="1" parent="0" />
<mxCell id="c1" value="Service processes and communication" style="text;html=0;fontSize=24;fontStyle=1;align=left;verticalAlign=middle;" vertex="1" parent="1">
<mxGeometry as="geometry" x="30" y="15" width="1690" height="45" />
</mxCell>
<mxCell id="c2" value="ApiGateway process&#10;Authentication + PatientAccessMiddleware&#10;Controllers → named HttpClients&#10;Login / public guidance / assignments&#10;Persistent Data Protection key files" style="rounded=0;whiteSpace=wrap;html=0;fillColor=#dae8fc;strokeColor=#666666;fontSize=14;align=left;verticalAlign=top;spacing=12;" vertex="1" parent="1" link="../../src/ApiGateway/Program.cs">
<mxGeometry as="geometry" x="640" y="110" width="420" height="240" />
</mxCell>
<mxCell id="c3" value="PatientProfileService process&#10;PatientController&#10;→ PatientApplicationService&#10;→ PatientRepository / SqlPatientRepository&#10;→ PatientDbContext" style="rounded=0;whiteSpace=wrap;html=0;fillColor=#d5e8d4;strokeColor=#666666;fontSize=14;align=left;verticalAlign=top;spacing=12;" vertex="1" parent="1" link="../../src/PatientProfileService/Program.cs">
<mxGeometry as="geometry" x="30" y="490" width="360" height="220" />
</mxCell>
<mxCell id="c4" value="ObservationService process&#10;ObservationController → application&#10;→ ObservationRepository / SQL / EF&#10;Patient existence client → Gateway" style="rounded=0;whiteSpace=wrap;html=0;fillColor=#d5e8d4;strokeColor=#666666;fontSize=14;align=left;verticalAlign=top;spacing=12;" vertex="1" parent="1" link="../../src/ObservationService/Program.cs">
<mxGeometry as="geometry" x="470" y="490" width="360" height="220" />
</mxCell>
<mxCell id="c5" value="InsightsService process&#10;InsightsController → application&#10;→ stateless InsightCalculator&#10;Observation HTTP client → Gateway&#10;No DB" style="rounded=0;whiteSpace=wrap;html=0;fillColor=#d5e8d4;strokeColor=#666666;fontSize=14;align=left;verticalAlign=top;spacing=12;" vertex="1" parent="1" link="../../src/InsightsService/Program.cs">
<mxGeometry as="geometry" x="910" y="490" width="360" height="220" />
</mxCell>
<mxCell id="c6" value="HealthOverviewService process&#10;Overview controller → application&#10;Three typed HTTP clients → Gateway&#10;Sequential profile/latest/insight reads&#10;No DB" style="rounded=0;whiteSpace=wrap;html=0;fillColor=#d5e8d4;strokeColor=#666666;fontSize=14;align=left;verticalAlign=top;spacing=12;" vertex="1" parent="1" link="../../src/HealthOverviewService/Program.cs">
<mxGeometry as="geometry" x="1350" y="490" width="360" height="220" />
</mxCell>
<mxCell id="c7" value="Profile APIs&#10;HTTPS + X-Gateway-Key" style="edgeStyle=orthogonalEdgeStyle;rounded=0;html=0;fontSize=12;labelBackgroundColor=#ffffff;endArrow=classic;" edge="1" parent="1" source="c2" target="c3">
<mxGeometry as="geometry" relative="1" />
</mxCell>
<mxCell id="c8" value="Observation APIs&#10;HTTPS + X-Gateway-Key" style="edgeStyle=orthogonalEdgeStyle;rounded=0;html=0;fontSize=12;labelBackgroundColor=#ffffff;endArrow=classic;" edge="1" parent="1" source="c2" target="c4">
<mxGeometry as="geometry" relative="1" />
</mxCell>
<mxCell id="c9" value="Summary / trend APIs&#10;HTTPS + X-Gateway-Key" style="edgeStyle=orthogonalEdgeStyle;rounded=0;html=0;fontSize=12;labelBackgroundColor=#ffffff;endArrow=classic;" edge="1" parent="1" source="c2" target="c5">
<mxGeometry as="geometry" relative="1" />
</mxCell>
<mxCell id="c10" value="Overview API&#10;HTTPS + X-Gateway-Key" style="edgeStyle=orthogonalEdgeStyle;rounded=0;html=0;fontSize=12;labelBackgroundColor=#ffffff;endArrow=classic;" edge="1" parent="1" source="c2" target="c6">
<mxGeometry as="geometry" relative="1" />
</mxCell>
<mxCell id="c11" value="Patient read&#10;HTTPS + X-Service-Key" style="edgeStyle=orthogonalEdgeStyle;rounded=0;html=0;fontSize=12;labelBackgroundColor=#ffffff;endArrow=classic;" edge="1" parent="1" source="c4" target="c2">
<mxGeometry as="geometry" relative="1" />
</mxCell>
<mxCell id="c12" value="History read&#10;HTTPS + X-Service-Key" style="edgeStyle=orthogonalEdgeStyle;rounded=0;html=0;fontSize=12;labelBackgroundColor=#ffffff;endArrow=classic;" edge="1" parent="1" source="c5" target="c2">
<mxGeometry as="geometry" relative="1" />
</mxCell>
<mxCell id="c13" value="Profile / latest / summary reads&#10;HTTPS + X-Service-Key" style="edgeStyle=orthogonalEdgeStyle;rounded=0;html=0;fontSize=12;labelBackgroundColor=#ffffff;endArrow=classic;" edge="1" parent="1" source="c6" target="c2">
<mxGeometry as="geometry" relative="1" />
</mxCell>
<mxCell id="c14" value="Patient DB&#10;patient + migration history&#10;Only Patient/Profile accesses it" style="rounded=0;whiteSpace=wrap;html=0;fillColor=#fff2cc;strokeColor=#666666;fontSize=14;align=left;verticalAlign=top;spacing=12;" vertex="1" parent="1">
<mxGeometry as="geometry" x="30" y="850" width="360" height="150" />
</mxCell>
<mxCell id="c15" value="Observation DB&#10;observation + flattened context&#10;Only Observation accesses it" style="rounded=0;whiteSpace=wrap;html=0;fillColor=#fff2cc;strokeColor=#666666;fontSize=14;align=left;verticalAlign=top;spacing=12;" vertex="1" parent="1">
<mxGeometry as="geometry" x="470" y="850" width="360" height="150" />
</mxCell>
<mxCell id="c16" value="EF Core / PostgreSQL" style="edgeStyle=orthogonalEdgeStyle;rounded=0;html=0;fontSize=12;labelBackgroundColor=#ffffff;endArrow=classic;" edge="1" parent="1" source="c3" target="c14">
<mxGeometry as="geometry" relative="1" />
</mxCell>
<mxCell id="c17" value="EF Core / PostgreSQL" style="edgeStyle=orthogonalEdgeStyle;rounded=0;html=0;fontSize=12;labelBackgroundColor=#ffffff;endArrow=classic;" edge="1" parent="1" source="c4" target="c15">
<mxGeometry as="geometry" relative="1" />
</mxCell>
<mxCell id="c18" value="No direct application-service network links, shared runtime library, shared domain objects, broker or cross-service DB access. Domain/client names do not change the configured Gateway origin. Each box is a separate project/process. Source links are attached to service boxes." style="rounded=0;whiteSpace=wrap;html=0;fillColor=#fff2cc;strokeColor=#666666;fontSize=14;align=left;verticalAlign=top;spacing=12;" vertex="1" parent="1">
<mxGeometry as="geometry" x="30" y="1090" width="1680" height="100" />
</mxCell>
</root>
</mxGraphModel>
</diagram>
</mxfile>
@@ -0,0 +1,205 @@
<?xml version='1.0' encoding='utf-8'?>
<mxfile host="app.diagrams.net" compressed="false" version="24.7.17">
<diagram id="Complete-application-domain:-health,-access-and-guidance" name="Complete application domain: health, access and guidance">
<mxGraphModel grid="1" gridSize="10" page="1" pageWidth="2550" pageHeight="2100">
<root>
<mxCell id="0" />
<mxCell id="1" parent="0" />
<mxCell id="c1" value="Complete application domain: health, access and guidance" style="text;html=0;fontSize=26;fontStyle=1;align=left;" vertex="1" parent="1">
<mxGeometry as="geometry" x="40" y="20" width="2470" height="60" />
</mxCell>
<mxCell id="c2" value="Account&#10;Stable account identifier&#10;Trusted Patient / HealthcareProfessional role&#10;Pre-created credentials; no registration" style="rounded=0;html=0;whiteSpace=wrap;align=left;verticalAlign=top;fontSize=14;spacing=12;strokeColor=#555555;fillColor=#d5e8d4;" vertex="1" parent="1">
<mxGeometry as="geometry" x="50" y="170" width="480" height="195" />
</mxCell>
<mxCell id="c3" value="Patient profile&#10;Patient identifier; name; date of birth&#10;Optional contact information&#10;Persistently associated with patient account" style="rounded=0;html=0;whiteSpace=wrap;align=left;verticalAlign=top;fontSize=14;spacing=12;strokeColor=#555555;fillColor=#dae8fc;" vertex="1" parent="1">
<mxGeometry as="geometry" x="675" y="170" width="480" height="195" />
</mxCell>
<mxCell id="c4" value="Professional assignment&#10;Professional account ↔ patient identifier&#10;Predefined, read-only entitlement&#10;Multiple patients / multiple professionals" style="rounded=0;html=0;whiteSpace=wrap;align=left;verticalAlign=top;fontSize=14;spacing=12;strokeColor=#555555;fillColor=#d5e8d4;" vertex="1" parent="1">
<mxGeometry as="geometry" x="1300" y="170" width="480" height="195" />
</mxCell>
<mxCell id="c5" value="Authentication grant&#10;Account identity and trusted role&#10;Issue/expiry instants; time limited&#10;No patient health information" style="rounded=0;html=0;whiteSpace=wrap;align=left;verticalAlign=top;fontSize=14;spacing=12;strokeColor=#555555;fillColor=#d5e8d4;" vertex="1" parent="1">
<mxGeometry as="geometry" x="1925" y="170" width="480" height="195" />
</mxCell>
<mxCell id="c6" value="Blood-pressure observation&#10;Observation and patient identifiers&#10;Measurement instant; original recording time&#10;Systolic/diastolic pressure and pulse&#10;Optional original context text and note" style="rounded=0;html=0;whiteSpace=wrap;align=left;verticalAlign=top;fontSize=14;spacing=12;strokeColor=#555555;fillColor=#dae8fc;" vertex="1" parent="1">
<mxGeometry as="geometry" x="50" y="510" width="480" height="195" />
</mxCell>
<mxCell id="c7" value="Measurement context&#10;Setting; activity condition&#10;Optional preparation/technique details&#10;Optional additional circumstances&#10;Unknown retained; no inferred compliance" style="rounded=0;html=0;whiteSpace=wrap;align=left;verticalAlign=top;fontSize=14;spacing=12;strokeColor=#555555;fillColor=#fff2cc;" vertex="1" parent="1">
<mxGeometry as="geometry" x="675" y="510" width="480" height="195" />
</mxCell>
<mxCell id="c8" value="Context selection&#10;Optional setting and/or activity&#10;Both selected dimensions must match&#10;Unknown is an explicit selectable category" style="rounded=0;html=0;whiteSpace=wrap;align=left;verticalAlign=top;fontSize=14;spacing=12;strokeColor=#555555;fillColor=#fff2cc;" vertex="1" parent="1">
<mxGeometry as="geometry" x="1300" y="510" width="480" height="195" />
</mxCell>
<mxCell id="c9" value="Measurement period&#10;Inclusive start and end instants&#10;Equal bounds valid; reversed invalid&#10;Measurement instants interpreted as UTC" style="rounded=0;html=0;whiteSpace=wrap;align=left;verticalAlign=top;fontSize=14;spacing=12;strokeColor=#555555;fillColor=#fff2cc;" vertex="1" parent="1">
<mxGeometry as="geometry" x="1925" y="510" width="480" height="195" />
</mxCell>
<mxCell id="c10" value="Numerical health insight&#10;Systolic/diastolic/pulse arithmetic means&#10;Blood-pressure minima and maxima&#10;Contributing count; selected basis&#10;Context explanation; derived, not stored" style="rounded=0;html=0;whiteSpace=wrap;align=left;verticalAlign=top;fontSize=14;spacing=12;strokeColor=#555555;fillColor=#dae8fc;" vertex="1" parent="1">
<mxGeometry as="geometry" x="50" y="850" width="480" height="195" />
</mxCell>
<mxCell id="c11" value="Trend assessment&#10;Patient, period and context selection&#10;Contributing observation count&#10;Three separate metric assessments&#10;Recorded comparability and limitations" style="rounded=0;html=0;whiteSpace=wrap;align=left;verticalAlign=top;fontSize=14;spacing=12;strokeColor=#555555;fillColor=#dae8fc;" vertex="1" parent="1">
<mxGeometry as="geometry" x="675" y="850" width="480" height="195" />
</mxCell>
<mxCell id="c12" value="Recorded comparability&#10;Known similarities and differences&#10;Missing details and narrative conflicts&#10;Evidence/explanation; not certification" style="rounded=0;html=0;whiteSpace=wrap;align=left;verticalAlign=top;fontSize=14;spacing=12;strokeColor=#555555;fillColor=#fff2cc;" vertex="1" parent="1">
<mxGeometry as="geometry" x="1300" y="850" width="480" height="195" />
</mxCell>
<mxCell id="c13" value="Measurement assessment&#10;Metric and unit; mean/minimum/maximum/range&#10;Temporal and overall direction; slope&#10;Reversals/successive variation&#10;Interpretation, reference comparison and hint" style="rounded=0;html=0;whiteSpace=wrap;align=left;verticalAlign=top;fontSize=14;spacing=12;strokeColor=#555555;fillColor=#fff2cc;" vertex="1" parent="1">
<mxGeometry as="geometry" x="1925" y="850" width="480" height="195" />
</mxCell>
<mxCell id="c14" value="Health overview&#10;Patient profile&#10;Optional latest overall observation&#10;Optional selected-period numerical insight&#10;Explicit separate bases and absence reasons" style="rounded=0;html=0;whiteSpace=wrap;align=left;verticalAlign=top;fontSize=14;spacing=12;strokeColor=#555555;fillColor=#dae8fc;" vertex="1" parent="1">
<mxGeometry as="geometry" x="50" y="1190" width="480" height="195" />
</mxCell>
<mxCell id="c15" value="Clinical reference&#10;Applicable scope and measurement conditions&#10;Lower/upper boundaries and operators&#10;Source provenance; applicability limits&#10;General reference ≠ individual treatment goal" style="rounded=0;html=0;whiteSpace=wrap;align=left;verticalAlign=top;fontSize=14;spacing=12;strokeColor=#555555;fillColor=#fff2cc;" vertex="1" parent="1">
<mxGeometry as="geometry" x="675" y="1190" width="480" height="195" />
</mxCell>
<mxCell id="c16" value="Reference source&#10;Publication title and URL&#10;Publication update/review dates where supplied&#10;Provenance, not a patient record&#10;No automatic live source refresh" style="rounded=0;html=0;whiteSpace=wrap;align=left;verticalAlign=top;fontSize=14;spacing=12;strokeColor=#555555;fillColor=#fff2cc;" vertex="1" parent="1">
<mxGeometry as="geometry" x="1300" y="1190" width="480" height="195" />
</mxCell>
<mxCell id="c17" value="Measurement guidance&#10;Requested setting/activity&#10;Applicable home/resting basis or unavailable&#10;Ordered instructions; explanations/limits&#10;Review date and source provenance" style="rounded=0;html=0;whiteSpace=wrap;align=left;verticalAlign=top;fontSize=14;spacing=12;strokeColor=#555555;fillColor=#dae8fc;" vertex="1" parent="1">
<mxGeometry as="geometry" x="1925" y="1190" width="480" height="195" />
</mxCell>
<mxCell id="c18" value="Guidance instruction&#10;Sequence order; topic; instruction&#10;Preparation/equipment/position/measurement/&#10;planned monitoring/recording&#10;No stored compliance state" style="rounded=0;html=0;whiteSpace=wrap;align=left;verticalAlign=top;fontSize=14;spacing=12;strokeColor=#555555;fillColor=#fff2cc;" vertex="1" parent="1">
<mxGeometry as="geometry" x="1925" y="1530" width="480" height="195" />
</mxCell>
<mxCell id="c19" value="Patient account 1 ↔ profile 0..1; legacy profile account 0..1" style="edgeStyle=orthogonalEdgeStyle;html=0;fontSize=12;labelBackgroundColor=#ffffff;endArrow=none;" edge="1" parent="1" source="c2" target="c3">
<mxGeometry as="geometry" relative="1" />
</mxCell>
<mxCell id="c20" value="Professional account 1 ↔ assignments 0..*" style="edgeStyle=orthogonalEdgeStyle;html=0;fontSize=12;labelBackgroundColor=#ffffff;endArrow=none;" edge="1" parent="1" source="c2" target="c4">
<mxGeometry as="geometry" relative="1" />
</mxCell>
<mxCell id="c21" value="Assignments 0..* ↔ patient 1 (identifier may outlive data)" style="edgeStyle=orthogonalEdgeStyle;html=0;fontSize=12;labelBackgroundColor=#ffffff;endArrow=none;" edge="1" parent="1" source="c4" target="c3">
<mxGeometry as="geometry" relative="1" />
</mxCell>
<mxCell id="c22" value="Account 1 ↔ issued grants 0..*" style="edgeStyle=orthogonalEdgeStyle;html=0;fontSize=12;labelBackgroundColor=#ffffff;endArrow=none;" edge="1" parent="1" source="c2" target="c5">
<mxGeometry as="geometry" relative="1" />
</mxCell>
<mxCell id="c23" value="Patient 1 ↔ observations 0..*" style="edgeStyle=orthogonalEdgeStyle;html=0;fontSize=12;labelBackgroundColor=#ffffff;endArrow=none;" edge="1" parent="1" source="c3" target="c6">
<mxGeometry as="geometry" relative="1" />
</mxCell>
<mxCell id="c24" value="Observation 1 ↔ owned context 1" style="edgeStyle=orthogonalEdgeStyle;html=0;fontSize=12;labelBackgroundColor=#ffffff;startArrow=diamond;startFill=1;endArrow=none;" edge="1" parent="1" source="c6" target="c7">
<mxGeometry as="geometry" relative="1" />
</mxCell>
<mxCell id="c25" value="Selects recorded setting/activity; does not change them" style="edgeStyle=orthogonalEdgeStyle;html=0;fontSize=12;labelBackgroundColor=#ffffff;dashed=1;endArrow=open;" edge="1" parent="1" source="c8" target="c7">
<mxGeometry as="geometry" relative="1" />
</mxCell>
<mxCell id="c26" value="Selects by measurement instant" style="edgeStyle=orthogonalEdgeStyle;html=0;fontSize=12;labelBackgroundColor=#ffffff;dashed=1;endArrow=open;" edge="1" parent="1" source="c9" target="c6">
<mxGeometry as="geometry" relative="1" />
</mxCell>
<mxCell id="c27" value="Derived from 1..* selected observations" style="edgeStyle=orthogonalEdgeStyle;html=0;fontSize=12;labelBackgroundColor=#ffffff;dashed=1;endArrow=open;" edge="1" parent="1" source="c6" target="c10">
<mxGeometry as="geometry" relative="1" />
</mxCell>
<mxCell id="c28" value="Derived from 0..* selected observations" style="edgeStyle=orthogonalEdgeStyle;html=0;fontSize=12;labelBackgroundColor=#ffffff;dashed=1;endArrow=open;" edge="1" parent="1" source="c6" target="c11">
<mxGeometry as="geometry" relative="1" />
</mxCell>
<mxCell id="c29" value="Applied selection 1" style="edgeStyle=orthogonalEdgeStyle;html=0;fontSize=12;labelBackgroundColor=#ffffff;endArrow=none;" edge="1" parent="1" source="c8" target="c10">
<mxGeometry as="geometry" relative="1" />
</mxCell>
<mxCell id="c30" value="Applied selection 1" style="edgeStyle=orthogonalEdgeStyle;html=0;fontSize=12;labelBackgroundColor=#ffffff;endArrow=none;" edge="1" parent="1" source="c8" target="c11">
<mxGeometry as="geometry" relative="1" />
</mxCell>
<mxCell id="c31" value="Requested period 1" style="edgeStyle=orthogonalEdgeStyle;html=0;fontSize=12;labelBackgroundColor=#ffffff;endArrow=none;" edge="1" parent="1" source="c9" target="c10">
<mxGeometry as="geometry" relative="1" />
</mxCell>
<mxCell id="c32" value="Requested period 1" style="edgeStyle=orthogonalEdgeStyle;html=0;fontSize=12;labelBackgroundColor=#ffffff;endArrow=none;" edge="1" parent="1" source="c9" target="c11">
<mxGeometry as="geometry" relative="1" />
</mxCell>
<mxCell id="c33" value="Assessment 1 ↔ recorded comparability 1" style="edgeStyle=orthogonalEdgeStyle;html=0;fontSize=12;labelBackgroundColor=#ffffff;startArrow=diamond;startFill=1;endArrow=none;" edge="1" parent="1" source="c11" target="c12">
<mxGeometry as="geometry" relative="1" />
</mxCell>
<mxCell id="c34" value="Assessment 1 ↔ metric assessments 3" style="edgeStyle=orthogonalEdgeStyle;html=0;fontSize=12;labelBackgroundColor=#ffffff;startArrow=diamond;startFill=1;endArrow=none;" edge="1" parent="1" source="c11" target="c13">
<mxGeometry as="geometry" relative="1" />
</mxCell>
<mxCell id="c35" value="Metric assessment 1 ↔ applicable reference 0..1" style="edgeStyle=orthogonalEdgeStyle;html=0;fontSize=12;labelBackgroundColor=#ffffff;endArrow=none;" edge="1" parent="1" source="c13" target="c15">
<mxGeometry as="geometry" relative="1" />
</mxCell>
<mxCell id="c36" value="Reference 1 ↔ sources 1..*" style="edgeStyle=orthogonalEdgeStyle;html=0;fontSize=12;labelBackgroundColor=#ffffff;endArrow=none;" edge="1" parent="1" source="c15" target="c16">
<mxGeometry as="geometry" relative="1" />
</mxCell>
<mxCell id="c37" value="Overview 1 ↔ profile 1" style="edgeStyle=orthogonalEdgeStyle;html=0;fontSize=12;labelBackgroundColor=#ffffff;endArrow=none;" edge="1" parent="1" source="c14" target="c3">
<mxGeometry as="geometry" relative="1" />
</mxCell>
<mxCell id="c38" value="Overview 1 ↔ latest overall 0..1" style="edgeStyle=orthogonalEdgeStyle;html=0;fontSize=12;labelBackgroundColor=#ffffff;endArrow=none;" edge="1" parent="1" source="c14" target="c6">
<mxGeometry as="geometry" relative="1" />
</mxCell>
<mxCell id="c39" value="Overview 1 ↔ insight 0..1" style="edgeStyle=orthogonalEdgeStyle;html=0;fontSize=12;labelBackgroundColor=#ffffff;endArrow=none;" edge="1" parent="1" source="c14" target="c10">
<mxGeometry as="geometry" relative="1" />
</mxCell>
<mxCell id="c40" value="Guidance 1 ↔ ordered instructions 0..*" style="edgeStyle=orthogonalEdgeStyle;html=0;fontSize=12;labelBackgroundColor=#ffffff;startArrow=diamond;startFill=1;endArrow=none;" edge="1" parent="1" source="c17" target="c18">
<mxGeometry as="geometry" relative="1" />
</mxCell>
<mxCell id="c41" value="Guidance 1 ↔ cited sources 0..*" style="edgeStyle=orthogonalEdgeStyle;html=0;fontSize=12;labelBackgroundColor=#ffffff;endArrow=none;" edge="1" parent="1" source="c17" target="c16">
<mxGeometry as="geometry" relative="1" />
</mxCell>
<mxCell id="c42" value="Explains actual circumstances; never sets/saves context" style="edgeStyle=orthogonalEdgeStyle;html=0;fontSize=12;labelBackgroundColor=#ffffff;dashed=1;endArrow=open;" edge="1" parent="1" source="c17" target="c7">
<mxGeometry as="geometry" relative="1" />
</mxCell>
<mxCell id="c43" value="Scope spans the responsibilities of all five application services: access/accounts/assignments, patient profiles, observation/context/history, numerical insights, metric trends/comparability/references, overview and public guidance. These are business concepts, not controllers, DTOs, repositories or framework classes. Derived views are values, not persisted entities. Professional role is an Account role; there is no separate stored professional profile. Measurement device/cuff are recorded descriptions, not independently managed device entities." style="rounded=0;html=0;whiteSpace=wrap;align=left;verticalAlign=top;fontSize=14;spacing=12;strokeColor=#555555;fillColor=#f5f5f5;" vertex="1" parent="1">
<mxGeometry as="geometry" x="45" y="1900" width="2460" height="145" />
</mxCell>
</root>
</mxGraphModel>
</diagram>
<diagram id="Deployment-administration-concepts-(separate-supporting-domain)" name="Deployment administration concepts (separate supporting domain)">
<mxGraphModel grid="1" gridSize="10" page="1" pageWidth="2100" pageHeight="1450">
<root>
<mxCell id="0" />
<mxCell id="1" parent="0" />
<mxCell id="c1" value="Deployment administration concepts (separate supporting domain)" style="text;html=0;fontSize=26;fontStyle=1;align=left;" vertex="1" parent="1">
<mxGeometry as="geometry" x="40" y="20" width="2020" height="60" />
</mxCell>
<mxCell id="c2" value="Deployment topology&#10;Selected service names&#10;Reachable host/platform/port assignments&#10;Colocated or distributed" style="rounded=0;html=0;whiteSpace=wrap;align=left;verticalAlign=top;fontSize=14;spacing=12;strokeColor=#555555;fillColor=#d5e8d4;" vertex="1" parent="1">
<mxGeometry as="geometry" x="45" y="170" width="575" height="200" />
</mxCell>
<mxCell id="c3" value="Deployment node&#10;Host and native platform&#10;Administrative access prerequisites&#10;One or more selected service installations" style="rounded=0;html=0;whiteSpace=wrap;align=left;verticalAlign=top;fontSize=14;spacing=12;strokeColor=#555555;fillColor=#d5e8d4;" vertex="1" parent="1">
<mxGeometry as="geometry" x="730" y="170" width="575" height="200" />
</mxCell>
<mxCell id="c4" value="Service installation&#10;Independent executable/process identity&#10;Listening endpoint; local configuration&#10;Lifecycle independent of peers" style="rounded=0;html=0;whiteSpace=wrap;align=left;verticalAlign=top;fontSize=14;spacing=12;strokeColor=#555555;fillColor=#d5e8d4;" vertex="1" parent="1">
<mxGeometry as="geometry" x="1415" y="170" width="575" height="200" />
</mxCell>
<mxCell id="c5" value="Deployment material&#10;Deployment identifier&#10;Compatible service settings and account secrets&#10;Protected files, scoped to selected nodes" style="rounded=0;html=0;whiteSpace=wrap;align=left;verticalAlign=top;fontSize=14;spacing=12;strokeColor=#555555;fillColor=#d5e8d4;" vertex="1" parent="1">
<mxGeometry as="geometry" x="45" y="500" width="575" height="200" />
</mxCell>
<mxCell id="c6" value="Service configuration&#10;Listening address; dependencies/endpoints&#10;Credentials; certificate paths&#10;Own database connection where applicable" style="rounded=0;html=0;whiteSpace=wrap;align=left;verticalAlign=top;fontSize=14;spacing=12;strokeColor=#555555;fillColor=#d5e8d4;" vertex="1" parent="1">
<mxGeometry as="geometry" x="730" y="500" width="575" height="200" />
</mxCell>
<mxCell id="c7" value="Credential&#10;Service incoming/callback keys&#10;Synthetic account password/hash&#10;Separate database owner credential&#10;Private administrative material" style="rounded=0;html=0;whiteSpace=wrap;align=left;verticalAlign=top;fontSize=14;spacing=12;strokeColor=#555555;fillColor=#d5e8d4;" vertex="1" parent="1">
<mxGeometry as="geometry" x="1415" y="500" width="575" height="200" />
</mxCell>
<mxCell id="c8" value="Owned database&#10;Owning persistent service&#10;Dedicated role and schema&#10;No database for derived-data services" style="rounded=0;html=0;whiteSpace=wrap;align=left;verticalAlign=top;fontSize=14;spacing=12;strokeColor=#555555;fillColor=#d5e8d4;" vertex="1" parent="1">
<mxGeometry as="geometry" x="45" y="830" width="575" height="200" />
</mxCell>
<mxCell id="c9" value="Service certificate&#10;Endpoint DNS/IP identity&#10;Private key and protected PFX&#10;Validity interval and trust chain" style="rounded=0;html=0;whiteSpace=wrap;align=left;verticalAlign=top;fontSize=14;spacing=12;strokeColor=#555555;fillColor=#d5e8d4;" vertex="1" parent="1">
<mxGeometry as="geometry" x="730" y="830" width="575" height="200" />
</mxCell>
<mxCell id="c10" value="Prototype certificate authority&#10;Public trust anchor&#10;Issues service certificates at preparation&#10;Generated signing key not retained" style="rounded=0;html=0;whiteSpace=wrap;align=left;verticalAlign=top;fontSize=14;spacing=12;strokeColor=#555555;fillColor=#d5e8d4;" vertex="1" parent="1">
<mxGeometry as="geometry" x="1415" y="830" width="575" height="200" />
</mxCell>
<mxCell id="c11" value="Topology 1 ↔ nodes 1..*" style="edgeStyle=orthogonalEdgeStyle;html=0;fontSize=12;labelBackgroundColor=#ffffff;endArrow=none;" edge="1" parent="1" source="c2" target="c3">
<mxGeometry as="geometry" relative="1" />
</mxCell>
<mxCell id="c12" value="Node 1 ↔ installations 1..*" style="edgeStyle=orthogonalEdgeStyle;html=0;fontSize=12;labelBackgroundColor=#ffffff;endArrow=none;" edge="1" parent="1" source="c3" target="c4">
<mxGeometry as="geometry" relative="1" />
</mxCell>
<mxCell id="c13" value="Material 1 ↔ planned configurations 5" style="edgeStyle=orthogonalEdgeStyle;html=0;fontSize=12;labelBackgroundColor=#ffffff;endArrow=none;" edge="1" parent="1" source="c5" target="c6">
<mxGeometry as="geometry" relative="1" />
</mxCell>
<mxCell id="c14" value="Installation 1 ↔ configuration 1" style="edgeStyle=orthogonalEdgeStyle;html=0;fontSize=12;labelBackgroundColor=#ffffff;endArrow=none;" edge="1" parent="1" source="c4" target="c6">
<mxGeometry as="geometry" relative="1" />
</mxCell>
<mxCell id="c15" value="Configuration references appropriate credentials" style="edgeStyle=orthogonalEdgeStyle;html=0;fontSize=12;labelBackgroundColor=#ffffff;endArrow=none;" edge="1" parent="1" source="c6" target="c7">
<mxGeometry as="geometry" relative="1" />
</mxCell>
<mxCell id="c16" value="Persistent installation 1 ↔ owned database 1; others 0" style="edgeStyle=orthogonalEdgeStyle;html=0;fontSize=12;labelBackgroundColor=#ffffff;endArrow=none;" edge="1" parent="1" source="c4" target="c8">
<mxGeometry as="geometry" relative="1" />
</mxCell>
<mxCell id="c17" value="Configuration 1 ↔ service certificate 1" style="edgeStyle=orthogonalEdgeStyle;html=0;fontSize=12;labelBackgroundColor=#ffffff;endArrow=none;" edge="1" parent="1" source="c6" target="c9">
<mxGeometry as="geometry" relative="1" />
</mxCell>
<mxCell id="c18" value="Authority 1 ↔ issued service certificates 1..*" style="edgeStyle=orthogonalEdgeStyle;html=0;fontSize=12;labelBackgroundColor=#ffffff;endArrow=none;" edge="1" parent="1" source="c10" target="c9">
<mxGeometry as="geometry" relative="1" />
</mxCell>
<mxCell id="c19" value="Supporting deployment concepts describe existing installer data and administrator responsibilities; they do not create extra application microservices or change the health domain. Source evidence: Deployment.cs, DatabaseProvisioning.cs, ConfigurationWriter.cs and native installers. External certificates are also supported. Experiment tools and operating-system frameworks remain infrastructure, not invented clinical entities." style="rounded=0;html=0;whiteSpace=wrap;align=left;verticalAlign=top;fontSize=14;spacing=12;strokeColor=#555555;fillColor=#f5f5f5;" vertex="1" parent="1">
<mxGeometry as="geometry" x="45" y="1260" width="2010" height="140" />
</mxCell>
</root>
</mxGraphModel>
</diagram>
</mxfile>
@@ -0,0 +1,374 @@
<?xml version='1.0' encoding='utf-8'?>
<mxfile host="app.diagrams.net" version="24.7.17" compressed="false">
<diagram name="ApiGateway — implementation classes" id="ApiGateway---implementation-classes">
<mxGraphModel grid="1" gridSize="10" page="1" pageWidth="2660" pageHeight="2476" pageScale="1">
<root>
<mxCell id="0" />
<mxCell id="1" parent="0" />
<mxCell id="n1" value="ApiGateway — implementation classes" style="text;html=0;whiteSpace=wrap;align=left;verticalAlign=top;fontSize=13;spacing=8;fontSize=24;fontStyle=1;" vertex="1" parent="1">
<mxGeometry as="geometry" x="40" y="25" width="2580" height="45" />
</mxCell>
<mxCell id="n2" value="UML: + public, - private, # protected, ~ internal. Three compartments = classifier / attributes / operations. Hollow triangle: inheritance; dashed hollow triangle: interface realization. Solid line: attribute reference; dashed arrow: dependency; filled diamond: verified owned context. Each source type has its own classifier. Primary-constructor parameters are constructor operations, not invented fields." style="text;html=0;whiteSpace=wrap;align=left;verticalAlign=top;fontSize=13;spacing=8;" vertex="1" parent="1">
<mxGeometry as="geometry" x="40" y="85" width="2580" height="100" />
</mxCell>
<mxCell id="n3" value="«class»&#10;AuthenticationController&#10;ApiGateway.Controllers" style="swimlane;startSize=82;horizontal=1;html=0;whiteSpace=wrap;align=center;verticalAlign=top;fontSize=13;fontStyle=1;spacing=7;fillColor=#dae8fc;strokeColor=#444444;" vertex="1" parent="1" sourceType="ApiGateway.Controllers.AuthenticationController" sourceFiles="src/ApiGateway/Controllers/AuthenticationController.cs" link="../../src/ApiGateway/Controllers/AuthenticationController.cs">
<mxGeometry as="geometry" x="70" y="210" width="520" height="190" />
</mxCell>
<mxCell id="n4" value="(no declared attributes)" style="text;html=0;whiteSpace=wrap;align=left;verticalAlign=top;fontSize=13;spacing=8;fillColor=none;strokeColor=none;" vertex="1" parent="n3">
<mxGeometry as="geometry" x="0" y="82" width="520" height="36" />
</mxCell>
<mxCell id="n5" value="+ AuthenticationController(PrototypeAccounts accounts,&#10;IOptionsMonitor&lt;BearerTokenOptions&gt; options)&#10;+ Login(LoginRequest request): IActionResult" style="text;html=0;whiteSpace=wrap;align=left;verticalAlign=top;fontSize=13;spacing=8;fillColor=none;strokeColor=none;" vertex="1" parent="n3">
<mxGeometry as="geometry" x="0" y="118" width="520" height="72" />
</mxCell>
<mxCell id="n3-sep" style="endArrow=none;strokeColor=#444444;" edge="1" parent="n3">
<mxGeometry as="geometry" relative="1">
<mxPoint as="sourcePoint" x="0" y="118" />
<mxPoint as="targetPoint" x="520" y="118" />
</mxGeometry>
</mxCell>
<mxCell id="n6" value="«record»&#10;LoginRequest&#10;ApiGateway.Controllers.AuthenticationController" style="swimlane;startSize=82;horizontal=1;html=0;whiteSpace=wrap;align=center;verticalAlign=top;fontSize=13;fontStyle=1;spacing=7;fillColor=#dae8fc;strokeColor=#444444;" vertex="1" parent="1" sourceType="ApiGateway.Controllers.AuthenticationController.LoginRequest" sourceFiles="src/ApiGateway/Controllers/AuthenticationController.cs" link="../../src/ApiGateway/Controllers/AuthenticationController.cs">
<mxGeometry as="geometry" x="730" y="210" width="520" height="172" />
</mxCell>
<mxCell id="n7" value="+ AccountId: string {get, init}&#10;+ Password: string {get, init}" style="text;html=0;whiteSpace=wrap;align=left;verticalAlign=top;fontSize=13;spacing=8;fillColor=none;strokeColor=none;" vertex="1" parent="n6">
<mxGeometry as="geometry" x="0" y="82" width="520" height="54" />
</mxCell>
<mxCell id="n8" value="+ LoginRequest(string AccountId, string Password)" style="text;html=0;whiteSpace=wrap;align=left;verticalAlign=top;fontSize=13;spacing=8;fillColor=none;strokeColor=none;" vertex="1" parent="n6">
<mxGeometry as="geometry" x="0" y="136" width="520" height="36" />
</mxCell>
<mxCell id="n6-sep" style="endArrow=none;strokeColor=#444444;" edge="1" parent="n6">
<mxGeometry as="geometry" relative="1">
<mxPoint as="sourcePoint" x="0" y="136" />
<mxPoint as="targetPoint" x="520" y="136" />
</mxGeometry>
</mxCell>
<mxCell id="n9" value="«class»&#10;HealthOverviewController&#10;ApiGateway.Controllers" style="swimlane;startSize=82;horizontal=1;html=0;whiteSpace=wrap;align=center;verticalAlign=top;fontSize=13;fontStyle=1;spacing=7;fillColor=#dae8fc;strokeColor=#444444;" vertex="1" parent="1" sourceType="ApiGateway.Controllers.HealthOverviewController" sourceFiles="src/ApiGateway/Controllers/HealthOverviewController.cs" link="../../src/ApiGateway/Controllers/HealthOverviewController.cs">
<mxGeometry as="geometry" x="1390" y="210" width="520" height="226" />
</mxCell>
<mxCell id="n10" value="(no declared attributes)" style="text;html=0;whiteSpace=wrap;align=left;verticalAlign=top;fontSize=13;spacing=8;fillColor=none;strokeColor=none;" vertex="1" parent="n9">
<mxGeometry as="geometry" x="0" y="82" width="520" height="36" />
</mxCell>
<mxCell id="n11" value="+ HealthOverviewController(IHttpClientFactory clients)&#10;+ GetOverview(Guid patientId, CancellationToken cancellationToken): Task&#10;- ForwardAsync(HttpMethod method, string path, CancellationToken&#10;cancellationToken): Task&#10;- WriteFailureAsync(int status): Task" style="text;html=0;whiteSpace=wrap;align=left;verticalAlign=top;fontSize=13;spacing=8;fillColor=none;strokeColor=none;" vertex="1" parent="n9">
<mxGeometry as="geometry" x="0" y="118" width="520" height="108" />
</mxCell>
<mxCell id="n9-sep" style="endArrow=none;strokeColor=#444444;" edge="1" parent="n9">
<mxGeometry as="geometry" relative="1">
<mxPoint as="sourcePoint" x="0" y="118" />
<mxPoint as="targetPoint" x="520" y="118" />
</mxGeometry>
</mxCell>
<mxCell id="n12" value="«class»&#10;InsightsController&#10;ApiGateway.Controllers" style="swimlane;startSize=82;horizontal=1;html=0;whiteSpace=wrap;align=center;verticalAlign=top;fontSize=13;fontStyle=1;spacing=7;fillColor=#dae8fc;strokeColor=#444444;" vertex="1" parent="1" sourceType="ApiGateway.Controllers.InsightsController" sourceFiles="src/ApiGateway/Controllers/InsightsController.cs" link="../../src/ApiGateway/Controllers/InsightsController.cs">
<mxGeometry as="geometry" x="2050" y="210" width="520" height="244" />
</mxCell>
<mxCell id="n13" value="(no declared attributes)" style="text;html=0;whiteSpace=wrap;align=left;verticalAlign=top;fontSize=13;spacing=8;fillColor=none;strokeColor=none;" vertex="1" parent="n12">
<mxGeometry as="geometry" x="0" y="82" width="520" height="36" />
</mxCell>
<mxCell id="n14" value="+ InsightsController(IHttpClientFactory clients)&#10;+ GetSummary(Guid patientId, CancellationToken cancellationToken): Task&#10;+ GetTrend(Guid patientId, CancellationToken cancellationToken): Task&#10;- ForwardAsync(HttpMethod method, string path, CancellationToken&#10;cancellationToken): Task&#10;- WriteFailureAsync(int status): Task" style="text;html=0;whiteSpace=wrap;align=left;verticalAlign=top;fontSize=13;spacing=8;fillColor=none;strokeColor=none;" vertex="1" parent="n12">
<mxGeometry as="geometry" x="0" y="118" width="520" height="126" />
</mxCell>
<mxCell id="n12-sep" style="endArrow=none;strokeColor=#444444;" edge="1" parent="n12">
<mxGeometry as="geometry" relative="1">
<mxPoint as="sourcePoint" x="0" y="118" />
<mxPoint as="targetPoint" x="520" y="118" />
</mxGeometry>
</mxCell>
<mxCell id="n15" value="«class»&#10;MeasurementGuidanceController&#10;ApiGateway.Controllers" style="swimlane;startSize=82;horizontal=1;html=0;whiteSpace=wrap;align=center;verticalAlign=top;fontSize=13;fontStyle=1;spacing=7;fillColor=#dae8fc;strokeColor=#444444;" vertex="1" parent="1" sourceType="ApiGateway.Controllers.MeasurementGuidanceController" sourceFiles="src/ApiGateway/Controllers/MeasurementGuidanceController.cs" link="../../src/ApiGateway/Controllers/MeasurementGuidanceController.cs">
<mxGeometry as="geometry" x="70" y="634" width="520" height="154" />
</mxCell>
<mxCell id="n16" value="(no declared attributes)" style="text;html=0;whiteSpace=wrap;align=left;verticalAlign=top;fontSize=13;spacing=8;fillColor=none;strokeColor=none;" vertex="1" parent="n15">
<mxGeometry as="geometry" x="0" y="82" width="520" height="36" />
</mxCell>
<mxCell id="n17" value="+ Get(string? setting, string? activityCondition): IActionResult" style="text;html=0;whiteSpace=wrap;align=left;verticalAlign=top;fontSize=13;spacing=8;fillColor=none;strokeColor=none;" vertex="1" parent="n15">
<mxGeometry as="geometry" x="0" y="118" width="520" height="36" />
</mxCell>
<mxCell id="n15-sep" style="endArrow=none;strokeColor=#444444;" edge="1" parent="n15">
<mxGeometry as="geometry" relative="1">
<mxPoint as="sourcePoint" x="0" y="118" />
<mxPoint as="targetPoint" x="520" y="118" />
</mxGeometry>
</mxCell>
<mxCell id="n18" value="«record»&#10;GuidanceSource&#10;ApiGateway.Controllers.MeasurementGuidanceController" style="swimlane;startSize=82;horizontal=1;html=0;whiteSpace=wrap;align=center;verticalAlign=top;fontSize=13;fontStyle=1;spacing=7;fillColor=#dae8fc;strokeColor=#444444;" vertex="1" parent="1" sourceType="ApiGateway.Controllers.MeasurementGuidanceController.GuidanceSource" sourceFiles="src/ApiGateway/Controllers/MeasurementGuidanceController.cs" link="../../src/ApiGateway/Controllers/MeasurementGuidanceController.cs">
<mxGeometry as="geometry" x="730" y="634" width="520" height="190" />
</mxCell>
<mxCell id="n19" value="+ Title: string {get, init}&#10;+ Url: string {get, init}&#10;+ UpdatedOn: string {get, init}" style="text;html=0;whiteSpace=wrap;align=left;verticalAlign=top;fontSize=13;spacing=8;fillColor=none;strokeColor=none;" vertex="1" parent="n18">
<mxGeometry as="geometry" x="0" y="82" width="520" height="72" />
</mxCell>
<mxCell id="n20" value="+ GuidanceSource(string Title, string Url, string UpdatedOn)" style="text;html=0;whiteSpace=wrap;align=left;verticalAlign=top;fontSize=13;spacing=8;fillColor=none;strokeColor=none;" vertex="1" parent="n18">
<mxGeometry as="geometry" x="0" y="154" width="520" height="36" />
</mxCell>
<mxCell id="n18-sep" style="endArrow=none;strokeColor=#444444;" edge="1" parent="n18">
<mxGeometry as="geometry" relative="1">
<mxPoint as="sourcePoint" x="0" y="154" />
<mxPoint as="targetPoint" x="520" y="154" />
</mxGeometry>
</mxCell>
<mxCell id="n21" value="«record»&#10;GuidanceStep&#10;ApiGateway.Controllers.MeasurementGuidanceController" style="swimlane;startSize=82;horizontal=1;html=0;whiteSpace=wrap;align=center;verticalAlign=top;fontSize=13;fontStyle=1;spacing=7;fillColor=#dae8fc;strokeColor=#444444;" vertex="1" parent="1" sourceType="ApiGateway.Controllers.MeasurementGuidanceController.GuidanceStep" sourceFiles="src/ApiGateway/Controllers/MeasurementGuidanceController.cs" link="../../src/ApiGateway/Controllers/MeasurementGuidanceController.cs">
<mxGeometry as="geometry" x="1390" y="634" width="520" height="190" />
</mxCell>
<mxCell id="n22" value="+ Order: int {get, init}&#10;+ Topic: string {get, init}&#10;+ Instruction: string {get, init}" style="text;html=0;whiteSpace=wrap;align=left;verticalAlign=top;fontSize=13;spacing=8;fillColor=none;strokeColor=none;" vertex="1" parent="n21">
<mxGeometry as="geometry" x="0" y="82" width="520" height="72" />
</mxCell>
<mxCell id="n23" value="+ GuidanceStep(int Order, string Topic, string Instruction)" style="text;html=0;whiteSpace=wrap;align=left;verticalAlign=top;fontSize=13;spacing=8;fillColor=none;strokeColor=none;" vertex="1" parent="n21">
<mxGeometry as="geometry" x="0" y="154" width="520" height="36" />
</mxCell>
<mxCell id="n21-sep" style="endArrow=none;strokeColor=#444444;" edge="1" parent="n21">
<mxGeometry as="geometry" relative="1">
<mxPoint as="sourcePoint" x="0" y="154" />
<mxPoint as="targetPoint" x="520" y="154" />
</mxGeometry>
</mxCell>
<mxCell id="n24" value="«class»&#10;ObservationController&#10;ApiGateway.Controllers" style="swimlane;startSize=82;horizontal=1;html=0;whiteSpace=wrap;align=center;verticalAlign=top;fontSize=13;fontStyle=1;spacing=7;fillColor=#dae8fc;strokeColor=#444444;" vertex="1" parent="1" sourceType="ApiGateway.Controllers.ObservationController" sourceFiles="src/ApiGateway/Controllers/ObservationController.cs" link="../../src/ApiGateway/Controllers/ObservationController.cs">
<mxGeometry as="geometry" x="2050" y="634" width="520" height="424" />
</mxCell>
<mxCell id="n25" value="(no declared attributes)" style="text;html=0;whiteSpace=wrap;align=left;verticalAlign=top;fontSize=13;spacing=8;fillColor=none;strokeColor=none;" vertex="1" parent="n24">
<mxGeometry as="geometry" x="0" y="82" width="520" height="36" />
</mxCell>
<mxCell id="n26" value="+ ObservationController(IHttpClientFactory clients)&#10;+ RecordObservation(Guid patientId, CancellationToken cancellationToken):&#10;Task&#10;+ DeleteObservation(Guid observationId, CancellationToken&#10;cancellationToken): Task&#10;+ UpdateObservation(Guid observationId, CancellationToken&#10;cancellationToken): Task&#10;+ PatchObservation(Guid observationId, CancellationToken&#10;cancellationToken): Task&#10;+ GetObservation(Guid observationId, CancellationToken&#10;cancellationToken): Task&#10;+ GetLatest(Guid patientId, CancellationToken cancellationToken): Task&#10;+ GetByPeriod(Guid patientId, CancellationToken cancellationToken): Task&#10;- ForwardAsync(HttpMethod method, string path, CancellationToken&#10;cancellationToken): Task&#10;- WriteFailureAsync(int status): Task" style="text;html=0;whiteSpace=wrap;align=left;verticalAlign=top;fontSize=13;spacing=8;fillColor=none;strokeColor=none;" vertex="1" parent="n24">
<mxGeometry as="geometry" x="0" y="118" width="520" height="306" />
</mxCell>
<mxCell id="n24-sep" style="endArrow=none;strokeColor=#444444;" edge="1" parent="n24">
<mxGeometry as="geometry" relative="1">
<mxPoint as="sourcePoint" x="0" y="118" />
<mxPoint as="targetPoint" x="520" y="118" />
</mxGeometry>
</mxCell>
<mxCell id="n27" value="«class»&#10;PatientController&#10;ApiGateway.Controllers" style="swimlane;startSize=82;horizontal=1;html=0;whiteSpace=wrap;align=center;verticalAlign=top;fontSize=13;fontStyle=1;spacing=7;fillColor=#dae8fc;strokeColor=#444444;" vertex="1" parent="1" sourceType="ApiGateway.Controllers.PatientController" sourceFiles="src/ApiGateway/Controllers/PatientController.cs" link="../../src/ApiGateway/Controllers/PatientController.cs">
<mxGeometry as="geometry" x="70" y="1238" width="520" height="280" />
</mxCell>
<mxCell id="n28" value="(no declared attributes)" style="text;html=0;whiteSpace=wrap;align=left;verticalAlign=top;fontSize=13;spacing=8;fillColor=none;strokeColor=none;" vertex="1" parent="n27">
<mxGeometry as="geometry" x="0" y="82" width="520" height="36" />
</mxCell>
<mxCell id="n29" value="+ PatientController(IHttpClientFactory clients)&#10;+ CreatePatient(CancellationToken cancellationToken): Task&#10;+ GetOwnPatient(CancellationToken cancellationToken): Task&#10;+ GetPatient(Guid patientId, CancellationToken cancellationToken): Task&#10;+ UpdatePatient(Guid patientId, CancellationToken cancellationToken): Task&#10;- ForwardAsync(HttpMethod method, string path, CancellationToken&#10;cancellationToken): Task&#10;- WriteFailureAsync(int status): Task" style="text;html=0;whiteSpace=wrap;align=left;verticalAlign=top;fontSize=13;spacing=8;fillColor=none;strokeColor=none;" vertex="1" parent="n27">
<mxGeometry as="geometry" x="0" y="118" width="520" height="162" />
</mxCell>
<mxCell id="n27-sep" style="endArrow=none;strokeColor=#444444;" edge="1" parent="n27">
<mxGeometry as="geometry" relative="1">
<mxPoint as="sourcePoint" x="0" y="118" />
<mxPoint as="targetPoint" x="520" y="118" />
</mxGeometry>
</mxCell>
<mxCell id="n30" value="«class»&#10;ProfessionalController&#10;ApiGateway.Controllers" style="swimlane;startSize=82;horizontal=1;html=0;whiteSpace=wrap;align=center;verticalAlign=top;fontSize=13;fontStyle=1;spacing=7;fillColor=#dae8fc;strokeColor=#444444;" vertex="1" parent="1" sourceType="ApiGateway.Controllers.ProfessionalController" sourceFiles="src/ApiGateway/Controllers/ProfessionalController.cs" link="../../src/ApiGateway/Controllers/ProfessionalController.cs">
<mxGeometry as="geometry" x="730" y="1238" width="520" height="172" />
</mxCell>
<mxCell id="n31" value="(no declared attributes)" style="text;html=0;whiteSpace=wrap;align=left;verticalAlign=top;fontSize=13;spacing=8;fillColor=none;strokeColor=none;" vertex="1" parent="n30">
<mxGeometry as="geometry" x="0" y="82" width="520" height="36" />
</mxCell>
<mxCell id="n32" value="+ ProfessionalController(ProfessionalAssignments assignments)&#10;+ GetAssignedPatients(): IActionResult" style="text;html=0;whiteSpace=wrap;align=left;verticalAlign=top;fontSize=13;spacing=8;fillColor=none;strokeColor=none;" vertex="1" parent="n30">
<mxGeometry as="geometry" x="0" y="118" width="520" height="54" />
</mxCell>
<mxCell id="n30-sep" style="endArrow=none;strokeColor=#444444;" edge="1" parent="n30">
<mxGeometry as="geometry" relative="1">
<mxPoint as="sourcePoint" x="0" y="118" />
<mxPoint as="targetPoint" x="520" y="118" />
</mxGeometry>
</mxCell>
<mxCell id="n33" value="«class»&#10;InternalServiceAuthenticationHandler&#10;ApiGateway.Security" style="swimlane;startSize=82;horizontal=1;html=0;whiteSpace=wrap;align=center;verticalAlign=top;fontSize=13;fontStyle=1;spacing=7;fillColor=#f8cecc;strokeColor=#444444;" vertex="1" parent="1" sourceType="ApiGateway.Security.InternalServiceAuthenticationHandler" sourceFiles="src/ApiGateway/Security/InternalServiceAuthenticationHandler.cs" link="../../src/ApiGateway/Security/InternalServiceAuthenticationHandler.cs">
<mxGeometry as="geometry" x="1390" y="1238" width="520" height="226" />
</mxCell>
<mxCell id="n34" value="(no declared attributes)" style="text;html=0;whiteSpace=wrap;align=left;verticalAlign=top;fontSize=13;spacing=8;fillColor=none;strokeColor=none;" vertex="1" parent="n33">
<mxGeometry as="geometry" x="0" y="82" width="520" height="36" />
</mxCell>
<mxCell id="n35" value="+&#10;InternalServiceAuthenticationHandler(IOptionsMonitor&lt;AuthenticationSchemeOptions&gt;&#10;options, ILoggerFactory logger, UrlEncoder encoder, IConfiguration&#10;configuration)&#10;# HandleAuthenticateAsync(): Task&lt;AuthenticateResult&gt;" style="text;html=0;whiteSpace=wrap;align=left;verticalAlign=top;fontSize=13;spacing=8;fillColor=none;strokeColor=none;" vertex="1" parent="n33">
<mxGeometry as="geometry" x="0" y="118" width="520" height="108" />
</mxCell>
<mxCell id="n33-sep" style="endArrow=none;strokeColor=#444444;" edge="1" parent="n33">
<mxGeometry as="geometry" relative="1">
<mxPoint as="sourcePoint" x="0" y="118" />
<mxPoint as="targetPoint" x="520" y="118" />
</mxGeometry>
</mxCell>
<mxCell id="n36" value="«class»&#10;PatientAccessMiddleware&#10;ApiGateway.Security" style="swimlane;startSize=82;horizontal=1;html=0;whiteSpace=wrap;align=center;verticalAlign=top;fontSize=13;fontStyle=1;spacing=7;fillColor=#f8cecc;strokeColor=#444444;" vertex="1" parent="1" sourceType="ApiGateway.Security.PatientAccessMiddleware" sourceFiles="src/ApiGateway/Security/PatientAccessMiddleware.cs" link="../../src/ApiGateway/Security/PatientAccessMiddleware.cs">
<mxGeometry as="geometry" x="2050" y="1238" width="520" height="208" />
</mxCell>
<mxCell id="n37" value="(no declared attributes)" style="text;html=0;whiteSpace=wrap;align=left;verticalAlign=top;fontSize=13;spacing=8;fillColor=none;strokeColor=none;" vertex="1" parent="n36">
<mxGeometry as="geometry" x="0" y="82" width="520" height="36" />
</mxCell>
<mxCell id="n38" value="+ PatientAccessMiddleware(RequestDelegate next)&#10;+ InvokeAsync(HttpContext context, IHttpClientFactory clients,&#10;IAuthorizationService authorization, ProfessionalAssignments&#10;assignments): Task" style="text;html=0;whiteSpace=wrap;align=left;verticalAlign=top;fontSize=13;spacing=8;fillColor=none;strokeColor=none;" vertex="1" parent="n36">
<mxGeometry as="geometry" x="0" y="118" width="520" height="90" />
</mxCell>
<mxCell id="n36-sep" style="endArrow=none;strokeColor=#444444;" edge="1" parent="n36">
<mxGeometry as="geometry" relative="1">
<mxPoint as="sourcePoint" x="0" y="118" />
<mxPoint as="targetPoint" x="520" y="118" />
</mxGeometry>
</mxCell>
<mxCell id="n39" value="«class»&#10;ProfessionalAssignments&#10;ApiGateway.Security" style="swimlane;startSize=82;horizontal=1;html=0;whiteSpace=wrap;align=center;verticalAlign=top;fontSize=13;fontStyle=1;spacing=7;fillColor=#f8cecc;strokeColor=#444444;" vertex="1" parent="1" sourceType="ApiGateway.Security.ProfessionalAssignments" sourceFiles="src/ApiGateway/Security/ProfessionalAssignments.cs" link="../../src/ApiGateway/Security/ProfessionalAssignments.cs">
<mxGeometry as="geometry" x="70" y="1698" width="520" height="190" />
</mxCell>
<mxCell id="n40" value="- assignments: Dictionary&lt;string, Guid[]&gt; {readonly}" style="text;html=0;whiteSpace=wrap;align=left;verticalAlign=top;fontSize=13;spacing=8;fillColor=none;strokeColor=none;" vertex="1" parent="n39">
<mxGeometry as="geometry" x="0" y="82" width="520" height="36" />
</mxCell>
<mxCell id="n41" value="+ ProfessionalAssignments(IConfiguration configuration)&#10;+ GetPatients(string accountId): IReadOnlyList&lt;Guid&gt;&#10;+ IsAssigned(string accountId, Guid patientId): bool" style="text;html=0;whiteSpace=wrap;align=left;verticalAlign=top;fontSize=13;spacing=8;fillColor=none;strokeColor=none;" vertex="1" parent="n39">
<mxGeometry as="geometry" x="0" y="118" width="520" height="72" />
</mxCell>
<mxCell id="n39-sep" style="endArrow=none;strokeColor=#444444;" edge="1" parent="n39">
<mxGeometry as="geometry" relative="1">
<mxPoint as="sourcePoint" x="0" y="118" />
<mxPoint as="targetPoint" x="520" y="118" />
</mxGeometry>
</mxCell>
<mxCell id="n42" value="«class»&#10;PrototypeAccount&#10;ApiGateway.Security" style="swimlane;startSize=82;horizontal=1;html=0;whiteSpace=wrap;align=center;verticalAlign=top;fontSize=13;fontStyle=1;spacing=7;fillColor=#f8cecc;strokeColor=#444444;" vertex="1" parent="1" sourceType="ApiGateway.Security.PrototypeAccount" sourceFiles="src/ApiGateway/Security/PrototypeAccounts.cs" link="../../src/ApiGateway/Security/PrototypeAccounts.cs">
<mxGeometry as="geometry" x="730" y="1698" width="520" height="190" />
</mxCell>
<mxCell id="n43" value="+ AccountId: string {get, set}&#10;+ Role: string {get, set}&#10;+ PasswordHash: string {get, set}" style="text;html=0;whiteSpace=wrap;align=left;verticalAlign=top;fontSize=13;spacing=8;fillColor=none;strokeColor=none;" vertex="1" parent="n42">
<mxGeometry as="geometry" x="0" y="82" width="520" height="72" />
</mxCell>
<mxCell id="n44" value="(no declared operations)" style="text;html=0;whiteSpace=wrap;align=left;verticalAlign=top;fontSize=13;spacing=8;fillColor=none;strokeColor=none;" vertex="1" parent="n42">
<mxGeometry as="geometry" x="0" y="154" width="520" height="36" />
</mxCell>
<mxCell id="n42-sep" style="endArrow=none;strokeColor=#444444;" edge="1" parent="n42">
<mxGeometry as="geometry" relative="1">
<mxPoint as="sourcePoint" x="0" y="154" />
<mxPoint as="targetPoint" x="520" y="154" />
</mxGeometry>
</mxCell>
<mxCell id="n45" value="«class»&#10;PrototypeAccounts&#10;ApiGateway.Security" style="swimlane;startSize=82;horizontal=1;html=0;whiteSpace=wrap;align=center;verticalAlign=top;fontSize=13;fontStyle=1;spacing=7;fillColor=#f8cecc;strokeColor=#444444;" vertex="1" parent="1" sourceType="ApiGateway.Security.PrototypeAccounts" sourceFiles="src/ApiGateway/Security/PrototypeAccounts.cs" link="../../src/ApiGateway/Security/PrototypeAccounts.cs">
<mxGeometry as="geometry" x="1390" y="1698" width="520" height="208" />
</mxCell>
<mxCell id="n46" value="- accounts: Dictionary&lt;string, PrototypeAccount&gt; {readonly}&#10;- hasher: PasswordHasher&lt;PrototypeAccount&gt; {readonly}&#10;- dummy: PrototypeAccount {readonly}" style="text;html=0;whiteSpace=wrap;align=left;verticalAlign=top;fontSize=13;spacing=8;fillColor=none;strokeColor=none;" vertex="1" parent="n45">
<mxGeometry as="geometry" x="0" y="82" width="520" height="72" />
</mxCell>
<mxCell id="n47" value="+ PrototypeAccounts(IConfiguration configuration)&#10;+ Verify(string accountId, string password): PrototypeAccount?" style="text;html=0;whiteSpace=wrap;align=left;verticalAlign=top;fontSize=13;spacing=8;fillColor=none;strokeColor=none;" vertex="1" parent="n45">
<mxGeometry as="geometry" x="0" y="154" width="520" height="54" />
</mxCell>
<mxCell id="n45-sep" style="endArrow=none;strokeColor=#444444;" edge="1" parent="n45">
<mxGeometry as="geometry" relative="1">
<mxPoint as="sourcePoint" x="0" y="154" />
<mxPoint as="targetPoint" x="520" y="154" />
</mxGeometry>
</mxCell>
<mxCell id="n48" value="«class»&#10;Program&#10;ApiGateway" style="swimlane;startSize=82;horizontal=1;html=0;whiteSpace=wrap;align=center;verticalAlign=top;fontSize=13;fontStyle=1;spacing=7;fillColor=#f5f5f5;strokeColor=#444444;" vertex="1" parent="1" sourceType="ApiGateway.Program" sourceFiles="src/ApiGateway/Program.cs" link="../../src/ApiGateway/Program.cs">
<mxGeometry as="geometry" x="2050" y="1698" width="520" height="172" />
</mxCell>
<mxCell id="n49" value="(no declared attributes)" style="text;html=0;whiteSpace=wrap;align=left;verticalAlign=top;fontSize=13;spacing=8;fillColor=none;strokeColor=none;" vertex="1" parent="n48">
<mxGeometry as="geometry" x="0" y="82" width="520" height="36" />
</mxCell>
<mxCell id="n50" value="+ Main(string[] args): void {static}&#10;- GetBaseUri(IConfiguration configuration, string service): Uri {static}" style="text;html=0;whiteSpace=wrap;align=left;verticalAlign=top;fontSize=13;spacing=8;fillColor=none;strokeColor=none;" vertex="1" parent="n48">
<mxGeometry as="geometry" x="0" y="118" width="520" height="54" />
</mxCell>
<mxCell id="n48-sep" style="endArrow=none;strokeColor=#444444;" edge="1" parent="n48">
<mxGeometry as="geometry" relative="1">
<mxPoint as="sourcePoint" x="0" y="118" />
<mxPoint as="targetPoint" x="520" y="118" />
</mxGeometry>
</mxCell>
<mxCell id="n51" value="«framework reference»&#10;ControllerBase" style="text;html=0;whiteSpace=wrap;align=left;verticalAlign=top;fontSize=13;spacing=8;align=center;fillColor=#ffffff;strokeColor=#777777;dashed=1;" vertex="1" parent="1">
<mxGeometry as="geometry" x="70" y="2086" width="520" height="80" />
</mxCell>
<mxCell id="n52" value="«framework reference»&#10;AuthenticationHandler&lt;AuthenticationSchemeOptions&gt;" style="text;html=0;whiteSpace=wrap;align=left;verticalAlign=top;fontSize=13;spacing=8;align=center;fillColor=#ffffff;strokeColor=#777777;dashed=1;" vertex="1" parent="1">
<mxGeometry as="geometry" x="730" y="2086" width="520" height="80" />
</mxCell>
<mxCell id="n53" value="«framework reference»&#10;IHttpClientFactory" style="text;html=0;whiteSpace=wrap;align=left;verticalAlign=top;fontSize=13;spacing=8;align=center;fillColor=#ffffff;strokeColor=#777777;dashed=1;" vertex="1" parent="1">
<mxGeometry as="geometry" x="1390" y="2086" width="520" height="80" />
</mxCell>
<mxCell id="n54" value="«framework reference»&#10;IConfiguration" style="text;html=0;whiteSpace=wrap;align=left;verticalAlign=top;fontSize=13;spacing=8;align=center;fillColor=#ffffff;strokeColor=#777777;dashed=1;" vertex="1" parent="1">
<mxGeometry as="geometry" x="2050" y="2086" width="520" height="80" />
</mxCell>
<mxCell id="n55" value="«framework reference»&#10;ILoggerFactory" style="text;html=0;whiteSpace=wrap;align=left;verticalAlign=top;fontSize=13;spacing=8;align=center;fillColor=#ffffff;strokeColor=#777777;dashed=1;" vertex="1" parent="1">
<mxGeometry as="geometry" x="70" y="2196" width="520" height="80" />
</mxCell>
<mxCell id="n56" value="«framework reference»&#10;UrlEncoder" style="text;html=0;whiteSpace=wrap;align=left;verticalAlign=top;fontSize=13;spacing=8;align=center;fillColor=#ffffff;strokeColor=#777777;dashed=1;" vertex="1" parent="1">
<mxGeometry as="geometry" x="730" y="2196" width="520" height="80" />
</mxCell>
<mxCell id="n57" value="«framework reference»&#10;RequestDelegate" style="text;html=0;whiteSpace=wrap;align=left;verticalAlign=top;fontSize=13;spacing=8;align=center;fillColor=#ffffff;strokeColor=#777777;dashed=1;" vertex="1" parent="1">
<mxGeometry as="geometry" x="1390" y="2196" width="520" height="80" />
</mxCell>
<mxCell id="e57-0" value="nested classifier" style="edgeStyle=orthogonalEdgeStyle;html=0;rounded=0;fontSize=11;labelBackgroundColor=#ffffff;dashed=1;endArrow=open;" edge="1" parent="1" source="n3" target="n6" relationship="nested">
<mxGeometry as="geometry" relative="1" />
</mxCell>
<mxCell id="e57-1" value="signature / constructor" style="edgeStyle=orthogonalEdgeStyle;html=0;rounded=0;fontSize=11;labelBackgroundColor=#ffffff;dashed=1;endArrow=open;" edge="1" parent="1" source="n3" target="n45" relationship="dependency">
<mxGeometry as="geometry" relative="1" />
</mxCell>
<mxCell id="e57-2" value="nested classifier" style="edgeStyle=orthogonalEdgeStyle;html=0;rounded=0;fontSize=11;labelBackgroundColor=#ffffff;dashed=1;endArrow=open;" edge="1" parent="1" source="n15" target="n21" relationship="nested">
<mxGeometry as="geometry" relative="1" />
</mxCell>
<mxCell id="e57-3" value="nested classifier" style="edgeStyle=orthogonalEdgeStyle;html=0;rounded=0;fontSize=11;labelBackgroundColor=#ffffff;dashed=1;endArrow=open;" edge="1" parent="1" source="n15" target="n18" relationship="nested">
<mxGeometry as="geometry" relative="1" />
</mxCell>
<mxCell id="e57-4" value="creates / configures" style="edgeStyle=orthogonalEdgeStyle;html=0;rounded=0;fontSize=11;labelBackgroundColor=#ffffff;dashed=1;endArrow=open;" edge="1" parent="1" source="n21" target="n18" relationship="dependency">
<mxGeometry as="geometry" relative="1" />
</mxCell>
<mxCell id="e57-5" value="creates / configures" style="edgeStyle=orthogonalEdgeStyle;html=0;rounded=0;fontSize=11;labelBackgroundColor=#ffffff;dashed=1;endArrow=open;" edge="1" parent="1" source="n18" target="n21" relationship="dependency">
<mxGeometry as="geometry" relative="1" />
</mxCell>
<mxCell id="e57-6" value="signature / constructor" style="edgeStyle=orthogonalEdgeStyle;html=0;rounded=0;fontSize=11;labelBackgroundColor=#ffffff;dashed=1;endArrow=open;" edge="1" parent="1" source="n30" target="n39" relationship="dependency">
<mxGeometry as="geometry" relative="1" />
</mxCell>
<mxCell id="e57-7" value="signature / constructor" style="edgeStyle=orthogonalEdgeStyle;html=0;rounded=0;fontSize=11;labelBackgroundColor=#ffffff;dashed=1;endArrow=open;" edge="1" parent="1" source="n36" target="n39" relationship="dependency">
<mxGeometry as="geometry" relative="1" />
</mxCell>
<mxCell id="e57-8" value="accounts [0..*]; hasher [1]; dummy [1]" style="edgeStyle=orthogonalEdgeStyle;html=0;rounded=0;fontSize=11;labelBackgroundColor=#ffffff;endArrow=none;" edge="1" parent="1" source="n45" target="n42" relationship="association">
<mxGeometry as="geometry" relative="1" />
</mxCell>
<mxCell id="e57-9" value="registers / configures" style="edgeStyle=orthogonalEdgeStyle;html=0;rounded=0;fontSize=11;labelBackgroundColor=#ffffff;dashed=1;endArrow=open;" edge="1" parent="1" source="n48" target="n33" relationship="dependency">
<mxGeometry as="geometry" relative="1" />
</mxCell>
<mxCell id="e57-10" value="registers / configures" style="edgeStyle=orthogonalEdgeStyle;html=0;rounded=0;fontSize=11;labelBackgroundColor=#ffffff;dashed=1;endArrow=open;" edge="1" parent="1" source="n48" target="n36" relationship="dependency">
<mxGeometry as="geometry" relative="1" />
</mxCell>
<mxCell id="e57-11" value="registers / configures" style="edgeStyle=orthogonalEdgeStyle;html=0;rounded=0;fontSize=11;labelBackgroundColor=#ffffff;dashed=1;endArrow=open;" edge="1" parent="1" source="n48" target="n39" relationship="dependency">
<mxGeometry as="geometry" relative="1" />
</mxCell>
<mxCell id="e57-12" value="registers / configures" style="edgeStyle=orthogonalEdgeStyle;html=0;rounded=0;fontSize=11;labelBackgroundColor=#ffffff;dashed=1;endArrow=open;" edge="1" parent="1" source="n48" target="n45" relationship="dependency">
<mxGeometry as="geometry" relative="1" />
</mxCell>
<mxCell id="e57-13" value="constructor dependency" style="edgeStyle=orthogonalEdgeStyle;html=0;rounded=0;fontSize=11;labelBackgroundColor=#ffffff;dashed=1;endArrow=open;" edge="1" parent="1" source="n9" target="n53" relationship="dependency">
<mxGeometry as="geometry" relative="1" />
</mxCell>
<mxCell id="e57-14" value="constructor dependency" style="edgeStyle=orthogonalEdgeStyle;html=0;rounded=0;fontSize=11;labelBackgroundColor=#ffffff;dashed=1;endArrow=open;" edge="1" parent="1" source="n12" target="n53" relationship="dependency">
<mxGeometry as="geometry" relative="1" />
</mxCell>
<mxCell id="e57-15" value="constructor dependency" style="edgeStyle=orthogonalEdgeStyle;html=0;rounded=0;fontSize=11;labelBackgroundColor=#ffffff;dashed=1;endArrow=open;" edge="1" parent="1" source="n24" target="n53" relationship="dependency">
<mxGeometry as="geometry" relative="1" />
</mxCell>
<mxCell id="e57-16" value="constructor dependency" style="edgeStyle=orthogonalEdgeStyle;html=0;rounded=0;fontSize=11;labelBackgroundColor=#ffffff;dashed=1;endArrow=open;" edge="1" parent="1" source="n27" target="n53" relationship="dependency">
<mxGeometry as="geometry" relative="1" />
</mxCell>
<mxCell id="e57-17" value="constructor dependency" style="edgeStyle=orthogonalEdgeStyle;html=0;rounded=0;fontSize=11;labelBackgroundColor=#ffffff;dashed=1;endArrow=open;" edge="1" parent="1" source="n33" target="n54" relationship="dependency">
<mxGeometry as="geometry" relative="1" />
</mxCell>
<mxCell id="e57-18" value="constructor dependency" style="edgeStyle=orthogonalEdgeStyle;html=0;rounded=0;fontSize=11;labelBackgroundColor=#ffffff;dashed=1;endArrow=open;" edge="1" parent="1" source="n39" target="n54" relationship="dependency">
<mxGeometry as="geometry" relative="1" />
</mxCell>
<mxCell id="e57-19" value="constructor dependency" style="edgeStyle=orthogonalEdgeStyle;html=0;rounded=0;fontSize=11;labelBackgroundColor=#ffffff;dashed=1;endArrow=open;" edge="1" parent="1" source="n45" target="n54" relationship="dependency">
<mxGeometry as="geometry" relative="1" />
</mxCell>
<mxCell id="e57-20" value="constructor dependency" style="edgeStyle=orthogonalEdgeStyle;html=0;rounded=0;fontSize=11;labelBackgroundColor=#ffffff;dashed=1;endArrow=open;" edge="1" parent="1" source="n33" target="n55" relationship="dependency">
<mxGeometry as="geometry" relative="1" />
</mxCell>
<mxCell id="e57-21" value="constructor dependency" style="edgeStyle=orthogonalEdgeStyle;html=0;rounded=0;fontSize=11;labelBackgroundColor=#ffffff;dashed=1;endArrow=open;" edge="1" parent="1" source="n33" target="n56" relationship="dependency">
<mxGeometry as="geometry" relative="1" />
</mxCell>
<mxCell id="e57-22" value="constructor dependency" style="edgeStyle=orthogonalEdgeStyle;html=0;rounded=0;fontSize=11;labelBackgroundColor=#ffffff;dashed=1;endArrow=open;" edge="1" parent="1" source="n36" target="n57" relationship="dependency">
<mxGeometry as="geometry" relative="1" />
</mxCell>
<mxCell id="e57-23" value="" style="edgeStyle=orthogonalEdgeStyle;html=0;rounded=0;fontSize=11;labelBackgroundColor=#ffffff;endArrow=block;endFill=0;" edge="1" parent="1" source="n3" target="n51" relationship="generalization">
<mxGeometry as="geometry" relative="1" />
</mxCell>
<mxCell id="e57-24" value="" style="edgeStyle=orthogonalEdgeStyle;html=0;rounded=0;fontSize=11;labelBackgroundColor=#ffffff;endArrow=block;endFill=0;" edge="1" parent="1" source="n9" target="n51" relationship="generalization">
<mxGeometry as="geometry" relative="1" />
</mxCell>
<mxCell id="e57-25" value="" style="edgeStyle=orthogonalEdgeStyle;html=0;rounded=0;fontSize=11;labelBackgroundColor=#ffffff;endArrow=block;endFill=0;" edge="1" parent="1" source="n12" target="n51" relationship="generalization">
<mxGeometry as="geometry" relative="1" />
</mxCell>
<mxCell id="e57-26" value="" style="edgeStyle=orthogonalEdgeStyle;html=0;rounded=0;fontSize=11;labelBackgroundColor=#ffffff;endArrow=block;endFill=0;" edge="1" parent="1" source="n15" target="n51" relationship="generalization">
<mxGeometry as="geometry" relative="1" />
</mxCell>
<mxCell id="e57-27" value="" style="edgeStyle=orthogonalEdgeStyle;html=0;rounded=0;fontSize=11;labelBackgroundColor=#ffffff;endArrow=block;endFill=0;" edge="1" parent="1" source="n24" target="n51" relationship="generalization">
<mxGeometry as="geometry" relative="1" />
</mxCell>
<mxCell id="e57-28" value="" style="edgeStyle=orthogonalEdgeStyle;html=0;rounded=0;fontSize=11;labelBackgroundColor=#ffffff;endArrow=block;endFill=0;" edge="1" parent="1" source="n27" target="n51" relationship="generalization">
<mxGeometry as="geometry" relative="1" />
</mxCell>
<mxCell id="e57-29" value="" style="edgeStyle=orthogonalEdgeStyle;html=0;rounded=0;fontSize=11;labelBackgroundColor=#ffffff;endArrow=block;endFill=0;" edge="1" parent="1" source="n30" target="n51" relationship="generalization">
<mxGeometry as="geometry" relative="1" />
</mxCell>
<mxCell id="e57-30" value="" style="edgeStyle=orthogonalEdgeStyle;html=0;rounded=0;fontSize=11;labelBackgroundColor=#ffffff;endArrow=block;endFill=0;" edge="1" parent="1" source="n33" target="n52" relationship="generalization">
<mxGeometry as="geometry" relative="1" />
</mxCell>
<mxCell id="n58" value="Source-linked classifier headers. All declared members shown; compiler-generated record members and inherited framework members are omitted. Partial declarations are merged. Framework base/reference boxes are distinguished from service-defined types. A dependency is not ownership or a cross-service in-process call. See class-diagram-coverage.md for exact file/type coverage." style="text;html=0;whiteSpace=wrap;align=left;verticalAlign=top;fontSize=13;spacing=8;" vertex="1" parent="1">
<mxGeometry as="geometry" x="40" y="2341" width="2580" height="110" />
</mxCell>
</root>
</mxGraphModel>
</diagram>
</mxfile>
@@ -0,0 +1,359 @@
<?xml version='1.0' encoding='utf-8'?>
<mxfile host="app.diagrams.net" version="24.7.17" compressed="false">
<diagram name="HealthOverviewService — implementation classes" id="HealthOverviewService---implementation-classes">
<mxGraphModel grid="1" gridSize="10" page="1" pageWidth="2660" pageHeight="2402" pageScale="1">
<root>
<mxCell id="0" />
<mxCell id="1" parent="0" />
<mxCell id="n459" value="HealthOverviewService — implementation classes" style="text;html=0;whiteSpace=wrap;align=left;verticalAlign=top;fontSize=13;spacing=8;fontSize=24;fontStyle=1;" vertex="1" parent="1">
<mxGeometry as="geometry" x="40" y="25" width="2580" height="45" />
</mxCell>
<mxCell id="n460" value="UML: + public, - private, # protected, ~ internal. Three compartments = classifier / attributes / operations. Hollow triangle: inheritance; dashed hollow triangle: interface realization. Solid line: attribute reference; dashed arrow: dependency; filled diamond: verified owned context. Each source type has its own classifier. Primary-constructor parameters are constructor operations, not invented fields." style="text;html=0;whiteSpace=wrap;align=left;verticalAlign=top;fontSize=13;spacing=8;" vertex="1" parent="1">
<mxGeometry as="geometry" x="40" y="85" width="2580" height="100" />
</mxCell>
<mxCell id="n461" value="«class»&#10;HealthOverviewController&#10;HealthOverviewService.Controllers" style="swimlane;startSize=82;horizontal=1;html=0;whiteSpace=wrap;align=center;verticalAlign=top;fontSize=13;fontStyle=1;spacing=7;fillColor=#dae8fc;strokeColor=#444444;" vertex="1" parent="1" sourceType="HealthOverviewService.Controllers.HealthOverviewController" sourceFiles="src/HealthOverviewService/Controllers/HealthOverviewController.cs" link="../../src/HealthOverviewService/Controllers/HealthOverviewController.cs">
<mxGeometry as="geometry" x="70" y="210" width="520" height="208" />
</mxCell>
<mxCell id="n462" value="(no declared attributes)" style="text;html=0;whiteSpace=wrap;align=left;verticalAlign=top;fontSize=13;spacing=8;fillColor=none;strokeColor=none;" vertex="1" parent="n461">
<mxGeometry as="geometry" x="0" y="82" width="520" height="36" />
</mxCell>
<mxCell id="n463" value="+ HealthOverviewController(HealthOverviewApplicationService service)&#10;+ GetOverview(Guid patientId, DateTime from, DateTime to,&#10;ContextSelection selection, CancellationToken cancellationToken):&#10;Task&lt;ActionResult&lt;HealthOverviewDto&gt;&gt;" style="text;html=0;whiteSpace=wrap;align=left;verticalAlign=top;fontSize=13;spacing=8;fillColor=none;strokeColor=none;" vertex="1" parent="n461">
<mxGeometry as="geometry" x="0" y="118" width="520" height="90" />
</mxCell>
<mxCell id="n461-sep" style="endArrow=none;strokeColor=#444444;" edge="1" parent="n461">
<mxGeometry as="geometry" relative="1">
<mxPoint as="sourcePoint" x="0" y="118" />
<mxPoint as="targetPoint" x="520" y="118" />
</mxGeometry>
</mxCell>
<mxCell id="n464" value="«class»&#10;HealthOverviewApplicationService&#10;HealthOverviewService.Application" style="swimlane;startSize=82;horizontal=1;html=0;whiteSpace=wrap;align=center;verticalAlign=top;fontSize=13;fontStyle=1;spacing=7;fillColor=#e1d5e7;strokeColor=#444444;" vertex="1" parent="1" sourceType="HealthOverviewService.Application.HealthOverviewApplicationService" sourceFiles="src/HealthOverviewService/Application/HealthOverviewApplicationService.cs" link="../../src/HealthOverviewService/Application/HealthOverviewApplicationService.cs">
<mxGeometry as="geometry" x="730" y="210" width="520" height="244" />
</mxCell>
<mxCell id="n465" value="(no declared attributes)" style="text;html=0;whiteSpace=wrap;align=left;verticalAlign=top;fontSize=13;spacing=8;fillColor=none;strokeColor=none;" vertex="1" parent="n464">
<mxGeometry as="geometry" x="0" y="82" width="520" height="36" />
</mxCell>
<mxCell id="n466" value="+ HealthOverviewApplicationService(PatientProfileServiceClient patients,&#10;ObservationServiceClient observations, InsightsServiceClient insights)&#10;+ GetOverviewAsync(Guid patientId, DateTime from, DateTime to,&#10;ContextSelection selection, CancellationToken cancellationToken):&#10;Task&lt;HealthOverviewDto?&gt;&#10;- NormalizeTimestamp(DateTime value): DateTime {static}" style="text;html=0;whiteSpace=wrap;align=left;verticalAlign=top;fontSize=13;spacing=8;fillColor=none;strokeColor=none;" vertex="1" parent="n464">
<mxGeometry as="geometry" x="0" y="118" width="520" height="126" />
</mxCell>
<mxCell id="n464-sep" style="endArrow=none;strokeColor=#444444;" edge="1" parent="n464">
<mxGeometry as="geometry" relative="1">
<mxPoint as="sourcePoint" x="0" y="118" />
<mxPoint as="targetPoint" x="520" y="118" />
</mxGeometry>
</mxCell>
<mxCell id="n467" value="«record»&#10;ContextSelection&#10;HealthOverviewService.Contracts" style="swimlane;startSize=82;horizontal=1;html=0;whiteSpace=wrap;align=center;verticalAlign=top;fontSize=13;fontStyle=1;spacing=7;fillColor=#ffe6cc;strokeColor=#444444;" vertex="1" parent="1" sourceType="HealthOverviewService.Contracts.ContextSelection" sourceFiles="src/HealthOverviewService/Contracts/HealthOverviewDto.cs" link="../../src/HealthOverviewService/Contracts/HealthOverviewDto.cs">
<mxGeometry as="geometry" x="1390" y="210" width="520" height="172" />
</mxCell>
<mxCell id="n468" value="+ Setting: string? {get, init}&#10;+ ActivityCondition: string? {get, init}" style="text;html=0;whiteSpace=wrap;align=left;verticalAlign=top;fontSize=13;spacing=8;fillColor=none;strokeColor=none;" vertex="1" parent="n467">
<mxGeometry as="geometry" x="0" y="82" width="520" height="54" />
</mxCell>
<mxCell id="n469" value="(no declared operations)" style="text;html=0;whiteSpace=wrap;align=left;verticalAlign=top;fontSize=13;spacing=8;fillColor=none;strokeColor=none;" vertex="1" parent="n467">
<mxGeometry as="geometry" x="0" y="136" width="520" height="36" />
</mxCell>
<mxCell id="n467-sep" style="endArrow=none;strokeColor=#444444;" edge="1" parent="n467">
<mxGeometry as="geometry" relative="1">
<mxPoint as="sourcePoint" x="0" y="136" />
<mxPoint as="targetPoint" x="520" y="136" />
</mxGeometry>
</mxCell>
<mxCell id="n470" value="«record»&#10;HealthInsightDto&#10;HealthOverviewService.Contracts" style="swimlane;startSize=82;horizontal=1;html=0;whiteSpace=wrap;align=center;verticalAlign=top;fontSize=13;fontStyle=1;spacing=7;fillColor=#ffe6cc;strokeColor=#444444;" vertex="1" parent="1" sourceType="HealthOverviewService.Contracts.HealthInsightDto" sourceFiles="src/HealthOverviewService/Contracts/HealthOverviewDto.cs" link="../../src/HealthOverviewService/Contracts/HealthOverviewDto.cs">
<mxGeometry as="geometry" x="2050" y="210" width="520" height="442" />
</mxCell>
<mxCell id="n471" value="+ PatientId: Guid {get, init}&#10;+ PeriodStart: DateTime {get, init}&#10;+ PeriodEnd: DateTime {get, init}&#10;+ AverageSystolic: decimal {get, init}&#10;+ AverageDiastolic: decimal {get, init}&#10;+ AveragePulse: decimal {get, init}&#10;+ MinSystolic: int {get, init}&#10;+ MaxSystolic: int {get, init}&#10;+ MinDiastolic: int {get, init}&#10;+ MaxDiastolic: int {get, init}&#10;+ AppliedSelection: ContextSelection {get, init}&#10;+ ContributingCount: int {get, init}&#10;+ ContextExplanation: string {get, init}" style="text;html=0;whiteSpace=wrap;align=left;verticalAlign=top;fontSize=13;spacing=8;fillColor=none;strokeColor=none;" vertex="1" parent="n470">
<mxGeometry as="geometry" x="0" y="82" width="520" height="252" />
</mxCell>
<mxCell id="n472" value="+ HealthInsightDto(Guid PatientId, DateTime PeriodStart, DateTime&#10;PeriodEnd, decimal AverageSystolic, decimal AverageDiastolic, decimal&#10;AveragePulse, int MinSystolic, int MaxSystolic, int MinDiastolic, int&#10;MaxDiastolic, ContextSelection AppliedSelection, int ContributingCount,&#10;string ContextExplanation)" style="text;html=0;whiteSpace=wrap;align=left;verticalAlign=top;fontSize=13;spacing=8;fillColor=none;strokeColor=none;" vertex="1" parent="n470">
<mxGeometry as="geometry" x="0" y="334" width="520" height="108" />
</mxCell>
<mxCell id="n470-sep" style="endArrow=none;strokeColor=#444444;" edge="1" parent="n470">
<mxGeometry as="geometry" relative="1">
<mxPoint as="sourcePoint" x="0" y="334" />
<mxPoint as="targetPoint" x="520" y="334" />
</mxGeometry>
</mxCell>
<mxCell id="n473" value="«record»&#10;HealthOverviewDto&#10;HealthOverviewService.Contracts" style="swimlane;startSize=82;horizontal=1;html=0;whiteSpace=wrap;align=center;verticalAlign=top;fontSize=13;fontStyle=1;spacing=7;fillColor=#ffe6cc;strokeColor=#444444;" vertex="1" parent="1" sourceType="HealthOverviewService.Contracts.HealthOverviewDto" sourceFiles="src/HealthOverviewService/Contracts/HealthOverviewDto.cs" link="../../src/HealthOverviewService/Contracts/HealthOverviewDto.cs">
<mxGeometry as="geometry" x="70" y="832" width="520" height="370" />
</mxCell>
<mxCell id="n474" value="+ Patient: PatientDto {get, init}&#10;+ LatestObservation: ObservationDto? {get, init}&#10;+ Insight: HealthInsightDto? {get, init}&#10;+ PeriodStart: DateTime {get, init}&#10;+ PeriodEnd: DateTime {get, init}&#10;+ InsightSelection: ContextSelection {get, init}&#10;+ InsightContributingCount: int {get, init}&#10;+ LatestObservationBasis: string {get, init}&#10;+ InsightExplanation: string {get, init}" style="text;html=0;whiteSpace=wrap;align=left;verticalAlign=top;fontSize=13;spacing=8;fillColor=none;strokeColor=none;" vertex="1" parent="n473">
<mxGeometry as="geometry" x="0" y="82" width="520" height="180" />
</mxCell>
<mxCell id="n475" value="+ HealthOverviewDto(PatientDto Patient, ObservationDto?&#10;LatestObservation, HealthInsightDto? Insight, DateTime PeriodStart,&#10;DateTime PeriodEnd, ContextSelection InsightSelection, int&#10;InsightContributingCount, string LatestObservationBasis, string&#10;InsightExplanation)" style="text;html=0;whiteSpace=wrap;align=left;verticalAlign=top;fontSize=13;spacing=8;fillColor=none;strokeColor=none;" vertex="1" parent="n473">
<mxGeometry as="geometry" x="0" y="262" width="520" height="108" />
</mxCell>
<mxCell id="n473-sep" style="endArrow=none;strokeColor=#444444;" edge="1" parent="n473">
<mxGeometry as="geometry" relative="1">
<mxPoint as="sourcePoint" x="0" y="262" />
<mxPoint as="targetPoint" x="520" y="262" />
</mxGeometry>
</mxCell>
<mxCell id="n476" value="«record»&#10;MeasurementContextDto&#10;HealthOverviewService.Contracts" style="swimlane;startSize=82;horizontal=1;html=0;whiteSpace=wrap;align=center;verticalAlign=top;fontSize=13;fontStyle=1;spacing=7;fillColor=#ffe6cc;strokeColor=#444444;" vertex="1" parent="1" sourceType="HealthOverviewService.Contracts.MeasurementContextDto" sourceFiles="src/HealthOverviewService/Contracts/HealthOverviewDto.cs" link="../../src/HealthOverviewService/Contracts/HealthOverviewDto.cs">
<mxGeometry as="geometry" x="730" y="832" width="520" height="316" />
</mxCell>
<mxCell id="n477" value="+ Setting: string {get, init}&#10;+ ActivityCondition: string {get, init}&#10;+ RestDurationMinutes: decimal? {get, init}&#10;+ BodyPosition: string? {get, init}&#10;+ MeasuredArm: string? {get, init}&#10;+ DeviceDetails: string? {get, init}&#10;+ CuffDetails: string? {get, init}&#10;+ AdditionalCircumstances: string? {get, init}" style="text;html=0;whiteSpace=wrap;align=left;verticalAlign=top;fontSize=13;spacing=8;fillColor=none;strokeColor=none;" vertex="1" parent="n476">
<mxGeometry as="geometry" x="0" y="82" width="520" height="162" />
</mxCell>
<mxCell id="n478" value="+ MeasurementContextDto(string Setting, string ActivityCondition,&#10;decimal? RestDurationMinutes, string? BodyPosition, string? MeasuredArm,&#10;string? DeviceDetails, string? CuffDetails, string? AdditionalCircumstances)" style="text;html=0;whiteSpace=wrap;align=left;verticalAlign=top;fontSize=13;spacing=8;fillColor=none;strokeColor=none;" vertex="1" parent="n476">
<mxGeometry as="geometry" x="0" y="244" width="520" height="72" />
</mxCell>
<mxCell id="n476-sep" style="endArrow=none;strokeColor=#444444;" edge="1" parent="n476">
<mxGeometry as="geometry" relative="1">
<mxPoint as="sourcePoint" x="0" y="244" />
<mxPoint as="targetPoint" x="520" y="244" />
</mxGeometry>
</mxCell>
<mxCell id="n479" value="«record»&#10;ObservationDto&#10;HealthOverviewService.Contracts" style="swimlane;startSize=82;horizontal=1;html=0;whiteSpace=wrap;align=center;verticalAlign=top;fontSize=13;fontStyle=1;spacing=7;fillColor=#ffe6cc;strokeColor=#444444;" vertex="1" parent="1" sourceType="HealthOverviewService.Contracts.ObservationDto" sourceFiles="src/HealthOverviewService/Contracts/HealthOverviewDto.cs" link="../../src/HealthOverviewService/Contracts/HealthOverviewDto.cs">
<mxGeometry as="geometry" x="1390" y="832" width="520" height="334" />
</mxCell>
<mxCell id="n480" value="+ ObservationId: Guid {get, init}&#10;+ PatientId: Guid {get, init}&#10;+ MeasuredAt: DateTime {get, init}&#10;+ Systolic: int {get, init}&#10;+ Diastolic: int {get, init}&#10;+ Pulse: int {get, init}&#10;+ Context: string? {get, init}&#10;+ Note: string? {get, init}&#10;+ MeasurementContext: MeasurementContextDto {get, init}" style="text;html=0;whiteSpace=wrap;align=left;verticalAlign=top;fontSize=13;spacing=8;fillColor=none;strokeColor=none;" vertex="1" parent="n479">
<mxGeometry as="geometry" x="0" y="82" width="520" height="180" />
</mxCell>
<mxCell id="n481" value="+ ObservationDto(Guid ObservationId, Guid PatientId, DateTime&#10;MeasuredAt, int Systolic, int Diastolic, int Pulse, string? Context, string?&#10;Note, MeasurementContextDto MeasurementContext)" style="text;html=0;whiteSpace=wrap;align=left;verticalAlign=top;fontSize=13;spacing=8;fillColor=none;strokeColor=none;" vertex="1" parent="n479">
<mxGeometry as="geometry" x="0" y="262" width="520" height="72" />
</mxCell>
<mxCell id="n479-sep" style="endArrow=none;strokeColor=#444444;" edge="1" parent="n479">
<mxGeometry as="geometry" relative="1">
<mxPoint as="sourcePoint" x="0" y="262" />
<mxPoint as="targetPoint" x="520" y="262" />
</mxGeometry>
</mxCell>
<mxCell id="n482" value="«record»&#10;PatientDto&#10;HealthOverviewService.Contracts" style="swimlane;startSize=82;horizontal=1;html=0;whiteSpace=wrap;align=center;verticalAlign=top;fontSize=13;fontStyle=1;spacing=7;fillColor=#ffe6cc;strokeColor=#444444;" vertex="1" parent="1" sourceType="HealthOverviewService.Contracts.PatientDto" sourceFiles="src/HealthOverviewService/Contracts/HealthOverviewDto.cs" link="../../src/HealthOverviewService/Contracts/HealthOverviewDto.cs">
<mxGeometry as="geometry" x="2050" y="832" width="520" height="226" />
</mxCell>
<mxCell id="n483" value="+ PatientId: Guid {get, init}&#10;+ Name: string {get, init}&#10;+ DateOfBirth: DateOnly {get, init}&#10;+ ContactInfo: string? {get, init}" style="text;html=0;whiteSpace=wrap;align=left;verticalAlign=top;fontSize=13;spacing=8;fillColor=none;strokeColor=none;" vertex="1" parent="n482">
<mxGeometry as="geometry" x="0" y="82" width="520" height="90" />
</mxCell>
<mxCell id="n484" value="+ PatientDto(Guid PatientId, string Name, DateOnly DateOfBirth, string?&#10;ContactInfo)" style="text;html=0;whiteSpace=wrap;align=left;verticalAlign=top;fontSize=13;spacing=8;fillColor=none;strokeColor=none;" vertex="1" parent="n482">
<mxGeometry as="geometry" x="0" y="172" width="520" height="54" />
</mxCell>
<mxCell id="n482-sep" style="endArrow=none;strokeColor=#444444;" edge="1" parent="n482">
<mxGeometry as="geometry" relative="1">
<mxPoint as="sourcePoint" x="0" y="172" />
<mxPoint as="targetPoint" x="520" y="172" />
</mxGeometry>
</mxCell>
<mxCell id="n485" value="«class»&#10;HttpInsightsServiceClient&#10;HealthOverviewService.Clients" style="swimlane;startSize=82;horizontal=1;html=0;whiteSpace=wrap;align=center;verticalAlign=top;fontSize=13;fontStyle=1;spacing=7;fillColor=#d5e8d4;strokeColor=#444444;" vertex="1" parent="1" sourceType="HealthOverviewService.Clients.HttpInsightsServiceClient" sourceFiles="src/HealthOverviewService/Clients/InsightsServiceClient.cs" link="../../src/HealthOverviewService/Clients/InsightsServiceClient.cs">
<mxGeometry as="geometry" x="70" y="1382" width="520" height="208" />
</mxCell>
<mxCell id="n486" value="(no declared attributes)" style="text;html=0;whiteSpace=wrap;align=left;verticalAlign=top;fontSize=13;spacing=8;fillColor=none;strokeColor=none;" vertex="1" parent="n485">
<mxGeometry as="geometry" x="0" y="82" width="520" height="36" />
</mxCell>
<mxCell id="n487" value="+ HttpInsightsServiceClient(HttpClient client)&#10;+ GetSummaryAsync(Guid patientId, DateTime from, DateTime to,&#10;ContextSelection selection, CancellationToken cancellationToken):&#10;Task&lt;HealthInsightDto?&gt;" style="text;html=0;whiteSpace=wrap;align=left;verticalAlign=top;fontSize=13;spacing=8;fillColor=none;strokeColor=none;" vertex="1" parent="n485">
<mxGeometry as="geometry" x="0" y="118" width="520" height="90" />
</mxCell>
<mxCell id="n485-sep" style="endArrow=none;strokeColor=#444444;" edge="1" parent="n485">
<mxGeometry as="geometry" relative="1">
<mxPoint as="sourcePoint" x="0" y="118" />
<mxPoint as="targetPoint" x="520" y="118" />
</mxGeometry>
</mxCell>
<mxCell id="n488" value="«class»&#10;HttpObservationServiceClient&#10;HealthOverviewService.Clients" style="swimlane;startSize=82;horizontal=1;html=0;whiteSpace=wrap;align=center;verticalAlign=top;fontSize=13;fontStyle=1;spacing=7;fillColor=#d5e8d4;strokeColor=#444444;" vertex="1" parent="1" sourceType="HealthOverviewService.Clients.HttpObservationServiceClient" sourceFiles="src/HealthOverviewService/Clients/ObservationServiceClient.cs" link="../../src/HealthOverviewService/Clients/ObservationServiceClient.cs">
<mxGeometry as="geometry" x="730" y="1382" width="520" height="190" />
</mxCell>
<mxCell id="n489" value="(no declared attributes)" style="text;html=0;whiteSpace=wrap;align=left;verticalAlign=top;fontSize=13;spacing=8;fillColor=none;strokeColor=none;" vertex="1" parent="n488">
<mxGeometry as="geometry" x="0" y="82" width="520" height="36" />
</mxCell>
<mxCell id="n490" value="+ HttpObservationServiceClient(HttpClient client)&#10;+ GetLatestAsync(Guid patientId, CancellationToken cancellationToken):&#10;Task&lt;ObservationDto?&gt;" style="text;html=0;whiteSpace=wrap;align=left;verticalAlign=top;fontSize=13;spacing=8;fillColor=none;strokeColor=none;" vertex="1" parent="n488">
<mxGeometry as="geometry" x="0" y="118" width="520" height="72" />
</mxCell>
<mxCell id="n488-sep" style="endArrow=none;strokeColor=#444444;" edge="1" parent="n488">
<mxGeometry as="geometry" relative="1">
<mxPoint as="sourcePoint" x="0" y="118" />
<mxPoint as="targetPoint" x="520" y="118" />
</mxGeometry>
</mxCell>
<mxCell id="n491" value="«class»&#10;HttpPatientProfileServiceClient&#10;HealthOverviewService.Clients" style="swimlane;startSize=82;horizontal=1;html=0;whiteSpace=wrap;align=center;verticalAlign=top;fontSize=13;fontStyle=1;spacing=7;fillColor=#d5e8d4;strokeColor=#444444;" vertex="1" parent="1" sourceType="HealthOverviewService.Clients.HttpPatientProfileServiceClient" sourceFiles="src/HealthOverviewService/Clients/PatientProfileServiceClient.cs" link="../../src/HealthOverviewService/Clients/PatientProfileServiceClient.cs">
<mxGeometry as="geometry" x="1390" y="1382" width="520" height="190" />
</mxCell>
<mxCell id="n492" value="(no declared attributes)" style="text;html=0;whiteSpace=wrap;align=left;verticalAlign=top;fontSize=13;spacing=8;fillColor=none;strokeColor=none;" vertex="1" parent="n491">
<mxGeometry as="geometry" x="0" y="82" width="520" height="36" />
</mxCell>
<mxCell id="n493" value="+ HttpPatientProfileServiceClient(HttpClient client)&#10;+ GetPatientAsync(Guid patientId, CancellationToken cancellationToken):&#10;Task&lt;PatientDto?&gt;" style="text;html=0;whiteSpace=wrap;align=left;verticalAlign=top;fontSize=13;spacing=8;fillColor=none;strokeColor=none;" vertex="1" parent="n491">
<mxGeometry as="geometry" x="0" y="118" width="520" height="72" />
</mxCell>
<mxCell id="n491-sep" style="endArrow=none;strokeColor=#444444;" edge="1" parent="n491">
<mxGeometry as="geometry" relative="1">
<mxPoint as="sourcePoint" x="0" y="118" />
<mxPoint as="targetPoint" x="520" y="118" />
</mxGeometry>
</mxCell>
<mxCell id="n494" value="«abstract class»&#10;InsightsServiceClient&#10;HealthOverviewService.Clients" style="swimlane;startSize=82;horizontal=1;html=0;whiteSpace=wrap;align=center;verticalAlign=top;fontSize=13;fontStyle=1;spacing=7;fillColor=#d5e8d4;strokeColor=#444444;" vertex="1" parent="1" sourceType="HealthOverviewService.Clients.InsightsServiceClient" sourceFiles="src/HealthOverviewService/Clients/InsightsServiceClient.cs" link="../../src/HealthOverviewService/Clients/InsightsServiceClient.cs">
<mxGeometry as="geometry" x="2050" y="1382" width="520" height="190" />
</mxCell>
<mxCell id="n495" value="(no declared attributes)" style="text;html=0;whiteSpace=wrap;align=left;verticalAlign=top;fontSize=13;spacing=8;fillColor=none;strokeColor=none;" vertex="1" parent="n494">
<mxGeometry as="geometry" x="0" y="82" width="520" height="36" />
</mxCell>
<mxCell id="n496" value="+ GetSummaryAsync(Guid patientId, DateTime from, DateTime to,&#10;ContextSelection selection, CancellationToken cancellationToken):&#10;Task&lt;HealthInsightDto?&gt; {abstract}" style="text;html=0;whiteSpace=wrap;align=left;verticalAlign=top;fontSize=13;spacing=8;fillColor=none;strokeColor=none;" vertex="1" parent="n494">
<mxGeometry as="geometry" x="0" y="118" width="520" height="72" />
</mxCell>
<mxCell id="n494-sep" style="endArrow=none;strokeColor=#444444;" edge="1" parent="n494">
<mxGeometry as="geometry" relative="1">
<mxPoint as="sourcePoint" x="0" y="118" />
<mxPoint as="targetPoint" x="520" y="118" />
</mxGeometry>
</mxCell>
<mxCell id="n497" value="«abstract class»&#10;ObservationServiceClient&#10;HealthOverviewService.Clients" style="swimlane;startSize=82;horizontal=1;html=0;whiteSpace=wrap;align=center;verticalAlign=top;fontSize=13;fontStyle=1;spacing=7;fillColor=#d5e8d4;strokeColor=#444444;" vertex="1" parent="1" sourceType="HealthOverviewService.Clients.ObservationServiceClient" sourceFiles="src/HealthOverviewService/Clients/ObservationServiceClient.cs" link="../../src/HealthOverviewService/Clients/ObservationServiceClient.cs">
<mxGeometry as="geometry" x="70" y="1770" width="520" height="172" />
</mxCell>
<mxCell id="n498" value="(no declared attributes)" style="text;html=0;whiteSpace=wrap;align=left;verticalAlign=top;fontSize=13;spacing=8;fillColor=none;strokeColor=none;" vertex="1" parent="n497">
<mxGeometry as="geometry" x="0" y="82" width="520" height="36" />
</mxCell>
<mxCell id="n499" value="+ GetLatestAsync(Guid patientId, CancellationToken cancellationToken):&#10;Task&lt;ObservationDto?&gt; {abstract}" style="text;html=0;whiteSpace=wrap;align=left;verticalAlign=top;fontSize=13;spacing=8;fillColor=none;strokeColor=none;" vertex="1" parent="n497">
<mxGeometry as="geometry" x="0" y="118" width="520" height="54" />
</mxCell>
<mxCell id="n497-sep" style="endArrow=none;strokeColor=#444444;" edge="1" parent="n497">
<mxGeometry as="geometry" relative="1">
<mxPoint as="sourcePoint" x="0" y="118" />
<mxPoint as="targetPoint" x="520" y="118" />
</mxGeometry>
</mxCell>
<mxCell id="n500" value="«abstract class»&#10;PatientProfileServiceClient&#10;HealthOverviewService.Clients" style="swimlane;startSize=82;horizontal=1;html=0;whiteSpace=wrap;align=center;verticalAlign=top;fontSize=13;fontStyle=1;spacing=7;fillColor=#d5e8d4;strokeColor=#444444;" vertex="1" parent="1" sourceType="HealthOverviewService.Clients.PatientProfileServiceClient" sourceFiles="src/HealthOverviewService/Clients/PatientProfileServiceClient.cs" link="../../src/HealthOverviewService/Clients/PatientProfileServiceClient.cs">
<mxGeometry as="geometry" x="730" y="1770" width="520" height="172" />
</mxCell>
<mxCell id="n501" value="(no declared attributes)" style="text;html=0;whiteSpace=wrap;align=left;verticalAlign=top;fontSize=13;spacing=8;fillColor=none;strokeColor=none;" vertex="1" parent="n500">
<mxGeometry as="geometry" x="0" y="82" width="520" height="36" />
</mxCell>
<mxCell id="n502" value="+ GetPatientAsync(Guid patientId, CancellationToken cancellationToken):&#10;Task&lt;PatientDto?&gt; {abstract}" style="text;html=0;whiteSpace=wrap;align=left;verticalAlign=top;fontSize=13;spacing=8;fillColor=none;strokeColor=none;" vertex="1" parent="n500">
<mxGeometry as="geometry" x="0" y="118" width="520" height="54" />
</mxCell>
<mxCell id="n500-sep" style="endArrow=none;strokeColor=#444444;" edge="1" parent="n500">
<mxGeometry as="geometry" relative="1">
<mxPoint as="sourcePoint" x="0" y="118" />
<mxPoint as="targetPoint" x="520" y="118" />
</mxGeometry>
</mxCell>
<mxCell id="n503" value="«class»&#10;Program&#10;HealthOverviewService" style="swimlane;startSize=82;horizontal=1;html=0;whiteSpace=wrap;align=center;verticalAlign=top;fontSize=13;fontStyle=1;spacing=7;fillColor=#f5f5f5;strokeColor=#444444;" vertex="1" parent="1" sourceType="HealthOverviewService.Program" sourceFiles="src/HealthOverviewService/Program.cs" link="../../src/HealthOverviewService/Program.cs">
<mxGeometry as="geometry" x="1390" y="1770" width="520" height="172" />
</mxCell>
<mxCell id="n504" value="(no declared attributes)" style="text;html=0;whiteSpace=wrap;align=left;verticalAlign=top;fontSize=13;spacing=8;fillColor=none;strokeColor=none;" vertex="1" parent="n503">
<mxGeometry as="geometry" x="0" y="82" width="520" height="36" />
</mxCell>
<mxCell id="n505" value="+ Main(string[] args): void {static}&#10;- GetGatewayUri(IConfiguration configuration): Uri {static}" style="text;html=0;whiteSpace=wrap;align=left;verticalAlign=top;fontSize=13;spacing=8;fillColor=none;strokeColor=none;" vertex="1" parent="n503">
<mxGeometry as="geometry" x="0" y="118" width="520" height="54" />
</mxCell>
<mxCell id="n503-sep" style="endArrow=none;strokeColor=#444444;" edge="1" parent="n503">
<mxGeometry as="geometry" relative="1">
<mxPoint as="sourcePoint" x="0" y="118" />
<mxPoint as="targetPoint" x="520" y="118" />
</mxGeometry>
</mxCell>
<mxCell id="n506" value="«framework reference»&#10;ControllerBase" style="text;html=0;whiteSpace=wrap;align=left;verticalAlign=top;fontSize=13;spacing=8;align=center;fillColor=#ffffff;strokeColor=#777777;dashed=1;" vertex="1" parent="1">
<mxGeometry as="geometry" x="70" y="2122" width="520" height="80" />
</mxCell>
<mxCell id="n507" value="«framework reference»&#10;HttpClient" style="text;html=0;whiteSpace=wrap;align=left;verticalAlign=top;fontSize=13;spacing=8;align=center;fillColor=#ffffff;strokeColor=#777777;dashed=1;" vertex="1" parent="1">
<mxGeometry as="geometry" x="730" y="2122" width="520" height="80" />
</mxCell>
<mxCell id="e507-0" value="signature / constructor" style="edgeStyle=orthogonalEdgeStyle;html=0;rounded=0;fontSize=11;labelBackgroundColor=#ffffff;dashed=1;endArrow=open;" edge="1" parent="1" source="n464" target="n494" relationship="dependency">
<mxGeometry as="geometry" relative="1" />
</mxCell>
<mxCell id="e507-1" value="signature / constructor" style="edgeStyle=orthogonalEdgeStyle;html=0;rounded=0;fontSize=11;labelBackgroundColor=#ffffff;dashed=1;endArrow=open;" edge="1" parent="1" source="n464" target="n497" relationship="dependency">
<mxGeometry as="geometry" relative="1" />
</mxCell>
<mxCell id="e507-2" value="signature / constructor" style="edgeStyle=orthogonalEdgeStyle;html=0;rounded=0;fontSize=11;labelBackgroundColor=#ffffff;dashed=1;endArrow=open;" edge="1" parent="1" source="n464" target="n500" relationship="dependency">
<mxGeometry as="geometry" relative="1" />
</mxCell>
<mxCell id="e507-3" value="signature / constructor" style="edgeStyle=orthogonalEdgeStyle;html=0;rounded=0;fontSize=11;labelBackgroundColor=#ffffff;dashed=1;endArrow=open;" edge="1" parent="1" source="n464" target="n467" relationship="dependency">
<mxGeometry as="geometry" relative="1" />
</mxCell>
<mxCell id="e507-4" value="signature / constructor" style="edgeStyle=orthogonalEdgeStyle;html=0;rounded=0;fontSize=11;labelBackgroundColor=#ffffff;dashed=1;endArrow=open;" edge="1" parent="1" source="n464" target="n473" relationship="dependency">
<mxGeometry as="geometry" relative="1" />
</mxCell>
<mxCell id="e507-5" value="signature / constructor" style="edgeStyle=orthogonalEdgeStyle;html=0;rounded=0;fontSize=11;labelBackgroundColor=#ffffff;dashed=1;endArrow=open;" edge="1" parent="1" source="n494" target="n467" relationship="dependency">
<mxGeometry as="geometry" relative="1" />
</mxCell>
<mxCell id="e507-6" value="signature / constructor" style="edgeStyle=orthogonalEdgeStyle;html=0;rounded=0;fontSize=11;labelBackgroundColor=#ffffff;dashed=1;endArrow=open;" edge="1" parent="1" source="n494" target="n470" relationship="dependency">
<mxGeometry as="geometry" relative="1" />
</mxCell>
<mxCell id="e507-7" value="" style="edgeStyle=orthogonalEdgeStyle;html=0;rounded=0;fontSize=11;labelBackgroundColor=#ffffff;endArrow=block;endFill=0;" edge="1" parent="1" source="n485" target="n494" relationship="generalization">
<mxGeometry as="geometry" relative="1" />
</mxCell>
<mxCell id="e507-8" value="signature / constructor" style="edgeStyle=orthogonalEdgeStyle;html=0;rounded=0;fontSize=11;labelBackgroundColor=#ffffff;dashed=1;endArrow=open;" edge="1" parent="1" source="n485" target="n467" relationship="dependency">
<mxGeometry as="geometry" relative="1" />
</mxCell>
<mxCell id="e507-9" value="signature / constructor" style="edgeStyle=orthogonalEdgeStyle;html=0;rounded=0;fontSize=11;labelBackgroundColor=#ffffff;dashed=1;endArrow=open;" edge="1" parent="1" source="n485" target="n470" relationship="dependency">
<mxGeometry as="geometry" relative="1" />
</mxCell>
<mxCell id="e507-10" value="signature / constructor" style="edgeStyle=orthogonalEdgeStyle;html=0;rounded=0;fontSize=11;labelBackgroundColor=#ffffff;dashed=1;endArrow=open;" edge="1" parent="1" source="n497" target="n479" relationship="dependency">
<mxGeometry as="geometry" relative="1" />
</mxCell>
<mxCell id="e507-11" value="" style="edgeStyle=orthogonalEdgeStyle;html=0;rounded=0;fontSize=11;labelBackgroundColor=#ffffff;endArrow=block;endFill=0;" edge="1" parent="1" source="n488" target="n497" relationship="generalization">
<mxGeometry as="geometry" relative="1" />
</mxCell>
<mxCell id="e507-12" value="signature / constructor" style="edgeStyle=orthogonalEdgeStyle;html=0;rounded=0;fontSize=11;labelBackgroundColor=#ffffff;dashed=1;endArrow=open;" edge="1" parent="1" source="n488" target="n479" relationship="dependency">
<mxGeometry as="geometry" relative="1" />
</mxCell>
<mxCell id="e507-13" value="signature / constructor" style="edgeStyle=orthogonalEdgeStyle;html=0;rounded=0;fontSize=11;labelBackgroundColor=#ffffff;dashed=1;endArrow=open;" edge="1" parent="1" source="n500" target="n482" relationship="dependency">
<mxGeometry as="geometry" relative="1" />
</mxCell>
<mxCell id="e507-14" value="" style="edgeStyle=orthogonalEdgeStyle;html=0;rounded=0;fontSize=11;labelBackgroundColor=#ffffff;endArrow=block;endFill=0;" edge="1" parent="1" source="n491" target="n500" relationship="generalization">
<mxGeometry as="geometry" relative="1" />
</mxCell>
<mxCell id="e507-15" value="signature / constructor" style="edgeStyle=orthogonalEdgeStyle;html=0;rounded=0;fontSize=11;labelBackgroundColor=#ffffff;dashed=1;endArrow=open;" edge="1" parent="1" source="n491" target="n482" relationship="dependency">
<mxGeometry as="geometry" relative="1" />
</mxCell>
<mxCell id="e507-16" value="MeasurementContext [1]" style="edgeStyle=orthogonalEdgeStyle;html=0;rounded=0;fontSize=11;labelBackgroundColor=#ffffff;endArrow=none;" edge="1" parent="1" source="n479" target="n476" relationship="association">
<mxGeometry as="geometry" relative="1" />
</mxCell>
<mxCell id="e507-17" value="AppliedSelection [1]" style="edgeStyle=orthogonalEdgeStyle;html=0;rounded=0;fontSize=11;labelBackgroundColor=#ffffff;endArrow=none;" edge="1" parent="1" source="n470" target="n467" relationship="association">
<mxGeometry as="geometry" relative="1" />
</mxCell>
<mxCell id="e507-18" value="InsightSelection [1]" style="edgeStyle=orthogonalEdgeStyle;html=0;rounded=0;fontSize=11;labelBackgroundColor=#ffffff;endArrow=none;" edge="1" parent="1" source="n473" target="n467" relationship="association">
<mxGeometry as="geometry" relative="1" />
</mxCell>
<mxCell id="e507-19" value="Patient [1]" style="edgeStyle=orthogonalEdgeStyle;html=0;rounded=0;fontSize=11;labelBackgroundColor=#ffffff;endArrow=none;" edge="1" parent="1" source="n473" target="n482" relationship="association">
<mxGeometry as="geometry" relative="1" />
</mxCell>
<mxCell id="e507-20" value="LatestObservation [0..1]" style="edgeStyle=orthogonalEdgeStyle;html=0;rounded=0;fontSize=11;labelBackgroundColor=#ffffff;endArrow=none;" edge="1" parent="1" source="n473" target="n479" relationship="association">
<mxGeometry as="geometry" relative="1" />
</mxCell>
<mxCell id="e507-21" value="Insight [0..1]" style="edgeStyle=orthogonalEdgeStyle;html=0;rounded=0;fontSize=11;labelBackgroundColor=#ffffff;endArrow=none;" edge="1" parent="1" source="n473" target="n470" relationship="association">
<mxGeometry as="geometry" relative="1" />
</mxCell>
<mxCell id="e507-22" value="signature / constructor" style="edgeStyle=orthogonalEdgeStyle;html=0;rounded=0;fontSize=11;labelBackgroundColor=#ffffff;dashed=1;endArrow=open;" edge="1" parent="1" source="n461" target="n464" relationship="dependency">
<mxGeometry as="geometry" relative="1" />
</mxCell>
<mxCell id="e507-23" value="signature / constructor" style="edgeStyle=orthogonalEdgeStyle;html=0;rounded=0;fontSize=11;labelBackgroundColor=#ffffff;dashed=1;endArrow=open;" edge="1" parent="1" source="n461" target="n467" relationship="dependency">
<mxGeometry as="geometry" relative="1" />
</mxCell>
<mxCell id="e507-24" value="signature / constructor" style="edgeStyle=orthogonalEdgeStyle;html=0;rounded=0;fontSize=11;labelBackgroundColor=#ffffff;dashed=1;endArrow=open;" edge="1" parent="1" source="n461" target="n473" relationship="dependency">
<mxGeometry as="geometry" relative="1" />
</mxCell>
<mxCell id="e507-25" value="registers / configures" style="edgeStyle=orthogonalEdgeStyle;html=0;rounded=0;fontSize=11;labelBackgroundColor=#ffffff;dashed=1;endArrow=open;" edge="1" parent="1" source="n503" target="n464" relationship="dependency">
<mxGeometry as="geometry" relative="1" />
</mxCell>
<mxCell id="e507-26" value="registers / configures" style="edgeStyle=orthogonalEdgeStyle;html=0;rounded=0;fontSize=11;labelBackgroundColor=#ffffff;dashed=1;endArrow=open;" edge="1" parent="1" source="n503" target="n494" relationship="dependency">
<mxGeometry as="geometry" relative="1" />
</mxCell>
<mxCell id="e507-27" value="registers / configures" style="edgeStyle=orthogonalEdgeStyle;html=0;rounded=0;fontSize=11;labelBackgroundColor=#ffffff;dashed=1;endArrow=open;" edge="1" parent="1" source="n503" target="n485" relationship="dependency">
<mxGeometry as="geometry" relative="1" />
</mxCell>
<mxCell id="e507-28" value="registers / configures" style="edgeStyle=orthogonalEdgeStyle;html=0;rounded=0;fontSize=11;labelBackgroundColor=#ffffff;dashed=1;endArrow=open;" edge="1" parent="1" source="n503" target="n497" relationship="dependency">
<mxGeometry as="geometry" relative="1" />
</mxCell>
<mxCell id="e507-29" value="registers / configures" style="edgeStyle=orthogonalEdgeStyle;html=0;rounded=0;fontSize=11;labelBackgroundColor=#ffffff;dashed=1;endArrow=open;" edge="1" parent="1" source="n503" target="n488" relationship="dependency">
<mxGeometry as="geometry" relative="1" />
</mxCell>
<mxCell id="e507-30" value="registers / configures" style="edgeStyle=orthogonalEdgeStyle;html=0;rounded=0;fontSize=11;labelBackgroundColor=#ffffff;dashed=1;endArrow=open;" edge="1" parent="1" source="n503" target="n500" relationship="dependency">
<mxGeometry as="geometry" relative="1" />
</mxCell>
<mxCell id="e507-31" value="registers / configures" style="edgeStyle=orthogonalEdgeStyle;html=0;rounded=0;fontSize=11;labelBackgroundColor=#ffffff;dashed=1;endArrow=open;" edge="1" parent="1" source="n503" target="n491" relationship="dependency">
<mxGeometry as="geometry" relative="1" />
</mxCell>
<mxCell id="e507-32" value="constructor dependency" style="edgeStyle=orthogonalEdgeStyle;html=0;rounded=0;fontSize=11;labelBackgroundColor=#ffffff;dashed=1;endArrow=open;" edge="1" parent="1" source="n485" target="n507" relationship="dependency">
<mxGeometry as="geometry" relative="1" />
</mxCell>
<mxCell id="e507-33" value="constructor dependency" style="edgeStyle=orthogonalEdgeStyle;html=0;rounded=0;fontSize=11;labelBackgroundColor=#ffffff;dashed=1;endArrow=open;" edge="1" parent="1" source="n488" target="n507" relationship="dependency">
<mxGeometry as="geometry" relative="1" />
</mxCell>
<mxCell id="e507-34" value="constructor dependency" style="edgeStyle=orthogonalEdgeStyle;html=0;rounded=0;fontSize=11;labelBackgroundColor=#ffffff;dashed=1;endArrow=open;" edge="1" parent="1" source="n491" target="n507" relationship="dependency">
<mxGeometry as="geometry" relative="1" />
</mxCell>
<mxCell id="e507-35" value="" style="edgeStyle=orthogonalEdgeStyle;html=0;rounded=0;fontSize=11;labelBackgroundColor=#ffffff;endArrow=block;endFill=0;" edge="1" parent="1" source="n461" target="n506" relationship="generalization">
<mxGeometry as="geometry" relative="1" />
</mxCell>
<mxCell id="n508" value="Source-linked classifier headers. All declared members shown; compiler-generated record members and inherited framework members are omitted. Partial declarations are merged. Framework base/reference boxes are distinguished from service-defined types. A dependency is not ownership or a cross-service in-process call. See class-diagram-coverage.md for exact file/type coverage." style="text;html=0;whiteSpace=wrap;align=left;verticalAlign=top;fontSize=13;spacing=8;" vertex="1" parent="1">
<mxGeometry as="geometry" x="40" y="2267" width="2580" height="110" />
</mxCell>
</root>
</mxGraphModel>
</diagram>
</mxfile>
@@ -0,0 +1,368 @@
<?xml version='1.0' encoding='utf-8'?>
<mxfile host="app.diagrams.net" version="24.7.17" compressed="false">
<diagram name="InsightsService — implementation classes" id="InsightsService---implementation-classes">
<mxGraphModel grid="1" gridSize="10" page="1" pageWidth="2660" pageHeight="2816" pageScale="1">
<root>
<mxCell id="0" />
<mxCell id="1" parent="0" />
<mxCell id="n353" value="InsightsService — implementation classes" style="text;html=0;whiteSpace=wrap;align=left;verticalAlign=top;fontSize=13;spacing=8;fontSize=24;fontStyle=1;" vertex="1" parent="1">
<mxGeometry as="geometry" x="40" y="25" width="2580" height="45" />
</mxCell>
<mxCell id="n354" value="UML: + public, - private, # protected, ~ internal. Three compartments = classifier / attributes / operations. Hollow triangle: inheritance; dashed hollow triangle: interface realization. Solid line: attribute reference; dashed arrow: dependency; filled diamond: verified owned context. Each source type has its own classifier. Primary-constructor parameters are constructor operations, not invented fields." style="text;html=0;whiteSpace=wrap;align=left;verticalAlign=top;fontSize=13;spacing=8;" vertex="1" parent="1">
<mxGeometry as="geometry" x="40" y="85" width="2580" height="100" />
</mxCell>
<mxCell id="n355" value="«class»&#10;InsightsController&#10;InsightsService.Controllers" style="swimlane;startSize=82;horizontal=1;html=0;whiteSpace=wrap;align=center;verticalAlign=top;fontSize=13;fontStyle=1;spacing=7;fillColor=#dae8fc;strokeColor=#444444;" vertex="1" parent="1" sourceType="InsightsService.Controllers.InsightsController" sourceFiles="src/InsightsService/Controllers/InsightsController.cs" link="../../src/InsightsService/Controllers/InsightsController.cs">
<mxGeometry as="geometry" x="70" y="210" width="520" height="262" />
</mxCell>
<mxCell id="n356" value="(no declared attributes)" style="text;html=0;whiteSpace=wrap;align=left;verticalAlign=top;fontSize=13;spacing=8;fillColor=none;strokeColor=none;" vertex="1" parent="n355">
<mxGeometry as="geometry" x="0" y="82" width="520" height="36" />
</mxCell>
<mxCell id="n357" value="+ InsightsController(InsightsApplicationService service)&#10;+ GetSummary(Guid patientId, DateTime from, DateTime to,&#10;ContextSelection selection, CancellationToken cancellationToken):&#10;Task&lt;ActionResult&lt;HealthInsightDto&gt;&gt;&#10;+ GetTrend(Guid patientId, DateTime from, DateTime to, ContextSelection&#10;selection, CancellationToken cancellationToken):&#10;Task&lt;ActionResult&lt;TrendAssessment&gt;&gt;" style="text;html=0;whiteSpace=wrap;align=left;verticalAlign=top;fontSize=13;spacing=8;fillColor=none;strokeColor=none;" vertex="1" parent="n355">
<mxGeometry as="geometry" x="0" y="118" width="520" height="144" />
</mxCell>
<mxCell id="n355-sep" style="endArrow=none;strokeColor=#444444;" edge="1" parent="n355">
<mxGeometry as="geometry" relative="1">
<mxPoint as="sourcePoint" x="0" y="118" />
<mxPoint as="targetPoint" x="520" y="118" />
</mxGeometry>
</mxCell>
<mxCell id="n358" value="«class»&#10;InsightsApplicationService&#10;InsightsService.Application" style="swimlane;startSize=82;horizontal=1;html=0;whiteSpace=wrap;align=center;verticalAlign=top;fontSize=13;fontStyle=1;spacing=7;fillColor=#e1d5e7;strokeColor=#444444;" vertex="1" parent="1" sourceType="InsightsService.Application.InsightsApplicationService" sourceFiles="src/InsightsService/Application/InsightsApplicationService.cs" link="../../src/InsightsService/Application/InsightsApplicationService.cs">
<mxGeometry as="geometry" x="730" y="210" width="520" height="298" />
</mxCell>
<mxCell id="n359" value="(no declared attributes)" style="text;html=0;whiteSpace=wrap;align=left;verticalAlign=top;fontSize=13;spacing=8;fillColor=none;strokeColor=none;" vertex="1" parent="n358">
<mxGeometry as="geometry" x="0" y="82" width="520" height="36" />
</mxCell>
<mxCell id="n360" value="+ InsightsApplicationService(ObservationServiceClient observations,&#10;InsightCalculator calculator)&#10;+ GetSummaryAsync(Guid patientId, DateTime from, DateTime to,&#10;ContextSelection selection, CancellationToken cancellationToken):&#10;Task&lt;HealthInsight?&gt;&#10;+ GetTrendAsync(Guid patientId, DateTime from, DateTime to,&#10;ContextSelection selection, CancellationToken cancellationToken):&#10;Task&lt;TrendAssessment&gt;&#10;- NormalizeTimestamp(DateTime value): DateTime {static}" style="text;html=0;whiteSpace=wrap;align=left;verticalAlign=top;fontSize=13;spacing=8;fillColor=none;strokeColor=none;" vertex="1" parent="n358">
<mxGeometry as="geometry" x="0" y="118" width="520" height="180" />
</mxCell>
<mxCell id="n358-sep" style="endArrow=none;strokeColor=#444444;" edge="1" parent="n358">
<mxGeometry as="geometry" relative="1">
<mxPoint as="sourcePoint" x="0" y="118" />
<mxPoint as="targetPoint" x="520" y="118" />
</mxGeometry>
</mxCell>
<mxCell id="n361" value="«record»&#10;ClinicalReference&#10;InsightsService.Domain" style="swimlane;startSize=82;horizontal=1;html=0;whiteSpace=wrap;align=center;verticalAlign=top;fontSize=13;fontStyle=1;spacing=7;fillColor=#fff2cc;strokeColor=#444444;" vertex="1" parent="1" sourceType="InsightsService.Domain.ClinicalReference" sourceFiles="src/InsightsService/Domain/TrendAssessment.cs" link="../../src/InsightsService/Domain/TrendAssessment.cs">
<mxGeometry as="geometry" x="1390" y="210" width="520" height="298" />
</mxCell>
<mxCell id="n362" value="+ Scope: string {get, init}&#10;+ LowerBoundary: decimal? {get, init}&#10;+ LowerComparison: string? {get, init}&#10;+ UpperBoundary: decimal {get, init}&#10;+ UpperComparison: string {get, init}&#10;+ Sources: IReadOnlyList&lt;ReferenceSource&gt; {get, init}&#10;+ Limitation: string {get, init}" style="text;html=0;whiteSpace=wrap;align=left;verticalAlign=top;fontSize=13;spacing=8;fillColor=none;strokeColor=none;" vertex="1" parent="n361">
<mxGeometry as="geometry" x="0" y="82" width="520" height="144" />
</mxCell>
<mxCell id="n363" value="+ ClinicalReference(string Scope, decimal? LowerBoundary, string?&#10;LowerComparison, decimal UpperBoundary, string UpperComparison,&#10;IReadOnlyList&lt;ReferenceSource&gt; Sources, string Limitation)" style="text;html=0;whiteSpace=wrap;align=left;verticalAlign=top;fontSize=13;spacing=8;fillColor=none;strokeColor=none;" vertex="1" parent="n361">
<mxGeometry as="geometry" x="0" y="226" width="520" height="72" />
</mxCell>
<mxCell id="n361-sep" style="endArrow=none;strokeColor=#444444;" edge="1" parent="n361">
<mxGeometry as="geometry" relative="1">
<mxPoint as="sourcePoint" x="0" y="226" />
<mxPoint as="targetPoint" x="520" y="226" />
</mxGeometry>
</mxCell>
<mxCell id="n364" value="«record»&#10;ComparabilityAssessment&#10;InsightsService.Domain" style="swimlane;startSize=82;horizontal=1;html=0;whiteSpace=wrap;align=center;verticalAlign=top;fontSize=13;fontStyle=1;spacing=7;fillColor=#fff2cc;strokeColor=#444444;" vertex="1" parent="1" sourceType="InsightsService.Domain.ComparabilityAssessment" sourceFiles="src/InsightsService/Domain/TrendAssessment.cs" link="../../src/InsightsService/Domain/TrendAssessment.cs">
<mxGeometry as="geometry" x="2050" y="210" width="520" height="298" />
</mxCell>
<mxCell id="n365" value="+ Status: string {get, init}&#10;+ KnownSimilarities: IReadOnlyList&lt;string&gt; {get, init}&#10;+ KnownDifferences: IReadOnlyList&lt;string&gt; {get, init}&#10;+ MissingDetails: IReadOnlyList&lt;string&gt; {get, init}&#10;+ Conflicts: IReadOnlyList&lt;string&gt; {get, init}&#10;+ Explanation: string {get, init}" style="text;html=0;whiteSpace=wrap;align=left;verticalAlign=top;fontSize=13;spacing=8;fillColor=none;strokeColor=none;" vertex="1" parent="n364">
<mxGeometry as="geometry" x="0" y="82" width="520" height="126" />
</mxCell>
<mxCell id="n366" value="+ ComparabilityAssessment(string Status, IReadOnlyList&lt;string&gt;&#10;KnownSimilarities, IReadOnlyList&lt;string&gt; KnownDifferences,&#10;IReadOnlyList&lt;string&gt; MissingDetails, IReadOnlyList&lt;string&gt; Conflicts,&#10;string Explanation)" style="text;html=0;whiteSpace=wrap;align=left;verticalAlign=top;fontSize=13;spacing=8;fillColor=none;strokeColor=none;" vertex="1" parent="n364">
<mxGeometry as="geometry" x="0" y="208" width="520" height="90" />
</mxCell>
<mxCell id="n364-sep" style="endArrow=none;strokeColor=#444444;" edge="1" parent="n364">
<mxGeometry as="geometry" relative="1">
<mxPoint as="sourcePoint" x="0" y="208" />
<mxPoint as="targetPoint" x="520" y="208" />
</mxGeometry>
</mxCell>
<mxCell id="n367" value="«record»&#10;ContextSelection&#10;InsightsService.Domain" style="swimlane;startSize=82;horizontal=1;html=0;whiteSpace=wrap;align=center;verticalAlign=top;fontSize=13;fontStyle=1;spacing=7;fillColor=#fff2cc;strokeColor=#444444;" vertex="1" parent="1" sourceType="InsightsService.Domain.ContextSelection" sourceFiles="src/InsightsService/Domain/ContextSelection.cs" link="../../src/InsightsService/Domain/ContextSelection.cs">
<mxGeometry as="geometry" x="70" y="688" width="520" height="172" />
</mxCell>
<mxCell id="n368" value="+ Setting: string? {get, init}&#10;+ ActivityCondition: string? {get, init}" style="text;html=0;whiteSpace=wrap;align=left;verticalAlign=top;fontSize=13;spacing=8;fillColor=none;strokeColor=none;" vertex="1" parent="n367">
<mxGeometry as="geometry" x="0" y="82" width="520" height="54" />
</mxCell>
<mxCell id="n369" value="(no declared operations)" style="text;html=0;whiteSpace=wrap;align=left;verticalAlign=top;fontSize=13;spacing=8;fillColor=none;strokeColor=none;" vertex="1" parent="n367">
<mxGeometry as="geometry" x="0" y="136" width="520" height="36" />
</mxCell>
<mxCell id="n367-sep" style="endArrow=none;strokeColor=#444444;" edge="1" parent="n367">
<mxGeometry as="geometry" relative="1">
<mxPoint as="sourcePoint" x="0" y="136" />
<mxPoint as="targetPoint" x="520" y="136" />
</mxGeometry>
</mxCell>
<mxCell id="n370" value="«record»&#10;HealthInsight&#10;InsightsService.Domain" style="swimlane;startSize=82;horizontal=1;html=0;whiteSpace=wrap;align=center;verticalAlign=top;fontSize=13;fontStyle=1;spacing=7;fillColor=#fff2cc;strokeColor=#444444;" vertex="1" parent="1" sourceType="InsightsService.Domain.HealthInsight" sourceFiles="src/InsightsService/Domain/HealthInsight.cs" link="../../src/InsightsService/Domain/HealthInsight.cs">
<mxGeometry as="geometry" x="730" y="688" width="520" height="442" />
</mxCell>
<mxCell id="n371" value="+ PatientId: Guid {get, init}&#10;+ PeriodStart: DateTime {get, init}&#10;+ PeriodEnd: DateTime {get, init}&#10;+ AverageSystolic: decimal {get, init}&#10;+ AverageDiastolic: decimal {get, init}&#10;+ AveragePulse: decimal {get, init}&#10;+ MinSystolic: int {get, init}&#10;+ MaxSystolic: int {get, init}&#10;+ MinDiastolic: int {get, init}&#10;+ MaxDiastolic: int {get, init}&#10;+ AppliedSelection: ContextSelection {get, init}&#10;+ ContributingCount: int {get, init}&#10;+ ContextExplanation: string {get, init}" style="text;html=0;whiteSpace=wrap;align=left;verticalAlign=top;fontSize=13;spacing=8;fillColor=none;strokeColor=none;" vertex="1" parent="n370">
<mxGeometry as="geometry" x="0" y="82" width="520" height="252" />
</mxCell>
<mxCell id="n372" value="+ HealthInsight(Guid PatientId, DateTime PeriodStart, DateTime PeriodEnd,&#10;decimal AverageSystolic, decimal AverageDiastolic, decimal AveragePulse,&#10;int MinSystolic, int MaxSystolic, int MinDiastolic, int MaxDiastolic,&#10;ContextSelection AppliedSelection, int ContributingCount, string&#10;ContextExplanation)" style="text;html=0;whiteSpace=wrap;align=left;verticalAlign=top;fontSize=13;spacing=8;fillColor=none;strokeColor=none;" vertex="1" parent="n370">
<mxGeometry as="geometry" x="0" y="334" width="520" height="108" />
</mxCell>
<mxCell id="n370-sep" style="endArrow=none;strokeColor=#444444;" edge="1" parent="n370">
<mxGeometry as="geometry" relative="1">
<mxPoint as="sourcePoint" x="0" y="334" />
<mxPoint as="targetPoint" x="520" y="334" />
</mxGeometry>
</mxCell>
<mxCell id="n373" value="«class»&#10;InsightCalculator&#10;InsightsService.Domain" style="swimlane;startSize=82;horizontal=1;html=0;whiteSpace=wrap;align=center;verticalAlign=top;fontSize=13;fontStyle=1;spacing=7;fillColor=#fff2cc;strokeColor=#444444;" vertex="1" parent="1" sourceType="InsightsService.Domain.InsightCalculator" sourceFiles="src/InsightsService/Domain/InsightCalculator.Trends.cs|src/InsightsService/Domain/InsightCalculator.cs" link="../../src/InsightsService/Domain/InsightCalculator.Trends.cs">
<mxGeometry as="geometry" x="1390" y="688" width="520" height="532" />
</mxCell>
<mxCell id="n374" value="- GeneralLimits: string {static}" style="text;html=0;whiteSpace=wrap;align=left;verticalAlign=top;fontSize=13;spacing=8;fillColor=none;strokeColor=none;" vertex="1" parent="n373">
<mxGeometry as="geometry" x="0" y="82" width="520" height="36" />
</mxCell>
<mxCell id="n375" value="+ CalculateTrend(Guid patientId, DateTime from, DateTime to,&#10;IReadOnlyList&lt;ObservationDto&gt; observations, ContextSelection selection):&#10;TrendAssessment&#10;- AssessMeasurement(string metric, string unit,&#10;IReadOnlyList&lt;ObservationDto&gt; observations, Func&lt;ObservationDto, int&gt;&#10;value, ComparabilityAssessment comparability): MeasurementAssessment&#10;{static}&#10;- SelectReference(string metric, IReadOnlyList&lt;ObservationDto&gt;&#10;observations, ComparabilityAssessment comparability): ClinicalReference?&#10;{static}&#10;- IsHigh(decimal value, ClinicalReference reference): bool {static}&#10;- IsLow(decimal value, ClinicalReference reference): bool {static}&#10;- Round(decimal value): decimal {static}&#10;- Format(decimal value): string {static}&#10;- AssessComparability(IReadOnlyList&lt;ObservationDto&gt; observations):&#10;ComparabilityAssessment {static}&#10;+ CalculateSummary(Guid patientId, DateTime from, DateTime to,&#10;IReadOnlyList&lt;ObservationDto&gt; observations, ContextSelection selection):&#10;HealthInsight?&#10;- DescribeContext(IReadOnlyList&lt;ObservationDto&gt; observations): string&#10;{static}&#10;- Counts(IEnumerable&lt;string&gt; values): string {static}" style="text;html=0;whiteSpace=wrap;align=left;verticalAlign=top;fontSize=13;spacing=8;fillColor=none;strokeColor=none;" vertex="1" parent="n373">
<mxGeometry as="geometry" x="0" y="118" width="520" height="414" />
</mxCell>
<mxCell id="n373-sep" style="endArrow=none;strokeColor=#444444;" edge="1" parent="n373">
<mxGeometry as="geometry" relative="1">
<mxPoint as="sourcePoint" x="0" y="118" />
<mxPoint as="targetPoint" x="520" y="118" />
</mxGeometry>
</mxCell>
<mxCell id="n376" value="«record»&#10;MeasurementAssessment&#10;InsightsService.Domain" style="swimlane;startSize=82;horizontal=1;html=0;whiteSpace=wrap;align=center;verticalAlign=top;fontSize=13;fontStyle=1;spacing=7;fillColor=#fff2cc;strokeColor=#444444;" vertex="1" parent="1" sourceType="InsightsService.Domain.MeasurementAssessment" sourceFiles="src/InsightsService/Domain/TrendAssessment.cs" link="../../src/InsightsService/Domain/TrendAssessment.cs">
<mxGeometry as="geometry" x="2050" y="688" width="520" height="532" />
</mxCell>
<mxCell id="n377" value="+ Metric: string {get, init}&#10;+ Unit: string {get, init}&#10;+ Mean: decimal? {get, init}&#10;+ Minimum: int? {get, init}&#10;+ Maximum: int? {get, init}&#10;+ Range: int? {get, init}&#10;+ DistinctTimestampCount: int {get, init}&#10;+ Direction: string {get, init}&#10;+ OverallDirection: string {get, init}&#10;+ SlopePerDay: decimal? {get, init}&#10;+ ReversalCount: int {get, init}&#10;+ TotalSuccessiveChange: decimal? {get, init}&#10;+ NumericalExplanation: string {get, init}&#10;+ Reference: ClinicalReference? {get, init}&#10;+ ReferenceComparison: string {get, init}&#10;+ Interpretation: string {get, init}&#10;+ Hint: string {get, init}" style="text;html=0;whiteSpace=wrap;align=left;verticalAlign=top;fontSize=13;spacing=8;fillColor=none;strokeColor=none;" vertex="1" parent="n376">
<mxGeometry as="geometry" x="0" y="82" width="520" height="324" />
</mxCell>
<mxCell id="n378" value="+ MeasurementAssessment(string Metric, string Unit, decimal? Mean, int?&#10;Minimum, int? Maximum, int? Range, int DistinctTimestampCount, string&#10;Direction, string OverallDirection, decimal? SlopePerDay, int&#10;ReversalCount, decimal? TotalSuccessiveChange, string&#10;NumericalExplanation, ClinicalReference? Reference, string&#10;ReferenceComparison, string Interpretation, string Hint)" style="text;html=0;whiteSpace=wrap;align=left;verticalAlign=top;fontSize=13;spacing=8;fillColor=none;strokeColor=none;" vertex="1" parent="n376">
<mxGeometry as="geometry" x="0" y="406" width="520" height="126" />
</mxCell>
<mxCell id="n376-sep" style="endArrow=none;strokeColor=#444444;" edge="1" parent="n376">
<mxGeometry as="geometry" relative="1">
<mxPoint as="sourcePoint" x="0" y="406" />
<mxPoint as="targetPoint" x="520" y="406" />
</mxGeometry>
</mxCell>
<mxCell id="n379" value="«record»&#10;ReferenceSource&#10;InsightsService.Domain" style="swimlane;startSize=82;horizontal=1;html=0;whiteSpace=wrap;align=center;verticalAlign=top;fontSize=13;fontStyle=1;spacing=7;fillColor=#fff2cc;strokeColor=#444444;" vertex="1" parent="1" sourceType="InsightsService.Domain.ReferenceSource" sourceFiles="src/InsightsService/Domain/TrendAssessment.cs" link="../../src/InsightsService/Domain/TrendAssessment.cs">
<mxGeometry as="geometry" x="70" y="1400" width="520" height="208" />
</mxCell>
<mxCell id="n380" value="+ Title: string {get, init}&#10;+ Url: string {get, init}&#10;+ Updated: string {get, init}&#10;+ Reviewed: string {get, init}" style="text;html=0;whiteSpace=wrap;align=left;verticalAlign=top;fontSize=13;spacing=8;fillColor=none;strokeColor=none;" vertex="1" parent="n379">
<mxGeometry as="geometry" x="0" y="82" width="520" height="90" />
</mxCell>
<mxCell id="n381" value="+ ReferenceSource(string Title, string Url, string Updated, string Reviewed)" style="text;html=0;whiteSpace=wrap;align=left;verticalAlign=top;fontSize=13;spacing=8;fillColor=none;strokeColor=none;" vertex="1" parent="n379">
<mxGeometry as="geometry" x="0" y="172" width="520" height="36" />
</mxCell>
<mxCell id="n379-sep" style="endArrow=none;strokeColor=#444444;" edge="1" parent="n379">
<mxGeometry as="geometry" relative="1">
<mxPoint as="sourcePoint" x="0" y="172" />
<mxPoint as="targetPoint" x="520" y="172" />
</mxGeometry>
</mxCell>
<mxCell id="n382" value="«record»&#10;TrendAssessment&#10;InsightsService.Domain" style="swimlane;startSize=82;horizontal=1;html=0;whiteSpace=wrap;align=center;verticalAlign=top;fontSize=13;fontStyle=1;spacing=7;fillColor=#fff2cc;strokeColor=#444444;" vertex="1" parent="1" sourceType="InsightsService.Domain.TrendAssessment" sourceFiles="src/InsightsService/Domain/TrendAssessment.cs" link="../../src/InsightsService/Domain/TrendAssessment.cs">
<mxGeometry as="geometry" x="730" y="1400" width="520" height="370" />
</mxCell>
<mxCell id="n383" value="+ PatientId: Guid {get, init}&#10;+ PeriodStart: DateTime {get, init}&#10;+ PeriodEnd: DateTime {get, init}&#10;+ AppliedSelection: ContextSelection {get, init}&#10;+ ContributingCount: int {get, init}&#10;+ Comparability: ComparabilityAssessment {get, init}&#10;+ Systolic: MeasurementAssessment {get, init}&#10;+ Diastolic: MeasurementAssessment {get, init}&#10;+ Pulse: MeasurementAssessment {get, init}" style="text;html=0;whiteSpace=wrap;align=left;verticalAlign=top;fontSize=13;spacing=8;fillColor=none;strokeColor=none;" vertex="1" parent="n382">
<mxGeometry as="geometry" x="0" y="82" width="520" height="180" />
</mxCell>
<mxCell id="n384" value="+ TrendAssessment(Guid PatientId, DateTime PeriodStart, DateTime&#10;PeriodEnd, ContextSelection AppliedSelection, int ContributingCount,&#10;ComparabilityAssessment Comparability, MeasurementAssessment&#10;Systolic, MeasurementAssessment Diastolic, MeasurementAssessment&#10;Pulse)" style="text;html=0;whiteSpace=wrap;align=left;verticalAlign=top;fontSize=13;spacing=8;fillColor=none;strokeColor=none;" vertex="1" parent="n382">
<mxGeometry as="geometry" x="0" y="262" width="520" height="108" />
</mxCell>
<mxCell id="n382-sep" style="endArrow=none;strokeColor=#444444;" edge="1" parent="n382">
<mxGeometry as="geometry" relative="1">
<mxPoint as="sourcePoint" x="0" y="262" />
<mxPoint as="targetPoint" x="520" y="262" />
</mxGeometry>
</mxCell>
<mxCell id="n385" value="«record»&#10;HealthInsightDto&#10;InsightsService.Contracts" style="swimlane;startSize=82;horizontal=1;html=0;whiteSpace=wrap;align=center;verticalAlign=top;fontSize=13;fontStyle=1;spacing=7;fillColor=#ffe6cc;strokeColor=#444444;" vertex="1" parent="1" sourceType="InsightsService.Contracts.HealthInsightDto" sourceFiles="src/InsightsService/Contracts/HealthInsightDto.cs" link="../../src/InsightsService/Contracts/HealthInsightDto.cs">
<mxGeometry as="geometry" x="1390" y="1400" width="520" height="442" />
</mxCell>
<mxCell id="n386" value="+ PatientId: Guid {get, init}&#10;+ PeriodStart: DateTime {get, init}&#10;+ PeriodEnd: DateTime {get, init}&#10;+ AverageSystolic: decimal {get, init}&#10;+ AverageDiastolic: decimal {get, init}&#10;+ AveragePulse: decimal {get, init}&#10;+ MinSystolic: int {get, init}&#10;+ MaxSystolic: int {get, init}&#10;+ MinDiastolic: int {get, init}&#10;+ MaxDiastolic: int {get, init}&#10;+ AppliedSelection: ContextSelection {get, init}&#10;+ ContributingCount: int {get, init}&#10;+ ContextExplanation: string {get, init}" style="text;html=0;whiteSpace=wrap;align=left;verticalAlign=top;fontSize=13;spacing=8;fillColor=none;strokeColor=none;" vertex="1" parent="n385">
<mxGeometry as="geometry" x="0" y="82" width="520" height="252" />
</mxCell>
<mxCell id="n387" value="+ HealthInsightDto(Guid PatientId, DateTime PeriodStart, DateTime&#10;PeriodEnd, decimal AverageSystolic, decimal AverageDiastolic, decimal&#10;AveragePulse, int MinSystolic, int MaxSystolic, int MinDiastolic, int&#10;MaxDiastolic, ContextSelection AppliedSelection, int ContributingCount,&#10;string ContextExplanation)" style="text;html=0;whiteSpace=wrap;align=left;verticalAlign=top;fontSize=13;spacing=8;fillColor=none;strokeColor=none;" vertex="1" parent="n385">
<mxGeometry as="geometry" x="0" y="334" width="520" height="108" />
</mxCell>
<mxCell id="n385-sep" style="endArrow=none;strokeColor=#444444;" edge="1" parent="n385">
<mxGeometry as="geometry" relative="1">
<mxPoint as="sourcePoint" x="0" y="334" />
<mxPoint as="targetPoint" x="520" y="334" />
</mxGeometry>
</mxCell>
<mxCell id="n388" value="«record»&#10;MeasurementContextDto&#10;InsightsService.Contracts" style="swimlane;startSize=82;horizontal=1;html=0;whiteSpace=wrap;align=center;verticalAlign=top;fontSize=13;fontStyle=1;spacing=7;fillColor=#ffe6cc;strokeColor=#444444;" vertex="1" parent="1" sourceType="InsightsService.Contracts.MeasurementContextDto" sourceFiles="src/InsightsService/Contracts/ObservationDto.cs" link="../../src/InsightsService/Contracts/ObservationDto.cs">
<mxGeometry as="geometry" x="2050" y="1400" width="520" height="316" />
</mxCell>
<mxCell id="n389" value="+ Setting: string? {get, init}&#10;+ ActivityCondition: string? {get, init}&#10;+ RestDurationMinutes: decimal? {get, init}&#10;+ BodyPosition: string? {get, init}&#10;+ MeasuredArm: string? {get, init}&#10;+ DeviceDetails: string? {get, init}&#10;+ CuffDetails: string? {get, init}&#10;+ AdditionalCircumstances: string? {get, init}" style="text;html=0;whiteSpace=wrap;align=left;verticalAlign=top;fontSize=13;spacing=8;fillColor=none;strokeColor=none;" vertex="1" parent="n388">
<mxGeometry as="geometry" x="0" y="82" width="520" height="162" />
</mxCell>
<mxCell id="n390" value="+ MeasurementContextDto(string? Setting, string? ActivityCondition,&#10;decimal? RestDurationMinutes, string? BodyPosition, string? MeasuredArm,&#10;string? DeviceDetails, string? CuffDetails, string? AdditionalCircumstances)" style="text;html=0;whiteSpace=wrap;align=left;verticalAlign=top;fontSize=13;spacing=8;fillColor=none;strokeColor=none;" vertex="1" parent="n388">
<mxGeometry as="geometry" x="0" y="244" width="520" height="72" />
</mxCell>
<mxCell id="n388-sep" style="endArrow=none;strokeColor=#444444;" edge="1" parent="n388">
<mxGeometry as="geometry" relative="1">
<mxPoint as="sourcePoint" x="0" y="244" />
<mxPoint as="targetPoint" x="520" y="244" />
</mxGeometry>
</mxCell>
<mxCell id="n391" value="«record»&#10;ObservationDto&#10;InsightsService.Contracts" style="swimlane;startSize=82;horizontal=1;html=0;whiteSpace=wrap;align=center;verticalAlign=top;fontSize=13;fontStyle=1;spacing=7;fillColor=#ffe6cc;strokeColor=#444444;" vertex="1" parent="1" sourceType="InsightsService.Contracts.ObservationDto" sourceFiles="src/InsightsService/Contracts/ObservationDto.cs" link="../../src/InsightsService/Contracts/ObservationDto.cs">
<mxGeometry as="geometry" x="70" y="2022" width="520" height="334" />
</mxCell>
<mxCell id="n392" value="+ ObservationId: Guid {get, init}&#10;+ PatientId: Guid {get, init}&#10;+ MeasuredAt: DateTime {get, init}&#10;+ Systolic: int {get, init}&#10;+ Diastolic: int {get, init}&#10;+ Pulse: int {get, init}&#10;+ MeasurementContext: MeasurementContextDto? {get, init}&#10;+ Context: string? {get, init}&#10;+ Note: string? {get, init}" style="text;html=0;whiteSpace=wrap;align=left;verticalAlign=top;fontSize=13;spacing=8;fillColor=none;strokeColor=none;" vertex="1" parent="n391">
<mxGeometry as="geometry" x="0" y="82" width="520" height="180" />
</mxCell>
<mxCell id="n393" value="+ ObservationDto(Guid ObservationId, Guid PatientId, DateTime&#10;MeasuredAt, int Systolic, int Diastolic, int Pulse, MeasurementContextDto?&#10;MeasurementContext = null, string? Context = null, string? Note = null)" style="text;html=0;whiteSpace=wrap;align=left;verticalAlign=top;fontSize=13;spacing=8;fillColor=none;strokeColor=none;" vertex="1" parent="n391">
<mxGeometry as="geometry" x="0" y="262" width="520" height="72" />
</mxCell>
<mxCell id="n391-sep" style="endArrow=none;strokeColor=#444444;" edge="1" parent="n391">
<mxGeometry as="geometry" relative="1">
<mxPoint as="sourcePoint" x="0" y="262" />
<mxPoint as="targetPoint" x="520" y="262" />
</mxGeometry>
</mxCell>
<mxCell id="n394" value="«class»&#10;HttpObservationServiceClient&#10;InsightsService.Clients" style="swimlane;startSize=82;horizontal=1;html=0;whiteSpace=wrap;align=center;verticalAlign=top;fontSize=13;fontStyle=1;spacing=7;fillColor=#d5e8d4;strokeColor=#444444;" vertex="1" parent="1" sourceType="InsightsService.Clients.HttpObservationServiceClient" sourceFiles="src/InsightsService/Clients/HttpObservationServiceClient.cs" link="../../src/InsightsService/Clients/HttpObservationServiceClient.cs">
<mxGeometry as="geometry" x="730" y="2022" width="520" height="208" />
</mxCell>
<mxCell id="n395" value="(no declared attributes)" style="text;html=0;whiteSpace=wrap;align=left;verticalAlign=top;fontSize=13;spacing=8;fillColor=none;strokeColor=none;" vertex="1" parent="n394">
<mxGeometry as="geometry" x="0" y="82" width="520" height="36" />
</mxCell>
<mxCell id="n396" value="+ HttpObservationServiceClient(HttpClient client)&#10;+ GetByPeriodAsync(Guid patientId, DateTime from, DateTime to,&#10;ContextSelection selection, CancellationToken cancellationToken):&#10;Task&lt;List&lt;ObservationDto&gt;&gt;" style="text;html=0;whiteSpace=wrap;align=left;verticalAlign=top;fontSize=13;spacing=8;fillColor=none;strokeColor=none;" vertex="1" parent="n394">
<mxGeometry as="geometry" x="0" y="118" width="520" height="90" />
</mxCell>
<mxCell id="n394-sep" style="endArrow=none;strokeColor=#444444;" edge="1" parent="n394">
<mxGeometry as="geometry" relative="1">
<mxPoint as="sourcePoint" x="0" y="118" />
<mxPoint as="targetPoint" x="520" y="118" />
</mxGeometry>
</mxCell>
<mxCell id="n397" value="«interface»&#10;ObservationServiceClient&#10;InsightsService.Clients" style="swimlane;startSize=82;horizontal=1;html=0;whiteSpace=wrap;align=center;verticalAlign=top;fontSize=13;fontStyle=1;spacing=7;fillColor=#d5e8d4;strokeColor=#444444;" vertex="1" parent="1" sourceType="InsightsService.Clients.ObservationServiceClient" sourceFiles="src/InsightsService/Clients/ObservationServiceClient.cs" link="../../src/InsightsService/Clients/ObservationServiceClient.cs">
<mxGeometry as="geometry" x="1390" y="2022" width="520" height="190" />
</mxCell>
<mxCell id="n398" value="(no declared attributes)" style="text;html=0;whiteSpace=wrap;align=left;verticalAlign=top;fontSize=13;spacing=8;fillColor=none;strokeColor=none;" vertex="1" parent="n397">
<mxGeometry as="geometry" x="0" y="82" width="520" height="36" />
</mxCell>
<mxCell id="n399" value="+ GetByPeriodAsync(Guid patientId, DateTime from, DateTime to,&#10;ContextSelection selection, CancellationToken cancellationToken):&#10;Task&lt;List&lt;ObservationDto&gt;&gt; {abstract}" style="text;html=0;whiteSpace=wrap;align=left;verticalAlign=top;fontSize=13;spacing=8;fillColor=none;strokeColor=none;" vertex="1" parent="n397">
<mxGeometry as="geometry" x="0" y="118" width="520" height="72" />
</mxCell>
<mxCell id="n397-sep" style="endArrow=none;strokeColor=#444444;" edge="1" parent="n397">
<mxGeometry as="geometry" relative="1">
<mxPoint as="sourcePoint" x="0" y="118" />
<mxPoint as="targetPoint" x="520" y="118" />
</mxGeometry>
</mxCell>
<mxCell id="n400" value="«class»&#10;Program&#10;InsightsService" style="swimlane;startSize=82;horizontal=1;html=0;whiteSpace=wrap;align=center;verticalAlign=top;fontSize=13;fontStyle=1;spacing=7;fillColor=#f5f5f5;strokeColor=#444444;" vertex="1" parent="1" sourceType="InsightsService.Program" sourceFiles="src/InsightsService/Program.cs" link="../../src/InsightsService/Program.cs">
<mxGeometry as="geometry" x="2050" y="2022" width="520" height="172" />
</mxCell>
<mxCell id="n401" value="(no declared attributes)" style="text;html=0;whiteSpace=wrap;align=left;verticalAlign=top;fontSize=13;spacing=8;fillColor=none;strokeColor=none;" vertex="1" parent="n400">
<mxGeometry as="geometry" x="0" y="82" width="520" height="36" />
</mxCell>
<mxCell id="n402" value="+ Main(string[] args): void {static}&#10;- GetGatewayUri(IConfiguration configuration): Uri {static}" style="text;html=0;whiteSpace=wrap;align=left;verticalAlign=top;fontSize=13;spacing=8;fillColor=none;strokeColor=none;" vertex="1" parent="n400">
<mxGeometry as="geometry" x="0" y="118" width="520" height="54" />
</mxCell>
<mxCell id="n400-sep" style="endArrow=none;strokeColor=#444444;" edge="1" parent="n400">
<mxGeometry as="geometry" relative="1">
<mxPoint as="sourcePoint" x="0" y="118" />
<mxPoint as="targetPoint" x="520" y="118" />
</mxGeometry>
</mxCell>
<mxCell id="n403" value="«framework reference»&#10;ControllerBase" style="text;html=0;whiteSpace=wrap;align=left;verticalAlign=top;fontSize=13;spacing=8;align=center;fillColor=#ffffff;strokeColor=#777777;dashed=1;" vertex="1" parent="1">
<mxGeometry as="geometry" x="70" y="2536" width="520" height="80" />
</mxCell>
<mxCell id="n404" value="«framework reference»&#10;HttpClient" style="text;html=0;whiteSpace=wrap;align=left;verticalAlign=top;fontSize=13;spacing=8;align=center;fillColor=#ffffff;strokeColor=#777777;dashed=1;" vertex="1" parent="1">
<mxGeometry as="geometry" x="730" y="2536" width="520" height="80" />
</mxCell>
<mxCell id="e404-0" value="signature / constructor" style="edgeStyle=orthogonalEdgeStyle;html=0;rounded=0;fontSize=11;labelBackgroundColor=#ffffff;dashed=1;endArrow=open;" edge="1" parent="1" source="n358" target="n397" relationship="dependency">
<mxGeometry as="geometry" relative="1" />
</mxCell>
<mxCell id="e404-1" value="signature / constructor" style="edgeStyle=orthogonalEdgeStyle;html=0;rounded=0;fontSize=11;labelBackgroundColor=#ffffff;dashed=1;endArrow=open;" edge="1" parent="1" source="n358" target="n367" relationship="dependency">
<mxGeometry as="geometry" relative="1" />
</mxCell>
<mxCell id="e404-2" value="signature / constructor" style="edgeStyle=orthogonalEdgeStyle;html=0;rounded=0;fontSize=11;labelBackgroundColor=#ffffff;dashed=1;endArrow=open;" edge="1" parent="1" source="n358" target="n370" relationship="dependency">
<mxGeometry as="geometry" relative="1" />
</mxCell>
<mxCell id="e404-3" value="signature / constructor" style="edgeStyle=orthogonalEdgeStyle;html=0;rounded=0;fontSize=11;labelBackgroundColor=#ffffff;dashed=1;endArrow=open;" edge="1" parent="1" source="n358" target="n373" relationship="dependency">
<mxGeometry as="geometry" relative="1" />
</mxCell>
<mxCell id="e404-4" value="signature / constructor" style="edgeStyle=orthogonalEdgeStyle;html=0;rounded=0;fontSize=11;labelBackgroundColor=#ffffff;dashed=1;endArrow=open;" edge="1" parent="1" source="n358" target="n382" relationship="dependency">
<mxGeometry as="geometry" relative="1" />
</mxCell>
<mxCell id="e404-5" value="" style="edgeStyle=orthogonalEdgeStyle;html=0;rounded=0;fontSize=11;labelBackgroundColor=#ffffff;dashed=1;endArrow=block;endFill=0;" edge="1" parent="1" source="n394" target="n397" relationship="realization">
<mxGeometry as="geometry" relative="1" />
</mxCell>
<mxCell id="e404-6" value="signature / constructor" style="edgeStyle=orthogonalEdgeStyle;html=0;rounded=0;fontSize=11;labelBackgroundColor=#ffffff;dashed=1;endArrow=open;" edge="1" parent="1" source="n394" target="n391" relationship="dependency">
<mxGeometry as="geometry" relative="1" />
</mxCell>
<mxCell id="e404-7" value="signature / constructor" style="edgeStyle=orthogonalEdgeStyle;html=0;rounded=0;fontSize=11;labelBackgroundColor=#ffffff;dashed=1;endArrow=open;" edge="1" parent="1" source="n394" target="n367" relationship="dependency">
<mxGeometry as="geometry" relative="1" />
</mxCell>
<mxCell id="e404-8" value="signature / constructor" style="edgeStyle=orthogonalEdgeStyle;html=0;rounded=0;fontSize=11;labelBackgroundColor=#ffffff;dashed=1;endArrow=open;" edge="1" parent="1" source="n397" target="n391" relationship="dependency">
<mxGeometry as="geometry" relative="1" />
</mxCell>
<mxCell id="e404-9" value="signature / constructor" style="edgeStyle=orthogonalEdgeStyle;html=0;rounded=0;fontSize=11;labelBackgroundColor=#ffffff;dashed=1;endArrow=open;" edge="1" parent="1" source="n397" target="n367" relationship="dependency">
<mxGeometry as="geometry" relative="1" />
</mxCell>
<mxCell id="e404-10" value="AppliedSelection [1]" style="edgeStyle=orthogonalEdgeStyle;html=0;rounded=0;fontSize=11;labelBackgroundColor=#ffffff;endArrow=none;" edge="1" parent="1" source="n385" target="n367" relationship="association">
<mxGeometry as="geometry" relative="1" />
</mxCell>
<mxCell id="e404-11" value="MeasurementContext [0..1]" style="edgeStyle=orthogonalEdgeStyle;html=0;rounded=0;fontSize=11;labelBackgroundColor=#ffffff;endArrow=none;" edge="1" parent="1" source="n391" target="n388" relationship="association">
<mxGeometry as="geometry" relative="1" />
</mxCell>
<mxCell id="e404-12" value="signature / constructor" style="edgeStyle=orthogonalEdgeStyle;html=0;rounded=0;fontSize=11;labelBackgroundColor=#ffffff;dashed=1;endArrow=open;" edge="1" parent="1" source="n355" target="n358" relationship="dependency">
<mxGeometry as="geometry" relative="1" />
</mxCell>
<mxCell id="e404-13" value="signature / constructor" style="edgeStyle=orthogonalEdgeStyle;html=0;rounded=0;fontSize=11;labelBackgroundColor=#ffffff;dashed=1;endArrow=open;" edge="1" parent="1" source="n355" target="n385" relationship="dependency">
<mxGeometry as="geometry" relative="1" />
</mxCell>
<mxCell id="e404-14" value="signature / constructor" style="edgeStyle=orthogonalEdgeStyle;html=0;rounded=0;fontSize=11;labelBackgroundColor=#ffffff;dashed=1;endArrow=open;" edge="1" parent="1" source="n355" target="n367" relationship="dependency">
<mxGeometry as="geometry" relative="1" />
</mxCell>
<mxCell id="e404-15" value="signature / constructor" style="edgeStyle=orthogonalEdgeStyle;html=0;rounded=0;fontSize=11;labelBackgroundColor=#ffffff;dashed=1;endArrow=open;" edge="1" parent="1" source="n355" target="n382" relationship="dependency">
<mxGeometry as="geometry" relative="1" />
</mxCell>
<mxCell id="e404-16" value="AppliedSelection [1]" style="edgeStyle=orthogonalEdgeStyle;html=0;rounded=0;fontSize=11;labelBackgroundColor=#ffffff;endArrow=none;" edge="1" parent="1" source="n370" target="n367" relationship="association">
<mxGeometry as="geometry" relative="1" />
</mxCell>
<mxCell id="e404-17" value="signature / constructor" style="edgeStyle=orthogonalEdgeStyle;html=0;rounded=0;fontSize=11;labelBackgroundColor=#ffffff;dashed=1;endArrow=open;" edge="1" parent="1" source="n373" target="n391" relationship="dependency">
<mxGeometry as="geometry" relative="1" />
</mxCell>
<mxCell id="e404-18" value="signature / constructor" style="edgeStyle=orthogonalEdgeStyle;html=0;rounded=0;fontSize=11;labelBackgroundColor=#ffffff;dashed=1;endArrow=open;" edge="1" parent="1" source="n373" target="n367" relationship="dependency">
<mxGeometry as="geometry" relative="1" />
</mxCell>
<mxCell id="e404-19" value="signature / constructor" style="edgeStyle=orthogonalEdgeStyle;html=0;rounded=0;fontSize=11;labelBackgroundColor=#ffffff;dashed=1;endArrow=open;" edge="1" parent="1" source="n373" target="n370" relationship="dependency">
<mxGeometry as="geometry" relative="1" />
</mxCell>
<mxCell id="e404-20" value="signature / constructor" style="edgeStyle=orthogonalEdgeStyle;html=0;rounded=0;fontSize=11;labelBackgroundColor=#ffffff;dashed=1;endArrow=open;" edge="1" parent="1" source="n373" target="n382" relationship="dependency">
<mxGeometry as="geometry" relative="1" />
</mxCell>
<mxCell id="e404-21" value="signature / constructor" style="edgeStyle=orthogonalEdgeStyle;html=0;rounded=0;fontSize=11;labelBackgroundColor=#ffffff;dashed=1;endArrow=open;" edge="1" parent="1" source="n373" target="n364" relationship="dependency">
<mxGeometry as="geometry" relative="1" />
</mxCell>
<mxCell id="e404-22" value="signature / constructor" style="edgeStyle=orthogonalEdgeStyle;html=0;rounded=0;fontSize=11;labelBackgroundColor=#ffffff;dashed=1;endArrow=open;" edge="1" parent="1" source="n373" target="n376" relationship="dependency">
<mxGeometry as="geometry" relative="1" />
</mxCell>
<mxCell id="e404-23" value="signature / constructor" style="edgeStyle=orthogonalEdgeStyle;html=0;rounded=0;fontSize=11;labelBackgroundColor=#ffffff;dashed=1;endArrow=open;" edge="1" parent="1" source="n373" target="n361" relationship="dependency">
<mxGeometry as="geometry" relative="1" />
</mxCell>
<mxCell id="e404-24" value="AppliedSelection [1]" style="edgeStyle=orthogonalEdgeStyle;html=0;rounded=0;fontSize=11;labelBackgroundColor=#ffffff;endArrow=none;" edge="1" parent="1" source="n382" target="n367" relationship="association">
<mxGeometry as="geometry" relative="1" />
</mxCell>
<mxCell id="e404-25" value="Comparability [1]" style="edgeStyle=orthogonalEdgeStyle;html=0;rounded=0;fontSize=11;labelBackgroundColor=#ffffff;endArrow=none;" edge="1" parent="1" source="n382" target="n364" relationship="association">
<mxGeometry as="geometry" relative="1" />
</mxCell>
<mxCell id="e404-26" value="Systolic [1]; Diastolic [1]; Pulse [1]" style="edgeStyle=orthogonalEdgeStyle;html=0;rounded=0;fontSize=11;labelBackgroundColor=#ffffff;endArrow=none;" edge="1" parent="1" source="n382" target="n376" relationship="association">
<mxGeometry as="geometry" relative="1" />
</mxCell>
<mxCell id="e404-27" value="Reference [0..1]" style="edgeStyle=orthogonalEdgeStyle;html=0;rounded=0;fontSize=11;labelBackgroundColor=#ffffff;endArrow=none;" edge="1" parent="1" source="n376" target="n361" relationship="association">
<mxGeometry as="geometry" relative="1" />
</mxCell>
<mxCell id="e404-28" value="Sources [0..*]" style="edgeStyle=orthogonalEdgeStyle;html=0;rounded=0;fontSize=11;labelBackgroundColor=#ffffff;endArrow=none;" edge="1" parent="1" source="n361" target="n379" relationship="association">
<mxGeometry as="geometry" relative="1" />
</mxCell>
<mxCell id="e404-29" value="registers / configures" style="edgeStyle=orthogonalEdgeStyle;html=0;rounded=0;fontSize=11;labelBackgroundColor=#ffffff;dashed=1;endArrow=open;" edge="1" parent="1" source="n400" target="n358" relationship="dependency">
<mxGeometry as="geometry" relative="1" />
</mxCell>
<mxCell id="e404-30" value="registers / configures" style="edgeStyle=orthogonalEdgeStyle;html=0;rounded=0;fontSize=11;labelBackgroundColor=#ffffff;dashed=1;endArrow=open;" edge="1" parent="1" source="n400" target="n394" relationship="dependency">
<mxGeometry as="geometry" relative="1" />
</mxCell>
<mxCell id="e404-31" value="registers / configures" style="edgeStyle=orthogonalEdgeStyle;html=0;rounded=0;fontSize=11;labelBackgroundColor=#ffffff;dashed=1;endArrow=open;" edge="1" parent="1" source="n400" target="n373" relationship="dependency">
<mxGeometry as="geometry" relative="1" />
</mxCell>
<mxCell id="e404-32" value="constructor dependency" style="edgeStyle=orthogonalEdgeStyle;html=0;rounded=0;fontSize=11;labelBackgroundColor=#ffffff;dashed=1;endArrow=open;" edge="1" parent="1" source="n394" target="n404" relationship="dependency">
<mxGeometry as="geometry" relative="1" />
</mxCell>
<mxCell id="e404-33" value="" style="edgeStyle=orthogonalEdgeStyle;html=0;rounded=0;fontSize=11;labelBackgroundColor=#ffffff;endArrow=block;endFill=0;" edge="1" parent="1" source="n355" target="n403" relationship="generalization">
<mxGeometry as="geometry" relative="1" />
</mxCell>
<mxCell id="n405" value="Source-linked classifier headers. All declared members shown; compiler-generated record members and inherited framework members are omitted. Partial declarations are merged. Framework base/reference boxes are distinguished from service-defined types. A dependency is not ownership or a cross-service in-process call. See class-diagram-coverage.md for exact file/type coverage." style="text;html=0;whiteSpace=wrap;align=left;verticalAlign=top;fontSize=13;spacing=8;" vertex="1" parent="1">
<mxGeometry as="geometry" x="40" y="2681" width="2580" height="110" />
</mxCell>
</root>
</mxGraphModel>
</diagram>
</mxfile>
@@ -0,0 +1,436 @@
<?xml version='1.0' encoding='utf-8'?>
<mxfile host="app.diagrams.net" version="24.7.17" compressed="false">
<diagram name="ObservationService — implementation classes" id="ObservationService---implementation-classes">
<mxGraphModel grid="1" gridSize="10" page="1" pageWidth="2660" pageHeight="2888" pageScale="1">
<root>
<mxCell id="0" />
<mxCell id="1" parent="0" />
<mxCell id="n225" value="ObservationService — implementation classes" style="text;html=0;whiteSpace=wrap;align=left;verticalAlign=top;fontSize=13;spacing=8;fontSize=24;fontStyle=1;" vertex="1" parent="1">
<mxGeometry as="geometry" x="40" y="25" width="2580" height="45" />
</mxCell>
<mxCell id="n226" value="UML: + public, - private, # protected, ~ internal. Three compartments = classifier / attributes / operations. Hollow triangle: inheritance; dashed hollow triangle: interface realization. Solid line: attribute reference; dashed arrow: dependency; filled diamond: verified owned context. Each source type has its own classifier. Primary-constructor parameters are constructor operations, not invented fields." style="text;html=0;whiteSpace=wrap;align=left;verticalAlign=top;fontSize=13;spacing=8;" vertex="1" parent="1">
<mxGeometry as="geometry" x="40" y="85" width="2580" height="100" />
</mxCell>
<mxCell id="n227" value="«class»&#10;ObservationController&#10;ObservationService.Controllers" style="swimlane;startSize=82;horizontal=1;html=0;whiteSpace=wrap;align=center;verticalAlign=top;fontSize=13;fontStyle=1;spacing=7;fillColor=#dae8fc;strokeColor=#444444;" vertex="1" parent="1" sourceType="ObservationService.Controllers.ObservationController" sourceFiles="src/ObservationService/Controllers/ObservationController.cs" link="../../src/ObservationService/Controllers/ObservationController.cs">
<mxGeometry as="geometry" x="70" y="210" width="520" height="496" />
</mxCell>
<mxCell id="n228" value="(no declared attributes)" style="text;html=0;whiteSpace=wrap;align=left;verticalAlign=top;fontSize=13;spacing=8;fillColor=none;strokeColor=none;" vertex="1" parent="n227">
<mxGeometry as="geometry" x="0" y="82" width="520" height="36" />
</mxCell>
<mxCell id="n229" value="+ ObservationController(ObservationApplicationService service)&#10;+ RecordObservation(Guid patientId, RecordObservationRequest request,&#10;CancellationToken cancellationToken):&#10;Task&lt;ActionResult&lt;ObservationDto&gt;&gt;&#10;+ DeleteObservation(Guid observationId, CancellationToken&#10;cancellationToken): Task&lt;IActionResult&gt;&#10;+ UpdateObservation(Guid observationId, UpdateObservationRequest&#10;request, CancellationToken cancellationToken):&#10;Task&lt;ActionResult&lt;ObservationDto&gt;&gt;&#10;+ PatchObservation(Guid observationId, PatchObservationRequest request,&#10;CancellationToken cancellationToken):&#10;Task&lt;ActionResult&lt;ObservationDto&gt;&gt;&#10;+ GetObservation(Guid observationId, CancellationToken&#10;cancellationToken): Task&lt;ActionResult&lt;ObservationDto&gt;&gt;&#10;+ GetLatest(Guid patientId, CancellationToken cancellationToken):&#10;Task&lt;ActionResult&lt;ObservationDto&gt;&gt;&#10;+ GetByPeriod(Guid patientId, DateTime from, DateTime to,&#10;ContextSelection selection, CancellationToken cancellationToken):&#10;Task&lt;ActionResult&lt;List&lt;ObservationDto&gt;&gt;&gt;&#10;- ToDto(BloodPressureObservation observation): ObservationDto {static}" style="text;html=0;whiteSpace=wrap;align=left;verticalAlign=top;fontSize=13;spacing=8;fillColor=none;strokeColor=none;" vertex="1" parent="n227">
<mxGeometry as="geometry" x="0" y="118" width="520" height="378" />
</mxCell>
<mxCell id="n227-sep" style="endArrow=none;strokeColor=#444444;" edge="1" parent="n227">
<mxGeometry as="geometry" relative="1">
<mxPoint as="sourcePoint" x="0" y="118" />
<mxPoint as="targetPoint" x="520" y="118" />
</mxGeometry>
</mxCell>
<mxCell id="n230" value="«class»&#10;ObservationApplicationService&#10;ObservationService.Application" style="swimlane;startSize=82;horizontal=1;html=0;whiteSpace=wrap;align=center;verticalAlign=top;fontSize=13;fontStyle=1;spacing=7;fillColor=#e1d5e7;strokeColor=#444444;" vertex="1" parent="1" sourceType="ObservationService.Application.ObservationApplicationService" sourceFiles="src/ObservationService/Application/ObservationApplicationService.cs" link="../../src/ObservationService/Application/ObservationApplicationService.cs">
<mxGeometry as="geometry" x="730" y="210" width="520" height="460" />
</mxCell>
<mxCell id="n231" value="(no declared attributes)" style="text;html=0;whiteSpace=wrap;align=left;verticalAlign=top;fontSize=13;spacing=8;fillColor=none;strokeColor=none;" vertex="1" parent="n230">
<mxGeometry as="geometry" x="0" y="82" width="520" height="36" />
</mxCell>
<mxCell id="n232" value="+ ObservationApplicationService(ObservationRepository repository,&#10;IHttpClientFactory clients)&#10;+ DeleteAsync(Guid observationId, CancellationToken cancellationToken):&#10;Task&lt;bool&gt;&#10;+ UpdateAsync(Guid observationId, UpdateObservationRequest request,&#10;CancellationToken cancellationToken): Task&lt;BloodPressureObservation?&gt;&#10;+ PatchAsync(Guid observationId, PatchObservationRequest request,&#10;CancellationToken cancellationToken): Task&lt;BloodPressureObservation?&gt;&#10;+ RecordAsync(Guid patientId, RecordObservationRequest request,&#10;CancellationToken cancellationToken): Task&lt;BloodPressureObservation?&gt;&#10;+ GetByIdAsync(Guid observationId, CancellationToken cancellationToken):&#10;Task&lt;BloodPressureObservation?&gt;&#10;+ GetLatestAsync(Guid patientId, CancellationToken cancellationToken):&#10;Task&lt;BloodPressureObservation?&gt;&#10;+ GetByPeriodAsync(Guid patientId, DateTime from, DateTime to,&#10;ContextSelection selection, CancellationToken cancellationToken):&#10;Task&lt;List&lt;BloodPressureObservation&gt;&gt;&#10;- NormalizeTimestamp(DateTime timestamp): DateTime {static}" style="text;html=0;whiteSpace=wrap;align=left;verticalAlign=top;fontSize=13;spacing=8;fillColor=none;strokeColor=none;" vertex="1" parent="n230">
<mxGeometry as="geometry" x="0" y="118" width="520" height="342" />
</mxCell>
<mxCell id="n230-sep" style="endArrow=none;strokeColor=#444444;" edge="1" parent="n230">
<mxGeometry as="geometry" relative="1">
<mxPoint as="sourcePoint" x="0" y="118" />
<mxPoint as="targetPoint" x="520" y="118" />
</mxGeometry>
</mxCell>
<mxCell id="n233" value="«interface»&#10;ObservationRepository&#10;ObservationService.Application" style="swimlane;startSize=82;horizontal=1;html=0;whiteSpace=wrap;align=center;verticalAlign=top;fontSize=13;fontStyle=1;spacing=7;fillColor=#e1d5e7;strokeColor=#444444;" vertex="1" parent="1" sourceType="ObservationService.Application.ObservationRepository" sourceFiles="src/ObservationService/Application/ObservationRepository.cs" link="../../src/ObservationService/Application/ObservationRepository.cs">
<mxGeometry as="geometry" x="1390" y="210" width="520" height="388" />
</mxCell>
<mxCell id="n234" value="(no declared attributes)" style="text;html=0;whiteSpace=wrap;align=left;verticalAlign=top;fontSize=13;spacing=8;fillColor=none;strokeColor=none;" vertex="1" parent="n233">
<mxGeometry as="geometry" x="0" y="82" width="520" height="36" />
</mxCell>
<mxCell id="n235" value="+ DeleteAsync(Guid observationId, CancellationToken cancellationToken):&#10;Task&lt;bool&gt; {abstract}&#10;+ UpdateAsync(Guid observationId, PatchObservationRequest request,&#10;DateTime updatedAt, CancellationToken cancellationToken):&#10;Task&lt;BloodPressureObservation?&gt; {abstract}&#10;+ SaveAsync(BloodPressureObservation observation, CancellationToken&#10;cancellationToken): Task&lt;BloodPressureObservation&gt; {abstract}&#10;+ FindByIdAsync(Guid observationId, CancellationToken&#10;cancellationToken): Task&lt;BloodPressureObservation?&gt; {abstract}&#10;+ FindLatestByPatientIdAsync(Guid patientId, CancellationToken&#10;cancellationToken): Task&lt;BloodPressureObservation?&gt; {abstract}&#10;+ FindByPatientIdAndPeriodAsync(Guid patientId, DateTime from,&#10;DateTime to, ContextSelection selection, CancellationToken&#10;cancellationToken): Task&lt;List&lt;BloodPressureObservation&gt;&gt; {abstract}" style="text;html=0;whiteSpace=wrap;align=left;verticalAlign=top;fontSize=13;spacing=8;fillColor=none;strokeColor=none;" vertex="1" parent="n233">
<mxGeometry as="geometry" x="0" y="118" width="520" height="270" />
</mxCell>
<mxCell id="n233-sep" style="endArrow=none;strokeColor=#444444;" edge="1" parent="n233">
<mxGeometry as="geometry" relative="1">
<mxPoint as="sourcePoint" x="0" y="118" />
<mxPoint as="targetPoint" x="520" y="118" />
</mxGeometry>
</mxCell>
<mxCell id="n236" value="«class»&#10;ObservationDbContext&#10;ObservationService.Persistence" style="swimlane;startSize=82;horizontal=1;html=0;whiteSpace=wrap;align=center;verticalAlign=top;fontSize=13;fontStyle=1;spacing=7;fillColor=#d5e8d4;strokeColor=#444444;" vertex="1" parent="1" sourceType="ObservationService.Persistence.ObservationDbContext" sourceFiles="src/ObservationService/Persistence/ObservationDbContext.cs" link="../../src/ObservationService/Persistence/ObservationDbContext.cs">
<mxGeometry as="geometry" x="2050" y="210" width="520" height="190" />
</mxCell>
<mxCell id="n237" value="+ Observations: DbSet&lt;BloodPressureObservation&gt; {get}" style="text;html=0;whiteSpace=wrap;align=left;verticalAlign=top;fontSize=13;spacing=8;fillColor=none;strokeColor=none;" vertex="1" parent="n236">
<mxGeometry as="geometry" x="0" y="82" width="520" height="36" />
</mxCell>
<mxCell id="n238" value="+ ObservationDbContext(DbContextOptions&lt;ObservationDbContext&gt;&#10;options)&#10;# OnModelCreating(ModelBuilder modelBuilder): void" style="text;html=0;whiteSpace=wrap;align=left;verticalAlign=top;fontSize=13;spacing=8;fillColor=none;strokeColor=none;" vertex="1" parent="n236">
<mxGeometry as="geometry" x="0" y="118" width="520" height="72" />
</mxCell>
<mxCell id="n236-sep" style="endArrow=none;strokeColor=#444444;" edge="1" parent="n236">
<mxGeometry as="geometry" relative="1">
<mxPoint as="sourcePoint" x="0" y="118" />
<mxPoint as="targetPoint" x="520" y="118" />
</mxGeometry>
</mxCell>
<mxCell id="n239" value="«class»&#10;SqlObservationRepository&#10;ObservationService.Persistence" style="swimlane;startSize=82;horizontal=1;html=0;whiteSpace=wrap;align=center;verticalAlign=top;fontSize=13;fontStyle=1;spacing=7;fillColor=#d5e8d4;strokeColor=#444444;" vertex="1" parent="1" sourceType="ObservationService.Persistence.SqlObservationRepository" sourceFiles="src/ObservationService/Persistence/SqlObservationRepository.cs" link="../../src/ObservationService/Persistence/SqlObservationRepository.cs">
<mxGeometry as="geometry" x="70" y="886" width="520" height="406" />
</mxCell>
<mxCell id="n240" value="(no declared attributes)" style="text;html=0;whiteSpace=wrap;align=left;verticalAlign=top;fontSize=13;spacing=8;fillColor=none;strokeColor=none;" vertex="1" parent="n239">
<mxGeometry as="geometry" x="0" y="82" width="520" height="36" />
</mxCell>
<mxCell id="n241" value="+ SqlObservationRepository(ObservationDbContext db)&#10;+ DeleteAsync(Guid observationId, CancellationToken cancellationToken):&#10;Task&lt;bool&gt;&#10;+ UpdateAsync(Guid observationId, PatchObservationRequest request,&#10;DateTime updatedAt, CancellationToken cancellationToken):&#10;Task&lt;BloodPressureObservation?&gt;&#10;+ SaveAsync(BloodPressureObservation observation, CancellationToken&#10;cancellationToken): Task&lt;BloodPressureObservation&gt;&#10;+ FindByIdAsync(Guid observationId, CancellationToken&#10;cancellationToken): Task&lt;BloodPressureObservation?&gt;&#10;+ FindLatestByPatientIdAsync(Guid patientId, CancellationToken&#10;cancellationToken): Task&lt;BloodPressureObservation?&gt;&#10;+ FindByPatientIdAndPeriodAsync(Guid patientId, DateTime from,&#10;DateTime to, ContextSelection selection, CancellationToken&#10;cancellationToken): Task&lt;List&lt;BloodPressureObservation&gt;&gt;" style="text;html=0;whiteSpace=wrap;align=left;verticalAlign=top;fontSize=13;spacing=8;fillColor=none;strokeColor=none;" vertex="1" parent="n239">
<mxGeometry as="geometry" x="0" y="118" width="520" height="288" />
</mxCell>
<mxCell id="n239-sep" style="endArrow=none;strokeColor=#444444;" edge="1" parent="n239">
<mxGeometry as="geometry" relative="1">
<mxPoint as="sourcePoint" x="0" y="118" />
<mxPoint as="targetPoint" x="520" y="118" />
</mxGeometry>
</mxCell>
<mxCell id="n242" value="«class»&#10;BloodPressureObservation&#10;ObservationService.Domain" style="swimlane;startSize=82;horizontal=1;html=0;whiteSpace=wrap;align=center;verticalAlign=top;fontSize=13;fontStyle=1;spacing=7;fillColor=#fff2cc;strokeColor=#444444;" vertex="1" parent="1" sourceType="ObservationService.Domain.BloodPressureObservation" sourceFiles="src/ObservationService/Domain/BloodPressureObservation.cs" link="../../src/ObservationService/Domain/BloodPressureObservation.cs">
<mxGeometry as="geometry" x="730" y="886" width="520" height="334" />
</mxCell>
<mxCell id="n243" value="+ ObservationId: Guid {get, set}&#10;+ PatientId: Guid {get, set}&#10;+ MeasuredAt: DateTime {get, set}&#10;+ Systolic: int {get, set}&#10;+ Diastolic: int {get, set}&#10;+ Pulse: int {get, set}&#10;+ MeasurementContext: MeasurementContext {get, set}&#10;+ Context: string? {get, set}&#10;+ Note: string? {get, set}&#10;+ CreatedAt: DateTime {get, set}&#10;+ UpdatedAt: DateTime {get, set}" style="text;html=0;whiteSpace=wrap;align=left;verticalAlign=top;fontSize=13;spacing=8;fillColor=none;strokeColor=none;" vertex="1" parent="n242">
<mxGeometry as="geometry" x="0" y="82" width="520" height="216" />
</mxCell>
<mxCell id="n244" value="(no declared operations)" style="text;html=0;whiteSpace=wrap;align=left;verticalAlign=top;fontSize=13;spacing=8;fillColor=none;strokeColor=none;" vertex="1" parent="n242">
<mxGeometry as="geometry" x="0" y="298" width="520" height="36" />
</mxCell>
<mxCell id="n242-sep" style="endArrow=none;strokeColor=#444444;" edge="1" parent="n242">
<mxGeometry as="geometry" relative="1">
<mxPoint as="sourcePoint" x="0" y="298" />
<mxPoint as="targetPoint" x="520" y="298" />
</mxGeometry>
</mxCell>
<mxCell id="n245" value="«record»&#10;ContextSelection&#10;ObservationService.Domain" style="swimlane;startSize=82;horizontal=1;html=0;whiteSpace=wrap;align=center;verticalAlign=top;fontSize=13;fontStyle=1;spacing=7;fillColor=#fff2cc;strokeColor=#444444;" vertex="1" parent="1" sourceType="ObservationService.Domain.ContextSelection" sourceFiles="src/ObservationService/Domain/ContextSelection.cs" link="../../src/ObservationService/Domain/ContextSelection.cs">
<mxGeometry as="geometry" x="1390" y="886" width="520" height="172" />
</mxCell>
<mxCell id="n246" value="+ Setting: string? {get, init}&#10;+ ActivityCondition: string? {get, init}" style="text;html=0;whiteSpace=wrap;align=left;verticalAlign=top;fontSize=13;spacing=8;fillColor=none;strokeColor=none;" vertex="1" parent="n245">
<mxGeometry as="geometry" x="0" y="82" width="520" height="54" />
</mxCell>
<mxCell id="n247" value="(no declared operations)" style="text;html=0;whiteSpace=wrap;align=left;verticalAlign=top;fontSize=13;spacing=8;fillColor=none;strokeColor=none;" vertex="1" parent="n245">
<mxGeometry as="geometry" x="0" y="136" width="520" height="36" />
</mxCell>
<mxCell id="n245-sep" style="endArrow=none;strokeColor=#444444;" edge="1" parent="n245">
<mxGeometry as="geometry" relative="1">
<mxPoint as="sourcePoint" x="0" y="136" />
<mxPoint as="targetPoint" x="520" y="136" />
</mxGeometry>
</mxCell>
<mxCell id="n248" value="«record»&#10;MeasurementContext&#10;ObservationService.Domain" style="swimlane;startSize=82;horizontal=1;html=0;whiteSpace=wrap;align=center;verticalAlign=top;fontSize=13;fontStyle=1;spacing=7;fillColor=#fff2cc;strokeColor=#444444;" vertex="1" parent="1" sourceType="ObservationService.Domain.MeasurementContext" sourceFiles="src/ObservationService/Domain/MeasurementContext.cs" link="../../src/ObservationService/Domain/MeasurementContext.cs">
<mxGeometry as="geometry" x="2050" y="886" width="520" height="280" />
</mxCell>
<mxCell id="n249" value="+ Setting: string? {get, init}&#10;+ ActivityCondition: string? {get, init}&#10;+ RestDurationMinutes: decimal? {get, init}&#10;+ BodyPosition: string? {get, init}&#10;+ MeasuredArm: string? {get, init}&#10;+ DeviceDetails: string? {get, init}&#10;+ CuffDetails: string? {get, init}&#10;+ AdditionalCircumstances: string? {get, init}" style="text;html=0;whiteSpace=wrap;align=left;verticalAlign=top;fontSize=13;spacing=8;fillColor=none;strokeColor=none;" vertex="1" parent="n248">
<mxGeometry as="geometry" x="0" y="82" width="520" height="162" />
</mxCell>
<mxCell id="n250" value="(no declared operations)" style="text;html=0;whiteSpace=wrap;align=left;verticalAlign=top;fontSize=13;spacing=8;fillColor=none;strokeColor=none;" vertex="1" parent="n248">
<mxGeometry as="geometry" x="0" y="244" width="520" height="36" />
</mxCell>
<mxCell id="n248-sep" style="endArrow=none;strokeColor=#444444;" edge="1" parent="n248">
<mxGeometry as="geometry" relative="1">
<mxPoint as="sourcePoint" x="0" y="244" />
<mxPoint as="targetPoint" x="520" y="244" />
</mxGeometry>
</mxCell>
<mxCell id="n251" value="«record»&#10;MeasurementContextPatch&#10;ObservationService.Contracts" style="swimlane;startSize=82;horizontal=1;html=0;whiteSpace=wrap;align=center;verticalAlign=top;fontSize=13;fontStyle=1;spacing=7;fillColor=#ffe6cc;strokeColor=#444444;" vertex="1" parent="1" sourceType="ObservationService.Contracts.MeasurementContextPatch" sourceFiles="src/ObservationService/Contracts/MeasurementContextPatch.cs" link="../../src/ObservationService/Contracts/MeasurementContextPatch.cs">
<mxGeometry as="geometry" x="70" y="1472" width="520" height="586" />
</mxCell>
<mxCell id="n252" value="- setting: string?&#10;+ Setting: string? {get, init}&#10;+ SettingSpecified: bool {get, private set}&#10;- activityCondition: string?&#10;+ ActivityCondition: string? {get, init}&#10;+ ActivityConditionSpecified: bool {get, private set}&#10;- restDurationMinutes: decimal?&#10;+ RestDurationMinutes: decimal? {get, init}&#10;+ RestDurationMinutesSpecified: bool {get, private set}&#10;- bodyPosition: string?&#10;+ BodyPosition: string? {get, init}&#10;+ BodyPositionSpecified: bool {get, private set}&#10;- measuredArm: string?&#10;+ MeasuredArm: string? {get, init}&#10;+ MeasuredArmSpecified: bool {get, private set}&#10;- deviceDetails: string?&#10;+ DeviceDetails: string? {get, init}&#10;+ DeviceDetailsSpecified: bool {get, private set}&#10;- cuffDetails: string?&#10;+ CuffDetails: string? {get, init}&#10;+ CuffDetailsSpecified: bool {get, private set}&#10;- additionalCircumstances: string?&#10;+ AdditionalCircumstances: string? {get, init}&#10;+ AdditionalCircumstancesSpecified: bool {get, private set}&#10;+ HasChanges: bool {get}" style="text;html=0;whiteSpace=wrap;align=left;verticalAlign=top;fontSize=13;spacing=8;fillColor=none;strokeColor=none;" vertex="1" parent="n251">
<mxGeometry as="geometry" x="0" y="82" width="520" height="468" />
</mxCell>
<mxCell id="n253" value="(no declared operations)" style="text;html=0;whiteSpace=wrap;align=left;verticalAlign=top;fontSize=13;spacing=8;fillColor=none;strokeColor=none;" vertex="1" parent="n251">
<mxGeometry as="geometry" x="0" y="550" width="520" height="36" />
</mxCell>
<mxCell id="n251-sep" style="endArrow=none;strokeColor=#444444;" edge="1" parent="n251">
<mxGeometry as="geometry" relative="1">
<mxPoint as="sourcePoint" x="0" y="550" />
<mxPoint as="targetPoint" x="520" y="550" />
</mxGeometry>
</mxCell>
<mxCell id="n254" value="«record»&#10;ObservationDto&#10;ObservationService.Contracts" style="swimlane;startSize=82;horizontal=1;html=0;whiteSpace=wrap;align=center;verticalAlign=top;fontSize=13;fontStyle=1;spacing=7;fillColor=#ffe6cc;strokeColor=#444444;" vertex="1" parent="1" sourceType="ObservationService.Contracts.ObservationDto" sourceFiles="src/ObservationService/Contracts/ObservationDto.cs" link="../../src/ObservationService/Contracts/ObservationDto.cs">
<mxGeometry as="geometry" x="730" y="1472" width="520" height="334" />
</mxCell>
<mxCell id="n255" value="+ ObservationId: Guid {get, init}&#10;+ PatientId: Guid {get, init}&#10;+ MeasuredAt: DateTime {get, init}&#10;+ Systolic: int {get, init}&#10;+ Diastolic: int {get, init}&#10;+ Pulse: int {get, init}&#10;+ Context: string? {get, init}&#10;+ Note: string? {get, init}&#10;+ MeasurementContext: MeasurementContext {get, init}" style="text;html=0;whiteSpace=wrap;align=left;verticalAlign=top;fontSize=13;spacing=8;fillColor=none;strokeColor=none;" vertex="1" parent="n254">
<mxGeometry as="geometry" x="0" y="82" width="520" height="180" />
</mxCell>
<mxCell id="n256" value="+ ObservationDto(Guid ObservationId, Guid PatientId, DateTime&#10;MeasuredAt, int Systolic, int Diastolic, int Pulse, string? Context, string?&#10;Note, MeasurementContext MeasurementContext)" style="text;html=0;whiteSpace=wrap;align=left;verticalAlign=top;fontSize=13;spacing=8;fillColor=none;strokeColor=none;" vertex="1" parent="n254">
<mxGeometry as="geometry" x="0" y="262" width="520" height="72" />
</mxCell>
<mxCell id="n254-sep" style="endArrow=none;strokeColor=#444444;" edge="1" parent="n254">
<mxGeometry as="geometry" relative="1">
<mxPoint as="sourcePoint" x="0" y="262" />
<mxPoint as="targetPoint" x="520" y="262" />
</mxGeometry>
</mxCell>
<mxCell id="n257" value="«record»&#10;PatchObservationRequest&#10;ObservationService.Contracts" style="swimlane;startSize=82;horizontal=1;html=0;whiteSpace=wrap;align=center;verticalAlign=top;fontSize=13;fontStyle=1;spacing=7;fillColor=#ffe6cc;strokeColor=#444444;" vertex="1" parent="1" sourceType="ObservationService.Contracts.PatchObservationRequest" sourceFiles="src/ObservationService/Contracts/PatchObservationRequest.cs" link="../../src/ObservationService/Contracts/PatchObservationRequest.cs">
<mxGeometry as="geometry" x="1390" y="1472" width="520" height="478" />
</mxCell>
<mxCell id="n258" value="- systolic: int?&#10;+ Systolic: int? {get, init}&#10;+ SystolicSpecified: bool {get, private set}&#10;- diastolic: int?&#10;+ Diastolic: int? {get, init}&#10;+ DiastolicSpecified: bool {get, private set}&#10;- pulse: int?&#10;+ Pulse: int? {get, init}&#10;+ PulseSpecified: bool {get, private set}&#10;- measurementContext: MeasurementContextPatch?&#10;+ MeasurementContext: MeasurementContextPatch? {get, init}&#10;+ MeasurementContextSpecified: bool {get, private set}&#10;- context: string?&#10;+ Context: string? {get, init}&#10;+ ContextSpecified: bool {get, private set}&#10;- note: string?&#10;+ Note: string? {get, init}&#10;+ NoteSpecified: bool {get, private set}" style="text;html=0;whiteSpace=wrap;align=left;verticalAlign=top;fontSize=13;spacing=8;fillColor=none;strokeColor=none;" vertex="1" parent="n257">
<mxGeometry as="geometry" x="0" y="82" width="520" height="342" />
</mxCell>
<mxCell id="n259" value="+ Validate(ValidationContext validationContext):&#10;IEnumerable&lt;ValidationResult&gt;" style="text;html=0;whiteSpace=wrap;align=left;verticalAlign=top;fontSize=13;spacing=8;fillColor=none;strokeColor=none;" vertex="1" parent="n257">
<mxGeometry as="geometry" x="0" y="424" width="520" height="54" />
</mxCell>
<mxCell id="n257-sep" style="endArrow=none;strokeColor=#444444;" edge="1" parent="n257">
<mxGeometry as="geometry" relative="1">
<mxPoint as="sourcePoint" x="0" y="424" />
<mxPoint as="targetPoint" x="520" y="424" />
</mxGeometry>
</mxCell>
<mxCell id="n260" value="«record»&#10;RecordObservationRequest&#10;ObservationService.Contracts" style="swimlane;startSize=82;horizontal=1;html=0;whiteSpace=wrap;align=center;verticalAlign=top;fontSize=13;fontStyle=1;spacing=7;fillColor=#ffe6cc;strokeColor=#444444;" vertex="1" parent="1" sourceType="ObservationService.Contracts.RecordObservationRequest" sourceFiles="src/ObservationService/Contracts/RecordObservationRequest.cs" link="../../src/ObservationService/Contracts/RecordObservationRequest.cs">
<mxGeometry as="geometry" x="2050" y="1472" width="520" height="262" />
</mxCell>
<mxCell id="n261" value="+ MeasuredAt: DateTime? {get, init}&#10;+ Systolic: int? {get, init}&#10;+ Diastolic: int? {get, init}&#10;+ Pulse: int? {get, init}&#10;+ MeasurementContext: MeasurementContext? {get, init}&#10;+ Context: string? {get, init}&#10;+ Note: string? {get, init}" style="text;html=0;whiteSpace=wrap;align=left;verticalAlign=top;fontSize=13;spacing=8;fillColor=none;strokeColor=none;" vertex="1" parent="n260">
<mxGeometry as="geometry" x="0" y="82" width="520" height="144" />
</mxCell>
<mxCell id="n262" value="(no declared operations)" style="text;html=0;whiteSpace=wrap;align=left;verticalAlign=top;fontSize=13;spacing=8;fillColor=none;strokeColor=none;" vertex="1" parent="n260">
<mxGeometry as="geometry" x="0" y="226" width="520" height="36" />
</mxCell>
<mxCell id="n260-sep" style="endArrow=none;strokeColor=#444444;" edge="1" parent="n260">
<mxGeometry as="geometry" relative="1">
<mxPoint as="sourcePoint" x="0" y="226" />
<mxPoint as="targetPoint" x="520" y="226" />
</mxGeometry>
</mxCell>
<mxCell id="n263" value="«record»&#10;UpdateObservationRequest&#10;ObservationService.Contracts" style="swimlane;startSize=82;horizontal=1;html=0;whiteSpace=wrap;align=center;verticalAlign=top;fontSize=13;fontStyle=1;spacing=7;fillColor=#ffe6cc;strokeColor=#444444;" vertex="1" parent="1" sourceType="ObservationService.Contracts.UpdateObservationRequest" sourceFiles="src/ObservationService/Contracts/UpdateObservationRequest.cs" link="../../src/ObservationService/Contracts/UpdateObservationRequest.cs">
<mxGeometry as="geometry" x="70" y="2238" width="520" height="190" />
</mxCell>
<mxCell id="n264" value="+ Systolic: int? {get, init}&#10;+ Diastolic: int? {get, init}&#10;+ Pulse: int? {get, init}" style="text;html=0;whiteSpace=wrap;align=left;verticalAlign=top;fontSize=13;spacing=8;fillColor=none;strokeColor=none;" vertex="1" parent="n263">
<mxGeometry as="geometry" x="0" y="82" width="520" height="72" />
</mxCell>
<mxCell id="n265" value="(no declared operations)" style="text;html=0;whiteSpace=wrap;align=left;verticalAlign=top;fontSize=13;spacing=8;fillColor=none;strokeColor=none;" vertex="1" parent="n263">
<mxGeometry as="geometry" x="0" y="154" width="520" height="36" />
</mxCell>
<mxCell id="n263-sep" style="endArrow=none;strokeColor=#444444;" edge="1" parent="n263">
<mxGeometry as="geometry" relative="1">
<mxPoint as="sourcePoint" x="0" y="154" />
<mxPoint as="targetPoint" x="520" y="154" />
</mxGeometry>
</mxCell>
<mxCell id="n266" value="«class»&#10;Program&#10;ObservationService" style="swimlane;startSize=82;horizontal=1;html=0;whiteSpace=wrap;align=center;verticalAlign=top;fontSize=13;fontStyle=1;spacing=7;fillColor=#f5f5f5;strokeColor=#444444;" vertex="1" parent="1" sourceType="ObservationService.Program" sourceFiles="src/ObservationService/Program.cs" link="../../src/ObservationService/Program.cs">
<mxGeometry as="geometry" x="730" y="2238" width="520" height="172" />
</mxCell>
<mxCell id="n267" value="(no declared attributes)" style="text;html=0;whiteSpace=wrap;align=left;verticalAlign=top;fontSize=13;spacing=8;fillColor=none;strokeColor=none;" vertex="1" parent="n266">
<mxGeometry as="geometry" x="0" y="82" width="520" height="36" />
</mxCell>
<mxCell id="n268" value="+ Main(string[] args): Task {static}&#10;- GetGatewayUri(IConfiguration configuration): Uri {static}" style="text;html=0;whiteSpace=wrap;align=left;verticalAlign=top;fontSize=13;spacing=8;fillColor=none;strokeColor=none;" vertex="1" parent="n266">
<mxGeometry as="geometry" x="0" y="118" width="520" height="54" />
</mxCell>
<mxCell id="n266-sep" style="endArrow=none;strokeColor=#444444;" edge="1" parent="n266">
<mxGeometry as="geometry" relative="1">
<mxPoint as="sourcePoint" x="0" y="118" />
<mxPoint as="targetPoint" x="520" y="118" />
</mxGeometry>
</mxCell>
<mxCell id="n269" value="«framework reference»&#10;IValidatableObject" style="text;html=0;whiteSpace=wrap;align=left;verticalAlign=top;fontSize=13;spacing=8;align=center;fillColor=#ffffff;strokeColor=#777777;dashed=1;" vertex="1" parent="1">
<mxGeometry as="geometry" x="70" y="2608" width="520" height="80" />
</mxCell>
<mxCell id="n270" value="«framework reference»&#10;ControllerBase" style="text;html=0;whiteSpace=wrap;align=left;verticalAlign=top;fontSize=13;spacing=8;align=center;fillColor=#ffffff;strokeColor=#777777;dashed=1;" vertex="1" parent="1">
<mxGeometry as="geometry" x="730" y="2608" width="520" height="80" />
</mxCell>
<mxCell id="n271" value="«framework reference»&#10;DbContext" style="text;html=0;whiteSpace=wrap;align=left;verticalAlign=top;fontSize=13;spacing=8;align=center;fillColor=#ffffff;strokeColor=#777777;dashed=1;" vertex="1" parent="1">
<mxGeometry as="geometry" x="1390" y="2608" width="520" height="80" />
</mxCell>
<mxCell id="n272" value="«framework reference»&#10;IHttpClientFactory" style="text;html=0;whiteSpace=wrap;align=left;verticalAlign=top;fontSize=13;spacing=8;align=center;fillColor=#ffffff;strokeColor=#777777;dashed=1;" vertex="1" parent="1">
<mxGeometry as="geometry" x="2050" y="2608" width="520" height="80" />
</mxCell>
<mxCell id="e272-0" value="signature / constructor" style="edgeStyle=orthogonalEdgeStyle;html=0;rounded=0;fontSize=11;labelBackgroundColor=#ffffff;dashed=1;endArrow=open;" edge="1" parent="1" source="n230" target="n233" relationship="dependency">
<mxGeometry as="geometry" relative="1" />
</mxCell>
<mxCell id="e272-1" value="signature / constructor" style="edgeStyle=orthogonalEdgeStyle;html=0;rounded=0;fontSize=11;labelBackgroundColor=#ffffff;dashed=1;endArrow=open;" edge="1" parent="1" source="n230" target="n257" relationship="dependency">
<mxGeometry as="geometry" relative="1" />
</mxCell>
<mxCell id="e272-2" value="signature / constructor" style="edgeStyle=orthogonalEdgeStyle;html=0;rounded=0;fontSize=11;labelBackgroundColor=#ffffff;dashed=1;endArrow=open;" edge="1" parent="1" source="n230" target="n260" relationship="dependency">
<mxGeometry as="geometry" relative="1" />
</mxCell>
<mxCell id="e272-3" value="signature / constructor" style="edgeStyle=orthogonalEdgeStyle;html=0;rounded=0;fontSize=11;labelBackgroundColor=#ffffff;dashed=1;endArrow=open;" edge="1" parent="1" source="n230" target="n263" relationship="dependency">
<mxGeometry as="geometry" relative="1" />
</mxCell>
<mxCell id="e272-4" value="signature / constructor" style="edgeStyle=orthogonalEdgeStyle;html=0;rounded=0;fontSize=11;labelBackgroundColor=#ffffff;dashed=1;endArrow=open;" edge="1" parent="1" source="n230" target="n242" relationship="dependency">
<mxGeometry as="geometry" relative="1" />
</mxCell>
<mxCell id="e272-5" value="signature / constructor" style="edgeStyle=orthogonalEdgeStyle;html=0;rounded=0;fontSize=11;labelBackgroundColor=#ffffff;dashed=1;endArrow=open;" edge="1" parent="1" source="n230" target="n245" relationship="dependency">
<mxGeometry as="geometry" relative="1" />
</mxCell>
<mxCell id="e272-6" value="creates / configures" style="edgeStyle=orthogonalEdgeStyle;html=0;rounded=0;fontSize=11;labelBackgroundColor=#ffffff;dashed=1;endArrow=open;" edge="1" parent="1" source="n230" target="n248" relationship="dependency">
<mxGeometry as="geometry" relative="1" />
</mxCell>
<mxCell id="e272-7" value="signature / constructor" style="edgeStyle=orthogonalEdgeStyle;html=0;rounded=0;fontSize=11;labelBackgroundColor=#ffffff;dashed=1;endArrow=open;" edge="1" parent="1" source="n233" target="n257" relationship="dependency">
<mxGeometry as="geometry" relative="1" />
</mxCell>
<mxCell id="e272-8" value="signature / constructor" style="edgeStyle=orthogonalEdgeStyle;html=0;rounded=0;fontSize=11;labelBackgroundColor=#ffffff;dashed=1;endArrow=open;" edge="1" parent="1" source="n233" target="n242" relationship="dependency">
<mxGeometry as="geometry" relative="1" />
</mxCell>
<mxCell id="e272-9" value="signature / constructor" style="edgeStyle=orthogonalEdgeStyle;html=0;rounded=0;fontSize=11;labelBackgroundColor=#ffffff;dashed=1;endArrow=open;" edge="1" parent="1" source="n233" target="n245" relationship="dependency">
<mxGeometry as="geometry" relative="1" />
</mxCell>
<mxCell id="e272-10" value="MeasurementContext [1]" style="edgeStyle=orthogonalEdgeStyle;html=0;rounded=0;fontSize=11;labelBackgroundColor=#ffffff;endArrow=none;" edge="1" parent="1" source="n254" target="n248" relationship="association">
<mxGeometry as="geometry" relative="1" />
</mxCell>
<mxCell id="e272-11" value="measurementContext [0..1]; MeasurementContext [0..1]" style="edgeStyle=orthogonalEdgeStyle;html=0;rounded=0;fontSize=11;labelBackgroundColor=#ffffff;endArrow=none;" edge="1" parent="1" source="n257" target="n251" relationship="association">
<mxGeometry as="geometry" relative="1" />
</mxCell>
<mxCell id="e272-12" value="MeasurementContext [0..1]" style="edgeStyle=orthogonalEdgeStyle;html=0;rounded=0;fontSize=11;labelBackgroundColor=#ffffff;endArrow=none;" edge="1" parent="1" source="n257" target="n248" relationship="association">
<mxGeometry as="geometry" relative="1" />
</mxCell>
<mxCell id="e272-13" value="MeasurementContext [0..1]" style="edgeStyle=orthogonalEdgeStyle;html=0;rounded=0;fontSize=11;labelBackgroundColor=#ffffff;endArrow=none;" edge="1" parent="1" source="n260" target="n248" relationship="association">
<mxGeometry as="geometry" relative="1" />
</mxCell>
<mxCell id="e272-14" value="signature / constructor" style="edgeStyle=orthogonalEdgeStyle;html=0;rounded=0;fontSize=11;labelBackgroundColor=#ffffff;dashed=1;endArrow=open;" edge="1" parent="1" source="n227" target="n230" relationship="dependency">
<mxGeometry as="geometry" relative="1" />
</mxCell>
<mxCell id="e272-15" value="signature / constructor" style="edgeStyle=orthogonalEdgeStyle;html=0;rounded=0;fontSize=11;labelBackgroundColor=#ffffff;dashed=1;endArrow=open;" edge="1" parent="1" source="n227" target="n254" relationship="dependency">
<mxGeometry as="geometry" relative="1" />
</mxCell>
<mxCell id="e272-16" value="signature / constructor" style="edgeStyle=orthogonalEdgeStyle;html=0;rounded=0;fontSize=11;labelBackgroundColor=#ffffff;dashed=1;endArrow=open;" edge="1" parent="1" source="n227" target="n257" relationship="dependency">
<mxGeometry as="geometry" relative="1" />
</mxCell>
<mxCell id="e272-17" value="signature / constructor" style="edgeStyle=orthogonalEdgeStyle;html=0;rounded=0;fontSize=11;labelBackgroundColor=#ffffff;dashed=1;endArrow=open;" edge="1" parent="1" source="n227" target="n260" relationship="dependency">
<mxGeometry as="geometry" relative="1" />
</mxCell>
<mxCell id="e272-18" value="signature / constructor" style="edgeStyle=orthogonalEdgeStyle;html=0;rounded=0;fontSize=11;labelBackgroundColor=#ffffff;dashed=1;endArrow=open;" edge="1" parent="1" source="n227" target="n263" relationship="dependency">
<mxGeometry as="geometry" relative="1" />
</mxCell>
<mxCell id="e272-19" value="signature / constructor" style="edgeStyle=orthogonalEdgeStyle;html=0;rounded=0;fontSize=11;labelBackgroundColor=#ffffff;dashed=1;endArrow=open;" edge="1" parent="1" source="n227" target="n242" relationship="dependency">
<mxGeometry as="geometry" relative="1" />
</mxCell>
<mxCell id="e272-20" value="signature / constructor" style="edgeStyle=orthogonalEdgeStyle;html=0;rounded=0;fontSize=11;labelBackgroundColor=#ffffff;dashed=1;endArrow=open;" edge="1" parent="1" source="n227" target="n245" relationship="dependency">
<mxGeometry as="geometry" relative="1" />
</mxCell>
<mxCell id="e272-21" value="MeasurementContext [1]" style="edgeStyle=orthogonalEdgeStyle;html=0;rounded=0;fontSize=11;labelBackgroundColor=#ffffff;startArrow=diamond;startFill=1;endArrow=none;" edge="1" parent="1" source="n242" target="n248" relationship="composition">
<mxGeometry as="geometry" relative="1" />
</mxCell>
<mxCell id="e272-25" value="Observations [0..*]" style="edgeStyle=orthogonalEdgeStyle;html=0;rounded=0;fontSize=11;labelBackgroundColor=#ffffff;endArrow=none;" edge="1" parent="1" source="n236" target="n242" relationship="association">
<mxGeometry as="geometry" relative="1" />
</mxCell>
<mxCell id="e272-26" value="" style="edgeStyle=orthogonalEdgeStyle;html=0;rounded=0;fontSize=11;labelBackgroundColor=#ffffff;dashed=1;endArrow=block;endFill=0;" edge="1" parent="1" source="n239" target="n233" relationship="realization">
<mxGeometry as="geometry" relative="1" />
</mxCell>
<mxCell id="e272-27" value="signature / constructor" style="edgeStyle=orthogonalEdgeStyle;html=0;rounded=0;fontSize=11;labelBackgroundColor=#ffffff;dashed=1;endArrow=open;" edge="1" parent="1" source="n239" target="n257" relationship="dependency">
<mxGeometry as="geometry" relative="1" />
</mxCell>
<mxCell id="e272-28" value="signature / constructor" style="edgeStyle=orthogonalEdgeStyle;html=0;rounded=0;fontSize=11;labelBackgroundColor=#ffffff;dashed=1;endArrow=open;" edge="1" parent="1" source="n239" target="n242" relationship="dependency">
<mxGeometry as="geometry" relative="1" />
</mxCell>
<mxCell id="e272-29" value="signature / constructor" style="edgeStyle=orthogonalEdgeStyle;html=0;rounded=0;fontSize=11;labelBackgroundColor=#ffffff;dashed=1;endArrow=open;" edge="1" parent="1" source="n239" target="n245" relationship="dependency">
<mxGeometry as="geometry" relative="1" />
</mxCell>
<mxCell id="e272-30" value="signature / constructor" style="edgeStyle=orthogonalEdgeStyle;html=0;rounded=0;fontSize=11;labelBackgroundColor=#ffffff;dashed=1;endArrow=open;" edge="1" parent="1" source="n239" target="n236" relationship="dependency">
<mxGeometry as="geometry" relative="1" />
</mxCell>
<mxCell id="e272-31" value="registers / configures" style="edgeStyle=orthogonalEdgeStyle;html=0;rounded=0;fontSize=11;labelBackgroundColor=#ffffff;dashed=1;endArrow=open;" edge="1" parent="1" source="n266" target="n230" relationship="dependency">
<mxGeometry as="geometry" relative="1" />
</mxCell>
<mxCell id="e272-32" value="registers / configures" style="edgeStyle=orthogonalEdgeStyle;html=0;rounded=0;fontSize=11;labelBackgroundColor=#ffffff;dashed=1;endArrow=open;" edge="1" parent="1" source="n266" target="n236" relationship="dependency">
<mxGeometry as="geometry" relative="1" />
</mxCell>
<mxCell id="e272-33" value="registers / configures" style="edgeStyle=orthogonalEdgeStyle;html=0;rounded=0;fontSize=11;labelBackgroundColor=#ffffff;dashed=1;endArrow=open;" edge="1" parent="1" source="n266" target="n239" relationship="dependency">
<mxGeometry as="geometry" relative="1" />
</mxCell>
<mxCell id="e272-34" value="constructor dependency" style="edgeStyle=orthogonalEdgeStyle;html=0;rounded=0;fontSize=11;labelBackgroundColor=#ffffff;dashed=1;endArrow=open;" edge="1" parent="1" source="n230" target="n272" relationship="dependency">
<mxGeometry as="geometry" relative="1" />
</mxCell>
<mxCell id="e272-35" value="" style="edgeStyle=orthogonalEdgeStyle;html=0;rounded=0;fontSize=11;labelBackgroundColor=#ffffff;dashed=1;endArrow=block;endFill=0;" edge="1" parent="1" source="n257" target="n269" relationship="realization">
<mxGeometry as="geometry" relative="1" />
</mxCell>
<mxCell id="e272-36" value="" style="edgeStyle=orthogonalEdgeStyle;html=0;rounded=0;fontSize=11;labelBackgroundColor=#ffffff;endArrow=block;endFill=0;" edge="1" parent="1" source="n227" target="n270" relationship="generalization">
<mxGeometry as="geometry" relative="1" />
</mxCell>
<mxCell id="e272-37" value="" style="edgeStyle=orthogonalEdgeStyle;html=0;rounded=0;fontSize=11;labelBackgroundColor=#ffffff;endArrow=block;endFill=0;" edge="1" parent="1" source="n236" target="n271" relationship="generalization">
<mxGeometry as="geometry" relative="1" />
</mxCell>
<mxCell id="n273" value="Source-linked classifier headers. All declared members shown; compiler-generated record members and inherited framework members are omitted. Partial declarations are merged. Framework base/reference boxes are distinguished from service-defined types. A dependency is not ownership or a cross-service in-process call. See class-diagram-coverage.md for exact file/type coverage." style="text;html=0;whiteSpace=wrap;align=left;verticalAlign=top;fontSize=13;spacing=8;" vertex="1" parent="1">
<mxGeometry as="geometry" x="40" y="2753" width="2580" height="110" />
</mxCell>
</root>
</mxGraphModel>
</diagram>
<diagram name="ObservationService — EF migration classes" id="ObservationService---EF-migration-classes">
<mxGraphModel grid="1" gridSize="10" page="1" pageWidth="2660" pageHeight="970" pageScale="1">
<root>
<mxCell id="0" />
<mxCell id="1" parent="0" />
<mxCell id="n323" value="ObservationService — EF migration classes" style="text;html=0;whiteSpace=wrap;align=left;verticalAlign=top;fontSize=13;spacing=8;fontSize=24;fontStyle=1;" vertex="1" parent="1">
<mxGeometry as="geometry" x="40" y="25" width="2580" height="45" />
</mxCell>
<mxCell id="n324" value="UML: + public, - private, # protected, ~ internal. Three compartments = classifier / attributes / operations. Hollow triangle: inheritance; dashed hollow triangle: interface realization. Solid line: attribute reference; dashed arrow: dependency; filled diamond: verified owned context. Each source type has its own classifier. Primary-constructor parameters are constructor operations, not invented fields." style="text;html=0;whiteSpace=wrap;align=left;verticalAlign=top;fontSize=13;spacing=8;" vertex="1" parent="1">
<mxGeometry as="geometry" x="40" y="85" width="2580" height="100" />
</mxCell>
<mxCell id="n325" value="«class»&#10;InitialObservationSchema&#10;ObservationService.Persistence.Migrations" style="swimlane;startSize=82;horizontal=1;html=0;whiteSpace=wrap;align=center;verticalAlign=top;fontSize=13;fontStyle=1;spacing=7;fillColor=#d5e8d4;strokeColor=#444444;" vertex="1" parent="1" sourceType="ObservationService.Persistence.Migrations.InitialObservationSchema" sourceFiles="src/ObservationService/Persistence/Migrations/20261001095222_InitialObservationSchema.Designer.cs|src/ObservationService/Persistence/Migrations/20261001095222_InitialObservationSchema.cs" link="../../src/ObservationService/Persistence/Migrations/20261001095222_InitialObservationSchema.Designer.cs">
<mxGeometry as="geometry" x="70" y="210" width="520" height="190" />
</mxCell>
<mxCell id="n326" value="(no declared attributes)" style="text;html=0;whiteSpace=wrap;align=left;verticalAlign=top;fontSize=13;spacing=8;fillColor=none;strokeColor=none;" vertex="1" parent="n325">
<mxGeometry as="geometry" x="0" y="82" width="520" height="36" />
</mxCell>
<mxCell id="n327" value="# BuildTargetModel(ModelBuilder modelBuilder): void&#10;# Up(MigrationBuilder migrationBuilder): void&#10;# Down(MigrationBuilder migrationBuilder): void" style="text;html=0;whiteSpace=wrap;align=left;verticalAlign=top;fontSize=13;spacing=8;fillColor=none;strokeColor=none;" vertex="1" parent="n325">
<mxGeometry as="geometry" x="0" y="118" width="520" height="72" />
</mxCell>
<mxCell id="n325-sep" style="endArrow=none;strokeColor=#444444;" edge="1" parent="n325">
<mxGeometry as="geometry" relative="1">
<mxPoint as="sourcePoint" x="0" y="118" />
<mxPoint as="targetPoint" x="520" y="118" />
</mxGeometry>
</mxCell>
<mxCell id="n328" value="«class»&#10;ObservationDbContextModelSnapshot&#10;ObservationService.Persistence.Migrations" style="swimlane;startSize=82;horizontal=1;html=0;whiteSpace=wrap;align=center;verticalAlign=top;fontSize=13;fontStyle=1;spacing=7;fillColor=#d5e8d4;strokeColor=#444444;" vertex="1" parent="1" sourceType="ObservationService.Persistence.Migrations.ObservationDbContextModelSnapshot" sourceFiles="src/ObservationService/Persistence/Migrations/ObservationDbContextModelSnapshot.cs" link="../../src/ObservationService/Persistence/Migrations/ObservationDbContextModelSnapshot.cs">
<mxGeometry as="geometry" x="730" y="210" width="520" height="154" />
</mxCell>
<mxCell id="n329" value="(no declared attributes)" style="text;html=0;whiteSpace=wrap;align=left;verticalAlign=top;fontSize=13;spacing=8;fillColor=none;strokeColor=none;" vertex="1" parent="n328">
<mxGeometry as="geometry" x="0" y="82" width="520" height="36" />
</mxCell>
<mxCell id="n330" value="# BuildModel(ModelBuilder modelBuilder): void" style="text;html=0;whiteSpace=wrap;align=left;verticalAlign=top;fontSize=13;spacing=8;fillColor=none;strokeColor=none;" vertex="1" parent="n328">
<mxGeometry as="geometry" x="0" y="118" width="520" height="36" />
</mxCell>
<mxCell id="n328-sep" style="endArrow=none;strokeColor=#444444;" edge="1" parent="n328">
<mxGeometry as="geometry" relative="1">
<mxPoint as="sourcePoint" x="0" y="118" />
<mxPoint as="targetPoint" x="520" y="118" />
</mxGeometry>
</mxCell>
<mxCell id="n331" value="«class»&#10;RecordedMeasurementContext&#10;ObservationService.Persistence.Migrations" style="swimlane;startSize=82;horizontal=1;html=0;whiteSpace=wrap;align=center;verticalAlign=top;fontSize=13;fontStyle=1;spacing=7;fillColor=#d5e8d4;strokeColor=#444444;" vertex="1" parent="1" sourceType="ObservationService.Persistence.Migrations.RecordedMeasurementContext" sourceFiles="src/ObservationService/Persistence/Migrations/20261005094632_RecordedMeasurementContext.Designer.cs|src/ObservationService/Persistence/Migrations/20261005094632_RecordedMeasurementContext.cs" link="../../src/ObservationService/Persistence/Migrations/20261005094632_RecordedMeasurementContext.Designer.cs">
<mxGeometry as="geometry" x="1390" y="210" width="520" height="190" />
</mxCell>
<mxCell id="n332" value="(no declared attributes)" style="text;html=0;whiteSpace=wrap;align=left;verticalAlign=top;fontSize=13;spacing=8;fillColor=none;strokeColor=none;" vertex="1" parent="n331">
<mxGeometry as="geometry" x="0" y="82" width="520" height="36" />
</mxCell>
<mxCell id="n333" value="# BuildTargetModel(ModelBuilder modelBuilder): void&#10;# Up(MigrationBuilder migrationBuilder): void&#10;# Down(MigrationBuilder migrationBuilder): void" style="text;html=0;whiteSpace=wrap;align=left;verticalAlign=top;fontSize=13;spacing=8;fillColor=none;strokeColor=none;" vertex="1" parent="n331">
<mxGeometry as="geometry" x="0" y="118" width="520" height="72" />
</mxCell>
<mxCell id="n331-sep" style="endArrow=none;strokeColor=#444444;" edge="1" parent="n331">
<mxGeometry as="geometry" relative="1">
<mxPoint as="sourcePoint" x="0" y="118" />
<mxPoint as="targetPoint" x="520" y="118" />
</mxGeometry>
</mxCell>
<mxCell id="n334" value="«framework reference»&#10;Migration" style="text;html=0;whiteSpace=wrap;align=left;verticalAlign=top;fontSize=13;spacing=8;align=center;fillColor=#ffffff;strokeColor=#777777;dashed=1;" vertex="1" parent="1">
<mxGeometry as="geometry" x="70" y="580" width="520" height="80" />
</mxCell>
<mxCell id="n335" value="«framework reference»&#10;ModelSnapshot" style="text;html=0;whiteSpace=wrap;align=left;verticalAlign=top;fontSize=13;spacing=8;align=center;fillColor=#ffffff;strokeColor=#777777;dashed=1;" vertex="1" parent="1">
<mxGeometry as="geometry" x="730" y="580" width="520" height="80" />
</mxCell>
<mxCell id="n336" value="«same-service type, other page»&#10;ObservationDbContext" style="text;html=0;whiteSpace=wrap;align=left;verticalAlign=top;fontSize=13;spacing=8;align=center;fillColor=#ffffff;strokeColor=#777777;dashed=1;" vertex="1" parent="1" referenceType="ObservationService.Persistence.ObservationDbContext">
<mxGeometry as="geometry" x="70" y="690" width="520" height="80" />
</mxCell>
<mxCell id="e336-22" value="creates / configures" style="edgeStyle=orthogonalEdgeStyle;html=0;rounded=0;fontSize=11;labelBackgroundColor=#ffffff;dashed=1;endArrow=open;" edge="1" parent="1" source="n325" target="n336" relationship="dependency">
<mxGeometry as="geometry" relative="1" />
</mxCell>
<mxCell id="e336-23" value="creates / configures" style="edgeStyle=orthogonalEdgeStyle;html=0;rounded=0;fontSize=11;labelBackgroundColor=#ffffff;dashed=1;endArrow=open;" edge="1" parent="1" source="n331" target="n336" relationship="dependency">
<mxGeometry as="geometry" relative="1" />
</mxCell>
<mxCell id="e336-24" value="creates / configures" style="edgeStyle=orthogonalEdgeStyle;html=0;rounded=0;fontSize=11;labelBackgroundColor=#ffffff;dashed=1;endArrow=open;" edge="1" parent="1" source="n328" target="n336" relationship="dependency">
<mxGeometry as="geometry" relative="1" />
</mxCell>
<mxCell id="e336-34" value="" style="edgeStyle=orthogonalEdgeStyle;html=0;rounded=0;fontSize=11;labelBackgroundColor=#ffffff;endArrow=block;endFill=0;" edge="1" parent="1" source="n325" target="n334" relationship="generalization">
<mxGeometry as="geometry" relative="1" />
</mxCell>
<mxCell id="e336-35" value="" style="edgeStyle=orthogonalEdgeStyle;html=0;rounded=0;fontSize=11;labelBackgroundColor=#ffffff;endArrow=block;endFill=0;" edge="1" parent="1" source="n331" target="n334" relationship="generalization">
<mxGeometry as="geometry" relative="1" />
</mxCell>
<mxCell id="e336-36" value="" style="edgeStyle=orthogonalEdgeStyle;html=0;rounded=0;fontSize=11;labelBackgroundColor=#ffffff;endArrow=block;endFill=0;" edge="1" parent="1" source="n328" target="n335" relationship="generalization">
<mxGeometry as="geometry" relative="1" />
</mxCell>
<mxCell id="n337" value="Source-linked classifier headers. All declared members shown; compiler-generated record members and inherited framework members are omitted. Partial declarations are merged. Framework base/reference boxes are distinguished from service-defined types. A dependency is not ownership or a cross-service in-process call. See class-diagram-coverage.md for exact file/type coverage." style="text;html=0;whiteSpace=wrap;align=left;verticalAlign=top;fontSize=13;spacing=8;" vertex="1" parent="1">
<mxGeometry as="geometry" x="40" y="835" width="2580" height="110" />
</mxCell>
</root>
</mxGraphModel>
</diagram>
</mxfile>
@@ -0,0 +1,349 @@
<?xml version='1.0' encoding='utf-8'?>
<mxfile host="app.diagrams.net" version="24.7.17" compressed="false">
<diagram name="PatientProfileService — implementation classes" id="PatientProfileService---implementation-classes">
<mxGraphModel grid="1" gridSize="10" page="1" pageWidth="2660" pageHeight="1870" pageScale="1">
<root>
<mxCell id="0" />
<mxCell id="1" parent="0" />
<mxCell id="n117" value="PatientProfileService — implementation classes" style="text;html=0;whiteSpace=wrap;align=left;verticalAlign=top;fontSize=13;spacing=8;fontSize=24;fontStyle=1;" vertex="1" parent="1">
<mxGeometry as="geometry" x="40" y="25" width="2580" height="45" />
</mxCell>
<mxCell id="n118" value="UML: + public, - private, # protected, ~ internal. Three compartments = classifier / attributes / operations. Hollow triangle: inheritance; dashed hollow triangle: interface realization. Solid line: attribute reference; dashed arrow: dependency; filled diamond: verified owned context. Each source type has its own classifier. Primary-constructor parameters are constructor operations, not invented fields." style="text;html=0;whiteSpace=wrap;align=left;verticalAlign=top;fontSize=13;spacing=8;" vertex="1" parent="1">
<mxGeometry as="geometry" x="40" y="85" width="2580" height="100" />
</mxCell>
<mxCell id="n119" value="«class»&#10;PatientController&#10;PatientProfileService.Controllers" style="swimlane;startSize=82;horizontal=1;html=0;whiteSpace=wrap;align=center;verticalAlign=top;fontSize=13;fontStyle=1;spacing=7;fillColor=#dae8fc;strokeColor=#444444;" vertex="1" parent="1" sourceType="PatientProfileService.Controllers.PatientController" sourceFiles="src/PatientProfileService/Controllers/PatientController.cs" link="../../src/PatientProfileService/Controllers/PatientController.cs">
<mxGeometry as="geometry" x="70" y="210" width="520" height="316" />
</mxCell>
<mxCell id="n120" value="(no declared attributes)" style="text;html=0;whiteSpace=wrap;align=left;verticalAlign=top;fontSize=13;spacing=8;fillColor=none;strokeColor=none;" vertex="1" parent="n119">
<mxGeometry as="geometry" x="0" y="82" width="520" height="36" />
</mxCell>
<mxCell id="n121" value="+ PatientController(PatientApplicationService service)&#10;+ CreatePatient(CreatePatientRequest request, CancellationToken&#10;cancellationToken): Task&lt;ActionResult&lt;PatientDto&gt;&gt;&#10;+ GetByAccount(string accountId, CancellationToken cancellationToken):&#10;Task&lt;ActionResult&lt;PatientDto&gt;&gt;&#10;+ GetPatient(Guid patientId, CancellationToken cancellationToken):&#10;Task&lt;ActionResult&lt;PatientDto&gt;&gt;&#10;+ UpdatePatient(Guid patientId, UpdatePatientRequest request,&#10;CancellationToken cancellationToken): Task&lt;ActionResult&lt;PatientDto&gt;&gt;&#10;- ToDto(Patient patient): PatientDto {static}" style="text;html=0;whiteSpace=wrap;align=left;verticalAlign=top;fontSize=13;spacing=8;fillColor=none;strokeColor=none;" vertex="1" parent="n119">
<mxGeometry as="geometry" x="0" y="118" width="520" height="198" />
</mxCell>
<mxCell id="n119-sep" style="endArrow=none;strokeColor=#444444;" edge="1" parent="n119">
<mxGeometry as="geometry" relative="1">
<mxPoint as="sourcePoint" x="0" y="118" />
<mxPoint as="targetPoint" x="520" y="118" />
</mxGeometry>
</mxCell>
<mxCell id="n122" value="«class»&#10;PatientApplicationService&#10;PatientProfileService.Application" style="swimlane;startSize=82;horizontal=1;html=0;whiteSpace=wrap;align=center;verticalAlign=top;fontSize=13;fontStyle=1;spacing=7;fillColor=#e1d5e7;strokeColor=#444444;" vertex="1" parent="1" sourceType="PatientProfileService.Application.PatientApplicationService" sourceFiles="src/PatientProfileService/Application/PatientApplicationService.cs" link="../../src/PatientProfileService/Application/PatientApplicationService.cs">
<mxGeometry as="geometry" x="730" y="210" width="520" height="298" />
</mxCell>
<mxCell id="n123" value="(no declared attributes)" style="text;html=0;whiteSpace=wrap;align=left;verticalAlign=top;fontSize=13;spacing=8;fillColor=none;strokeColor=none;" vertex="1" parent="n122">
<mxGeometry as="geometry" x="0" y="82" width="520" height="36" />
</mxCell>
<mxCell id="n124" value="+ PatientApplicationService(PatientRepository repository)&#10;+ CreatePatientAsync(CreatePatientRequest request, string accountId,&#10;CancellationToken cancellationToken): Task&lt;Patient&gt;&#10;+ GetByAccountAsync(string accountId, CancellationToken&#10;cancellationToken): Task&lt;Patient?&gt;&#10;+ GetPatientAsync(Guid patientId, CancellationToken cancellationToken):&#10;Task&lt;Patient?&gt;&#10;+ UpdatePatientAsync(Guid patientId, UpdatePatientRequest request,&#10;CancellationToken cancellationToken): Task&lt;Patient?&gt;" style="text;html=0;whiteSpace=wrap;align=left;verticalAlign=top;fontSize=13;spacing=8;fillColor=none;strokeColor=none;" vertex="1" parent="n122">
<mxGeometry as="geometry" x="0" y="118" width="520" height="180" />
</mxCell>
<mxCell id="n122-sep" style="endArrow=none;strokeColor=#444444;" edge="1" parent="n122">
<mxGeometry as="geometry" relative="1">
<mxPoint as="sourcePoint" x="0" y="118" />
<mxPoint as="targetPoint" x="520" y="118" />
</mxGeometry>
</mxCell>
<mxCell id="n125" value="«interface»&#10;PatientRepository&#10;PatientProfileService.Application" style="swimlane;startSize=82;horizontal=1;html=0;whiteSpace=wrap;align=center;verticalAlign=top;fontSize=13;fontStyle=1;spacing=7;fillColor=#e1d5e7;strokeColor=#444444;" vertex="1" parent="1" sourceType="PatientProfileService.Application.PatientRepository" sourceFiles="src/PatientProfileService/Application/PatientRepository.cs" link="../../src/PatientProfileService/Application/PatientRepository.cs">
<mxGeometry as="geometry" x="1390" y="210" width="520" height="280" />
</mxCell>
<mxCell id="n126" value="(no declared attributes)" style="text;html=0;whiteSpace=wrap;align=left;verticalAlign=top;fontSize=13;spacing=8;fillColor=none;strokeColor=none;" vertex="1" parent="n125">
<mxGeometry as="geometry" x="0" y="82" width="520" height="36" />
</mxCell>
<mxCell id="n127" value="+ FindByAccountIdAsync(string accountId, CancellationToken&#10;cancellationToken): Task&lt;Patient?&gt; {abstract}&#10;+ SaveAsync(Patient patient, CancellationToken cancellationToken):&#10;Task&lt;Patient&gt; {abstract}&#10;+ FindByIdAsync(Guid patientId, CancellationToken cancellationToken):&#10;Task&lt;Patient?&gt; {abstract}&#10;+ UpdateProfileAsync(Guid patientId, string name, string? contactInfo,&#10;CancellationToken cancellationToken): Task&lt;bool&gt; {abstract}" style="text;html=0;whiteSpace=wrap;align=left;verticalAlign=top;fontSize=13;spacing=8;fillColor=none;strokeColor=none;" vertex="1" parent="n125">
<mxGeometry as="geometry" x="0" y="118" width="520" height="162" />
</mxCell>
<mxCell id="n125-sep" style="endArrow=none;strokeColor=#444444;" edge="1" parent="n125">
<mxGeometry as="geometry" relative="1">
<mxPoint as="sourcePoint" x="0" y="118" />
<mxPoint as="targetPoint" x="520" y="118" />
</mxGeometry>
</mxCell>
<mxCell id="n128" value="«class»&#10;ProfileAlreadyExistsException&#10;PatientProfileService.Application" style="swimlane;startSize=82;horizontal=1;html=0;whiteSpace=wrap;align=center;verticalAlign=top;fontSize=13;fontStyle=1;spacing=7;fillColor=#e1d5e7;strokeColor=#444444;" vertex="1" parent="1" sourceType="PatientProfileService.Application.ProfileAlreadyExistsException" sourceFiles="src/PatientProfileService/Application/ProfileAlreadyExistsException.cs" link="../../src/PatientProfileService/Application/ProfileAlreadyExistsException.cs">
<mxGeometry as="geometry" x="2050" y="210" width="520" height="154" />
</mxCell>
<mxCell id="n129" value="(no declared attributes)" style="text;html=0;whiteSpace=wrap;align=left;verticalAlign=top;fontSize=13;spacing=8;fillColor=none;strokeColor=none;" vertex="1" parent="n128">
<mxGeometry as="geometry" x="0" y="82" width="520" height="36" />
</mxCell>
<mxCell id="n130" value="(no declared operations)" style="text;html=0;whiteSpace=wrap;align=left;verticalAlign=top;fontSize=13;spacing=8;fillColor=none;strokeColor=none;" vertex="1" parent="n128">
<mxGeometry as="geometry" x="0" y="118" width="520" height="36" />
</mxCell>
<mxCell id="n128-sep" style="endArrow=none;strokeColor=#444444;" edge="1" parent="n128">
<mxGeometry as="geometry" relative="1">
<mxPoint as="sourcePoint" x="0" y="118" />
<mxPoint as="targetPoint" x="520" y="118" />
</mxGeometry>
</mxCell>
<mxCell id="n131" value="«class»&#10;PatientDbContext&#10;PatientProfileService.Persistence" style="swimlane;startSize=82;horizontal=1;html=0;whiteSpace=wrap;align=center;verticalAlign=top;fontSize=13;fontStyle=1;spacing=7;fillColor=#d5e8d4;strokeColor=#444444;" vertex="1" parent="1" sourceType="PatientProfileService.Persistence.PatientDbContext" sourceFiles="src/PatientProfileService/Persistence/PatientDbContext.cs" link="../../src/PatientProfileService/Persistence/PatientDbContext.cs">
<mxGeometry as="geometry" x="70" y="706" width="520" height="172" />
</mxCell>
<mxCell id="n132" value="+ Patients: DbSet&lt;Patient&gt; {get}" style="text;html=0;whiteSpace=wrap;align=left;verticalAlign=top;fontSize=13;spacing=8;fillColor=none;strokeColor=none;" vertex="1" parent="n131">
<mxGeometry as="geometry" x="0" y="82" width="520" height="36" />
</mxCell>
<mxCell id="n133" value="+ PatientDbContext(DbContextOptions&lt;PatientDbContext&gt; options)&#10;# OnModelCreating(ModelBuilder modelBuilder): void" style="text;html=0;whiteSpace=wrap;align=left;verticalAlign=top;fontSize=13;spacing=8;fillColor=none;strokeColor=none;" vertex="1" parent="n131">
<mxGeometry as="geometry" x="0" y="118" width="520" height="54" />
</mxCell>
<mxCell id="n131-sep" style="endArrow=none;strokeColor=#444444;" edge="1" parent="n131">
<mxGeometry as="geometry" relative="1">
<mxPoint as="sourcePoint" x="0" y="118" />
<mxPoint as="targetPoint" x="520" y="118" />
</mxGeometry>
</mxCell>
<mxCell id="n134" value="«class»&#10;SqlPatientRepository&#10;PatientProfileService.Persistence" style="swimlane;startSize=82;horizontal=1;html=0;whiteSpace=wrap;align=center;verticalAlign=top;fontSize=13;fontStyle=1;spacing=7;fillColor=#d5e8d4;strokeColor=#444444;" vertex="1" parent="1" sourceType="PatientProfileService.Persistence.SqlPatientRepository" sourceFiles="src/PatientProfileService/Persistence/SqlPatientRepository.cs" link="../../src/PatientProfileService/Persistence/SqlPatientRepository.cs">
<mxGeometry as="geometry" x="730" y="706" width="520" height="298" />
</mxCell>
<mxCell id="n135" value="(no declared attributes)" style="text;html=0;whiteSpace=wrap;align=left;verticalAlign=top;fontSize=13;spacing=8;fillColor=none;strokeColor=none;" vertex="1" parent="n134">
<mxGeometry as="geometry" x="0" y="82" width="520" height="36" />
</mxCell>
<mxCell id="n136" value="+ SqlPatientRepository(PatientDbContext db)&#10;+ SaveAsync(Patient patient, CancellationToken cancellationToken):&#10;Task&lt;Patient&gt;&#10;+ FindByAccountIdAsync(string accountId, CancellationToken&#10;cancellationToken): Task&lt;Patient?&gt;&#10;+ FindByIdAsync(Guid patientId, CancellationToken cancellationToken):&#10;Task&lt;Patient?&gt;&#10;+ UpdateProfileAsync(Guid patientId, string name, string? contactInfo,&#10;CancellationToken cancellationToken): Task&lt;bool&gt;" style="text;html=0;whiteSpace=wrap;align=left;verticalAlign=top;fontSize=13;spacing=8;fillColor=none;strokeColor=none;" vertex="1" parent="n134">
<mxGeometry as="geometry" x="0" y="118" width="520" height="180" />
</mxCell>
<mxCell id="n134-sep" style="endArrow=none;strokeColor=#444444;" edge="1" parent="n134">
<mxGeometry as="geometry" relative="1">
<mxPoint as="sourcePoint" x="0" y="118" />
<mxPoint as="targetPoint" x="520" y="118" />
</mxGeometry>
</mxCell>
<mxCell id="n137" value="«class»&#10;Patient&#10;PatientProfileService.Domain" style="swimlane;startSize=82;horizontal=1;html=0;whiteSpace=wrap;align=center;verticalAlign=top;fontSize=13;fontStyle=1;spacing=7;fillColor=#fff2cc;strokeColor=#444444;" vertex="1" parent="1" sourceType="PatientProfileService.Domain.Patient" sourceFiles="src/PatientProfileService/Domain/Patient.cs" link="../../src/PatientProfileService/Domain/Patient.cs">
<mxGeometry as="geometry" x="1390" y="706" width="520" height="262" />
</mxCell>
<mxCell id="n138" value="+ AccountId: string? {get, set}&#10;+ PatientId: Guid {get, set}&#10;+ Name: string {get, set}&#10;+ DateOfBirth: DateOnly {get, set}&#10;+ ContactInfo: string? {get, set}&#10;+ CreatedAt: DateTime {get, set}&#10;+ UpdatedAt: DateTime {get, set}" style="text;html=0;whiteSpace=wrap;align=left;verticalAlign=top;fontSize=13;spacing=8;fillColor=none;strokeColor=none;" vertex="1" parent="n137">
<mxGeometry as="geometry" x="0" y="82" width="520" height="144" />
</mxCell>
<mxCell id="n139" value="(no declared operations)" style="text;html=0;whiteSpace=wrap;align=left;verticalAlign=top;fontSize=13;spacing=8;fillColor=none;strokeColor=none;" vertex="1" parent="n137">
<mxGeometry as="geometry" x="0" y="226" width="520" height="36" />
</mxCell>
<mxCell id="n137-sep" style="endArrow=none;strokeColor=#444444;" edge="1" parent="n137">
<mxGeometry as="geometry" relative="1">
<mxPoint as="sourcePoint" x="0" y="226" />
<mxPoint as="targetPoint" x="520" y="226" />
</mxGeometry>
</mxCell>
<mxCell id="n140" value="«record»&#10;CreatePatientRequest&#10;PatientProfileService.Contracts" style="swimlane;startSize=82;horizontal=1;html=0;whiteSpace=wrap;align=center;verticalAlign=top;fontSize=13;fontStyle=1;spacing=7;fillColor=#ffe6cc;strokeColor=#444444;" vertex="1" parent="1" sourceType="PatientProfileService.Contracts.CreatePatientRequest" sourceFiles="src/PatientProfileService/Contracts/CreatePatientRequest.cs" link="../../src/PatientProfileService/Contracts/CreatePatientRequest.cs">
<mxGeometry as="geometry" x="2050" y="706" width="520" height="190" />
</mxCell>
<mxCell id="n141" value="+ Name: string? {get, init}&#10;+ DateOfBirth: DateOnly? {get, init}&#10;+ ContactInfo: string? {get, init}" style="text;html=0;whiteSpace=wrap;align=left;verticalAlign=top;fontSize=13;spacing=8;fillColor=none;strokeColor=none;" vertex="1" parent="n140">
<mxGeometry as="geometry" x="0" y="82" width="520" height="72" />
</mxCell>
<mxCell id="n142" value="(no declared operations)" style="text;html=0;whiteSpace=wrap;align=left;verticalAlign=top;fontSize=13;spacing=8;fillColor=none;strokeColor=none;" vertex="1" parent="n140">
<mxGeometry as="geometry" x="0" y="154" width="520" height="36" />
</mxCell>
<mxCell id="n140-sep" style="endArrow=none;strokeColor=#444444;" edge="1" parent="n140">
<mxGeometry as="geometry" relative="1">
<mxPoint as="sourcePoint" x="0" y="154" />
<mxPoint as="targetPoint" x="520" y="154" />
</mxGeometry>
</mxCell>
<mxCell id="n143" value="«record»&#10;PatientDto&#10;PatientProfileService.Contracts" style="swimlane;startSize=82;horizontal=1;html=0;whiteSpace=wrap;align=center;verticalAlign=top;fontSize=13;fontStyle=1;spacing=7;fillColor=#ffe6cc;strokeColor=#444444;" vertex="1" parent="1" sourceType="PatientProfileService.Contracts.PatientDto" sourceFiles="src/PatientProfileService/Contracts/PatientDto.cs" link="../../src/PatientProfileService/Contracts/PatientDto.cs">
<mxGeometry as="geometry" x="70" y="1184" width="520" height="226" />
</mxCell>
<mxCell id="n144" value="+ PatientId: Guid {get, init}&#10;+ Name: string {get, init}&#10;+ DateOfBirth: DateOnly {get, init}&#10;+ ContactInfo: string? {get, init}" style="text;html=0;whiteSpace=wrap;align=left;verticalAlign=top;fontSize=13;spacing=8;fillColor=none;strokeColor=none;" vertex="1" parent="n143">
<mxGeometry as="geometry" x="0" y="82" width="520" height="90" />
</mxCell>
<mxCell id="n145" value="+ PatientDto(Guid PatientId, string Name, DateOnly DateOfBirth, string?&#10;ContactInfo)" style="text;html=0;whiteSpace=wrap;align=left;verticalAlign=top;fontSize=13;spacing=8;fillColor=none;strokeColor=none;" vertex="1" parent="n143">
<mxGeometry as="geometry" x="0" y="172" width="520" height="54" />
</mxCell>
<mxCell id="n143-sep" style="endArrow=none;strokeColor=#444444;" edge="1" parent="n143">
<mxGeometry as="geometry" relative="1">
<mxPoint as="sourcePoint" x="0" y="172" />
<mxPoint as="targetPoint" x="520" y="172" />
</mxGeometry>
</mxCell>
<mxCell id="n146" value="«record»&#10;UpdatePatientRequest&#10;PatientProfileService.Contracts" style="swimlane;startSize=82;horizontal=1;html=0;whiteSpace=wrap;align=center;verticalAlign=top;fontSize=13;fontStyle=1;spacing=7;fillColor=#ffe6cc;strokeColor=#444444;" vertex="1" parent="1" sourceType="PatientProfileService.Contracts.UpdatePatientRequest" sourceFiles="src/PatientProfileService/Contracts/UpdatePatientRequest.cs" link="../../src/PatientProfileService/Contracts/UpdatePatientRequest.cs">
<mxGeometry as="geometry" x="730" y="1184" width="520" height="172" />
</mxCell>
<mxCell id="n147" value="+ Name: string? {get, init}&#10;+ ContactInfo: string? {get, init}" style="text;html=0;whiteSpace=wrap;align=left;verticalAlign=top;fontSize=13;spacing=8;fillColor=none;strokeColor=none;" vertex="1" parent="n146">
<mxGeometry as="geometry" x="0" y="82" width="520" height="54" />
</mxCell>
<mxCell id="n148" value="(no declared operations)" style="text;html=0;whiteSpace=wrap;align=left;verticalAlign=top;fontSize=13;spacing=8;fillColor=none;strokeColor=none;" vertex="1" parent="n146">
<mxGeometry as="geometry" x="0" y="136" width="520" height="36" />
</mxCell>
<mxCell id="n146-sep" style="endArrow=none;strokeColor=#444444;" edge="1" parent="n146">
<mxGeometry as="geometry" relative="1">
<mxPoint as="sourcePoint" x="0" y="136" />
<mxPoint as="targetPoint" x="520" y="136" />
</mxGeometry>
</mxCell>
<mxCell id="n149" value="«class»&#10;Program&#10;PatientProfileService" style="swimlane;startSize=82;horizontal=1;html=0;whiteSpace=wrap;align=center;verticalAlign=top;fontSize=13;fontStyle=1;spacing=7;fillColor=#f5f5f5;strokeColor=#444444;" vertex="1" parent="1" sourceType="PatientProfileService.Program" sourceFiles="src/PatientProfileService/Program.cs" link="../../src/PatientProfileService/Program.cs">
<mxGeometry as="geometry" x="1390" y="1184" width="520" height="154" />
</mxCell>
<mxCell id="n150" value="(no declared attributes)" style="text;html=0;whiteSpace=wrap;align=left;verticalAlign=top;fontSize=13;spacing=8;fillColor=none;strokeColor=none;" vertex="1" parent="n149">
<mxGeometry as="geometry" x="0" y="82" width="520" height="36" />
</mxCell>
<mxCell id="n151" value="+ Main(string[] args): Task {static}" style="text;html=0;whiteSpace=wrap;align=left;verticalAlign=top;fontSize=13;spacing=8;fillColor=none;strokeColor=none;" vertex="1" parent="n149">
<mxGeometry as="geometry" x="0" y="118" width="520" height="36" />
</mxCell>
<mxCell id="n149-sep" style="endArrow=none;strokeColor=#444444;" edge="1" parent="n149">
<mxGeometry as="geometry" relative="1">
<mxPoint as="sourcePoint" x="0" y="118" />
<mxPoint as="targetPoint" x="520" y="118" />
</mxGeometry>
</mxCell>
<mxCell id="n152" value="«framework reference»&#10;Exception" style="text;html=0;whiteSpace=wrap;align=left;verticalAlign=top;fontSize=13;spacing=8;align=center;fillColor=#ffffff;strokeColor=#777777;dashed=1;" vertex="1" parent="1">
<mxGeometry as="geometry" x="70" y="1590" width="520" height="80" />
</mxCell>
<mxCell id="n153" value="«framework reference»&#10;ControllerBase" style="text;html=0;whiteSpace=wrap;align=left;verticalAlign=top;fontSize=13;spacing=8;align=center;fillColor=#ffffff;strokeColor=#777777;dashed=1;" vertex="1" parent="1">
<mxGeometry as="geometry" x="730" y="1590" width="520" height="80" />
</mxCell>
<mxCell id="n154" value="«framework reference»&#10;DbContext" style="text;html=0;whiteSpace=wrap;align=left;verticalAlign=top;fontSize=13;spacing=8;align=center;fillColor=#ffffff;strokeColor=#777777;dashed=1;" vertex="1" parent="1">
<mxGeometry as="geometry" x="1390" y="1590" width="520" height="80" />
</mxCell>
<mxCell id="e154-0" value="signature / constructor" style="edgeStyle=orthogonalEdgeStyle;html=0;rounded=0;fontSize=11;labelBackgroundColor=#ffffff;dashed=1;endArrow=open;" edge="1" parent="1" source="n122" target="n125" relationship="dependency">
<mxGeometry as="geometry" relative="1" />
</mxCell>
<mxCell id="e154-1" value="creates / configures" style="edgeStyle=orthogonalEdgeStyle;html=0;rounded=0;fontSize=11;labelBackgroundColor=#ffffff;dashed=1;endArrow=open;" edge="1" parent="1" source="n122" target="n128" relationship="dependency">
<mxGeometry as="geometry" relative="1" />
</mxCell>
<mxCell id="e154-2" value="signature / constructor" style="edgeStyle=orthogonalEdgeStyle;html=0;rounded=0;fontSize=11;labelBackgroundColor=#ffffff;dashed=1;endArrow=open;" edge="1" parent="1" source="n122" target="n140" relationship="dependency">
<mxGeometry as="geometry" relative="1" />
</mxCell>
<mxCell id="e154-3" value="signature / constructor" style="edgeStyle=orthogonalEdgeStyle;html=0;rounded=0;fontSize=11;labelBackgroundColor=#ffffff;dashed=1;endArrow=open;" edge="1" parent="1" source="n122" target="n146" relationship="dependency">
<mxGeometry as="geometry" relative="1" />
</mxCell>
<mxCell id="e154-4" value="signature / constructor" style="edgeStyle=orthogonalEdgeStyle;html=0;rounded=0;fontSize=11;labelBackgroundColor=#ffffff;dashed=1;endArrow=open;" edge="1" parent="1" source="n122" target="n137" relationship="dependency">
<mxGeometry as="geometry" relative="1" />
</mxCell>
<mxCell id="e154-5" value="signature / constructor" style="edgeStyle=orthogonalEdgeStyle;html=0;rounded=0;fontSize=11;labelBackgroundColor=#ffffff;dashed=1;endArrow=open;" edge="1" parent="1" source="n125" target="n137" relationship="dependency">
<mxGeometry as="geometry" relative="1" />
</mxCell>
<mxCell id="e154-6" value="signature / constructor" style="edgeStyle=orthogonalEdgeStyle;html=0;rounded=0;fontSize=11;labelBackgroundColor=#ffffff;dashed=1;endArrow=open;" edge="1" parent="1" source="n119" target="n122" relationship="dependency">
<mxGeometry as="geometry" relative="1" />
</mxCell>
<mxCell id="e154-7" value="signature / constructor" style="edgeStyle=orthogonalEdgeStyle;html=0;rounded=0;fontSize=11;labelBackgroundColor=#ffffff;dashed=1;endArrow=open;" edge="1" parent="1" source="n119" target="n140" relationship="dependency">
<mxGeometry as="geometry" relative="1" />
</mxCell>
<mxCell id="e154-8" value="signature / constructor" style="edgeStyle=orthogonalEdgeStyle;html=0;rounded=0;fontSize=11;labelBackgroundColor=#ffffff;dashed=1;endArrow=open;" edge="1" parent="1" source="n119" target="n143" relationship="dependency">
<mxGeometry as="geometry" relative="1" />
</mxCell>
<mxCell id="e154-9" value="signature / constructor" style="edgeStyle=orthogonalEdgeStyle;html=0;rounded=0;fontSize=11;labelBackgroundColor=#ffffff;dashed=1;endArrow=open;" edge="1" parent="1" source="n119" target="n146" relationship="dependency">
<mxGeometry as="geometry" relative="1" />
</mxCell>
<mxCell id="e154-10" value="signature / constructor" style="edgeStyle=orthogonalEdgeStyle;html=0;rounded=0;fontSize=11;labelBackgroundColor=#ffffff;dashed=1;endArrow=open;" edge="1" parent="1" source="n119" target="n137" relationship="dependency">
<mxGeometry as="geometry" relative="1" />
</mxCell>
<mxCell id="e154-14" value="Patients [0..*]" style="edgeStyle=orthogonalEdgeStyle;html=0;rounded=0;fontSize=11;labelBackgroundColor=#ffffff;endArrow=none;" edge="1" parent="1" source="n131" target="n137" relationship="association">
<mxGeometry as="geometry" relative="1" />
</mxCell>
<mxCell id="e154-15" value="" style="edgeStyle=orthogonalEdgeStyle;html=0;rounded=0;fontSize=11;labelBackgroundColor=#ffffff;dashed=1;endArrow=block;endFill=0;" edge="1" parent="1" source="n134" target="n125" relationship="realization">
<mxGeometry as="geometry" relative="1" />
</mxCell>
<mxCell id="e154-16" value="creates / configures" style="edgeStyle=orthogonalEdgeStyle;html=0;rounded=0;fontSize=11;labelBackgroundColor=#ffffff;dashed=1;endArrow=open;" edge="1" parent="1" source="n134" target="n128" relationship="dependency">
<mxGeometry as="geometry" relative="1" />
</mxCell>
<mxCell id="e154-17" value="signature / constructor" style="edgeStyle=orthogonalEdgeStyle;html=0;rounded=0;fontSize=11;labelBackgroundColor=#ffffff;dashed=1;endArrow=open;" edge="1" parent="1" source="n134" target="n137" relationship="dependency">
<mxGeometry as="geometry" relative="1" />
</mxCell>
<mxCell id="e154-18" value="signature / constructor" style="edgeStyle=orthogonalEdgeStyle;html=0;rounded=0;fontSize=11;labelBackgroundColor=#ffffff;dashed=1;endArrow=open;" edge="1" parent="1" source="n134" target="n131" relationship="dependency">
<mxGeometry as="geometry" relative="1" />
</mxCell>
<mxCell id="e154-19" value="registers / configures" style="edgeStyle=orthogonalEdgeStyle;html=0;rounded=0;fontSize=11;labelBackgroundColor=#ffffff;dashed=1;endArrow=open;" edge="1" parent="1" source="n149" target="n122" relationship="dependency">
<mxGeometry as="geometry" relative="1" />
</mxCell>
<mxCell id="e154-20" value="registers / configures" style="edgeStyle=orthogonalEdgeStyle;html=0;rounded=0;fontSize=11;labelBackgroundColor=#ffffff;dashed=1;endArrow=open;" edge="1" parent="1" source="n149" target="n131" relationship="dependency">
<mxGeometry as="geometry" relative="1" />
</mxCell>
<mxCell id="e154-21" value="registers / configures" style="edgeStyle=orthogonalEdgeStyle;html=0;rounded=0;fontSize=11;labelBackgroundColor=#ffffff;dashed=1;endArrow=open;" edge="1" parent="1" source="n149" target="n134" relationship="dependency">
<mxGeometry as="geometry" relative="1" />
</mxCell>
<mxCell id="e154-22" value="" style="edgeStyle=orthogonalEdgeStyle;html=0;rounded=0;fontSize=11;labelBackgroundColor=#ffffff;endArrow=block;endFill=0;" edge="1" parent="1" source="n128" target="n152" relationship="generalization">
<mxGeometry as="geometry" relative="1" />
</mxCell>
<mxCell id="e154-23" value="" style="edgeStyle=orthogonalEdgeStyle;html=0;rounded=0;fontSize=11;labelBackgroundColor=#ffffff;endArrow=block;endFill=0;" edge="1" parent="1" source="n119" target="n153" relationship="generalization">
<mxGeometry as="geometry" relative="1" />
</mxCell>
<mxCell id="e154-24" value="" style="edgeStyle=orthogonalEdgeStyle;html=0;rounded=0;fontSize=11;labelBackgroundColor=#ffffff;endArrow=block;endFill=0;" edge="1" parent="1" source="n131" target="n154" relationship="generalization">
<mxGeometry as="geometry" relative="1" />
</mxCell>
<mxCell id="n155" value="Source-linked classifier headers. All declared members shown; compiler-generated record members and inherited framework members are omitted. Partial declarations are merged. Framework base/reference boxes are distinguished from service-defined types. A dependency is not ownership or a cross-service in-process call. See class-diagram-coverage.md for exact file/type coverage." style="text;html=0;whiteSpace=wrap;align=left;verticalAlign=top;fontSize=13;spacing=8;" vertex="1" parent="1">
<mxGeometry as="geometry" x="40" y="1735" width="2580" height="110" />
</mxCell>
</root>
</mxGraphModel>
</diagram>
<diagram name="PatientProfileService — EF migration classes" id="PatientProfileService---EF-migration-classes">
<mxGraphModel grid="1" gridSize="10" page="1" pageWidth="2660" pageHeight="970" pageScale="1">
<root>
<mxCell id="0" />
<mxCell id="1" parent="0" />
<mxCell id="n195" value="PatientProfileService — EF migration classes" style="text;html=0;whiteSpace=wrap;align=left;verticalAlign=top;fontSize=13;spacing=8;fontSize=24;fontStyle=1;" vertex="1" parent="1">
<mxGeometry as="geometry" x="40" y="25" width="2580" height="45" />
</mxCell>
<mxCell id="n196" value="UML: + public, - private, # protected, ~ internal. Three compartments = classifier / attributes / operations. Hollow triangle: inheritance; dashed hollow triangle: interface realization. Solid line: attribute reference; dashed arrow: dependency; filled diamond: verified owned context. Each source type has its own classifier. Primary-constructor parameters are constructor operations, not invented fields." style="text;html=0;whiteSpace=wrap;align=left;verticalAlign=top;fontSize=13;spacing=8;" vertex="1" parent="1">
<mxGeometry as="geometry" x="40" y="85" width="2580" height="100" />
</mxCell>
<mxCell id="n197" value="«class»&#10;AccountProfileAssociation&#10;PatientProfileService.Persistence.Migrations" style="swimlane;startSize=82;horizontal=1;html=0;whiteSpace=wrap;align=center;verticalAlign=top;fontSize=13;fontStyle=1;spacing=7;fillColor=#d5e8d4;strokeColor=#444444;" vertex="1" parent="1" sourceType="PatientProfileService.Persistence.Migrations.AccountProfileAssociation" sourceFiles="src/PatientProfileService/Persistence/Migrations/20261005082209_AccountProfileAssociation.Designer.cs|src/PatientProfileService/Persistence/Migrations/20261005082209_AccountProfileAssociation.cs" link="../../src/PatientProfileService/Persistence/Migrations/20261005082209_AccountProfileAssociation.Designer.cs">
<mxGeometry as="geometry" x="70" y="210" width="520" height="190" />
</mxCell>
<mxCell id="n198" value="(no declared attributes)" style="text;html=0;whiteSpace=wrap;align=left;verticalAlign=top;fontSize=13;spacing=8;fillColor=none;strokeColor=none;" vertex="1" parent="n197">
<mxGeometry as="geometry" x="0" y="82" width="520" height="36" />
</mxCell>
<mxCell id="n199" value="# BuildTargetModel(ModelBuilder modelBuilder): void&#10;# Up(MigrationBuilder migrationBuilder): void&#10;# Down(MigrationBuilder migrationBuilder): void" style="text;html=0;whiteSpace=wrap;align=left;verticalAlign=top;fontSize=13;spacing=8;fillColor=none;strokeColor=none;" vertex="1" parent="n197">
<mxGeometry as="geometry" x="0" y="118" width="520" height="72" />
</mxCell>
<mxCell id="n197-sep" style="endArrow=none;strokeColor=#444444;" edge="1" parent="n197">
<mxGeometry as="geometry" relative="1">
<mxPoint as="sourcePoint" x="0" y="118" />
<mxPoint as="targetPoint" x="520" y="118" />
</mxGeometry>
</mxCell>
<mxCell id="n200" value="«class»&#10;InitialPatientSchema&#10;PatientProfileService.Persistence.Migrations" style="swimlane;startSize=82;horizontal=1;html=0;whiteSpace=wrap;align=center;verticalAlign=top;fontSize=13;fontStyle=1;spacing=7;fillColor=#d5e8d4;strokeColor=#444444;" vertex="1" parent="1" sourceType="PatientProfileService.Persistence.Migrations.InitialPatientSchema" sourceFiles="src/PatientProfileService/Persistence/Migrations/20260930200031_InitialPatientSchema.Designer.cs|src/PatientProfileService/Persistence/Migrations/20260930200031_InitialPatientSchema.cs" link="../../src/PatientProfileService/Persistence/Migrations/20260930200031_InitialPatientSchema.Designer.cs">
<mxGeometry as="geometry" x="730" y="210" width="520" height="190" />
</mxCell>
<mxCell id="n201" value="(no declared attributes)" style="text;html=0;whiteSpace=wrap;align=left;verticalAlign=top;fontSize=13;spacing=8;fillColor=none;strokeColor=none;" vertex="1" parent="n200">
<mxGeometry as="geometry" x="0" y="82" width="520" height="36" />
</mxCell>
<mxCell id="n202" value="# BuildTargetModel(ModelBuilder modelBuilder): void&#10;# Up(MigrationBuilder migrationBuilder): void&#10;# Down(MigrationBuilder migrationBuilder): void" style="text;html=0;whiteSpace=wrap;align=left;verticalAlign=top;fontSize=13;spacing=8;fillColor=none;strokeColor=none;" vertex="1" parent="n200">
<mxGeometry as="geometry" x="0" y="118" width="520" height="72" />
</mxCell>
<mxCell id="n200-sep" style="endArrow=none;strokeColor=#444444;" edge="1" parent="n200">
<mxGeometry as="geometry" relative="1">
<mxPoint as="sourcePoint" x="0" y="118" />
<mxPoint as="targetPoint" x="520" y="118" />
</mxGeometry>
</mxCell>
<mxCell id="n203" value="«class»&#10;PatientDbContextModelSnapshot&#10;PatientProfileService.Persistence.Migrations" style="swimlane;startSize=82;horizontal=1;html=0;whiteSpace=wrap;align=center;verticalAlign=top;fontSize=13;fontStyle=1;spacing=7;fillColor=#d5e8d4;strokeColor=#444444;" vertex="1" parent="1" sourceType="PatientProfileService.Persistence.Migrations.PatientDbContextModelSnapshot" sourceFiles="src/PatientProfileService/Persistence/Migrations/PatientDbContextModelSnapshot.cs" link="../../src/PatientProfileService/Persistence/Migrations/PatientDbContextModelSnapshot.cs">
<mxGeometry as="geometry" x="1390" y="210" width="520" height="154" />
</mxCell>
<mxCell id="n204" value="(no declared attributes)" style="text;html=0;whiteSpace=wrap;align=left;verticalAlign=top;fontSize=13;spacing=8;fillColor=none;strokeColor=none;" vertex="1" parent="n203">
<mxGeometry as="geometry" x="0" y="82" width="520" height="36" />
</mxCell>
<mxCell id="n205" value="# BuildModel(ModelBuilder modelBuilder): void" style="text;html=0;whiteSpace=wrap;align=left;verticalAlign=top;fontSize=13;spacing=8;fillColor=none;strokeColor=none;" vertex="1" parent="n203">
<mxGeometry as="geometry" x="0" y="118" width="520" height="36" />
</mxCell>
<mxCell id="n203-sep" style="endArrow=none;strokeColor=#444444;" edge="1" parent="n203">
<mxGeometry as="geometry" relative="1">
<mxPoint as="sourcePoint" x="0" y="118" />
<mxPoint as="targetPoint" x="520" y="118" />
</mxGeometry>
</mxCell>
<mxCell id="n206" value="«framework reference»&#10;Migration" style="text;html=0;whiteSpace=wrap;align=left;verticalAlign=top;fontSize=13;spacing=8;align=center;fillColor=#ffffff;strokeColor=#777777;dashed=1;" vertex="1" parent="1">
<mxGeometry as="geometry" x="70" y="580" width="520" height="80" />
</mxCell>
<mxCell id="n207" value="«framework reference»&#10;ModelSnapshot" style="text;html=0;whiteSpace=wrap;align=left;verticalAlign=top;fontSize=13;spacing=8;align=center;fillColor=#ffffff;strokeColor=#777777;dashed=1;" vertex="1" parent="1">
<mxGeometry as="geometry" x="730" y="580" width="520" height="80" />
</mxCell>
<mxCell id="n208" value="«same-service type, other page»&#10;PatientDbContext" style="text;html=0;whiteSpace=wrap;align=left;verticalAlign=top;fontSize=13;spacing=8;align=center;fillColor=#ffffff;strokeColor=#777777;dashed=1;" vertex="1" parent="1" referenceType="PatientProfileService.Persistence.PatientDbContext">
<mxGeometry as="geometry" x="70" y="690" width="520" height="80" />
</mxCell>
<mxCell id="e208-11" value="creates / configures" style="edgeStyle=orthogonalEdgeStyle;html=0;rounded=0;fontSize=11;labelBackgroundColor=#ffffff;dashed=1;endArrow=open;" edge="1" parent="1" source="n200" target="n208" relationship="dependency">
<mxGeometry as="geometry" relative="1" />
</mxCell>
<mxCell id="e208-12" value="creates / configures" style="edgeStyle=orthogonalEdgeStyle;html=0;rounded=0;fontSize=11;labelBackgroundColor=#ffffff;dashed=1;endArrow=open;" edge="1" parent="1" source="n197" target="n208" relationship="dependency">
<mxGeometry as="geometry" relative="1" />
</mxCell>
<mxCell id="e208-13" value="creates / configures" style="edgeStyle=orthogonalEdgeStyle;html=0;rounded=0;fontSize=11;labelBackgroundColor=#ffffff;dashed=1;endArrow=open;" edge="1" parent="1" source="n203" target="n208" relationship="dependency">
<mxGeometry as="geometry" relative="1" />
</mxCell>
<mxCell id="e208-22" value="" style="edgeStyle=orthogonalEdgeStyle;html=0;rounded=0;fontSize=11;labelBackgroundColor=#ffffff;endArrow=block;endFill=0;" edge="1" parent="1" source="n200" target="n206" relationship="generalization">
<mxGeometry as="geometry" relative="1" />
</mxCell>
<mxCell id="e208-23" value="" style="edgeStyle=orthogonalEdgeStyle;html=0;rounded=0;fontSize=11;labelBackgroundColor=#ffffff;endArrow=block;endFill=0;" edge="1" parent="1" source="n197" target="n206" relationship="generalization">
<mxGeometry as="geometry" relative="1" />
</mxCell>
<mxCell id="e208-24" value="" style="edgeStyle=orthogonalEdgeStyle;html=0;rounded=0;fontSize=11;labelBackgroundColor=#ffffff;endArrow=block;endFill=0;" edge="1" parent="1" source="n203" target="n207" relationship="generalization">
<mxGeometry as="geometry" relative="1" />
</mxCell>
<mxCell id="n209" value="Source-linked classifier headers. All declared members shown; compiler-generated record members and inherited framework members are omitted. Partial declarations are merged. Framework base/reference boxes are distinguished from service-defined types. A dependency is not ownership or a cross-service in-process call. See class-diagram-coverage.md for exact file/type coverage." style="text;html=0;whiteSpace=wrap;align=left;verticalAlign=top;fontSize=13;spacing=8;" vertex="1" parent="1">
<mxGeometry as="geometry" x="40" y="835" width="2580" height="110" />
</mxCell>
</root>
</mxGraphModel>
</diagram>
</mxfile>
File diff suppressed because it is too large. Load diff
@@ -0,0 +1,47 @@
<?xml version='1.0' encoding='utf-8'?>
<mxfile host="app.diagrams.net" version="24.7.17" compressed="false">
<diagram id="p1" name="Ownership and physical persistence">
<mxGraphModel dx="1700" dy="1500" grid="1" gridSize="10" guides="1" tooltips="1" connect="1" arrows="1" fold="1" page="1" pageScale="1" pageWidth="1700" pageHeight="1400" math="0" shadow="0">
<root>
<mxCell id="0" />
<mxCell id="1" parent="0" />
<mxCell id="c1" value="Ownership and physical persistence" style="text;html=0;fontSize=24;fontStyle=1;align=left;verticalAlign=middle;" vertex="1" parent="1">
<mxGeometry as="geometry" x="30" y="15" width="1640" height="45" />
</mxCell>
<mxCell id="c2" value="Patient/Profile process&#10;PatientDbContext / SqlPatientRepository&#10;Own credentials only" style="rounded=0;whiteSpace=wrap;html=0;fillColor=#d5e8d4;strokeColor=#666666;fontSize=14;align=left;verticalAlign=top;spacing=12;" vertex="1" parent="1">
<mxGeometry as="geometry" x="30" y="120" width="450" height="160" />
</mxCell>
<mxCell id="c3" value="Observation process&#10;ObservationDbContext / SqlObservationRepository&#10;Own credentials only" style="rounded=0;whiteSpace=wrap;html=0;fillColor=#d5e8d4;strokeColor=#666666;fontSize=14;align=left;verticalAlign=top;spacing=12;" vertex="1" parent="1">
<mxGeometry as="geometry" x="900" y="120" width="450" height="160" />
</mxCell>
<mxCell id="c4" value="Patient database: patient&#10;PK patient_id UUID&#10;account_id TEXT nullable; UNIQUE&#10;name VARCHAR NOT NULL&#10;date_of_birth DATE NOT NULL&#10;contact_info VARCHAR nullable&#10;created_at / updated_at TIMESTAMP NOT NULL&#10;+ __EFMigrationsHistory" style="rounded=0;whiteSpace=wrap;html=0;fillColor=#fff2cc;strokeColor=#666666;fontSize=14;align=left;verticalAlign=top;spacing=12;" vertex="1" parent="1">
<mxGeometry as="geometry" x="30" y="420" width="520" height="310" />
</mxCell>
<mxCell id="c5" value="Observation database: blood_pressure_observation&#10;PK observation_id UUID; external patient_id UUID&#10;measured_at / created_at / updated_at TIMESTAMP&#10;systolic / diastolic / pulse INTEGER NOT NULL&#10;context / note VARCHAR nullable&#10;setting / activity_condition TEXT NOT NULL = Unknown&#10;rest_duration_minutes NUMERIC nullable&#10;body_position / measured_arm / device_details /&#10;cuff_details / additional_circumstances TEXT nullable&#10;+ __EFMigrationsHistory" style="rounded=0;whiteSpace=wrap;html=0;fillColor=#fff2cc;strokeColor=#666666;fontSize=14;align=left;verticalAlign=top;spacing=12;" vertex="1" parent="1">
<mxGeometry as="geometry" x="900" y="420" width="650" height="350" />
</mxCell>
<mxCell id="c6" value="EF Core / own role" style="edgeStyle=orthogonalEdgeStyle;rounded=0;html=0;fontSize=12;labelBackgroundColor=#ffffff;endArrow=classic;" edge="1" parent="1" source="c2" target="c4">
<mxGeometry as="geometry" relative="1" />
</mxCell>
<mxCell id="c7" value="EF Core / own role" style="edgeStyle=orthogonalEdgeStyle;rounded=0;html=0;fontSize=12;labelBackgroundColor=#ffffff;endArrow=classic;" edge="1" parent="1" source="c3" target="c5">
<mxGeometry as="geometry" relative="1" />
</mxCell>
<mxCell id="c8" value="Logical patient_id reference ONLY&#10;No SQL access / FK / join" style="edgeStyle=orthogonalEdgeStyle;rounded=0;html=0;fontSize=12;labelBackgroundColor=#ffffff;endArrow=none;" edge="1" parent="1" source="c5" target="c4">
<mxGeometry as="geometry" relative="1" />
</mxCell>
<mxCell id="c9" value="Gateway-owned files/configuration&#10;Configured password hashes + roles&#10;Configured professional assignment IDs&#10;Persistent Data Protection XML key ring&#10;No Gateway clinical database" style="rounded=0;whiteSpace=wrap;html=0;fillColor=#dae8fc;strokeColor=#666666;fontSize=14;align=left;verticalAlign=top;spacing=12;" vertex="1" parent="1">
<mxGeometry as="geometry" x="30" y="900" width="520" height="220" />
</mxCell>
<mxCell id="c10" value="Insights / Overview&#10;Deserialize local wire DTOs&#10;Calculate/compose results in request memory&#10;No result database, stored IDs or cache&#10;No source-database credentials" style="rounded=0;whiteSpace=wrap;html=0;fillColor=#dae8fc;strokeColor=#666666;fontSize=14;align=left;verticalAlign=top;spacing=12;" vertex="1" parent="1">
<mxGeometry as="geometry" x="640" y="900" width="490" height="220" />
</mxCell>
<mxCell id="c11" value="Administrative deployment material&#10;Manifest/service.env/JSON/PFX&#10;Generated account passwords and service/DB keys&#10;Protected root/admin files; scoped distribution&#10;Public CA exported; signing key not retained" style="rounded=0;whiteSpace=wrap;html=0;fillColor=#f5f5f5;strokeColor=#666666;fontSize=14;align=left;verticalAlign=top;spacing=12;" vertex="1" parent="1">
<mxGeometry as="geometry" x="1180" y="900" width="450" height="220" />
</mxCell>
<mxCell id="c12" value="TIMESTAMP means timestamp without time zone, interpreted as UTC clock values. MeasurementContext uses columns in the observation row, not a separate table. Only PK and account uniqueness indexes are declared. Diagram shows logical database owners; PostgreSQL servers may be colocated or separate. Sources: DbContexts, migrations, Deployment/DatabaseProvisioning." style="rounded=0;whiteSpace=wrap;html=0;fillColor=#fff2cc;strokeColor=#666666;fontSize=14;align=left;verticalAlign=top;spacing=12;" vertex="1" parent="1">
<mxGeometry as="geometry" x="30" y="1220" width="1630" height="100" />
</mxCell>
</root>
</mxGraphModel>
</diagram>
</mxfile>
@@ -0,0 +1,165 @@
<?xml version='1.0' encoding='utf-8'?>
<mxfile host="app.diagrams.net" version="24.7.17" compressed="false">
<diagram id="p1" name="Colocated Linux: separate native processes">
<mxGraphModel dx="1700" dy="1500" grid="1" gridSize="10" guides="1" tooltips="1" connect="1" arrows="1" fold="1" page="1" pageScale="1" pageWidth="1700" pageHeight="1250" math="0" shadow="0">
<root>
<mxCell id="0" />
<mxCell id="1" parent="0" />
<mxCell id="c1" value="Colocated Linux: separate native processes" style="text;html=0;fontSize=24;fontStyle=1;align=left;verticalAlign=middle;" vertex="1" parent="1">
<mxGeometry as="geometry" x="30" y="15" width="1640" height="45" />
</mxCell>
<mxCell id="c2" value="Client machine&#10;HTTPS trust in public CA&#10;Token-bearing requests → Gateway" style="rounded=0;whiteSpace=wrap;html=0;fillColor=#d5e8d4;strokeColor=#666666;fontSize=14;align=left;verticalAlign=top;spacing=12;" vertex="1" parent="1">
<mxGeometry as="geometry" x="30" y="110" width="350" height="170" />
</mxCell>
<mxCell id="c3" value="One Linux host: Debian/Ubuntu family + apt + systemd&#10;.NET 10 ASP.NET Core runtime; local PostgreSQL for selected persistent services&#10;Same service DLLs as distributed deployment; all ports configurable" style="rounded=0;whiteSpace=wrap;html=0;fillColor=#f5f5f5;strokeColor=#666666;fontSize=14;align=left;verticalAlign=top;spacing=12;" vertex="1" parent="1">
<mxGeometry as="geometry" x="460" y="110" width="1190" height="160" />
</mxCell>
<mxCell id="c4" value="healthapp-api-gateway.service&#10;Dedicated healthapp-api-gateway identity&#10;Independent dotnet process&#10;HTTPS 0.0.0.0:5443&#10;/opt/healthapp/api-gateway&#10;/etc/healthapp/api-gateway/service.env" style="rounded=0;whiteSpace=wrap;html=0;fillColor=#dae8fc;strokeColor=#666666;fontSize=14;align=left;verticalAlign=top;spacing=12;" vertex="1" parent="1">
<mxGeometry as="geometry" x="40" y="410" width="300" height="240" />
</mxCell>
<mxCell id="c5" value="healthapp-patient-profile.service&#10;Dedicated healthapp-patient-profile identity&#10;Independent dotnet process&#10;HTTPS 0.0.0.0:5081&#10;/opt/healthapp/patient-profile&#10;/etc/healthapp/patient-profile/service.env" style="rounded=0;whiteSpace=wrap;html=0;fillColor=#dae8fc;strokeColor=#666666;fontSize=14;align=left;verticalAlign=top;spacing=12;" vertex="1" parent="1">
<mxGeometry as="geometry" x="375" y="410" width="300" height="240" />
</mxCell>
<mxCell id="c6" value="healthapp-observation.service&#10;Dedicated healthapp-observation identity&#10;Independent dotnet process&#10;HTTPS 0.0.0.0:5082&#10;/opt/healthapp/observation&#10;/etc/healthapp/observation/service.env" style="rounded=0;whiteSpace=wrap;html=0;fillColor=#dae8fc;strokeColor=#666666;fontSize=14;align=left;verticalAlign=top;spacing=12;" vertex="1" parent="1">
<mxGeometry as="geometry" x="710" y="410" width="300" height="240" />
</mxCell>
<mxCell id="c7" value="healthapp-insights.service&#10;Dedicated healthapp-insights identity&#10;Independent dotnet process&#10;HTTPS 0.0.0.0:5083&#10;/opt/healthapp/insights&#10;/etc/healthapp/insights/service.env" style="rounded=0;whiteSpace=wrap;html=0;fillColor=#dae8fc;strokeColor=#666666;fontSize=14;align=left;verticalAlign=top;spacing=12;" vertex="1" parent="1">
<mxGeometry as="geometry" x="1045" y="410" width="300" height="240" />
</mxCell>
<mxCell id="c8" value="healthapp-health-overview.service&#10;Dedicated healthapp-health-overview identity&#10;Independent dotnet process&#10;HTTPS 0.0.0.0:5084&#10;/opt/healthapp/health-overview&#10;/etc/healthapp/health-overview/service.env" style="rounded=0;whiteSpace=wrap;html=0;fillColor=#dae8fc;strokeColor=#666666;fontSize=14;align=left;verticalAlign=top;spacing=12;" vertex="1" parent="1">
<mxGeometry as="geometry" x="1380" y="410" width="300" height="240" />
</mxCell>
<mxCell id="c9" value="HTTPS :5443" style="edgeStyle=orthogonalEdgeStyle;rounded=0;html=0;fontSize=12;labelBackgroundColor=#ffffff;endArrow=classic;" edge="1" parent="1" source="c2" target="c4">
<mxGeometry as="geometry" relative="1" />
</mxCell>
<mxCell id="c10" value="HTTPS + incoming key" style="edgeStyle=orthogonalEdgeStyle;rounded=0;html=0;fontSize=12;labelBackgroundColor=#ffffff;endArrow=classic;" edge="1" parent="1" source="c4" target="c5">
<mxGeometry as="geometry" relative="1" />
</mxCell>
<mxCell id="c11" value="HTTPS + incoming key" style="edgeStyle=orthogonalEdgeStyle;rounded=0;html=0;fontSize=12;labelBackgroundColor=#ffffff;endArrow=classic;" edge="1" parent="1" source="c4" target="c6">
<mxGeometry as="geometry" relative="1" />
</mxCell>
<mxCell id="c12" value="HTTPS + incoming key" style="edgeStyle=orthogonalEdgeStyle;rounded=0;html=0;fontSize=12;labelBackgroundColor=#ffffff;endArrow=classic;" edge="1" parent="1" source="c4" target="c7">
<mxGeometry as="geometry" relative="1" />
</mxCell>
<mxCell id="c13" value="HTTPS + incoming key" style="edgeStyle=orthogonalEdgeStyle;rounded=0;html=0;fontSize=12;labelBackgroundColor=#ffffff;endArrow=classic;" edge="1" parent="1" source="c4" target="c8">
<mxGeometry as="geometry" relative="1" />
</mxCell>
<mxCell id="c14" value="HTTPS + callback key" style="edgeStyle=orthogonalEdgeStyle;rounded=0;html=0;fontSize=12;labelBackgroundColor=#ffffff;endArrow=classic;" edge="1" parent="1" source="c6" target="c4">
<mxGeometry as="geometry" relative="1" />
</mxCell>
<mxCell id="c15" value="HTTPS + callback key" style="edgeStyle=orthogonalEdgeStyle;rounded=0;html=0;fontSize=12;labelBackgroundColor=#ffffff;endArrow=classic;" edge="1" parent="1" source="c7" target="c4">
<mxGeometry as="geometry" relative="1" />
</mxCell>
<mxCell id="c16" value="HTTPS + callback key" style="edgeStyle=orthogonalEdgeStyle;rounded=0;html=0;fontSize=12;labelBackgroundColor=#ffffff;endArrow=classic;" edge="1" parent="1" source="c8" target="c4">
<mxGeometry as="geometry" relative="1" />
</mxCell>
<mxCell id="c17" value="Local PostgreSQL server&#10;Separate profile DB and observation DB&#10;Separate roles; no cross-database rights" style="rounded=0;whiteSpace=wrap;html=0;fillColor=#fff2cc;strokeColor=#666666;fontSize=14;align=left;verticalAlign=top;spacing=12;" vertex="1" parent="1">
<mxGeometry as="geometry" x="390" y="830" width="610" height="180" />
</mxCell>
<mxCell id="c18" value="Profile DB" style="edgeStyle=orthogonalEdgeStyle;rounded=0;html=0;fontSize=12;labelBackgroundColor=#ffffff;endArrow=classic;" edge="1" parent="1" source="c5" target="c17">
<mxGeometry as="geometry" relative="1" />
</mxCell>
<mxCell id="c19" value="Observation DB" style="edgeStyle=orthogonalEdgeStyle;rounded=0;html=0;fontSize=12;labelBackgroundColor=#ffffff;endArrow=classic;" edge="1" parent="1" source="c6" target="c17">
<mxGeometry as="geometry" relative="1" />
</mxCell>
<mxCell id="c20" value="Private administrative plan + public CA trust&#10;Gateway key ring: /var/lib/healthapp-api-gateway/keys&#10;Per-service PFX; env supplied by systemd" style="rounded=0;whiteSpace=wrap;html=0;fillColor=#f5f5f5;strokeColor=#666666;fontSize=14;align=left;verticalAlign=top;spacing=12;" vertex="1" parent="1">
<mxGeometry as="geometry" x="1090" y="820" width="540" height="180" />
</mxCell>
<mxCell id="c21" value="Topology is supported configuration, not a fresh inspection of a live host. Peer units are not PartOf/Requires/BindsTo one another. Default port numbers come from Deployment.cs, not hard-coded application routing. Stopping a process does not directly stop peers; dependent API workflows can fail." style="rounded=0;whiteSpace=wrap;html=0;fillColor=#fff2cc;strokeColor=#666666;fontSize=14;align=left;verticalAlign=top;spacing=12;" vertex="1" parent="1">
<mxGeometry as="geometry" x="30" y="1100" width="1620" height="100" />
</mxCell>
</root>
</mxGraphModel>
</diagram>
<diagram id="p2" name="Distributed Linux: supported topology">
<mxGraphModel dx="1700" dy="1500" grid="1" gridSize="10" guides="1" tooltips="1" connect="1" arrows="1" fold="1" page="1" pageScale="1" pageWidth="1800" pageHeight="1350" math="0" shadow="0">
<root>
<mxCell id="0" />
<mxCell id="1" parent="0" />
<mxCell id="c22" value="Distributed Linux: supported topology" style="text;html=0;fontSize=24;fontStyle=1;align=left;verticalAlign=middle;" vertex="1" parent="1">
<mxGeometry as="geometry" x="30" y="15" width="1740" height="45" />
</mxCell>
<mxCell id="c23" value="Machine A&#10;Gateway process / systemd&#10;HTTPS :5443&#10;Local account/assignment configuration&#10;Own key ring + certificate&#10;No clinical DB" style="rounded=0;whiteSpace=wrap;html=0;fillColor=#dae8fc;strokeColor=#666666;fontSize=14;align=left;verticalAlign=top;spacing=12;" vertex="1" parent="1">
<mxGeometry as="geometry" x="700" y="110" width="380" height="210" />
</mxCell>
<mxCell id="c24" value="Machine B&#10;Patient/Profile process / systemd&#10;HTTPS :5081&#10;Own profile DB + role&#10;Local PostgreSQL or configured remote DB" style="rounded=0;whiteSpace=wrap;html=0;fillColor=#d5e8d4;strokeColor=#666666;fontSize=14;align=left;verticalAlign=top;spacing=12;" vertex="1" parent="1">
<mxGeometry as="geometry" x="30" y="550" width="380" height="220" />
</mxCell>
<mxCell id="c25" value="Machine C&#10;Observation process / systemd&#10;HTTPS :5082&#10;Own observation DB + role&#10;Local PostgreSQL or configured remote DB" style="rounded=0;whiteSpace=wrap;html=0;fillColor=#d5e8d4;strokeColor=#666666;fontSize=14;align=left;verticalAlign=top;spacing=12;" vertex="1" parent="1">
<mxGeometry as="geometry" x="470" y="550" width="380" height="220" />
</mxCell>
<mxCell id="c26" value="Machine D&#10;Insights process / systemd&#10;HTTPS :5083&#10;No DB&#10;History client origin = Gateway" style="rounded=0;whiteSpace=wrap;html=0;fillColor=#d5e8d4;strokeColor=#666666;fontSize=14;align=left;verticalAlign=top;spacing=12;" vertex="1" parent="1">
<mxGeometry as="geometry" x="910" y="550" width="380" height="220" />
</mxCell>
<mxCell id="c27" value="Machine E&#10;Overview process / systemd&#10;HTTPS :5084&#10;No DB&#10;All three client origins = Gateway" style="rounded=0;whiteSpace=wrap;html=0;fillColor=#d5e8d4;strokeColor=#666666;fontSize=14;align=left;verticalAlign=top;spacing=12;" vertex="1" parent="1">
<mxGeometry as="geometry" x="1350" y="550" width="380" height="220" />
</mxCell>
<mxCell id="c28" value="HTTPS + X-Gateway-Key" style="edgeStyle=orthogonalEdgeStyle;rounded=0;html=0;fontSize=12;labelBackgroundColor=#ffffff;endArrow=classic;" edge="1" parent="1" source="c23" target="c24">
<mxGeometry as="geometry" relative="1" />
</mxCell>
<mxCell id="c29" value="HTTPS + X-Gateway-Key" style="edgeStyle=orthogonalEdgeStyle;rounded=0;html=0;fontSize=12;labelBackgroundColor=#ffffff;endArrow=classic;" edge="1" parent="1" source="c23" target="c25">
<mxGeometry as="geometry" relative="1" />
</mxCell>
<mxCell id="c30" value="HTTPS + X-Gateway-Key" style="edgeStyle=orthogonalEdgeStyle;rounded=0;html=0;fontSize=12;labelBackgroundColor=#ffffff;endArrow=classic;" edge="1" parent="1" source="c23" target="c26">
<mxGeometry as="geometry" relative="1" />
</mxCell>
<mxCell id="c31" value="HTTPS + X-Gateway-Key" style="edgeStyle=orthogonalEdgeStyle;rounded=0;html=0;fontSize=12;labelBackgroundColor=#ffffff;endArrow=classic;" edge="1" parent="1" source="c23" target="c27">
<mxGeometry as="geometry" relative="1" />
</mxCell>
<mxCell id="c32" value="HTTPS + X-Service-Key" style="edgeStyle=orthogonalEdgeStyle;rounded=0;html=0;fontSize=12;labelBackgroundColor=#ffffff;endArrow=classic;" edge="1" parent="1" source="c25" target="c23">
<mxGeometry as="geometry" relative="1" />
</mxCell>
<mxCell id="c33" value="HTTPS + X-Service-Key" style="edgeStyle=orthogonalEdgeStyle;rounded=0;html=0;fontSize=12;labelBackgroundColor=#ffffff;endArrow=classic;" edge="1" parent="1" source="c26" target="c23">
<mxGeometry as="geometry" relative="1" />
</mxCell>
<mxCell id="c34" value="HTTPS + X-Service-Key" style="edgeStyle=orthogonalEdgeStyle;rounded=0;html=0;fontSize=12;labelBackgroundColor=#ffffff;endArrow=classic;" edge="1" parent="1" source="c27" target="c23">
<mxGeometry as="geometry" relative="1" />
</mxCell>
<mxCell id="c35" value="Administrative preparation / distribution&#10;One topology plan → scoped files per host&#10;SSH/SCP and noninteractive native install&#10;OS CA trust + dedicated service identities&#10;Final HTTPS topology verification" style="rounded=0;whiteSpace=wrap;html=0;fillColor=#f5f5f5;strokeColor=#666666;fontSize=14;align=left;verticalAlign=top;spacing=12;" vertex="1" parent="1">
<mxGeometry as="geometry" x="490" y="970" width="760" height="230" />
</mxCell>
<mxCell id="c36" value="SSH/SCP administration (not app traffic)" style="edgeStyle=orthogonalEdgeStyle;rounded=0;html=0;fontSize=12;labelBackgroundColor=#ffffff;endArrow=open;dashed=1;" edge="1" parent="1" source="c35" target="c23">
<mxGeometry as="geometry" relative="1" />
</mxCell>
<mxCell id="c37" value="Each process uses its own local config/private certificate. No shared runtime directory or common process memory across machines. All origin hosts/ports configurable. Real multi-machine deployment remains an evidence limit; tests use separate loopback origins and transport doubles." style="rounded=0;whiteSpace=wrap;html=0;fillColor=#fff2cc;strokeColor=#666666;fontSize=14;align=left;verticalAlign=top;spacing=12;" vertex="1" parent="1">
<mxGeometry as="geometry" x="30" y="1240" width="1720" height="100" />
</mxCell>
</root>
</mxGraphModel>
</diagram>
<diagram id="p3" name="Native platform adapters: same application DLLs">
<mxGraphModel dx="1700" dy="1500" grid="1" gridSize="10" guides="1" tooltips="1" connect="1" arrows="1" fold="1" page="1" pageScale="1" pageWidth="1700" pageHeight="1200" math="0" shadow="0">
<root>
<mxCell id="0" />
<mxCell id="1" parent="0" />
<mxCell id="c38" value="Native platform adapters: same application DLLs" style="text;html=0;fontSize=24;fontStyle=1;align=left;verticalAlign=middle;" vertex="1" parent="1">
<mxGeometry as="geometry" x="30" y="15" width="1640" height="45" />
</mxCell>
<mxCell id="c39" value="Build machine&#10;.NET 10 SDK + package feeds&#10;Publish separate framework-dependent DLLs&#10;No OS-specific apphost; no containers&#10;Bundle includes provisioner + installers" style="rounded=0;whiteSpace=wrap;html=0;fillColor=#dae8fc;strokeColor=#666666;fontSize=14;align=left;verticalAlign=top;spacing=12;" vertex="1" parent="1">
<mxGeometry as="geometry" x="570" y="110" width="560" height="200" />
</mxCell>
<mxCell id="c40" value="Linux target&#10;Debian/Ubuntu ancestry, apt, systemd&#10;Install aspnetcore-runtime-10.0 if absent&#10;PostgreSQL when persistent service selected&#10;Per-service Unix users/env/PFX&#10;Native unit + restart-on-failure" style="rounded=0;whiteSpace=wrap;html=0;fillColor=#d5e8d4;strokeColor=#666666;fontSize=14;align=left;verticalAlign=top;spacing=12;" vertex="1" parent="1">
<mxGeometry as="geometry" x="30" y="540" width="490" height="270" />
</mxCell>
<mxCell id="c41" value="Windows target&#10;Windows Services / virtual service identities&#10;.NET runtime download if absent&#10;EDB PostgreSQL 17 manifest/checksum&#10;%ProgramData%/HealthApp paths&#10;JSON/PFX ACLs + selected firewall rules&#10;UseWindowsService lifetime" style="rounded=0;whiteSpace=wrap;html=0;fillColor=#d5e8d4;strokeColor=#666666;fontSize=14;align=left;verticalAlign=top;spacing=12;" vertex="1" parent="1">
<mxGeometry as="geometry" x="600" y="540" width="490" height="270" />
</mxCell>
<mxCell id="c42" value="macOS target&#10;launchd / hidden service identities&#10;.NET runtime download if absent&#10;Homebrew PostgreSQL 17 / owned cluster&#10;Apple tools/Homebrew if needed&#10;/Library/Application Support/HealthApp&#10;System CA trust; private env/plist" style="rounded=0;whiteSpace=wrap;html=0;fillColor=#d5e8d4;strokeColor=#666666;fontSize=14;align=left;verticalAlign=top;spacing=12;" vertex="1" parent="1">
<mxGeometry as="geometry" x="1170" y="540" width="490" height="270" />
</mxCell>
<mxCell id="c43" value="Same DLLs; native adapter" style="edgeStyle=orthogonalEdgeStyle;rounded=0;html=0;fontSize=12;labelBackgroundColor=#ffffff;endArrow=classic;" edge="1" parent="1" source="c39" target="c40">
<mxGeometry as="geometry" relative="1" />
</mxCell>
<mxCell id="c44" value="Same DLLs; native adapter" style="edgeStyle=orthogonalEdgeStyle;rounded=0;html=0;fontSize=12;labelBackgroundColor=#ffffff;endArrow=classic;" edge="1" parent="1" source="c39" target="c41">
<mxGeometry as="geometry" relative="1" />
</mxCell>
<mxCell id="c45" value="Same DLLs; native adapter" style="edgeStyle=orthogonalEdgeStyle;rounded=0;html=0;fontSize=12;labelBackgroundColor=#ffffff;endArrow=classic;" edge="1" parent="1" source="c39" target="c42">
<mxGeometry as="geometry" relative="1" />
</mxCell>
<mxCell id="c46" value="Verified code paths/config-format tests ≠ proven native execution on every target. Manual GitHub Actions workflow exists; run outcomes unknown. Linux --root performs offline staging only. Native adapters need administrator/network access; distribution does not provision host SSH permissions. Evidence: deploy/build-release.*, installer/*, ConfigurationWriter, LaunchdWriter." style="rounded=0;whiteSpace=wrap;html=0;fillColor=#fff2cc;strokeColor=#666666;fontSize=14;align=left;verticalAlign=top;spacing=12;" vertex="1" parent="1">
<mxGeometry as="geometry" x="30" y="970" width="1630" height="100" />
</mxCell>
</root>
</mxGraphModel>
</diagram>
</mxfile>
File diff suppressed because it is too large. Load diff
+40
View File
@@ -0,0 +1,40 @@
# Documented design versus implementation
Scope: repository snapshot 2026-10-12, commit `5d9371388c15066eeb2bc124ed227659c644dab5`. **Difference** is not automatically a defect. Current `.drawio` authority and explicit corrections supersede same-stem historical JPEGs under [Architecture README](../Docs/Architecture/README.md). No authoritative document was edited and no conflicting design was silently selected for implementation.
## Verified differences and elaborations
| ID | Original/current documentation | As-built evidence and interpretation |
| --- | --- | --- |
| D-01 | Original [domain model](../Docs/Architecture/01_domain_model.jpg) and [duplicate domain image](../Docs/Architecture/personal_health_measurement_all_diagrams-Domain%20Model.jpg) show Patient, Observation and Health Summary only | Account/profile lifecycle, professional assignments, measurement context, selections, trend assessments and overview concepts now exist. `HealthInsight` is a transient summary without stored summary ID. This is an expanded as-built model, not a claim that the original three concepts were replaced. [domains](../src/InsightsService/Domain/HealthInsight.cs), [assignments](../src/ApiGateway/Security/ProfessionalAssignments.cs) |
| D-02 | [Patient class](../Docs/Architecture/03_class_patient_profile_service.jpg) and [Patient ER](../Docs/Architecture/07_er_patient_profile_service.jpg) omit account association and account lookup | `Patient.AccountId`, nullable `account_id` and unique index plus by-account API now implement US-01/13. [migration](../src/PatientProfileService/Persistence/Migrations/20261005082209_AccountProfileAssociation.cs), [controller](../src/PatientProfileService/Controllers/PatientController.cs). Existing null associations are retained; no migration backfill assigns old rows to credentials. |
| D-03 | Original authentication design's opening/Section 10 says token format, lifetime, persistence owner and gateway protection are open; final paragraph permits minimum established mechanisms | Concrete opaque framework Bearer tokens, default 30-minute lifetime, Patient-owned association and shared-key HTTPS boundaries are implemented and described in [AUTHENTICATION.md](../src/AUTHENTICATION.md). Opening/open-decision text was not updated, so the document has residual status ambiguity. The final permission is consistent with selecting simple mechanisms; this task does not infer an unrecorded formal approval history. |
| D-04 | Historical Insights ER showed persisted HealthSummary; old Overview ER showed an overview persistence concept | Current [Insights correction](../Docs/Architecture/us10-insights-correction.md), [Insights drawio](../Docs/Architecture/09_er_insights_service.drawio) and [Overview drawio](../Docs/Architecture/06_class_health_overview_service.drawio) already supersede those concepts. Code has no DB/repository in either service. Historical inconsistency is resolved by current baseline; do not report it as a new implementation violation. |
| D-05 | Updated logical diagrams use schematic methods/names (`activity`, preparation details, HealthOverview/DTO) and sometimes combine domain/DTO boxes | Code uses `ActivityCondition`, `RestDurationMinutes`, flattened owned columns; separate local consumer DTOs; Overview client abstractions are abstract classes whereas Insights' client is an interface. Observation DTO does not expose creation/update timestamps although its domain entity contains them. These are implementation details permitted by Architecture README, not unexplained new services/tables. [context mapping](../src/ObservationService/Persistence/ObservationDbContext.cs), [DTO](../src/ObservationService/Contracts/ObservationDto.cs) |
| D-06 | Original class diagrams omit EF contexts, framework authentication, patch-presence fields and detailed trend result types | As-built class pages show those actual dependencies/attributes and responsibilities. No shared runtime contracts or direct class links across service boundaries were found. [patch](../src/ObservationService/Contracts/PatchObservationRequest.cs), [trend records](../src/InsightsService/Domain/TrendAssessment.cs), [Gateway startup](../src/ApiGateway/Program.cs) |
| D-07 | US-16 and its addendum describe Linux/systemd; later implementation guide also describes Windows/macOS | Native Windows Services/launchd adapters and WindowsServices package are present. This expands implemented platform support beyond the Linux wording while retaining service boundaries. Whether formal requirements should be updated is outside this assignment. Native success on every advertised platform is unknown. [adapters](../deploy/installer/install.ps1), [macOS](../deploy/installer/install-macos.sh) |
| D-08 | Committed systemd templates use `User=healthapp` and `/etc/healthapp/NAME.env`; installer guide describes dedicated users/nested files | Installer rewrites templates into `healthapp-NAME` user/group and `/etc/healthapp/NAME/service.env`. Using templates manually without that transform differs from normal installed behavior. [template](../deploy/systemd/healthapp-observation.service), [installer](../deploy/installer/install.sh) |
| D-09 | Original topology depicts client Web/Mobile | No product frontend is present. This repository implements the API backend; JMeter/curl/test clients are actual consumers. It is unknown whether a client lives in another repository. Backend stories do not establish a frontend deliverable. |
| D-10 | Installation prose broadly says native verification checks independent processes; US-16 AC-I includes stop/restart demonstration | Linux and Windows adapters check running state/distinct PIDs. macOS adapter calls `launchctl print` and HTTPS probes but does not explicitly compare PIDs. Live verification does not cycle stop/restart; test suite does so with direct processes. This is a runtime-verification limitation, not proof that services cannot restart independently. [Linux verifier](../deploy/installer/verify.sh), [macOS](../deploy/installer/install-macos.sh), [tests](../tests/Deployment.AcceptanceTests/InstallationTests.cs) |
| D-11 | Early ownership section of [AUTHENTICATION.md](../src/AUTHENTICATION.md) says trend/overview endpoints remain unimplemented; later sections say they are implemented | Both endpoint sets, client permissions and integration tests exist. The earlier sentence is stale and contradicts later sections of that same implementation document. Earlier service-protection text names only Observation/Insights callbacks, while the later US-12 section/code also provides Overview callbacks. [routes](../src/ApiGateway/Controllers/HealthOverviewController.cs), [trend controller](../src/InsightsService/Controllers/InsightsController.cs) |
## Current behavior with requirements or evidence limits
| ID | Verified behavior | Requirement/evidence implication |
| --- | --- | --- |
| U-01 | Narrative conflict detection is a finite substring list, including documented English/Danish phrases. [calculator](../src/InsightsService/Domain/InsightCalculator.Trends.cs) | US-04/11 broadly require relevant conflicts to be apparent; cited example `during exercise` is covered. Arbitrary wording/negation is not semantically understood. Exhaustive natural-language fulfillment is unknown and not proven by existing fixtures. |
| U-02 | Reference thresholds and development labels have compiled sources/limits; favourable/concerning logic is coded locally. [TRENDS](../src/TRENDS.md) | Numerical behavior is testable. Whether every inference is clinically supported under all input combinations needs an independent domain assessment; this documentation does not assert clinical validation. |
| U-03 | Ownership middleware compares most path segments case-sensitively; routing accepts conventional case variants | Canonical routes work. A case-varied route can return 404/403 instead of the controller behavior. Requirements do not prescribe casing; observable interface inconsistency, not a confirmed missing story. [middleware](../src/ApiGateway/Security/PatientAccessMiddleware.cs) |
| U-04 | Missing expected ownership JSON fields/invalid JSON lack dedicated upstream 502 mapping; general exception handling applies | Such malformed responses may yield 500, unlike explicit Insights/Overview invalid-JSON 502 handling. Upstream failure-injection tests do not prove every malformed shape/status path. |
| U-05 | Assignments are startup configuration, no installer assignment population; generated professional has none | US-14 assigned reads exist and are tested with predefined test assignments. A normal fresh installation cannot demonstrate a populated professional review workflow until assignments are configured. This does not require an out-of-scope assignment-management API. |
| U-06 | Deployment tests use different loopback addresses, controlled SSH/SCP and package doubles | These establish interfaces/scoping/command intent, not actual multi-machine routing, network/firewall policy or native package/service-manager success. Manual CI workflow exists; execution results are unknown in this task. |
| U-07 | Generated DB connections use `Pooling=false;SslMode=Prefer`; normal Linux startup bootstrap checks local PostgreSQL even if an external admin file is supplied | This is the actual configuration. Mandatory verified DB TLS is not implemented. External-DB Linux installation can still provision/check an unnecessary local server; the guide's general external-DB description does not mention this coupling. [bootstrap call](../deploy/installer/install.sh), [connection builder](../deploy/HealthApp.Provisioning/Deployment.cs) |
| U-08 | Installer detects existing app/config and refuses; failure retains partial output | No safe resumable upgrade/uninstall/transactional rollback is implemented. First-install retries may require administrative handling of retained material. This is documented prototype scope, not a silently repaired behavior. |
| U-09 | Complete flag in local installers/verifier is selected by literal `all` | Explicitly listing all five service names installs them but does not trigger the complete synthetic workflow in those wrappers. Distribution uses selected count for completeness. This is an observable verification asymmetry under US-16, without changing the application topology. |
| U-10 | Overview does sequential reads; no concurrency token or snapshot; history unbounded | Concurrent-write snapshot, conditional-edit protection, pagination and load resilience are absent. They are not explicit baseline story requirements; do not reclassify them as missing accepted features. |
| U-11 | Filesystem key ring has no explicitly configured encryption-at-rest; no immediate bearer revocation or account-record recheck | The prototype has persistent protected tickets and file permissions, not a full identity lifecycle. Registration/recovery/MFA/refresh/administration are explicitly outside scope. Production security compliance is not established. |
| U-12 | Supplied PFX is checked for a private key, then runtime verifies endpoints; generated leaf/CA expiry not automatically renewed | Early preflight, rotation, renewal and universal third-party chain support are not proven. Replacing certificates is an administrative first-install facility, not an implemented renewal service. |
## Unresolved unknowns
Live installed software/configuration may differ from this checkout; no server, device or administrative session was accessed. Native Windows/macOS CI runs, actual deployment firewall rules, backup/restore behavior, multi-instance Gateway behavior, certificate renewal procedures, production security/clinical approval and external client implementations cannot be established from this repository. [Traceability](requirements-traceability.md) separates these from observed functional support.
+486
View File
@@ -0,0 +1,486 @@
# Evidence inventory
Snapshot: 2026-10-12; source commit `5d9371388c15066eeb2bc124ed227659c644dab5`. This inventory lists tracked specification, application, deployment and acceptance-test files used to bound the review. SHA-256 prefixes identify file content, not a test result. Source links remain repository-relative.
## Inspection boundaries
Production source, contracts, persistence mappings/migrations, startup/security configuration, installer/provisioner, relevant acceptance fixtures/assertions and specification text were inspected. Current Draw.io cell content and original context/domain/Patient class/Patient ER images were examined. Same-stem historical JPEGs are superseded by current editable diagrams; their authority is governed by Architecture README. Test code is evidence of intended verification, not a fresh execution claim.
Experiment scripts/plans and their README were inspected for ancillary architecture. Private credentials and ignored raw load-test results were deliberately excluded; they are not needed to document production responsibilities. No live server or native installer was executed. No dependency versions were looked up externally; project declarations define this snapshot.
## File evidence
| File | Kind | SHA-256 prefix |
| --- | --- | --- |
| [.github/workflows/prototype-native-install.yml](../.github/workflows/prototype-native-install.yml) | Deployment / configuration / native validation | `de4240167653b10b` |
| [.gitignore](../.gitignore) | Repository / build / instructions | `5ff2245aafc37c27` |
| [AGENTS.md](../AGENTS.md) | Repository / build / instructions | `02330ed17811077c` |
| [Docs/Architecture/01_domain_model.jpg](../Docs/Architecture/01_domain_model.jpg) | Specification / context | `43354c405b637578` |
| [Docs/Architecture/02_microservice_architecture.jpg](../Docs/Architecture/02_microservice_architecture.jpg) | Specification / context | `67862bb8e9c1029f` |
| [Docs/Architecture/03_class_patient_profile_service.jpg](../Docs/Architecture/03_class_patient_profile_service.jpg) | Specification / context | `4abc364239a97b0d` |
| [Docs/Architecture/04_class_observation_service.drawio](../Docs/Architecture/04_class_observation_service.drawio) | Specification / context | `0b48a2760252607d` |
| [Docs/Architecture/04_class_observation_service.jpg](../Docs/Architecture/04_class_observation_service.jpg) | Specification / context | `749647606ee3a5a7` |
| [Docs/Architecture/05_class_insights_service.drawio](../Docs/Architecture/05_class_insights_service.drawio) | Specification / context | `8c5837f38eb745e1` |
| [Docs/Architecture/05_class_insights_service.jpg](../Docs/Architecture/05_class_insights_service.jpg) | Specification / context | `18d5fbeec5db5947` |
| [Docs/Architecture/06_class_health_overview_service.drawio](../Docs/Architecture/06_class_health_overview_service.drawio) | Specification / context | `8c401510f8c0a2e8` |
| [Docs/Architecture/06_class_health_overview_service.jpg](../Docs/Architecture/06_class_health_overview_service.jpg) | Specification / context | `1c2751c7fdbf123b` |
| [Docs/Architecture/07_er_patient_profile_service.jpg](../Docs/Architecture/07_er_patient_profile_service.jpg) | Specification / context | `8074f734e3e4e28e` |
| [Docs/Architecture/08_er_observation_service.drawio](../Docs/Architecture/08_er_observation_service.drawio) | Specification / context | `88cc97c26ff40650` |
| [Docs/Architecture/08_er_observation_service.jpg](../Docs/Architecture/08_er_observation_service.jpg) | Specification / context | `e6b02064ba2019ac` |
| [Docs/Architecture/09_er_insights_service-overruled no persistence here to give an idea of what data is needed to be able to use from other services or calculate.jpg](../Docs/Architecture/09_er_insights_service-overruled%20no%20persistence%20here%20to%20give%20an%20idea%20of%20what%20data%20is%20needed%20to%20be%20able%20to%20use%20from%20other%20services%20or%20calculate.jpg) | Specification / context | `6f01585a506f84ef` |
| [Docs/Architecture/09_er_insights_service.drawio](../Docs/Architecture/09_er_insights_service.drawio) | Specification / context | `534ba79368ac79eb` |
| [Docs/Architecture/10_er_health_overview_service-overruled no persistence here to give an idea of what data is needed to be able to use from other services or calculate.jpg](../Docs/Architecture/10_er_health_overview_service-overruled%20no%20persistence%20here%20to%20give%20an%20idea%20of%20what%20data%20is%20needed%20to%20be%20able%20to%20use%20from%20other%20services%20or%20calculate.jpg) | Specification / context | `b27db286ce26cbc1` |
| [Docs/Architecture/README.md](../Docs/Architecture/README.md) | Specification / context | `3754fa7ed95a6ef5` |
| [Docs/Architecture/personal_health_measurement_all_diagrams-Domain Model.jpg](../Docs/Architecture/personal_health_measurement_all_diagrams-Domain%20Model.jpg) | Specification / context | `285c4c52440a3000` |
| [Docs/Architecture/us10-insights-correction.md](../Docs/Architecture/us10-insights-correction.md) | Specification / context | `259d59ee31518068` |
| [Docs/Design/authentication-and-access-control-design.md](../Docs/Design/authentication-and-access-control-design.md) | Specification / context | `b044d0f78d542be0` |
| [Docs/Requirements/00-common-requirements.md](../Docs/Requirements/00-common-requirements.md) | Specification / context | `1f056a53699e0875` |
| [Docs/Requirements/US16 easy installation and deployment installer.txt](../Docs/Requirements/US16%20easy%20installation%20and%20deployment%20installer.txt) | Specification / context | `07416edc16ce034a` |
| [Docs/Requirements/us01-create-patient-profile.md](../Docs/Requirements/us01-create-patient-profile.md) | Specification / context | `52872490bd37b15e` |
| [Docs/Requirements/us02-view-patient-profile.md](../Docs/Requirements/us02-view-patient-profile.md) | Specification / context | `8af9e4e55ddb9bb4` |
| [Docs/Requirements/us03-update-patient-profile.md](../Docs/Requirements/us03-update-patient-profile.md) | Specification / context | `0825a974cea87924` |
| [Docs/Requirements/us04-record-observation.md](../Docs/Requirements/us04-record-observation.md) | Specification / context | `894e99dac4e05604` |
| [Docs/Requirements/us05-view-observation.md](../Docs/Requirements/us05-view-observation.md) | Specification / context | `3632aebd02b34996` |
| [Docs/Requirements/us06-latest-observation.md](../Docs/Requirements/us06-latest-observation.md) | Specification / context | `dfec3b4fcb1c8410` |
| [Docs/Requirements/us07-observation-history.md](../Docs/Requirements/us07-observation-history.md) | Specification / context | `dec0f06cee54e713` |
| [Docs/Requirements/us08-update-observation.md](../Docs/Requirements/us08-update-observation.md) | Specification / context | `1e65e62813db4e50` |
| [Docs/Requirements/us09-delete-observation.md](../Docs/Requirements/us09-delete-observation.md) | Specification / context | `28e4dc1cbc92f60b` |
| [Docs/Requirements/us10-calculated-insight.md](../Docs/Requirements/us10-calculated-insight.md) | Specification / context | `ed2f03e69d460ef5` |
| [Docs/Requirements/us11-health-trend.md](../Docs/Requirements/us11-health-trend.md) | Specification / context | `7121bb4890e70621` |
| [Docs/Requirements/us12-health-overview.md](../Docs/Requirements/us12-health-overview.md) | Specification / context | `58db5d95b70b09f7` |
| [Docs/Requirements/us13-patient-authentication.md](../Docs/Requirements/us13-patient-authentication.md) | Specification / context | `d2584876fbb17ecd` |
| [Docs/Requirements/us14-professional-access.md](../Docs/Requirements/us14-professional-access.md) | Specification / context | `bb451f00e4bad5d7` |
| [Docs/Requirements/us15-measurement-guidance.md](../Docs/Requirements/us15-measurement-guidance.md) | Specification / context | `1aa52764ac93fcdb` |
| [Docs/Requirements/us16-addendum](../Docs/Requirements/us16-addendum) | Specification / context | `61f88829b2501050` |
| [Docs/requirements-reconciliation-changelog.md](../Docs/requirements-reconciliation-changelog.md) | Specification / context | `318c4e2c9f3c1137` |
| [HealthApp.slnx](../HealthApp.slnx) | Repository / build / instructions | `3b070ed1a967e900` |
| [README.MD](../README.MD) | Repository / build / instructions | `fd783476366adf4c` |
| [deploy/HealthApp.Provisioning/ConfigurationWriter.cs](../deploy/HealthApp.Provisioning/ConfigurationWriter.cs) | Deployment / configuration / native validation | `702f4a646eac3dd6` |
| [deploy/HealthApp.Provisioning/DatabaseProvisioning.cs](../deploy/HealthApp.Provisioning/DatabaseProvisioning.cs) | Deployment / configuration / native validation | `e1c8e252642b12f8` |
| [deploy/HealthApp.Provisioning/Deployment.cs](../deploy/HealthApp.Provisioning/Deployment.cs) | Deployment / configuration / native validation | `8f3e6fc3761fe731` |
| [deploy/HealthApp.Provisioning/Distribution.cs](../deploy/HealthApp.Provisioning/Distribution.cs) | Deployment / configuration / native validation | `d9b7c467172e3156` |
| [deploy/HealthApp.Provisioning/HealthApp.Provisioning.csproj](../deploy/HealthApp.Provisioning/HealthApp.Provisioning.csproj) | Deployment / configuration / native validation | `5f18785a17f78d01` |
| [deploy/HealthApp.Provisioning/InstallationVerification.cs](../deploy/HealthApp.Provisioning/InstallationVerification.cs) | Deployment / configuration / native validation | `094877cb5e6ff6e8` |
| [deploy/HealthApp.Provisioning/LaunchdWriter.cs](../deploy/HealthApp.Provisioning/LaunchdWriter.cs) | Deployment / configuration / native validation | `b1d9b620ade4b525` |
| [deploy/HealthApp.Provisioning/Program.cs](../deploy/HealthApp.Provisioning/Program.cs) | Deployment / configuration / native validation | `e42034fedec2c3c1` |
| [deploy/INSTALLATION.md](../deploy/INSTALLATION.md) | Deployment / configuration / native validation | `94e8e3b7a7bcdf6f` |
| [deploy/api-gateway.env.example](../deploy/api-gateway.env.example) | Deployment / configuration / native validation | `e8137593d4710953` |
| [deploy/build-release.ps1](../deploy/build-release.ps1) | Deployment / configuration / native validation | `d85375f5a7392fe3` |
| [deploy/build-release.sh](../deploy/build-release.sh) | Deployment / configuration / native validation | `7de7fb0ffe963671` |
| [deploy/health-overview.env.example](../deploy/health-overview.env.example) | Deployment / configuration / native validation | `b7883d73a34da16a` |
| [deploy/insights.env.example](../deploy/insights.env.example) | Deployment / configuration / native validation | `8fff870eede50c4f` |
| [deploy/installer/bootstrap.sh](../deploy/installer/bootstrap.sh) | Deployment / configuration / native validation | `db52696d484fe728` |
| [deploy/installer/distribute.sh](../deploy/installer/distribute.sh) | Deployment / configuration / native validation | `bda6aa53146a3d4d` |
| [deploy/installer/install-macos.sh](../deploy/installer/install-macos.sh) | Deployment / configuration / native validation | `bd78d0ec3be482ce` |
| [deploy/installer/install.ps1](../deploy/installer/install.ps1) | Deployment / configuration / native validation | `4c1bbaac58c99539` |
| [deploy/installer/install.sh](../deploy/installer/install.sh) | Deployment / configuration / native validation | `ccc35b5764e96a7d` |
| [deploy/installer/services.sh](../deploy/installer/services.sh) | Deployment / configuration / native validation | `6a21a5c213fbe7b2` |
| [deploy/installer/verify.sh](../deploy/installer/verify.sh) | Deployment / configuration / native validation | `62d50b2bcd40b04a` |
| [deploy/observation.env.example](../deploy/observation.env.example) | Deployment / configuration / native validation | `c18f0f6abb1f32e9` |
| [deploy/patient-profile.env.example](../deploy/patient-profile.env.example) | Deployment / configuration / native validation | `f01a3ba42d22dbcf` |
| [deploy/systemd/healthapp-api-gateway.service](../deploy/systemd/healthapp-api-gateway.service) | Deployment / configuration / native validation | `15a9b7bc43a72940` |
| [deploy/systemd/healthapp-health-overview.service](../deploy/systemd/healthapp-health-overview.service) | Deployment / configuration / native validation | `d8841c4b04c74f3b` |
| [deploy/systemd/healthapp-insights.service](../deploy/systemd/healthapp-insights.service) | Deployment / configuration / native validation | `8ec5dbfa6e1a9fbd` |
| [deploy/systemd/healthapp-observation.service](../deploy/systemd/healthapp-observation.service) | Deployment / configuration / native validation | `a61518322838ca14` |
| [deploy/systemd/healthapp-patient-profile.service](../deploy/systemd/healthapp-patient-profile.service) | Deployment / configuration / native validation | `262b269a997923aa` |
| [src/AUTHENTICATION.md](../src/AUTHENTICATION.md) | Application / implementation documentation | `38e4a3580e1cc8aa` |
| [src/ApiGateway/ApiGateway.csproj](../src/ApiGateway/ApiGateway.csproj) | Application / implementation documentation | `6e81c32841f12d91` |
| [src/ApiGateway/Controllers/AuthenticationController.cs](../src/ApiGateway/Controllers/AuthenticationController.cs) | Application / implementation documentation | `f76ec4f393c55ee6` |
| [src/ApiGateway/Controllers/HealthOverviewController.cs](../src/ApiGateway/Controllers/HealthOverviewController.cs) | Application / implementation documentation | `0a05ccd0dd9b763e` |
| [src/ApiGateway/Controllers/InsightsController.cs](../src/ApiGateway/Controllers/InsightsController.cs) | Application / implementation documentation | `810c906f771ce01e` |
| [src/ApiGateway/Controllers/MeasurementGuidanceController.cs](../src/ApiGateway/Controllers/MeasurementGuidanceController.cs) | Application / implementation documentation | `1be2c32f56a5cda6` |
| [src/ApiGateway/Controllers/ObservationController.cs](../src/ApiGateway/Controllers/ObservationController.cs) | Application / implementation documentation | `2a33302f8d8158e2` |
| [src/ApiGateway/Controllers/PatientController.cs](../src/ApiGateway/Controllers/PatientController.cs) | Application / implementation documentation | `2b416bb49e98c400` |
| [src/ApiGateway/Controllers/ProfessionalController.cs](../src/ApiGateway/Controllers/ProfessionalController.cs) | Application / implementation documentation | `87f7c5830215673a` |
| [src/ApiGateway/Program.cs](../src/ApiGateway/Program.cs) | Application / implementation documentation | `9e6ba8e51c837719` |
| [src/ApiGateway/Security/InternalServiceAuthenticationHandler.cs](../src/ApiGateway/Security/InternalServiceAuthenticationHandler.cs) | Application / implementation documentation | `985ee505d8e38d15` |
| [src/ApiGateway/Security/PatientAccessMiddleware.cs](../src/ApiGateway/Security/PatientAccessMiddleware.cs) | Application / implementation documentation | `497c7f69c179fa04` |
| [src/ApiGateway/Security/ProfessionalAssignments.cs](../src/ApiGateway/Security/ProfessionalAssignments.cs) | Application / implementation documentation | `7883c801dcdec8df` |
| [src/ApiGateway/Security/PrototypeAccounts.cs](../src/ApiGateway/Security/PrototypeAccounts.cs) | Application / implementation documentation | `a4cbcaa6db514439` |
| [src/ApiGateway/appsettings.json](../src/ApiGateway/appsettings.json) | Application / implementation documentation | `817db0bf2ecca783` |
| [src/HealthOverviewService/Application/HealthOverviewApplicationService.cs](../src/HealthOverviewService/Application/HealthOverviewApplicationService.cs) | Application / implementation documentation | `234190b299f0487c` |
| [src/HealthOverviewService/Clients/InsightsServiceClient.cs](../src/HealthOverviewService/Clients/InsightsServiceClient.cs) | Application / implementation documentation | `1087c1ac57605ae7` |
| [src/HealthOverviewService/Clients/ObservationServiceClient.cs](../src/HealthOverviewService/Clients/ObservationServiceClient.cs) | Application / implementation documentation | `f6cef0c6f78e04ea` |
| [src/HealthOverviewService/Clients/PatientProfileServiceClient.cs](../src/HealthOverviewService/Clients/PatientProfileServiceClient.cs) | Application / implementation documentation | `7bba92bc1b382c3d` |
| [src/HealthOverviewService/Contracts/HealthOverviewDto.cs](../src/HealthOverviewService/Contracts/HealthOverviewDto.cs) | Application / implementation documentation | `d95e27f230cfeeb1` |
| [src/HealthOverviewService/Controllers/HealthOverviewController.cs](../src/HealthOverviewService/Controllers/HealthOverviewController.cs) | Application / implementation documentation | `c3e9bc2e646527a4` |
| [src/HealthOverviewService/HealthOverviewService.csproj](../src/HealthOverviewService/HealthOverviewService.csproj) | Application / implementation documentation | `6e81c32841f12d91` |
| [src/HealthOverviewService/Program.cs](../src/HealthOverviewService/Program.cs) | Application / implementation documentation | `63a799d09cdeaf1e` |
| [src/HealthOverviewService/appsettings.json](../src/HealthOverviewService/appsettings.json) | Application / implementation documentation | `817db0bf2ecca783` |
| [src/InsightsService/Application/InsightsApplicationService.cs](../src/InsightsService/Application/InsightsApplicationService.cs) | Application / implementation documentation | `7319a7f8057b1906` |
| [src/InsightsService/Clients/HttpObservationServiceClient.cs](../src/InsightsService/Clients/HttpObservationServiceClient.cs) | Application / implementation documentation | `91677b578eddbd12` |
| [src/InsightsService/Clients/ObservationServiceClient.cs](../src/InsightsService/Clients/ObservationServiceClient.cs) | Application / implementation documentation | `802b8cc66f58441d` |
| [src/InsightsService/Contracts/HealthInsightDto.cs](../src/InsightsService/Contracts/HealthInsightDto.cs) | Application / implementation documentation | `001d24e7d2b0dedf` |
| [src/InsightsService/Contracts/ObservationDto.cs](../src/InsightsService/Contracts/ObservationDto.cs) | Application / implementation documentation | `fd37572e721ba288` |
| [src/InsightsService/Controllers/InsightsController.cs](../src/InsightsService/Controllers/InsightsController.cs) | Application / implementation documentation | `0304dc102bb192ab` |
| [src/InsightsService/Domain/ContextSelection.cs](../src/InsightsService/Domain/ContextSelection.cs) | Application / implementation documentation | `82b9acd07e6b4de0` |
| [src/InsightsService/Domain/HealthInsight.cs](../src/InsightsService/Domain/HealthInsight.cs) | Application / implementation documentation | `fc634cb3b99905c3` |
| [src/InsightsService/Domain/InsightCalculator.Trends.cs](../src/InsightsService/Domain/InsightCalculator.Trends.cs) | Application / implementation documentation | `ef196331aad4cf12` |
| [src/InsightsService/Domain/InsightCalculator.cs](../src/InsightsService/Domain/InsightCalculator.cs) | Application / implementation documentation | `2575a8f7641f6f23` |
| [src/InsightsService/Domain/TrendAssessment.cs](../src/InsightsService/Domain/TrendAssessment.cs) | Application / implementation documentation | `5ba75fba606fa7ca` |
| [src/InsightsService/InsightsService.csproj](../src/InsightsService/InsightsService.csproj) | Application / implementation documentation | `6e81c32841f12d91` |
| [src/InsightsService/Program.cs](../src/InsightsService/Program.cs) | Application / implementation documentation | `3aceaf19cc216790` |
| [src/InsightsService/appsettings.json](../src/InsightsService/appsettings.json) | Application / implementation documentation | `817db0bf2ecca783` |
| [src/OVERVIEW.md](../src/OVERVIEW.md) | Application / implementation documentation | `aa7f4ca1ffca79de` |
| [src/ObservationService/Application/ObservationApplicationService.cs](../src/ObservationService/Application/ObservationApplicationService.cs) | Application / implementation documentation | `4ceaa7d67b391b0a` |
| [src/ObservationService/Application/ObservationRepository.cs](../src/ObservationService/Application/ObservationRepository.cs) | Application / implementation documentation | `a1c21ef7e0700b4f` |
| [src/ObservationService/Contracts/MeasurementContextPatch.cs](../src/ObservationService/Contracts/MeasurementContextPatch.cs) | Application / implementation documentation | `fae0cad81e9bec85` |
| [src/ObservationService/Contracts/ObservationDto.cs](../src/ObservationService/Contracts/ObservationDto.cs) | Application / implementation documentation | `989312e16eaa4306` |
| [src/ObservationService/Contracts/PatchObservationRequest.cs](../src/ObservationService/Contracts/PatchObservationRequest.cs) | Application / implementation documentation | `3be4db307b24e5c8` |
| [src/ObservationService/Contracts/RecordObservationRequest.cs](../src/ObservationService/Contracts/RecordObservationRequest.cs) | Application / implementation documentation | `7430845925f6ae9c` |
| [src/ObservationService/Contracts/UpdateObservationRequest.cs](../src/ObservationService/Contracts/UpdateObservationRequest.cs) | Application / implementation documentation | `f1d987f3d0d996ce` |
| [src/ObservationService/Controllers/ObservationController.cs](../src/ObservationService/Controllers/ObservationController.cs) | Application / implementation documentation | `68fe89a643bf1ff0` |
| [src/ObservationService/Domain/BloodPressureObservation.cs](../src/ObservationService/Domain/BloodPressureObservation.cs) | Application / implementation documentation | `a968856d9d9a7e8d` |
| [src/ObservationService/Domain/ContextSelection.cs](../src/ObservationService/Domain/ContextSelection.cs) | Application / implementation documentation | `1d7eeba19330a191` |
| [src/ObservationService/Domain/MeasurementContext.cs](../src/ObservationService/Domain/MeasurementContext.cs) | Application / implementation documentation | `500c7e2c02213fc1` |
| [src/ObservationService/ObservationService.csproj](../src/ObservationService/ObservationService.csproj) | Application / implementation documentation | `2a14c125f601d5fa` |
| [src/ObservationService/Persistence/Migrations/20261001095222_InitialObservationSchema.Designer.cs](../src/ObservationService/Persistence/Migrations/20261001095222_InitialObservationSchema.Designer.cs) | Application / implementation documentation | `9f24f074d1c49343` |
| [src/ObservationService/Persistence/Migrations/20261001095222_InitialObservationSchema.cs](../src/ObservationService/Persistence/Migrations/20261001095222_InitialObservationSchema.cs) | Application / implementation documentation | `1a44e09a08a6045f` |
| [src/ObservationService/Persistence/Migrations/20261005094632_RecordedMeasurementContext.Designer.cs](../src/ObservationService/Persistence/Migrations/20261005094632_RecordedMeasurementContext.Designer.cs) | Application / implementation documentation | `1cb88c86e7a13a5c` |
| [src/ObservationService/Persistence/Migrations/20261005094632_RecordedMeasurementContext.cs](../src/ObservationService/Persistence/Migrations/20261005094632_RecordedMeasurementContext.cs) | Application / implementation documentation | `da719484aab8eff2` |
| [src/ObservationService/Persistence/Migrations/ObservationDbContextModelSnapshot.cs](../src/ObservationService/Persistence/Migrations/ObservationDbContextModelSnapshot.cs) | Application / implementation documentation | `fb9c5c7d874f4b23` |
| [src/ObservationService/Persistence/ObservationDbContext.cs](../src/ObservationService/Persistence/ObservationDbContext.cs) | Application / implementation documentation | `6d9f0c6106db8b2f` |
| [src/ObservationService/Persistence/SqlObservationRepository.cs](../src/ObservationService/Persistence/SqlObservationRepository.cs) | Application / implementation documentation | `f77e38151d481cc3` |
| [src/ObservationService/Program.cs](../src/ObservationService/Program.cs) | Application / implementation documentation | `7ad86451a63a7b49` |
| [src/ObservationService/appsettings.json](../src/ObservationService/appsettings.json) | Application / implementation documentation | `8cd0df652a9a4966` |
| [src/PatientProfileService/Application/PatientApplicationService.cs](../src/PatientProfileService/Application/PatientApplicationService.cs) | Application / implementation documentation | `8f673a37101bd11a` |
| [src/PatientProfileService/Application/PatientRepository.cs](../src/PatientProfileService/Application/PatientRepository.cs) | Application / implementation documentation | `4d9d0ee890f2ce9e` |
| [src/PatientProfileService/Application/ProfileAlreadyExistsException.cs](../src/PatientProfileService/Application/ProfileAlreadyExistsException.cs) | Application / implementation documentation | `96ee280d51c6996f` |
| [src/PatientProfileService/Contracts/CreatePatientRequest.cs](../src/PatientProfileService/Contracts/CreatePatientRequest.cs) | Application / implementation documentation | `dd75326c9d723b9a` |
| [src/PatientProfileService/Contracts/PatientDto.cs](../src/PatientProfileService/Contracts/PatientDto.cs) | Application / implementation documentation | `2886340d45231135` |
| [src/PatientProfileService/Contracts/UpdatePatientRequest.cs](../src/PatientProfileService/Contracts/UpdatePatientRequest.cs) | Application / implementation documentation | `27528295eccdb708` |
| [src/PatientProfileService/Controllers/PatientController.cs](../src/PatientProfileService/Controllers/PatientController.cs) | Application / implementation documentation | `ac2c59bf16c70ea7` |
| [src/PatientProfileService/Domain/Patient.cs](../src/PatientProfileService/Domain/Patient.cs) | Application / implementation documentation | `7eaeee54560d9754` |
| [src/PatientProfileService/PatientProfileService.csproj](../src/PatientProfileService/PatientProfileService.csproj) | Application / implementation documentation | `2a14c125f601d5fa` |
| [src/PatientProfileService/Persistence/Migrations/20260930200031_InitialPatientSchema.Designer.cs](../src/PatientProfileService/Persistence/Migrations/20260930200031_InitialPatientSchema.Designer.cs) | Application / implementation documentation | `721fdc07915da2fa` |
| [src/PatientProfileService/Persistence/Migrations/20260930200031_InitialPatientSchema.cs](../src/PatientProfileService/Persistence/Migrations/20260930200031_InitialPatientSchema.cs) | Application / implementation documentation | `715e32ae82b3133a` |
| [src/PatientProfileService/Persistence/Migrations/20261005082209_AccountProfileAssociation.Designer.cs](../src/PatientProfileService/Persistence/Migrations/20261005082209_AccountProfileAssociation.Designer.cs) | Application / implementation documentation | `7d58aae8acc9e4e1` |
| [src/PatientProfileService/Persistence/Migrations/20261005082209_AccountProfileAssociation.cs](../src/PatientProfileService/Persistence/Migrations/20261005082209_AccountProfileAssociation.cs) | Application / implementation documentation | `d61827e783580644` |
| [src/PatientProfileService/Persistence/Migrations/PatientDbContextModelSnapshot.cs](../src/PatientProfileService/Persistence/Migrations/PatientDbContextModelSnapshot.cs) | Application / implementation documentation | `4137f40f98d3de0d` |
| [src/PatientProfileService/Persistence/PatientDbContext.cs](../src/PatientProfileService/Persistence/PatientDbContext.cs) | Application / implementation documentation | `c3ae81375a6973bb` |
| [src/PatientProfileService/Persistence/SqlPatientRepository.cs](../src/PatientProfileService/Persistence/SqlPatientRepository.cs) | Application / implementation documentation | `637d9a788b95ced0` |
| [src/PatientProfileService/Program.cs](../src/PatientProfileService/Program.cs) | Application / implementation documentation | `087178aa8c556e97` |
| [src/PatientProfileService/appsettings.json](../src/PatientProfileService/appsettings.json) | Application / implementation documentation | `8cd0df652a9a4966` |
| [src/README.md](../src/README.md) | Application / implementation documentation | `8779152d2a416c51` |
| [src/TRENDS.md](../src/TRENDS.md) | Application / implementation documentation | `0506cb4fef1e36e8` |
| [tests/Deployment.AcceptanceTests/BootstrapTests.cs](../tests/Deployment.AcceptanceTests/BootstrapTests.cs) | Acceptance / fixture / test support | `fe3dc46f5c127bb3` |
| [tests/Deployment.AcceptanceTests/Deployment.AcceptanceTests.csproj](../tests/Deployment.AcceptanceTests/Deployment.AcceptanceTests.csproj) | Acceptance / fixture / test support | `aa3bee15a11bd295` |
| [tests/Deployment.AcceptanceTests/DeploymentFixture.cs](../tests/Deployment.AcceptanceTests/DeploymentFixture.cs) | Acceptance / fixture / test support | `7138d67f1ab0def4` |
| [tests/Deployment.AcceptanceTests/InstallationTests.cs](../tests/Deployment.AcceptanceTests/InstallationTests.cs) | Acceptance / fixture / test support | `b771a4ffdd667eb1` |
| [tests/Observation.AcceptanceTests/ContextFilteredHistoryTests.cs](../tests/Observation.AcceptanceTests/ContextFilteredHistoryTests.cs) | Acceptance / fixture / test support | `0995b4980a55c1cd` |
| [tests/Observation.AcceptanceTests/ContextSelectedInsightTests.cs](../tests/Observation.AcceptanceTests/ContextSelectedInsightTests.cs) | Acceptance / fixture / test support | `ce8e908a3ff10c01` |
| [tests/Observation.AcceptanceTests/DeleteContextualisedObservationTests.cs](../tests/Observation.AcceptanceTests/DeleteContextualisedObservationTests.cs) | Acceptance / fixture / test support | `2709163cd782fee2` |
| [tests/Observation.AcceptanceTests/DeleteObservationTests.cs](../tests/Observation.AcceptanceTests/DeleteObservationTests.cs) | Acceptance / fixture / test support | `916ebbcc0f5d3737` |
| [tests/Observation.AcceptanceTests/HealthInsightTests.cs](../tests/Observation.AcceptanceTests/HealthInsightTests.cs) | Acceptance / fixture / test support | `b6e1cfac712455f3` |
| [tests/Observation.AcceptanceTests/HealthOverviewTests.cs](../tests/Observation.AcceptanceTests/HealthOverviewTests.cs) | Acceptance / fixture / test support | `0e7874fde9943828` |
| [tests/Observation.AcceptanceTests/HealthTrendTests.cs](../tests/Observation.AcceptanceTests/HealthTrendTests.cs) | Acceptance / fixture / test support | `48266f7b71838fe9` |
| [tests/Observation.AcceptanceTests/LatestObservationTests.cs](../tests/Observation.AcceptanceTests/LatestObservationTests.cs) | Acceptance / fixture / test support | `d4cb653d7fc0999b` |
| [tests/Observation.AcceptanceTests/MeasurementContextMigrationTests.cs](../tests/Observation.AcceptanceTests/MeasurementContextMigrationTests.cs) | Acceptance / fixture / test support | `7cf4d025ac906cce` |
| [tests/Observation.AcceptanceTests/Observation.AcceptanceTests.csproj](../tests/Observation.AcceptanceTests/Observation.AcceptanceTests.csproj) | Acceptance / fixture / test support | `68f9427df8b24b70` |
| [tests/Observation.AcceptanceTests/ObservationApiFixture.cs](../tests/Observation.AcceptanceTests/ObservationApiFixture.cs) | Acceptance / fixture / test support | `a26195b246a37547` |
| [tests/Observation.AcceptanceTests/ObservationHistoryTests.cs](../tests/Observation.AcceptanceTests/ObservationHistoryTests.cs) | Acceptance / fixture / test support | `17299fb041080f2a` |
| [tests/Observation.AcceptanceTests/PatchObservationTests.cs](../tests/Observation.AcceptanceTests/PatchObservationTests.cs) | Acceptance / fixture / test support | `84cbd448712e3b32` |
| [tests/Observation.AcceptanceTests/PatientAuthenticationTests.cs](../tests/Observation.AcceptanceTests/PatientAuthenticationTests.cs) | Acceptance / fixture / test support | `466ae0a234bb5deb` |
| [tests/Observation.AcceptanceTests/ProfessionalAccessTests.cs](../tests/Observation.AcceptanceTests/ProfessionalAccessTests.cs) | Acceptance / fixture / test support | `1e3c87b0666c6a87` |
| [tests/Observation.AcceptanceTests/RecordMeasurementContextTests.cs](../tests/Observation.AcceptanceTests/RecordMeasurementContextTests.cs) | Acceptance / fixture / test support | `d582410cd6b277a7` |
| [tests/Observation.AcceptanceTests/RecordObservationTests.cs](../tests/Observation.AcceptanceTests/RecordObservationTests.cs) | Acceptance / fixture / test support | `2cb26f6bed1d3c8e` |
| [tests/Observation.AcceptanceTests/UpdateObservationTests.cs](../tests/Observation.AcceptanceTests/UpdateObservationTests.cs) | Acceptance / fixture / test support | `ad18354dc70dbe42` |
| [tests/Observation.AcceptanceTests/ViewObservationContextTests.cs](../tests/Observation.AcceptanceTests/ViewObservationContextTests.cs) | Acceptance / fixture / test support | `3b25fb13e3582bdf` |
| [tests/PatientProfile.AcceptanceTests/AuthenticationIntegrationTests.cs](../tests/PatientProfile.AcceptanceTests/AuthenticationIntegrationTests.cs) | Acceptance / fixture / test support | `60dbf89fd22f9e75` |
| [tests/PatientProfile.AcceptanceTests/CreatePatientTests.cs](../tests/PatientProfile.AcceptanceTests/CreatePatientTests.cs) | Acceptance / fixture / test support | `2b0bb2b9b727a178` |
| [tests/PatientProfile.AcceptanceTests/MeasurementGuidanceTests.cs](../tests/PatientProfile.AcceptanceTests/MeasurementGuidanceTests.cs) | Acceptance / fixture / test support | `b4de9f53f067bf7d` |
| [tests/PatientProfile.AcceptanceTests/PatientApiFixture.cs](../tests/PatientProfile.AcceptanceTests/PatientApiFixture.cs) | Acceptance / fixture / test support | `e54c213453683996` |
| [tests/PatientProfile.AcceptanceTests/PatientProfile.AcceptanceTests.csproj](../tests/PatientProfile.AcceptanceTests/PatientProfile.AcceptanceTests.csproj) | Acceptance / fixture / test support | `d224cf5a084478bf` |
| [tests/PatientProfile.AcceptanceTests/UpdatePatientTests.cs](../tests/PatientProfile.AcceptanceTests/UpdatePatientTests.cs) | Acceptance / fixture / test support | `2bfebdf5fceaf2fc` |
| [tests/Support/AuthenticatedTestClient.cs](../tests/Support/AuthenticatedTestClient.cs) | Acceptance / fixture / test support | `112bb94396a6272b` |
## Test behavior index
This index records declared test method names so that claims can be cross-checked against concrete assertions/setup. Theory case counts are not enumerated; method count is not the executed test count.
### BootstrapTests.cs
Source: [tests/Deployment.AcceptanceTests/BootstrapTests.cs](../tests/Deployment.AcceptanceTests/BootstrapTests.cs).
- `Package_provisioning_detects_runtime_and_postgresql_and_installs_only_needed_dependencies`
### InstallationTests.cs
Source: [tests/Deployment.AcceptanceTests/InstallationTests.cs](../tests/Deployment.AcceptanceTests/InstallationTests.cs).
- `A_selected_service_release_can_be_built_into_a_relative_output_directory`
- `Only_selected_payloads_configuration_and_independent_units_are_installed`
- `Configuration_and_certificates_are_generated_with_matching_credentials_and_private_permissions`
- `Dedicated_database_roles_cannot_access_each_others_data_or_administer_the_server`
- `New_deployments_get_new_secrets_and_do_not_overwrite_existing_material`
- `Native_configuration_adapters_use_the_same_service_values_and_independent_paths`
- `Invalid_service_selection_is_rejected_without_creating_an_installation`
- `Invalid_topology_fails_before_generating_configuration_or_credentials`
- `A_single_installed_service_starts_and_stops_without_other_local_service_processes`
- `Two_colocated_installed_services_run_with_independent_configuration_and_processes`
- `Installed_complete_system_runs_in_five_processes_and_preserves_network_and_persistence_boundaries`
### ContextFilteredHistoryTests.cs
Source: [tests/Observation.AcceptanceTests/ContextFilteredHistoryTests.cs](../tests/Observation.AcceptanceTests/ContextFilteredHistoryTests.cs).
- `Independent_and_combined_selections_return_matching_context_and_metadata`
- `Unknown_selections_match_unknown_categories_without_interpreting_legacy_text`
- `No_selection_retains_all_contexts_in_chronological_order_after_restart`
- `Empty_filtered_history_is_an_empty_array_with_applied_selection_metadata`
- `Filtered_history_preserves_patient_scope_inclusive_boundaries_and_equal_bounds`
- `Unsupported_selections_are_rejected_without_changing_observations`
- `Professional_reads_follow_assignments_and_other_patient_tokens_cannot_use_filters_to_gain_access`
### ContextSelectedInsightTests.cs
Source: [tests/Observation.AcceptanceTests/ContextSelectedInsightTests.cs](../tests/Observation.AcceptanceTests/ContextSelectedInsightTests.cs).
- `Independent_and_combined_selections_use_only_matching_observations_and_report_their_basis`
- `Unfiltered_insight_includes_unknown_context_and_explains_mixed_and_missing_conditions`
- `Unknown_selection_is_explicit_and_legacy_narrative_does_not_create_known_membership`
- `Means_round_only_the_final_value_to_two_decimals_with_half_up_rounding`
- `Corrections_clearing_and_deletion_change_membership_and_fresh_summary_results_after_restart`
- `Filtered_insight_preserves_patient_scope_inclusive_bounds_and_equal_instants`
- `Unsupported_selection_is_rejected_with_validation_details`
- `Professional_selection_requires_assignment_and_other_patient_access_is_rejected`
### DeleteContextualisedObservationTests.cs
Source: [tests/Observation.AcceptanceTests/DeleteContextualisedObservationTests.cs](../tests/Observation.AcceptanceTests/DeleteContextualisedObservationTests.cs).
- `Deleted_context_stays_absent_from_retrieval_filtered_history_and_latest_after_restart`
- `New_numerical_summary_excludes_deleted_values_and_retains_current_remaining_observations`
- `Deleting_only_contextualised_observation_leaves_empty_filtered_history_and_no_summary`
- `Unauthorised_deletions_preserve_the_observation_and_all_context`
### DeleteObservationTests.cs
Source: [tests/Observation.AcceptanceTests/DeleteObservationTests.cs](../tests/Observation.AcceptanceTests/DeleteObservationTests.cs).
- `Deleted_observation_stays_absent_after_restart_and_other_observations_are_preserved`
- `Deleting_the_only_observation_leaves_empty_history_and_no_latest_observation`
- `Missing_observation_returns_not_found_without_changing_existing_data`
### HealthInsightTests.cs
Source: [tests/Observation.AcceptanceTests/HealthInsightTests.cs](../tests/Observation.AcceptanceTests/HealthInsightTests.cs).
- `Averages_use_only_the_requested_patient_and_period_after_restart`
- `Minimum_and_maximum_values_are_calculated`
- `Fractional_averages_are_preserved_and_recalculated_after_correction_and_deletion`
- `No_matching_observations_reports_insufficient_data`
- `Invalid_or_missing_period_is_rejected`
- `Equal_bounds_and_offsets_match_recording_timestamp_semantics`
- `Unavailable_observations_report_failure_instead_of_insufficient_data`
### HealthOverviewTests.cs
Source: [tests/Observation.AcceptanceTests/HealthOverviewTests.cs](../tests/Observation.AcceptanceTests/HealthOverviewTests.cs).
- `Overview_preserves_profile_latest_context_and_selected_insight_with_different_bases`
- `No_observations_returns_profile_and_explicit_insight_absence`
- `Empty_selected_insight_preserves_profile_latest_and_applied_selection`
- `Unfiltered_pooled_insight_preserves_mixed_and_unknown_context_explanations`
- `Equal_offset_instants_are_valid_and_single_observation_insight_is_sufficient`
- `Latest_tie_rules_and_current_corrections_deletions_and_profile_edits_survive_restart`
- `Invalid_period_or_context_is_rejected_with_details`
- `Assigned_missing_patient_reports_absence_without_exposing_other_patients`
- `Overview_requires_owner_or_assigned_professional_and_blocks_direct_bypass`
- `Overview_service_credential_is_restricted_to_required_reads`
- `Unavailable_source_or_overview_is_a_failure_not_absent_insight`
### HealthTrendTests.cs
Source: [tests/Observation.AcceptanceTests/HealthTrendTests.cs](../tests/Observation.AcceptanceTests/HealthTrendTests.cs).
- `Full_period_direction_and_separate_units_and_levels`
- `Equal_endpoints_do_not_hide_intermediate_excursion_or_reversal`
- `Overall_decrease_can_coexist_with_reversals_and_large_variation`
- `Low_variation_outside_reference_is_not_healthy`
- `Favourable_pressure_decrease_can_still_be_high_while_falling_pulse_is_concerning`
- `Moving_low_pulse_up_or_high_pulse_down_is_not_automatically_concerning`
- `Opposite_pulse_excursions_within_timestamp_ties_are_not_hidden_by_their_mean`
- `References_are_setting_specific_sourced_and_not_treatment_targets`
- `Pulse_reference_boundaries_are_exclusive`
- `Missing_context_preserves_numerical_direction_but_not_resting_interpretation`
- `Known_categories_with_missing_preparation_support_limited_reference_comparison`
- `Missing_optional_circumstances_do_not_block_supported_comparison`
- `Conflicting_rest_narrative_withholds_resting_interpretation`
- `Different_conditions_and_preparation_are_visible_and_limit_combined_trajectory`
- `Known_inadequate_pressure_preparation_does_not_block_resting_pulse_reference`
- `Timestamp_ties_do_not_manufacture_direction_or_hide_descriptive_range`
- `Empty_and_single_series_report_each_unavailable_part`
- `Retrieval_and_identifier_order_do_not_change_results_including_ties`
- `Inclusive_patient_period_and_equal_offset_instants_apply_before_sufficiency`
- `Labelled_home_and_clinic_selections_and_independent_dimensions_use_only_matches`
- `Unknown_empty_and_one_selected_observation_do_not_borrow_excluded_data`
- `Corrected_values_context_and_deletions_are_used_on_every_request_after_restart`
- `Invalid_period_or_selection_is_rejected_with_explanation`
- `Trend_access_requires_authentication_ownership_or_professional_assignment`
- `Upstream_failure_is_not_misreported_as_empty_data`
### LatestObservationTests.cs
Source: [tests/Observation.AcceptanceTests/LatestObservationTests.cs](../tests/Observation.AcceptanceTests/LatestObservationTests.cs).
- `Latest_is_selected_by_measurement_time_for_the_requested_patient_after_restart`
- `Patient_without_observations_returns_not_found_even_when_another_patient_has_observations`
- `Newer_after_activity_observation_is_returned_with_its_own_context`
- `Missing_context_does_not_replace_latest_with_an_older_complete_observation`
- `Measurement_timestamp_ties_use_original_recording_time_and_ignore_later_edits`
- `Complete_timestamp_ties_choose_greatest_identifier_reproducibly_across_restart`
### MeasurementContextMigrationTests.cs
Source: [tests/Observation.AcceptanceTests/MeasurementContextMigrationTests.cs](../tests/Observation.AcceptanceTests/MeasurementContextMigrationTests.cs).
- `Upgrading_an_existing_observation_retains_values_and_text_without_inventing_context`
### ObservationHistoryTests.cs
Source: [tests/Observation.AcceptanceTests/ObservationHistoryTests.cs](../tests/Observation.AcceptanceTests/ObservationHistoryTests.cs).
- `Selected_period_returns_only_the_matching_observation_after_restart`
- `Results_are_chronological_and_include_both_period_boundaries`
- `No_matching_observations_returns_an_empty_array`
- `Invalid_or_missing_period_is_rejected_without_changing_observations`
- `Offset_bounds_are_normalized_consistently_with_recorded_measurements`
### PatchObservationTests.cs
Source: [tests/Observation.AcceptanceTests/PatchObservationTests.cs](../tests/Observation.AcceptanceTests/PatchObservationTests.cs).
- `Context_can_be_added_to_a_historical_observation_without_changing_its_measurements`
- `Correcting_one_context_field_preserves_omitted_data_and_changes_selection_after_restart`
- `Individual_optional_fields_can_be_corrected_or_cleared_without_erasing_other_context`
- `Explicit_null_context_object_clears_structured_context_but_preserves_legacy_text_and_numbers`
- `Single_numerical_and_legacy_text_updates_preserve_other_values`
- `Invalid_patches_reject_the_whole_update_without_changes`
- `Unsupported_context_in_a_legacy_put_does_not_silently_apply_its_numerical_changes`
- `Missing_observation_is_not_created_by_a_context_patch`
- `Other_patients_professionals_and_unauthenticated_clients_cannot_patch_context`
### PatientAuthenticationTests.cs
Source: [tests/Observation.AcceptanceTests/PatientAuthenticationTests.cs](../tests/Observation.AcceptanceTests/PatientAuthenticationTests.cs).
- `Login_without_profile_returns_normalized_identity_and_no_patient_data`
- `Invalid_account_and_invalid_password_have_same_rejection`
- `Missing_and_invalid_tokens_reject_every_existing_patient_operation`
- `Own_observations_and_insights_are_available_but_another_patients_reads_and_writes_are_rejected`
- `Caller_supplied_account_identity_cannot_replace_authenticated_identity`
- `Profile_creation_retries_and_concurrency_preserve_one_persistent_association`
- `Failed_creation_can_be_retried_without_an_orphan_profile`
- `Expired_token_is_rejected_and_login_produces_a_fresh_token`
- `Tampering_with_a_valid_token_is_rejected`
- `Database_failure_rolls_back_profile_and_association_together`
- `Direct_services_reject_client_tokens_missing_keys_and_forged_keys`
- `Service_credentials_are_limited_to_their_documented_read_calls`
- `Healthcare_professional_cannot_create_profiles`
### ProfessionalAccessTests.cs
Source: [tests/Observation.AcceptanceTests/ProfessionalAccessTests.cs](../tests/Observation.AcceptanceTests/ProfessionalAccessTests.cs).
- `Login_recognizes_professional_identity_and_does_not_put_assignments_in_the_token_response`
- `Professionals_list_only_their_own_assignments_and_can_share_patients`
- `Assigned_profiles_observations_context_history_latest_and_insights_are_readable`
- `Unassigned_patients_and_observations_are_rejected_even_with_a_supplied_assigned_patient_id`
- `Missing_information_for_assigned_patients_follows_existing_retrieval_behaviour`
- `Professionals_cannot_create_update_or_delete_any_patient_information`
- `Missing_invalid_and_expired_tokens_do_not_disclose_assignments_or_patient_data`
- `Incorrect_professional_secret_and_unknown_account_have_identical_login_rejections`
- `Patient_cannot_list_professional_assignments_and_retains_own_access`
- `Assignment_removal_is_used_after_restart_even_with_an_existing_token`
- `Observation_ownership_lookup_failure_fails_closed_while_assignment_list_remains_available`
### RecordMeasurementContextTests.cs
Source: [tests/Observation.AcceptanceTests/RecordMeasurementContextTests.cs](../tests/Observation.AcceptanceTests/RecordMeasurementContextTests.cs).
- `Complete_context_is_saved_with_the_correct_values_and_retrievable_after_restart`
- `Setting_and_activity_are_independent_and_departures_from_guidance_are_valid`
- `Partial_and_absent_context_remain_unknown_without_reinterpreting_legacy_text`
- `Conflicting_categories_and_narrative_are_preserved_without_relabelling`
- `Invalid_context_is_rejected_with_validation_details_without_saving`
- `Context_is_protected_against_other_patient_reads_and_submissions_and_professional_writes`
- `Assigned_professional_can_retrieve_saved_context`
### RecordObservationTests.cs
Source: [tests/Observation.AcceptanceTests/RecordObservationTests.cs](../tests/Observation.AcceptanceTests/RecordObservationTests.cs).
- `Valid_observation_is_assigned_an_identifier_associated_with_the_patient_and_retrievable_after_restart`
- `Optional_fields_can_be_omitted_and_identifiers_are_distinct`
- `Non_positive_values_are_rejected_without_saving`
- `Missing_or_malformed_information_is_rejected_without_saving`
- `Missing_patient_is_rejected_without_saving`
- `Missing_observation_returns_not_found`
- `Failed_patient_lookup_is_rejected_without_saving`
### UpdateObservationTests.cs
Source: [tests/Observation.AcceptanceTests/UpdateObservationTests.cs](../tests/Observation.AcceptanceTests/UpdateObservationTests.cs).
- `Correction_preserves_other_information_and_is_visible_in_all_retrievals_after_restart`
- `All_three_measured_values_can_be_corrected`
- `Non_positive_values_are_rejected_without_changing_observation`
- `Missing_or_malformed_values_are_rejected_without_changes`
- `Missing_observation_is_rejected_without_inserting_a_new_observation`
### ViewObservationContextTests.cs
Source: [tests/Observation.AcceptanceTests/ViewObservationContextTests.cs](../tests/Observation.AcceptanceTests/ViewObservationContextTests.cs).
- `Complete_saved_context_is_returned_with_its_measurements_and_timestamp_after_restart`
- `Partial_saved_context_distinguishes_known_setting_from_unknown_condition_and_details`
- `Historical_free_text_is_returned_without_inventing_setting_or_activity`
- `Missing_observation_reports_not_found_without_disclosing_saved_context`
- `Unauthorised_callers_cannot_read_observation_context`
- `Assigned_professional_reads_the_same_context_as_the_owner`
### AuthenticationIntegrationTests.cs
Source: [tests/PatientProfile.AcceptanceTests/AuthenticationIntegrationTests.cs](../tests/PatientProfile.AcceptanceTests/AuthenticationIntegrationTests.cs).
- `Production_gateway_rejects_plain_http_even_for_login_and_public_guidance`
- `Standard_replacement_handler_with_same_identity_retains_ownership_policy`
### CreatePatientTests.cs
Source: [tests/PatientProfile.AcceptanceTests/CreatePatientTests.cs](../tests/PatientProfile.AcceptanceTests/CreatePatientTests.cs).
- `Valid_profile_is_assigned_an_identifier_and_can_be_retrieved_after_restart`
- `Missing_required_information_is_rejected_without_persisting`
- `Malformed_information_is_rejected`
- `Separate_creations_have_distinct_identifiers_and_contact_information_is_optional`
- `Unknown_identifier_returns_not_found`
### MeasurementGuidanceTests.cs
Source: [tests/PatientProfile.AcceptanceTests/MeasurementGuidanceTests.cs](../tests/PatientProfile.AcceptanceTests/MeasurementGuidanceTests.cs).
- `Public_guidance_without_patient_records_is_labelled_and_has_ordered_sourced_instructions`
- `Activity_is_not_relabelled_as_rest_or_certified`
- `Unsupported_guidance_is_explicitly_unavailable_without_unverified_instructions`
- `Invalid_categories_return_explained_rejections`
### UpdatePatientTests.cs
Source: [tests/PatientProfile.AcceptanceTests/UpdatePatientTests.cs](../tests/PatientProfile.AcceptanceTests/UpdatePatientTests.cs).
- `Updated_profile_preserves_identity_and_date_of_birth_and_survives_restart`
- `Updating_a_missing_patient_is_rejected_without_creating_a_profile`
- `Invalid_name_is_rejected_without_changing_the_profile`
## Ancillary tool evidence
| Tool | Responsibility |
| --- | --- |
| [PasswordHash](../tools/PasswordHash/Program.cs) | Established framework hashing utility; reads stdin |
| [energy-jmeter README](../tools/energy-jmeter/README.md) | Experiment topology, data/config boundaries and metric collection |
| [run.py](../tools/energy-jmeter/run.py) | Orchestrates warmup/measurement, validates telemetry and generates reports |
| [generate-plans.py](../tools/energy-jmeter/generate-plans.py) | Native JMX sessions, Gaussian delays, token renewals, live power/PerfMon |
| [perfmon.py](../tools/energy-jmeter/perfmon.py) / [shelly.py](../tools/energy-jmeter/shelly.py) | Metric interpretation/validation and measured-window summaries |
| [report.py](../tools/energy-jmeter/report.py) | Aligned per-second reporting, separate from application runtime |
@@ -0,0 +1,62 @@
# Requirements-to-implementation traceability
Authoritative scope: [common requirements](../Docs/Requirements/00-common-requirements.md), numbered US-01–US-15, [US-16](<../Docs/Requirements/US16 easy installation and deployment installer.txt>) and [installer addendum](../Docs/Requirements/us16-addendum). This is a static implementation/test review, not a new acceptance-test execution report.
**Implemented** means required behavior is visible in source and mapped tests. **Implemented with limits** means mechanisms exist but some scope/operational evidence is incomplete. No whole US-01–US-15 was found absent. That does not certify every clinical statement or possible deployment/input case. Test coverage references are evidence of checks present, not a claim they passed during this task.
## Story mapping
| Story | Observable implementation / acceptance behavior | Source and relevant tests | Status / limits |
| --- | --- | --- | --- |
| [US-01 create profile](../Docs/Requirements/us01-create-patient-profile.md) | Authenticated initial creation; required name/birth date; generated ID and atomic account association; repeat 409; unique index handles concurrent creation; persistence/retry/DB rollback | [application](../src/PatientProfileService/Application/PatientApplicationService.cs), [repository](../src/PatientProfileService/Persistence/SqlPatientRepository.cs), [CreatePatientTests](../tests/PatientProfile.AcceptanceTests/CreatePatientTests.cs), [PatientAuthenticationTests](../tests/Observation.AcceptanceTests/PatientAuthenticationTests.cs) | Implemented. Interrupted DB writes are checked with a trigger; lost response is approximated by retry after success. No separate process-kill-at-every-write-boundary test. |
| [US-02 view profile](../Docs/Requirements/us02-view-patient-profile.md) | Persisted DTO includes ID/name/date/contact; protected own/assigned reads; absent 404 | [controller](../src/PatientProfileService/Controllers/PatientController.cs), [CreatePatientTests](../tests/PatientProfile.AcceptanceTests/CreatePatientTests.cs), [ProfessionalAccessTests](../tests/Observation.AcceptanceTests/ProfessionalAccessTests.cs) | Implemented. Covered in creation/access suites rather than a separate ViewPatientTests file. |
| [US-03 update profile](../Docs/Requirements/us03-update-patient-profile.md) | Update name/contact; ID/birth/account/original creation preserved; missing does not create | [SQL repository](../src/PatientProfileService/Persistence/SqlPatientRepository.cs), [UpdatePatientTests](../tests/PatientProfile.AcceptanceTests/UpdatePatientTests.cs) | Implemented. Birth-date editing is not an accepted story behavior. |
| [US-04 record observation](../Docs/Requirements/us04-record-observation.md) | Timestamp and positive numerical values; patient lookup before own DB save; independent context dimensions, optional details, unknown defaults, legacy text retained, later read | [application](../src/ObservationService/Application/ObservationApplicationService.cs), [mapping](../src/ObservationService/Persistence/ObservationDbContext.cs), [RecordObservationTests](../tests/Observation.AcceptanceTests/RecordObservationTests.cs), [RecordMeasurementContextTests](../tests/Observation.AcceptanceTests/RecordMeasurementContextTests.cs), [migration test](../tests/Observation.AcceptanceTests/MeasurementContextMigrationTests.cs) | Implemented with limits: preservation is general; narrative conflict interpretation uses US-11 finite phrases. No arbitrary-language conflict detector. |
| [US-05 view observation](../Docs/Requirements/us05-view-observation.md) | Read by observation ID includes current measurements/time/context/note; owner/assignment lookup before access; missing 404 | [controller](../src/ObservationService/Controllers/ObservationController.cs), [ViewObservationContextTests](../tests/Observation.AcceptanceTests/ViewObservationContextTests.cs) | Implemented. Directly seeded Given states verify retrieval independently of creating a reading. |
| [US-06 latest](../Docs/Requirements/us06-latest-observation.md) | Greatest measurement time, then original recording time, then greatest UUID; context completeness ignored; no observations 404 | [repository](../src/ObservationService/Persistence/SqlObservationRepository.cs), [LatestObservationTests](../tests/Observation.AcceptanceTests/LatestObservationTests.cs) | Implemented, including deterministic complete ties across restart. |
| [US-07 history](../Docs/Requirements/us07-observation-history.md) | Inclusive/equal periods, ascending time/UUID, selected dimensions AND, explicit Unknown, no-selection includes all, empty array, metadata headers, invalid selections rejected | [controller](../src/ObservationService/Controllers/ObservationController.cs), [repository](../src/ObservationService/Persistence/SqlObservationRepository.cs), [ObservationHistoryTests](../tests/Observation.AcceptanceTests/ObservationHistoryTests.cs), [ContextFilteredHistoryTests](../tests/Observation.AcceptanceTests/ContextFilteredHistoryTests.cs) | Implemented. Full unpaginated result is actual contract; no requirement for pagination. |
| [US-08 correction](../Docs/Requirements/us08-update-observation.md) | Numeric PUT; partial PATCH adds/corrects/clears individual context fields; omitted fields preserved; unsupported fields/category rejected before save; current selection/calculation membership | [patch](../src/ObservationService/Contracts/PatchObservationRequest.cs), [repository](../src/ObservationService/Persistence/SqlObservationRepository.cs), [UpdateObservationTests](../tests/Observation.AcceptanceTests/UpdateObservationTests.cs), [PatchObservationTests](../tests/Observation.AcceptanceTests/PatchObservationTests.cs) | Implemented. No concurrent-update conflict detection, outside explicit story criteria. |
| [US-09 delete](../Docs/Requirements/us09-delete-observation.md) | Physical row/context deletion; no later read/history/statistics contribution; unaffected remaining data; access controls | [repository](../src/ObservationService/Persistence/SqlObservationRepository.cs), [DeleteObservationTests](../tests/Observation.AcceptanceTests/DeleteObservationTests.cs), [DeleteContextualisedObservationTests](../tests/Observation.AcceptanceTests/DeleteContextualisedObservationTests.cs) | Implemented. No separate stored result/context lifecycle to clean up. |
| [US-10 numerical insight](../Docs/Requirements/us10-calculated-insight.md) | Current filtered observations; arithmetic means/final two-decimal half-up; BP extrema; single sufficient; empty insufficient 404; explicit selection/count/context limitations | [calculator](../src/InsightsService/Domain/InsightCalculator.cs), [HealthInsightTests](../tests/Observation.AcceptanceTests/HealthInsightTests.cs), [ContextSelectedInsightTests](../tests/Observation.AcceptanceTests/ContextSelectedInsightTests.cs) | Implemented. No stored summary per baseline correction. |
| [US-11 trend](../Docs/Requirements/us11-health-trend.md) | Three separate metric assessments, full-period direction/OLS/variation, reversals and timestamp ties, reference scopes/limits, context comparability, selections and unavailable parts; corrections/deletions fresh | [calculator](../src/InsightsService/Domain/InsightCalculator.Trends.cs), [HealthTrendTests](../tests/Observation.AcceptanceTests/HealthTrendTests.cs), [method documentation](../src/TRENDS.md) | Implemented with limits: finite narrative phrases and locally coded clinical inferences need separate clinical review for broader claims; not independently validated here. |
| [US-12 overview](../Docs/Requirements/us12-health-overview.md) | Profile + latest overall + selected-period insight; latest context distinct; no-match keeps available parts; unknown/mixed explanations; invalid period/access/failures | [application](../src/HealthOverviewService/Application/HealthOverviewApplicationService.cs), [HealthOverviewTests](../tests/Observation.AcceptanceTests/HealthOverviewTests.cs) | Implemented. No trend component and no cross-service snapshot, both documented. |
| [US-13 patient authentication](../Docs/Requirements/us13-patient-authentication.md) | Valid generic login; opaque expiry/tamper checks; own-data restrictions by actual owner; profile-less login/create; persistence/bypass protection | [security](../src/ApiGateway/Security/PatientAccessMiddleware.cs), [PatientAuthenticationTests](../tests/Observation.AcceptanceTests/PatientAuthenticationTests.cs), [AuthenticationIntegrationTests](../tests/PatientProfile.AcceptanceTests/AuthenticationIntegrationTests.cs) | Implemented. Test clocks/replacement handlers are test-only; native secrets/files/network remain deployment responsibilities. |
| [US-14 professional reads](../Docs/Requirements/us14-professional-access.md) | Login role, own assignment list, many-to-many assignment reading including context/trends/overview; empty/missing results; unassigned concealment; all writes rejected | [assignments](../src/ApiGateway/Security/ProfessionalAssignments.cs), [ProfessionalAccessTests](../tests/Observation.AcceptanceTests/ProfessionalAccessTests.cs), [trend](../tests/Observation.AcceptanceTests/HealthTrendTests.cs), [overview](../tests/Observation.AcceptanceTests/HealthOverviewTests.cs) | Implemented. Fresh installer professional has no assignments; configured examples/tests demonstrate assigned workflow. Assignment administration is excluded. |
| [US-15 guidance](../Docs/Requirements/us15-measurement-guidance.md) | Public ordered sourced home/rest instructions, applicability/review dates, pulse/activity limits, unavailable setting explanation, no record/certification side effects; valid submission independent of viewing | [controller](../src/ApiGateway/Controllers/MeasurementGuidanceController.cs), [MeasurementGuidanceTests](../tests/PatientProfile.AcceptanceTests/MeasurementGuidanceTests.cs), [record-context tests](../tests/Observation.AcceptanceTests/RecordMeasurementContextTests.cs) | Implemented. Clinical references are compiled metadata, not dynamically refreshed guidance or evidence of current source validation in this task. |
| US-16 independent installation plus addendum | Selected payloads/processes/config; matching keys/HTTPS trust; runtime/PostgreSQL provisioning, separate DBs/roles/migrations; colocated/distributed origins; verification | [installer](../deploy/installer/install.sh), [provisioner](../deploy/HealthApp.Provisioning/Program.cs), [InstallationTests](../tests/Deployment.AcceptanceTests/InstallationTests.cs), [BootstrapTests](../tests/Deployment.AcceptanceTests/BootstrapTests.cs) | Implemented with operational/verification limits detailed below. Windows/macOS extend the Linux requirement text. |
## US-11 acceptance groups
| Criteria | Implementation/test basis |
| --- | --- |
| A/B/C: separate metrics, patient/period, direction | `CalculateTrend`, `AssessMeasurement`; separate units and all-timepoint calculations; tests `Full_period_direction_and_separate_units_and_levels`, `Inclusive_patient_period_and_equal_offset_instants_apply_before_sufficiency` |
| D/E: intermediate excursion and reversal | Raw range plus grouped adjacent absolute change/sign reversals; tests `Equal_endpoints_do_not_hide_intermediate_excursion_or_reversal`, `Overall_decrease_can_coexist_with_reversals_and_large_variation` |
| F/G/H/I: levels/interpretations/conflicting metrics | Applicable reference comparisons and separate hints; tests `Low_variation_outside_reference_is_not_healthy`, `Favourable_pressure_decrease_can_still_be_high_while_falling_pulse_is_concerning`, pulse boundary/tie excursion tests; independent clinical assessment remains unperformed |
| J/K/L: missing context, insufficiency, reference values | `AssessComparability`/`SelectReference`, explicit unavailable parts and provisional references; missing preparation/inadequate rest/setting-specific reference tests |
| M/N: ordering independence and freshness | Timestamp grouping/sorting; fresh HTTP history on each call; tests `Retrieval_and_identifier_order_do_not_change_results_including_ties`, `Corrected_values_context_and_deletions_are_used_on_every_request_after_restart` |
| Context additions | Filtered history retrieval, metadata and comparability evidence; selected Home/Clinic/Unknown, empty/single series and contradictory phrase tests |
All named tests above are in [HealthTrendTests.cs](../tests/Observation.AcceptanceTests/HealthTrendTests.cs).
## US-16 acceptance groups and operational gaps
| Criterion | Evidence | Remaining uncertainty / incomplete verification |
| --- | --- | --- |
| A/B/C selected/single/multiple/all | Release selection, installer selection, distinct payloads/units, direct independent processes | Normal single-node partial installation must reuse a plan with reachable remote dependencies or defer final topology check; creating a new default plan is not discovery of an existing deployment. |
| D independent config | Per-service env/JSON/certificates/origins/DB values; native configuration tests | Source templates and generated units differ; document generated behavior. |
| E separate machines | Runtime origins and HTTP are location-independent; scoped SSH/SCP distribution tests | Real separate-machine native deployment/network evidence not established by loopback/double tests. |
| F independent service management | Native registrations have no peer coupling; direct process stop/restart tests | Linux/Windows/macOS manager behavior must be demonstrated on native hosts; no new native run was performed here. |
| G persistence ownership | Separate DB/role generation, PUBLIC revocation, dedicated credential checks | Normal DB credentials own schema for migrations; mandatory encrypted DB transport is not implemented. |
| H preserve architecture | Same DLLs and Gateway-routed APIs on all layouts | No container/shared-memory/merged-service runtime path present. |
| I installation verification | Native active/PID checks (Linux/Windows), HTTPS/DB/callback probes, complete synthetic workflow | Live verifier does not explicitly stop/restart each service; macOS has no explicit distinct-PID comparison. Literal `all` enables complete verification in local wrappers; listing all five names does not. |
| Addendum dependencies/config | Apt ancestry/package checks; generated secrets/CA/PFX/roles/config/migration/native startup | Package doubles do not prove every distro/version/CPU; Linux automation limited to Debian/Ubuntu family; Windows/macOS packages/native execution require native evidence. |
## Missing functionality versus scope exclusions
No wholly unimplemented accepted backend user story was identified by this static review. Concrete incomplete **verification** items are native stop/restart demonstration in the live verifier, explicit macOS PID separation, complete-workflow verification for the five-name selection form, and actual multi-machine/native-platform evidence. General narrative understanding and independent clinical applicability remain **unknown**, rather than established complete capabilities. See [discrepancies](discrepancies.md) for exact evidence.
Registration, recovery, MFA, refresh tokens, professional credential verification, consent/emergency access, professional writes, assignment administration, a product frontend, pagination, optimistic concurrency, backup/restore, HA and production hardening are not accepted features established by the inspected stories. Their absence is recorded without adding scope or treating suggestions as approved requirements.
## Shared constraints
Ownership/professional access applies across all patient-specific routes; guidance alone is public. Inclusive/equal periods and offset normalization apply consistently to history, summary, trend and overview insight. `Unknown` is independently selectable; legacy narrative is never converted to a definite category. Persistence/restart tests and migration tests check ownership and context continuity. The snapshot is backend/source complete but not a claim that tests, external clinical sources or every deployment platform were freshly validated.
@@ -0,0 +1,291 @@
# HealthApp software architecture — as built
## 1. Scope and evidence
This is a source-level snapshot dated 2026-10-12 at commit `5d9371388c15066eeb2bc124ed227659c644dab5`. The system is a prototype REST backend for synthetic patient profiles, blood-pressure observations and derived assessments. It includes an installer and separate experiment tools. A web/mobile client is a context actor in the original diagrams; no product frontend is implemented in this repository.
Descriptions below are verified from source unless explicitly labelled inferred or unknown. Evidence links resolve to the inspected repository. Existing specifications supply context, especially [architecture authority](../Docs/Architecture/README.md), [common requirements](../Docs/Requirements/00-common-requirements.md), [Insights correction](../Docs/Architecture/us10-insights-correction.md) and [authentication design](../Docs/Design/authentication-and-access-control-design.md). Their differences from the implementation are catalogued in [discrepancies](discrepancies.md).
The [evidence inventory](evidence-inventory.md) records the inspected files. Automated tests were read, not rerun; this document makes no new test-pass, performance, clinical-validation or native-platform deployment claim.
## 2. Style, boundaries and structure
The implementation uses five independently buildable ASP.NET Core controller projects and operating-system processes. The topology is synchronous request/response microservices with a central API Gateway, service-owned persistence, and conventional controller/application/repository layering in the two persistent services. There is no application message bus, event processing, background synchronization or shared production implementation library. See [solution](../HealthApp.slnx), [logical diagram](diagrams/02-logical-services.drawio) and each service's `Program.cs` below.
| Process / project | Responsibility | Local implementation | State |
| --- | --- | --- | --- |
| [ApiGateway](../src/ApiGateway/Program.cs) | Client login, token authentication, ownership/assignment authorization, explicit API forwarding, public guidance | Controllers, security middleware, framework authentication and named HTTP clients | Startup account/assignment configuration; persistent token-protection key files |
| [PatientProfileService](../src/PatientProfileService/Program.cs) | Initial profile/account association, profile reads and updates | Controller → scoped application service → repository interface → SQL repository → EF context | Own PostgreSQL database, `patient` table |
| [ObservationService](../src/ObservationService/Program.cs) | Record/read/latest/history/correct/delete observations and their context | Controller → scoped application service → repository interface → SQL repository → EF context; gateway HTTP client for patient existence | Own PostgreSQL database, `blood_pressure_observation` table |
| [InsightsService](../src/InsightsService/Program.cs) | On-demand numerical summaries and context-aware trend assessment | Controller → scoped application service → observation HTTP client and singleton stateless calculator | No database or generated-result persistence |
| [HealthOverviewService](../src/HealthOverviewService/Program.cs) | Compose profile, latest overall observation and selected-period numerical insight | Controller → scoped application service → three typed HTTP clients | No database or generated-result persistence |
Every business call between services passes through the Gateway. The Gateway sends `X-Gateway-Key` to a target service; Observation, Insights and Overview call the Gateway using their own `X-Service-Key`. The Patient/Profile service has no outgoing business HTTP dependency. There are no direct Insights→Observation or Overview→Patient/Profile network calls: client class names denote the resource consumed, while their configured origin is the Gateway. This matches the [original service topology](../Docs/Architecture/02_microservice_architecture.jpg).
Within a service, dependencies are ordinary dependency injection calls. Between services, dependencies are actual HTTP/JSON calls; production projects do not reference each other's implementations. Tests do reference multiple projects and create hosts in one test runner, which is a testing arrangement, not the deployed process model.
The separate [HealthApp.Provisioning](../deploy/HealthApp.Provisioning/Program.cs) executable prepares deployment material, provisions databases and verifies the installed system. It is an administrative utility, not an additional microservice. [PasswordHash](../tools/PasswordHash/Program.cs) is another standalone utility for hashing input passwords, outside the solution's service topology.
## 3. Domain and ownership
The [domain diagram](diagrams/03-domain-model.drawio) uses business concepts, while [class diagrams](diagrams/04-design-classes.drawio) use actual implementation types.
The complete domain view includes authentication grants, professional assignments, guidance instructions and reference provenance as well as profiles, observations and calculated views. Deployment administration has a separate supporting-domain page. Each service also has its own implementation class-diagram file, linked from [README](README.md). Each declared class, record and interface is an individual UML classifier, including nested records, startup and generated EF support types. [Class-diagram coverage](class-diagram-coverage.md) maps all 78 source types and explains visibility, members and relationship notation.
A pre-created **account** identifies a Patient or HealthcareProfessional. A Patient account has zero associated profiles initially and one after creation. A **patient profile** has a generated identifier, name, date of birth and optional contact information. The association is persisted in the profile's row, separate from credential configuration. Legacy rows can have null account association.
A **blood-pressure observation** belongs to one patient by external patient identifier. It records measurement time, systolic/diastolic pressure, device-reported pulse, original free-text context and note, and one structured **measurement context**. Setting and activity categories remain independent; missing values become `Unknown`. Optional preparation/technique details remain unknown/null rather than being inferred from legacy text. Context has no independent persisted identifier or lifecycle.
A **context selection** optionally restricts setting and/or activity. Both supplied dimensions must match; omitted dimensions are unrestricted. An explicit `Unknown` is a filter value, not omission. A **health insight** summarizes current selected observations. A **trend assessment** contains separate systolic, diastolic and pulse assessments plus comparability evidence. A **health overview** combines a profile, optional latest observation and optional numerical insight. These are calculated values, not stored domain entities.
HealthcareProfessional **assignments** form a configured many-to-many account/patient relationship. No professional profile or assignment table exists. General **measurement guidance** has no patient association and does not write observations.
Evidence: [Patient](../src/PatientProfileService/Domain/Patient.cs), [observation](../src/ObservationService/Domain/BloodPressureObservation.cs), [measurement context](../src/ObservationService/Domain/MeasurementContext.cs), [selection](../src/ObservationService/Domain/ContextSelection.cs), [insight](../src/InsightsService/Domain/HealthInsight.cs), [trend types](../src/InsightsService/Domain/TrendAssessment.cs), [overview contracts](../src/HealthOverviewService/Contracts/HealthOverviewDto.cs), [assignments](../src/ApiGateway/Security/ProfessionalAssignments.cs).
## 4. Public API and contracts
All routes below are exposed by Gateway controllers. IDs are GUID route values. JSON uses the standard ASP.NET Core serializer conventions. Authentication applies to patient-specific routes; professionals can only read assigned patients, and only professionals can list their own assignments.
| Method and route | Input / result | Owning component |
| --- | --- | --- |
| `POST /api/authentication/login` | Required `accountId`, `password`; 200 access token, token type, lifetime, account ID, role; invalid credentials 401 | Gateway |
| `GET /api/measurement-guidance` | Optional setting/activity; 200 ordered guidance or explained unavailability; unsupported values 400 | Gateway; public |
| `GET /api/professionals/me/patients` | 200 array of `{patientId}` assignments, possibly empty | Gateway |
| `POST /api/patients` | Required name/dateOfBirth, optional contactInfo; 201 profile and Location; existing profile 409 | Patient/Profile |
| `GET /api/patients/me` | 200 authenticated account's profile; unavailable 404 | Patient/Profile via Gateway account lookup |
| `GET /api/patients/{patientId}` | 200 profile; missing/unauthorized owner 404 | Patient/Profile |
| `PUT /api/patients/{patientId}` | Required name, optional contactInfo; 200 updated profile; date of birth is not editable | Patient/Profile |
| `POST /api/patients/{patientId}/observations` | Required measuredAt and positive integer systolic/diastolic/pulse; optional structured context, context text and note; 201 observation and Location | Observation |
| `GET /api/observations/{observationId}` | 200 observation with recorded context; unavailable 404 | Observation |
| `PUT /api/observations/{observationId}` | All three positive measured values required; 200 corrected observation; other fields preserved | Observation |
| `PATCH /api/observations/{observationId}` | At least one supported measured/context/note field; 200 patched observation | Observation |
| `DELETE /api/observations/{observationId}` | 204 deleted; unavailable 404 | Observation |
| `GET /api/patients/{patientId}/observations/latest` | 200 latest overall observation; none 404 | Observation |
| `GET /api/patients/{patientId}/observations` | Required from/to, optional context selection; 200 array, empty `[]` allowed | Observation |
| `GET /api/patients/{patientId}/insights` | Required from/to, optional context selection; 200 numerical insight; no matching data 404 Problem | Insights |
| `GET /api/patients/{patientId}/trends` | Same query; 200 assessment, including explicit unavailable parts for empty/insufficient data | Insights |
| `GET /api/patients/{patientId}/overview` | Same query applied to insight only; 200 overview with nullable latest/insight; missing patient 404 Problem | Overview |
Gateway route evidence: [Patient](../src/ApiGateway/Controllers/PatientController.cs), [Observation](../src/ApiGateway/Controllers/ObservationController.cs), [Insights](../src/ApiGateway/Controllers/InsightsController.cs), [Overview](../src/ApiGateway/Controllers/HealthOverviewController.cs), [Professional](../src/ApiGateway/Controllers/ProfessionalController.cs), [Authentication](../src/ApiGateway/Controllers/AuthenticationController.cs), [Guidance](../src/ApiGateway/Controllers/MeasurementGuidanceController.cs). Backend-specific statuses/validation are defined by the corresponding controllers and contracts, not by a general reverse-proxy engine.
### 4.1 Forwarding and internal contracts
Gateway forwarding constructs a new HTTP request with a configured target and key. It streams POST/PUT/PATCH bodies and forwards Content-Type, not arbitrary client headers. It does not forward client tokens, client-selected account identities or callback keys. Profile creation explicitly derives `X-Account-Id` from the authenticated claim. Response forwarding preserves status, Content-Type and Location (absolute locations are reduced to path/query). Observation forwarding also preserves `X-Measurement-Setting` and `X-Activity-Condition`. The rest of upstream headers are not generically copied. Redirect following is disabled on all configured business HTTP clients.
Backend endpoints mostly mirror the Gateway routes. Patient/Profile additionally exposes `GET /api/patients/by-account/{accountId}` behind its key boundary; Gateway uses it internally and does not expose a corresponding controller route. `/api/patients/me`, login, guidance and assignment listing are Gateway-owned routes.
DTOs are defined locally within each service; consumers deserialize equivalent wire shapes without shared service project references. Insights duplicates an observation/context DTO; Overview duplicates patient, observation, insight and selection DTOs. These are structural JSON contracts, not references to remote domain objects. There is no OpenAPI/Swagger endpoint, API-versioning mechanism or generated client in the application setup.
### 4.2 Validation, patch and period semantics
`[ApiController]`, data annotations and JSON parsing reject invalid model input with 400 validation details. Categories are case-sensitive for recording/filtering/patching: settings `Home`, `Clinic`, `Other`, `Unknown`; activities `AtRest`, `DuringActivity`, `AfterActivity`, `Unknown`. General guidance trims and compares categories without case sensitivity. Numeric observation values must be positive integers; optional rest duration is a nonnegative decimal in minutes. There are no documented clinical upper/lower plausibility checks beyond those input constraints.
PATCH uses setter-maintained `...Specified` flags marked `[JsonIgnore]`. Omitted fields remain unchanged; explicit null clears optional text/details; null setting/activity becomes `Unknown`; null entire context resets it to unknown categories/null details. Numeric values cannot be cleared. Empty or unknown-field patches are rejected. Observation PUT accepts only the three numerical fields and rejects unmapped fields. Profile update preserves identifier, birth date, original creation time and account association; omitted/null contact information clears it. These behaviors are implemented in [patch contracts](../src/ObservationService/Contracts/PatchObservationRequest.cs), [context patch](../src/ObservationService/Contracts/MeasurementContextPatch.cs), [PUT contract](../src/ObservationService/Contracts/UpdateObservationRequest.cs) and [repositories](../src/ObservationService/Persistence/SqlObservationRepository.cs).
Period boundaries are inclusive. Reversed bounds are rejected; equal bounds are valid. Offset-free timestamp values are interpreted as UTC clock values, independent of host timezone. Offset-bearing values are normalized to UTC and stored as `DateTimeKind.Unspecified` in PostgreSQL `timestamp without time zone`. Responses therefore need not contain a trailing `Z`; clients must retain the documented UTC interpretation. `DateOnly` represents birth dates. Evidence: [record/period normalization](../src/ObservationService/Application/ObservationApplicationService.cs), [Insights normalization](../src/InsightsService/Application/InsightsApplicationService.cs), [Overview normalization](../src/HealthOverviewService/Application/HealthOverviewApplicationService.cs), [implementation timestamp documentation](../src/README.md), [offset/boundary tests](../tests/Observation.AcceptanceTests/ContextFilteredHistoryTests.cs).
## 5. Persistence and consistency
See [data diagram](diagrams/05-data-ownership.drawio). Each persistent service has a scoped EF Core DbContext and SQL repository. Reads generally use `AsNoTracking`; observation patches load a tracked entity and save it. Patient updates use `ExecuteUpdateAsync`, observation deletes use `ExecuteDeleteAsync`. There is no shared database access between application services.
| Owner/table | Columns and constraints |
| --- | --- |
| Patient/Profile `patient` | `patient_id uuid` PK generated by application; `account_id text NULL` with unique index `IX_patient_account_id`; required `name varchar`, `date_of_birth date`; optional `contact_info varchar`; required `created_at`, `updated_at timestamp without time zone` |
| Observation `blood_pressure_observation` | `observation_id uuid` PK generated by application; external `patient_id uuid`; `measured_at timestamp without time zone`; integer `systolic`, `diastolic`, `pulse`; optional `context`, `note varchar`; required original/update timestamps; required text `setting`, `activity_condition` default `Unknown`; nullable numeric `rest_duration_minutes` and text body position/arm/device/cuff/circumstances |
| Each EF-owned database | Framework `__EFMigrationsHistory`; no patient/observation cross-database foreign key |
`MeasurementContext` is an EF owned value flattened into the observation row. There is no separate context/preparation table. Database mappings declare PKs and the account uniqueness index, but no observation patient/time/filter indexes or category/positive-value check constraints. Input validation is enforced by APIs/application services; database credentials remain a separate trust boundary.
Evidence: [PatientDbContext](../src/PatientProfileService/Persistence/PatientDbContext.cs), [ObservationDbContext](../src/ObservationService/Persistence/ObservationDbContext.cs), [profile initial migration](../src/PatientProfileService/Persistence/Migrations/20260930200031_InitialPatientSchema.cs), [association migration](../src/PatientProfileService/Persistence/Migrations/20261005082209_AccountProfileAssociation.cs), [observation initial migration](../src/ObservationService/Persistence/Migrations/20261001095222_InitialObservationSchema.cs), [context migration](../src/ObservationService/Persistence/Migrations/20261005094632_RecordedMeasurementContext.cs).
### 5.1 Profile creation
Profile creation and account association are a single row insert. The application checks for an existing account first, but the unique database index is the final concurrency guard. A conflicting PostgreSQL `23505` for that index is translated into `ProfileAlreadyExistsException` and 409. Database failure leaves no separate association step to recover; a lost successful response followed by retry returns the existing-profile conflict, and `/api/patients/me` retrieves the association. Legacy null-account rows remain possible, with no automatic credential association/backfill.
Evidence: [application](../src/PatientProfileService/Application/PatientApplicationService.cs), [repository](../src/PatientProfileService/Persistence/SqlPatientRepository.cs), [concurrency/retry/trigger rollback tests](../tests/Observation.AcceptanceTests/PatientAuthenticationTests.cs).
### 5.2 Observation queries and changes
Recording first verifies patient existence by Observation→Gateway→Patient/Profile. Only then does it save the observation in its own database. This is not a distributed transaction or database foreign key. There is no patient deletion endpoint, but the runtime lookup and write still occur at different instants.
Latest orders by descending measurement time, then original `created_at`, then observation UUID under PostgreSQL ordering. Edits never update original recording time. History filters one patient, inclusive period and both requested context predicates; it orders measurement time ascending then UUID ascending. It returns all matching rows as a list with no pagination or result-size cap. Patch updates preserve omitted values; physical deletion removes the row and all its flattened context.
New insights/trends/overviews read current data. No invalidation event is needed because no generated result is stored. This does **not** imply a cross-service snapshot: overview profile, latest and insight are separate reads. A write between them can produce a composition from different instants.
## 6. Calculation and aggregation behavior
### 6.1 Numerical insight
Insights requests filtered history through the Gateway and calculates arithmetic decimal means for systolic/diastolic/pulse; only final means are rounded to two decimals, midpoint away from zero (half-up for the permitted positive inputs). Blood-pressure minima/maxima retain original integer values. One observation suffices. Zero returns no insight and a 404 Problem; it is not an upstream failure.
The response includes patient, normalized period, applied selection, contributing count and descriptive context explanation. Mixed/unknown settings, activities and optional details are disclosed. Source data is neither relabelled nor persisted by Insights. Evidence: [summary calculator](../src/InsightsService/Domain/InsightCalculator.cs), [HTTP observation client](../src/InsightsService/Clients/HttpObservationServiceClient.cs), [summary tests](../tests/Observation.AcceptanceTests/ContextSelectedInsightTests.cs).
### 6.2 Trends and comparability
Each metric retains mean/min/max/range over every selected raw observation. Temporal calculations group identical measurement timestamps into arithmetic means, then sort by timestamp. At least two distinct timestamps are needed for direction. Adjacent nonzero changes determine Increasing, Decreasing, Mixed or NoClearDirection; sign changes count reversals. Total successive change sums absolute adjacent changes. An ordinary least-squares fit across all distinct timestamp means supplies OverallDirection and SlopePerDay; each timestamp group has equal weight. Time is scaled to the observed span for calculation; slope output is rounded to six decimals. Empty or single-timestamp data returns explicit unavailable portions, not fabricated direction.
Recorded comparability inspects setting/activity/rest/posture/arm/device/cuff similarities, missing details and differences, plus differing additional circumstances. A finite list of case-insensitive narrative phrases detects conflicts between declared Home/Clinic/AtRest and preserved text. This is deterministic phrase matching, not NLP; unrecognized text does not establish correctness, and negations can still match.
The compiled reference metadata supports resting pulse comparisons below 50 or above 100 beats/min, and high blood-pressure comparisons at or above home 135/85 or clinic 140/90 mmHg. Blood-pressure reference selection requires a single known Home/Clinic setting and recorded AtRest, without detected conflicts or explicitly inadequate rest/posture. Missing preparation details can permit a limited provisional reference comparison. These figures describe the **implemented reference selection**, not new medical advice or an independent verification of the sources.
Interpretation distinguishes supported numerical findings from cautiously labelled PotentiallyFavourable, PotentiallyConcerning, Mixed or CannotInterpret. It requires additional comparability/temporal support for development interpretations, never combines the three metrics into one good/bad score, and includes reference scope, operators, sources, dates and limitations. Current guidance/reference text is compiled into the application; no clinical website is called at runtime.
Evidence: [trend calculator](../src/InsightsService/Domain/InsightCalculator.Trends.cs), [result types](../src/InsightsService/Domain/TrendAssessment.cs), [documented method/rationale](../src/TRENDS.md), [numerical/context/reference tests](../tests/Observation.AcceptanceTests/HealthTrendTests.cs). This task checks architectural consistency, not clinical validity.
### 6.3 Health overview
Overview performs three **sequential** awaits: profile, latest overall observation, selected-period numerical insight. A missing profile returns no overview; a 404 latest or insight becomes null and preserves the available profile/other component. Non-404 failures do not silently become absent data. Latest remains independent of the insight's period and context selection. The result explicitly states both bases and contributes no trend component.
The insight request adds another chain: Overview→Gateway→Insights→Gateway→Observation. Each network leg uses the caller's configured service credential; original user tokens do not flow down the chain. Evidence: [overview application](../src/HealthOverviewService/Application/HealthOverviewApplicationService.cs), [client handling](../src/HealthOverviewService/Clients/InsightsServiceClient.cs), [overview tests](../tests/Observation.AcceptanceTests/HealthOverviewTests.cs), [overview sequence](diagrams/07-sequences.drawio).
## 7. Authentication, authorization and security
### 7.1 Client identity
Gateway validates pre-created credentials using ASP.NET Core Identity's `PasswordHasher<PrototypeAccount>`. Accounts are external configuration bound once into a singleton dictionary. Roles are limited to Patient and HealthcareProfessional; account IDs permit ASCII letters/digits/hyphen/underscore, with a maximum length of 128. Unknown accounts still execute hash verification against a dummy hash. Invalid/incorrect credentials share one generic response. Malformed hash verification is rejected; successful hashes that would benefit from rehashing are not persisted back to configuration.
Login issues the framework's protected opaque Bearer authentication ticket, **not a JWT**, using Data Protection application name `HealthApp.ApiGateway`. Claims contain stable account ID and role, not patient health records or patient ownership. Default lifetime is 30 minutes, configurable from 1–1440. Subsequent requests validate the token without password verification. There is no refresh, logout/revocation endpoint, session database, registration or identity-provider integration. Successful login responses carry `no-store` and `no-cache`.
Gateway persists its Data Protection key ring to configured `Authentication:KeyDirectory`. No explicit `ProtectKeysWith...` key-at-rest encryption is configured; filesystem permissions are the deployment protection visible in this implementation. Persistent compatible keys allow tokens to survive a normal Gateway restart. Multi-instance Gateway key coordination, immediate account-change token revocation and external identity-provider behavior are not implemented or verified. See [accounts](../src/ApiGateway/Security/PrototypeAccounts.cs), [login](../src/ApiGateway/Controllers/AuthenticationController.cs), [Gateway startup](../src/ApiGateway/Program.cs), [authentication tests](../tests/Observation.AcceptanceTests/PatientAuthenticationTests.cs).
### 7.2 Per-request access control
Fallback authorization requires authentication; login and general guidance explicitly permit anonymous callers. Role policies require the stable NameIdentifier claim. `PatientAccessMiddleware` then establishes actual access:
- A Patient can POST its initial profile and GET `/api/patients/me` before knowing its patient ID. The profile service enforces uniqueness.
- Other patient operations obtain the account's current persisted profile through the protected by-account API. Requested patient routes must match its ID.
- Observation-ID routes first fetch the observation from Observation to establish the actual owning patient. This additional read occurs before returning/modifying/deleting it.
- Professionals may only GET and must have the patient ID in their configured assignment set. The assignment-list route returns only that professional's configured IDs. Assignments are read once, deduplicated and sorted; edits require restart to affect the singleton.
- Unauthorized ownership/unassigned/missing ownership gives an empty 404 to avoid exposing another patient's existence. Missing/invalid token is 401; authenticated forbidden role/method is 403.
Ownership data is not cached between requests. Patient-specific responses do not receive a global explicit no-store directive in the code. Middleware path-segment comparisons are case-sensitive, despite routing's normal case-insensitive behavior and a few case-insensitive special routes; canonical lower-case routes are used throughout tests/clients. Evidence: [middleware](../src/ApiGateway/Security/PatientAccessMiddleware.cs), [assignments](../src/ApiGateway/Security/ProfessionalAssignments.cs), [professional tests](../tests/Observation.AcceptanceTests/ProfessionalAccessTests.cs), [replacement-handler test](../tests/PatientProfile.AcceptanceTests/AuthenticationIntegrationTests.cs).
### 7.3 Internal trust boundary
Every backend checks `X-Gateway-Key` with fixed-time comparison before controllers. A client bearer token alone cannot call a backend. The key grants the Gateway-level trusted caller boundary; backend controllers do not re-evaluate patient ownership or professional assignment. Compromise/disclosure of a backend incoming key therefore bypasses client authorization for that backend's exposed API.
Gateway chooses InternalService authentication whenever `X-Service-Key` is present; otherwise it chooses Bearer. An invalid callback key does not fall back to a valid bearer token. Three distinct configured callback identities have the following GET-only permissions:
| Callback identity | Allowed Gateway reads |
| --- | --- |
| Observation | `/api/patients/{patientId}` |
| Insights | `/api/patients/{patientId}/observations` with period/selection query |
| HealthOverview | Patient profile, latest observation and numerical insight for `{patientId}` |
Service identities do not carry end-user ownership; permitted reads can address any valid patient ID. They cannot write, list professional assignments, read individual observation IDs or call unlisted aggregation routes. Backend incoming and callback keys are independently generated; length ≥32 is required at startup, while installer-generated secrets are 32 random bytes rendered as 64 hex characters. The unused incoming-key field generated for Gateway is not a Gateway authentication mechanism.
Evidence: [internal handler](../src/ApiGateway/Security/InternalServiceAuthenticationHandler.cs), [service whitelist](../src/ApiGateway/Security/PatientAccessMiddleware.cs), [backend guard example](../src/ObservationService/Program.cs), [bypass/permission tests](../tests/Observation.AcceptanceTests/PatientAuthenticationTests.cs), [Overview restrictions](../tests/Observation.AcceptanceTests/HealthOverviewTests.cs).
### 7.4 Transport and secrets
Non-Development modes require HTTPS business origins. Plain HTTP is rejected with 400 by Gateway and 401 by backends; requests are not redirected to HTTPS. Development permits HTTP for local tests/development while still requiring authentication keys. Base origins must be absolute HTTP(S), root-path URLs without userinfo, query or fragment. There is no application mTLS, forwarded-header trust setup, CORS configuration or rate limiter.
The installer configures Kestrel PFX certificates and OS trust. Client machines independently need trust in the exported public CA or a supplied trusted certificate chain. Server certificates authenticate endpoint names; internal application keys authenticate callers. PostgreSQL-generated connections use `SslMode=Prefer`, not mandatory verified TLS, and default to local database hosts. This is a different boundary from mandatory production HTTPS between application processes.
Generated deployment manifests/account files contain secrets and are protected administratively. Linux uses private deployment files/root-readable environment files and service-group-readable certificates; Windows ACLs and macOS permissions are described below. Application logging uses framework logging/stdout/stderr. No explicit sensitive-data logging is enabled, but request paths can contain patient/observation identifiers. No audit-log store or patient-data log redaction facility is implemented. These are observable limits, not an expansion of the prototype's stated scope.
## 8. Concurrency, caching and runtime behavior
ASP.NET handles concurrent HTTP requests; database and network work uses async Task/CancellationToken. Scoped application services/repositories/contexts are per request. The singleton calculator has no mutable per-request state; accounts/assignments are startup snapshots. Gateway re-entrant callback HTTP traffic is handled as new requests, not recursive in-process calls. Inferred consequence: aggregate workflows add Gateway hops and dependent-service load even when only one external request is counted.
There is no application response/data cache, output-cache middleware, distributed cache, stored statistics or materialized view. Static guidance and loaded account/assignment dictionaries are configuration/reference state rather than caches of clinical data. Framework HTTP handler reuse and database connection behavior are separate infrastructure concerns. The generated database connection strings explicitly set `Pooling=false` and a 10-second connection timeout; externally supplied connection strings can choose different settings. No business HttpClient timeout override or resilience/retry/circuit-breaker policy is configured. The verifier's retry policy does not apply to ordinary application requests.
Profile creation uniqueness is explicitly concurrency-safe. Other updates have no EF concurrency token, version/ETag or conditional-write contract. Inferred: concurrent edits can overwrite each other's changes, especially owned context replacement after reading its previous value; the read following a profile update can observe a later writer's values. There is no multi-service transaction, request idempotency key for observation creation or guaranteed atomic overview snapshot.
History and calculation clients materialize full matching arrays in memory. Overview awaits sources sequentially rather than parallelizing them. Request cancellation is passed through normal HTTP/database operations; connection/HTTP timeouts can happen independently, and client-disconnect cancellation is not deliberately converted to 504.
Runtime evidence: all five `Program.cs` files, [Observation repository](../src/ObservationService/Persistence/SqlObservationRepository.cs), [Patient repository](../src/PatientProfileService/Persistence/SqlPatientRepository.cs), [overview application](../src/HealthOverviewService/Application/HealthOverviewApplicationService.cs), [connection-string generation](../deploy/HealthApp.Provisioning/Deployment.cs).
## 9. Deployment architecture and dependencies
### 9.1 Build and runtime
All five service projects target `net10.0`. Services include `Microsoft.Extensions.Hosting.WindowsServices` 10.0.12. The persistent services use Npgsql EF provider 10.0.3 and EF Relational/Design 10.0.12; Design is private tooling. Provisioning uses Npgsql 10.0.3 and the ASP.NET shared framework. Versions are those declared by the inspected project files, not a latest-version recommendation. xUnit, ASP.NET testing support and PostgreSQL are acceptance-test dependencies.
[build-release.sh](../deploy/build-release.sh) and [build-release.ps1](../deploy/build-release.ps1) publish selected projects separately in Release, framework-dependent (`--self-contained false`) without an apphost (`UseAppHost=false`), plus the provisioner. The bundle carries installer scripts, systemd templates, safe examples and installation documentation. Build requires .NET 10 SDK and package access. Target machines require the .NET 10 ASP.NET Core runtime and PostgreSQL only for persistent services; automatic provisioning supplies missing supported dependencies.
### 9.2 Topology and configuration
Colocated and distributed layouts use the same DLLs and HTTP interfaces. [deployment diagrams](diagrams/06-deployment.drawio) show both supported layouts, not a claim about current physical hosts. Defaults are Gateway HTTPS 5443 and Patient/Profile/Observation/Insights/Overview HTTPS 5081/5082/5083/5084. Generated bindings are `https://0.0.0.0:PORT`; origins and certificate names use configured hosts. Ports must be 1024–65535; services at the same literal host need different ports. IPv6-reachable binding behavior and alias equivalence are not explicitly tested by this documentation task.
Standard .NET configuration loads JSON, environment and command-line values. Committed `appsettings.json` contains logging only. Required external values are:
| Service | Configuration |
| --- | --- |
| Gateway | `Authentication:Accounts`, `Authentication:KeyDirectory`, optional token lifetime; `Access:ProfessionalAssignments`; four `Services:{name}:BaseUrl/Key`; callback keys `InternalAccess:{Observation,Insights,HealthOverview}:Key` |
| Patient/Profile | `ConnectionStrings:PatientDatabase`, `InternalAccess:GatewayKey` |
| Observation | `ConnectionStrings:ObservationDatabase`, incoming Gateway key, `Services:ApiGateway:BaseUrl/Key` |
| Insights and Overview | Incoming Gateway key, `Services:ApiGateway:BaseUrl/Key`; no database settings |
| Each HTTPS host | Binding plus `Kestrel:Certificates:Default:Path/Password`, environment |
Environment-file keys use `__` for configuration sections. Missing/invalid required origins, keys, accounts and connection strings stop startup; startup validation is not a dependency reachability check. Patient/Profile and Observation support `--migrate`: migrations run and the process exits before normal host security/origin startup checks. Normal startup never migrates.
### 9.3 Provisioning stages
1. Validate selected service names, payloads and absence of existing installation/configuration. A repeated first-install command refuses overwrite; no upgrade/uninstall engine exists.
2. Detect supported native platform/dependencies. Linux accepts Debian/Ubuntu `ID`/`ID_LIKE`, apt and running systemd/root access. Package availability, not fixed release numbers, controls provisioning. Only actual Debian can receive a Microsoft Debian runtime repository fallback. Required package names are `aspnetcore-runtime-10.0` and, where needed, `postgresql`.
3. Prepare one private plan covering all five services, even for a subset. Generate per-service keys, database settings for the two owners, synthetic `prototype-patient`, `prototype-professional`, `installation-check` accounts and hashed Gateway account config. The professional initially has no assignments.
4. Generate a prototype CA (two-year validity) and service-name/IP SAN certificates (one-year validity). Only public CA material is retained; its generated signing private key is disposed. Alternatively accept externally supplied public CA and all service PFX/password files. Supplied material is not preflighted against every runtime requirement; endpoint verification checks trust/name later.
5. Create selected persistent services' separate DBs/roles, revoke public database/schema access and give the owner schema rights for migrations. Reuse a consistent generated plan, not independently generated incompatible secrets. Database roles cannot administer/create databases/roles/replicate. An external PostgreSQL admin connection can be supplied; generated service endpoint settings adopt its host/port.
6. Install selected payloads, protected configuration/certificates, native identities and registrations; apply migrations and start each selected process.
7. Verify local native status/distinct PIDs where implemented, HTTPS reachability, DB service identity, callback credentials and topology. Complete-system verification logs in and creates/reuses a labelled synthetic check profile/observation, then retrieves overview through all five services. Verification is therefore not entirely read-only.
Evidence: [Linux installer](../deploy/installer/install.sh), [bootstrap](../deploy/installer/bootstrap.sh), [deployment preparation](../deploy/HealthApp.Provisioning/Deployment.cs), [DB provisioning](../deploy/HealthApp.Provisioning/DatabaseProvisioning.cs), [config adapter](../deploy/HealthApp.Provisioning/ConfigurationWriter.cs), [verifier](../deploy/HealthApp.Provisioning/InstallationVerification.cs).
### 9.4 Native execution and paths
| Platform | Runtime management and paths | Important boundaries |
| --- | --- | --- |
| Linux | `healthapp-NAME.service`; `/opt/healthapp/NAME`; `/etc/healthapp/NAME/service.env`; Gateway `/var/lib/healthapp-api-gateway/keys`; default plan `/var/lib/healthapp-installation/deployment` | Dedicated `healthapp-NAME` users/groups; env root-only, certificates root/service group; systemd supplies env; default local PostgreSQL |
| Windows | Independent Windows Services/virtual `NT SERVICE\healthapp-NAME` identities; `%ProgramData%\HealthApp` with services/config/state | Private administrative ACLs plus own-service read/state rights; production JSON copied into application directory; selected HTTPS firewall rules; runtime downloaded if absent; EDB PostgreSQL 17 installer resolved from maintained package manifest and SHA-256 checked |
| macOS | Independent launchd daemons/hidden `_healthapp_NAME` identities; `/Library/Application Support/HealthApp` with services/config/state | System-keychain CA trust; Homebrew PostgreSQL 17 and installer-owned cluster if no external server; Apple command-line tools/Homebrew provisioning; private plist contains environment secrets |
Systemd source templates still show a shared `healthapp` user and old flat env paths. The installer rewrites them to per-service identities and nested env paths; the generated units are the as-built installed behavior. Units request network-online, restart on failure after five seconds, use SIGINT and a 30-second stop timeout. They do not couple peers via Requires/PartOf/BindsTo or impose explicit resource limits/sandbox directives. Backend DB unavailability does not necessarily stop a host before its first DB request. Independent stopping means process independence, not availability of workflows that depend on it.
Windows uses standard WindowsServices lifetime integration and restart-on-failure configuration. macOS `RunAtLoad`/`KeepAlive` launchd registration keeps daemons alive. The repository supplies a manual [native-install workflow](../.github/workflows/prototype-native-install.yml); its existence is not evidence that Windows/macOS live registration or CI execution succeeded.
### 9.5 Distributed administration and verification limits
One prepared topology can be grouped by host and installed through SSH/SCP using [Distribution](../deploy/HealthApp.Provisioning/Distribution.cs). Each node receives selected applications/private material and necessary remote origins, not all unrelated keys/DB passwords. The Gateway legitimately needs outgoing backend keys and callback authentication keys. Unix installation needs administrative SSH with noninteractive sudo; Windows requires an elevated SSH session. Host-administration access is a prerequisite separate from generated application credentials.
Node startup can defer cross-topology verification until other hosts start. Final verification probes actual origins. There is no remote runtime file-sharing dependency after installation. Failed installation retains existing/generated material and reports the failed step; it has no cross-host rollback transaction or remote-artifact cleanup guarantee. Linux `--root` is offline staging, not live package/service deployment.
Verification contains short startup retry loops for transient 502/503/504/connectivity failures, uses custom-root TLS validation with server-name checking, and tests actual database identity. Linux installer/verifier checks native active state and distinct MainPID values. Neither live verifier deliberately cycles every service through stop/restart. Independent stop/restart is exercised by deployment acceptance tests, with direct process control; native manager execution is a separate evidence limit. See [traceability](requirements-traceability.md).
## 10. Failure behavior
| Trigger | Implemented outcome |
| --- | --- |
| Missing/malformed model, unsupported category, reversed/missing period | 400 validation response; no intended partial write |
| Invalid login / missing, forged or expired bearer | 401; invalid login response does not identify which credential failed |
| Incorrect backend incoming key / production backend HTTP | 401 before controller |
| Production Gateway HTTP | Empty 400, including public/login routes |
| Forbidden professional write, role or internal service route | 403 |
| Cross-patient ownership, unassigned patient, no own profile, absent observation | Generally empty Gateway 404; authorized missing backend resources follow their own API response |
| Second/concurrent profile creation | 409 existing-profile condition, protected by unique DB index |
| No history / summary / temporal data | History 200 `[]`; summary 404 insufficient data; trends 200 explicit unavailable parts; overview keeps available profile/latest with null insight |
| Gateway forwarding connection failure | 502 Problem; upstream status responses otherwise forwarded |
| Local non-client-cancelled upstream timeout | 504 Problem; an upstream 504 already received remains an upstream response and can be mapped by a consuming service |
| Observation patient-lookup failure | 502/504, no saved observation |
| Insights/Overview upstream non-success or malformed JSON | 502; a local timeout 504; appropriate 404 treated as absence only in Overview clients |
| Ownership lookup invalid JSON/missing expected field, unhandled DB error or other exception | Generic exception-handler path, normally 500; not all invalid upstream shapes have an explicit 502 mapping |
| Gateway stream fails after response has started | Connection aborted; response cannot be replaced safely with a new error body |
| Required config invalid / packages unavailable / certificate or provisioning failure | Startup or installer fails; step diagnostics; retained data/material rather than automatic rollback |
Every host installs `AddProblemDetails`/`UseExceptionHandler`; response shapes are not entirely uniform (empty status responses, login `{title}`, validation Problems and explicit Problems coexist). Overview interprets any 404 from its designated insight route as absent insight; it does not inspect the upstream problem title to distinguish all possible causes. Gateway ownership lookup is an extra availability dependency on Patient/Profile for patient requests, even when the requested operation is otherwise Observation- or Insights-owned.
No automatic business retry, circuit breaker, overload shedding, rate limit, dedicated readiness/liveness API or fault-tolerant replica configuration is implemented. Inferred: a Gateway outage prevents all normal external operations and aggregation callbacks; a source outage may leave peer processes running while dependent workflows fail. Runtime failure tests: [patient failures](../tests/Observation.AcceptanceTests/PatientAuthenticationTests.cs), [insight failures](../tests/Observation.AcceptanceTests/HealthInsightTests.cs), [trend failures](../tests/Observation.AcceptanceTests/HealthTrendTests.cs), [overview failures](../tests/Observation.AcceptanceTests/HealthOverviewTests.cs).
## 11. Test and experiment architecture
Application acceptance fixtures use real PostgreSQL databases and HTTP hosts, standard credential hashing/protected tokens, controlled identities and an injectable token clock. They check persistence across host restarts, isolation, ownership, professional restrictions, period/category semantics and failures. Some tests seed directly into an owning DbContext to establish Given state; that is not production cross-service DB access. Test-specific replacement authentication verifies policy separation but is not the deployment mechanism.
Deployment acceptance builds/publishes a release, invokes the real offline installer/provisioner, creates isolated DBs/roles and launches five separate Production HTTPS processes at distinct loopback origins. It checks native config formats, secrets/certificate output, DB isolation, migrations, restart independence and representative workflows. SSH/SCP distribution and apt bootstrap commands use controlled doubles. Such tests cannot establish a real five-machine topology or native Windows/macOS service-manager operation. Evidence: [application fixture](../tests/Observation.AcceptanceTests/ObservationApiFixture.cs), [test token helper](../tests/Support/AuthenticatedTestClient.cs), [deployment fixture](../tests/Deployment.AcceptanceTests/DeploymentFixture.cs), [installation tests](../tests/Deployment.AcceptanceTests/InstallationTests.cs), [bootstrap tests](../tests/Deployment.AcceptanceTests/BootstrapTests.cs).
The optional [energy/JMeter tooling](../tools/energy-jmeter/README.md) runs outside the product processes. Generated JMX plans exercise synthetic API sessions, renew opaque tokens by login, and include Gaussian interaction delays. PerfMon ServerAgent host telemetry and Shelly plug HTTP power readings are collected live into JMeter, defaulting to one-second intervals. The runner separates warmup from the measured duration and reports request latency/throughput and CPU/RAM/power on aligned timelines. Idle sends no application requests. These agents/devices are experimental dependencies, not a sixth HealthApp service or a production monitoring/security guarantee. Private credentials and ignored raw experiment results were not inspected for this assignment.
## 12. Significant constraints and decisions
The architecture preserves independent process/persistence boundaries, Gateway-routed REST, controller APIs, external configuration and on-demand derived results. It deliberately uses pre-created accounts/assignments and synthetic data. No account administration, assignment-management UI, consent/emergency workflows, medication recommendations, professional edits or production identity-provider implementation is present; these are documented exclusions, not implicitly missing stories.
[Architecture decisions](architecture-decisions.md) distinguishes explicitly documented rationale from inferred consequences. [Requirements traceability](requirements-traceability.md) identifies implementation/verification limits without silently adding requirements. [Discrepancies](discrepancies.md) distinguishes superseded diagrams, current elaborations and unresolved evidence gaps. This documentation proposes no architectural or implementation changes.
+27
View File
@@ -0,0 +1,27 @@
# Documentation validation
Validated on 2026-10-12 against source commit `5d9371388c15066eeb2bc124ed227659c644dab5`.
## Deliverables
- Required architecture narrative, README, observable decisions, requirements traceability and discrepancies are present.
- Twelve native editable Draw.io files cover all required views. Five are standalone service class diagrams; the combined class file contains the same service views plus provisioning. The complete domain diagram has an application-domain page and a separate deployment-domain page.
- Every one of the 78 source-declared service classes, records and interfaces is an individual UML classifier in its service diagram. Classifiers have separate name, attribute and operation compartments; nested types and partial declarations are accounted for. Migrations/designer members/snapshots appear on distinct EF-support pages.
- Domain concepts and implementation classes are on separate diagrams.
- The evidence inventory links source, configuration, requirements and concrete test methods.
## Checks performed
Native XML was parsed for every diagram. Checks verified `mxfile`/`mxGraphModel` structure, unique cell IDs, existing connector endpoints, positive shape geometry, free-edge message/lifeline endpoints and absence of embedded raster-image diagram content. Native boxes do not overlap. A font-metric estimate checked wrapped label height against every shape; no estimated text overflow was found. Relative source links attached to diagram nodes and local Markdown links resolve to existing files.
Following the class-diagram correction, declarations were independently enumerated from each service's source files and compared against the diagram's fully qualified `sourceType` values. Exact per-service coverage is required: Gateway 16, Patient/Profile 14, Observation 17, Insights 16 and Overview 15. Member signatures were checked for arrays, nullable/default record parameters, visibility/private setters and merged partial migration methods. The earlier grouped class views were replaced, not retained as complete service diagrams.
Content was checked against actual service startup, controllers, client origins/headers, security middleware, domain/contracts, repositories, EF mappings/migrations, provisioning/native adapters and relevant acceptance assertions. The diagrams use the same Gateway-routed communication, separate database ownership, opaque-token mechanism, context semantics and sequential overview behavior as the narrative. Historic superseded diagrams and stale implementation prose are distinguished from current-baseline differences.
The directory contains documentation and `.drawio` source only. No application code, configuration, tests or existing documentation was changed. A SHA-256 comparison confirmed all **229 pre-existing tracked files** retain their original contents; Git reports only the new `AsBuiltArchitecture/` directory.
## Evidence limits
Application/deployment suites were inspected rather than rerun: this assignment authorizes documentation, not changes to existing implementation/build artifacts or live installation. No native installer, remote host, device or external clinical source was exercised. Test doubles and loopback origins are not described as real multi-machine/native deployment evidence.
Draw.io XML/geometry/source-link validation was automated; the Draw.io desktop/browser GUI was not available here, so GUI round-trip/import rendering was not separately exercised. Each file is uncompressed native Draw.io XML with editable labels, shapes and connectors, not an image-only export. The document records uncertainties rather than presenting these limits as verified runtime behavior.
+70
View File
@@ -0,0 +1,70 @@
# HealthApp prototype
A REST/JSON backend with five independent services. There is no web interface.
## 1. Compile and package
Install the **.NET 10 SDK** on the build computer. From this repository's root, run:
```bash
bash deploy/build-release.sh --output ./healthapp-release
```
On Windows, use PowerShell instead:
```powershell
.\deploy\build-release.ps1 -Output .\healthapp-release
```
The script compiles the application and packages its installer. The output directory
must not already exist. Copy `healthapp-release` to the test computer.
## 2. Install
Open a terminal inside the copied release directory. Replace `192.168.1.20` with
the test computer's reachable IP address or DNS name.
**Debian/Ubuntu-based Linux with systemd** (also the macOS command):
```bash
sudo bash install.sh --services all --host 192.168.1.20
```
**Windows**, from an administrator PowerShell:
```powershell
powershell -NoProfile -ExecutionPolicy Bypass -File .\install.ps1 -Services all -HostName 192.168.1.20
```
Internet access is required to download missing dependencies. The installer provisions
the runtime, PostgreSQL, databases, credentials, HTTPS and configuration, then starts
and verifies the services. Existing installations are not overwritten.
Native service installation still needs validation on the target operating systems;
see the [installation guide](deploy/INSTALLATION.md) for details and distributed deployment.
## 3. Run and use
Services start automatically after installation and on boot.
1. On a client computer, trust the generated public `healthapp-ca.crt` certificate.
2. Test the API at `https://192.168.1.20:5443/api/measurement-guidance`.
3. Retrieve the generated login details from `accounts.json`:
- Linux: `/var/lib/healthapp-installation/deployment/accounts.json`
- Windows: `%ProgramData%\HealthApp\deployment\accounts.json`
- macOS: `/Library/Application Support/HealthApp/deployment/accounts.json`
4. Use `POST /api/authentication/login` with `accountId` and `password`; send the
returned `accessToken` as a Bearer token for protected requests.
On Linux, check or restart a service with:
```bash
sudo systemctl status healthapp-api-gateway
sudo systemctl restart healthapp-api-gateway
```
Other service names are `healthapp-patient-profile`, `healthapp-observation`,
`healthapp-insights` and `healthapp-health-overview`.
See [API documentation](src/README.md) for available endpoints.
For JMeter scenarios and four-hour energy runs, see the [workload guide](tools/energy-jmeter/README.md).
+12 -6
View File
@@ -35,12 +35,18 @@ files contain no generated secrets. Build output must be a new directory.
## Normal Ubuntu/Debian installation
Automatic Linux package provisioning currently supports Ubuntu 24.04 and Debian 12/13,
with a running systemd manager and administrative access. This is the implemented
Linux adapter's supported set, not a restriction in the application binaries. Other
Linux distributions need corresponding package-manager integration before the installer
can claim native dependency provisioning there. Internet access to the signed OS/.NET
package feeds is needed when dependencies are absent.
Automatic Linux provisioning accepts Debian/Ubuntu ancestry (`ID` or `ID_LIKE`),
with apt, a running systemd manager and administrative access. It checks actual package
availability rather than a fixed distribution/version list. Internet access to configured
package feeds is needed when dependencies are absent. Existing .NET 10 ASP.NET Core
runtime and PostgreSQL installations are reused where available.
The installer prefers configured distribution feeds. On Debian itself, if the runtime
package is absent, it attempts Microsoft's repository for that Debian VERSION_ID.
Derivatives use their own configured feeds; their version numbers are never passed to
an upstream repository. If no compatible runtime source or PostgreSQL package is
available, installation stops with a specific dependency error. Debian ancestry alone
does not guarantee .NET/CPU compatibility; startup and topology verification still apply.
From the release directory:
+25 -8
View File
@@ -1,32 +1,49 @@
#!/usr/bin/env bash
# Source from install.sh. Package commands use the supported distribution's signed feeds.
package_available() {
local policy
policy=$(LC_ALL=C apt-cache policy "$1") || return 1
[[ "$policy" =~ Candidate:[[:space:]]+([^[:space:]]+) && "${BASH_REMATCH[1]}" != '(none)' ]]
}
ensure_dependencies() {
local distribution=$1 version=$2 runtime=$3 persistence=$4
case "$distribution:$version" in ubuntu:24.04|debian:12|debian:13) ;; *) fail 'Automatic provisioning supports Ubuntu 24.04 and Debian 12/13.';; esac
local distribution=$1 version=$2 runtime=$3 persistence=$4 ancestry=${5:-}
case " $distribution $ancestry " in
*" debian "*|*" ubuntu "*) ;;
*) fail 'Automatic Linux provisioning requires a Debian/Ubuntu-based distribution (ID or ID_LIKE).';;
esac
command -v apt-get >/dev/null && command -v apt-cache >/dev/null || fail 'Debian/Ubuntu provisioning requires apt-get and apt-cache.'
step='refresh dependency package availability'
apt-get update || fail 'Could not refresh package feeds; check network access and configured repositories.'
step='install base dependencies'
if ! command -v curl >/dev/null || ! command -v update-ca-certificates >/dev/null; then
apt-get update
DEBIAN_FRONTEND=noninteractive apt-get install -y ca-certificates curl
fi
if [[ ! -x "$runtime" ]] || ! "$runtime" --list-runtimes | grep -q 'Microsoft.AspNetCore.App 10\.'; then
step='install .NET 10 ASP.NET Core runtime'
apt-get update
if [[ "$distribution" == debian ]]; then
if ! package_available aspnetcore-runtime-10.0 && [[ "$distribution" == debian ]]; then
[[ "$version" =~ ^[0-9]+$ ]] || fail 'Cannot identify a compatible Microsoft Debian package repository from VERSION_ID.'
local package_dir
package_dir=$(mktemp -d)
curl --fail --silent --show-error "https://packages.microsoft.com/config/debian/$version/packages-microsoft-prod.deb" -o "$package_dir/microsoft.deb"
if ! curl --fail --silent --show-error --location "https://packages.microsoft.com/config/debian/$version/packages-microsoft-prod.deb" -o "$package_dir/microsoft.deb"; then
rm -f -- "$package_dir/microsoft.deb"
rmdir -- "$package_dir"
fail "No accessible Microsoft Debian $version repository; aspnetcore-runtime-10.0 is unavailable in configured feeds."
fi
dpkg -i "$package_dir/microsoft.deb"
rm -f -- "$package_dir/microsoft.deb"
rmdir -- "$package_dir"
apt-get update
fi
DEBIAN_FRONTEND=noninteractive apt-get install -y aspnetcore-runtime-10.0
package_available aspnetcore-runtime-10.0 || fail "Required package aspnetcore-runtime-10.0 is unavailable for $distribution $version in configured feeds; no compatible runtime repository could be identified automatically."
DEBIAN_FRONTEND=noninteractive apt-get install -y aspnetcore-runtime-10.0 || fail 'Failed to install aspnetcore-runtime-10.0 from configured feeds.'
fi
[[ -x "$runtime" ]] && "$runtime" --list-runtimes | grep -q 'Microsoft.AspNetCore.App 10\.' || fail 'The .NET 10 ASP.NET Core runtime could not be provisioned.'
if [[ "$persistence" == true ]]; then
step='provision PostgreSQL server'
if ! command -v pg_isready >/dev/null || ! pg_isready -q -h localhost -p 5432; then
DEBIAN_FRONTEND=noninteractive apt-get install -y postgresql
package_available postgresql || fail "Required package postgresql is unavailable for $distribution $version in configured feeds."
DEBIAN_FRONTEND=noninteractive apt-get install -y postgresql || fail 'Failed to install PostgreSQL from configured feeds.'
systemctl enable --now postgresql
fi
local ready=false attempt
+1 -1
View File
@@ -50,7 +50,7 @@ for service in "${selected_services[@]}"; do case "$service" in patient-profile|
if [[ "$target_root" == / && "$prepare_only" == false ]]; then
[[ $EUID -eq 0 && -d /run/systemd/system ]] || fail 'Live installation requires root and a running systemd manager.'
source /etc/os-release
ensure_dependencies "$ID" "$VERSION_ID" "$dotnet_path" "$persistence"
ensure_dependencies "$ID" "${VERSION_ID:-}" "$dotnet_path" "$persistence" "${ID_LIKE:-}"
else
[[ -x "$dotnet_path" ]] || fail 'Offline preparation needs an available .NET 10 runtime.'
fi
@@ -10,10 +10,22 @@ public sealed class BootstrapTests
[InlineData("ubuntu", "24.04", false, false, false)]
[InlineData("ubuntu", "24.04", true, true, false)]
[InlineData("ubuntu", "24.04", true, true, true)]
[InlineData("ubuntu", "26.04", false, true, false)]
[InlineData("ubuntu", "26.04", true, true, true)]
[InlineData("debian", "12", true, false, false)]
[InlineData("debian", "13", false, true, false)]
[InlineData("linuxmint", "22", false, true, false, "ubuntu debian")]
[InlineData("pop", "future", false, false, false, "ubuntu")]
[InlineData("ubuntu", "future", false, false, false)]
[InlineData("debian", "13", false, false, false, "", false)]
[InlineData("linuxmint", "22", false, false, false, "ubuntu debian", false, true, true, "aspnetcore-runtime-10.0 is unavailable")]
[InlineData("debian", "99", false, false, false, "", false, true, false, "No accessible Microsoft Debian 99 repository")]
[InlineData("ubuntu", "26.04", true, true, false, "", true, false, true, "Required package postgresql is unavailable")]
[InlineData("fedora", "44", true, false, false, "", true, true, true, "requires a Debian/Ubuntu-based distribution")]
public async Task Package_provisioning_detects_runtime_and_postgresql_and_installs_only_needed_dependencies(
string distribution, string version, bool runtimeAvailable, bool databaseRequired, bool databaseAvailable)
string distribution, string version, bool runtimeAvailable, bool databaseRequired, bool databaseAvailable,
string ancestry = "", bool runtimePackage = true, bool postgresPackage = true,
bool repositoryAvailable = true, string expectedError = "")
{
var directory = Path.Combine(Path.GetTempPath(), "healthapp-bootstrap-" + Guid.NewGuid().ToString("N"));
Directory.CreateDirectory(directory);
@@ -25,16 +37,21 @@ public sealed class BootstrapTests
var script = Path.Combine(directory, "test.sh");
await File.WriteAllTextAsync(script, """
set -euo pipefail
fail() { exit 1; }
fail() { printf '%s\n' "$*" >&2; exit 1; }
runtime() { if [[ "$RUNTIME_PRESENT" == true || -f "$RUNTIME_INSTALLED" ]]; then printf '%s\n' 'Microsoft.AspNetCore.App 10.0.12 [runtime]'; else return 1; fi; }
apt-get() { printf '%s\n' "apt-get $*" >> "$COMMAND_LOG"; if [[ "$*" == *aspnetcore-runtime-10.0* ]]; then touch "$RUNTIME_INSTALLED"; fi; }
curl() { printf '%s\n' "curl $*" >> "$COMMAND_LOG"; }
apt-cache() {
if [[ "$2" == aspnetcore-runtime-10.0 && ( "$RUNTIME_PACKAGE" == true || -f "$REPOSITORY_ADDED" ) || "$2" == postgresql && "$POSTGRES_PACKAGE" == true ]]; then
printf '%s\n' ' Candidate: 10.0.1';
else printf '%s\n' ' Candidate: (none)'; fi
}
curl() { [[ "$REPOSITORY_AVAILABLE" == true ]] || return 22; printf '%s\n' "curl $*" >> "$COMMAND_LOG"; }
update-ca-certificates() { :; }
dpkg() { printf '%s\n' "dpkg $*" >> "$COMMAND_LOG"; }
dpkg() { printf '%s\n' "dpkg $*" >> "$COMMAND_LOG"; touch "$REPOSITORY_ADDED"; }
pg_isready() { [[ -f "$DATABASE_READY" ]]; }
systemctl() { printf '%s\n' "systemctl $*" >> "$COMMAND_LOG"; touch "$DATABASE_READY"; }
source "$BOOTSTRAP"
ensure_dependencies "$DISTRO" "$VERSION" /bin/true "$DATABASE_REQUIRED"
ensure_dependencies "$DISTRO" "$VERSION" /bin/true "$DATABASE_REQUIRED" "$ANCESTRY"
""");
// Runtime is an executable stub; installed packages switch its simulated inventory.
var runtime = Path.Combine(directory, "dotnet");
@@ -47,16 +64,28 @@ public sealed class BootstrapTests
["COMMAND_LOG"] = log, ["RUNTIME_INSTALLED"] = installed,
["RUNTIME_PRESENT"] = runtimeAvailable ? "true" : "false", ["RUNTIME_EXECUTABLE"] = runtime,
["DATABASE_READY"] = Path.Combine(directory, "pg-ready"), ["DATABASE_REQUIRED"] = databaseRequired ? "true" : "false",
["ANCESTRY"] = ancestry, ["RUNTIME_PACKAGE"] = runtimePackage ? "true" : "false",
["POSTGRES_PACKAGE"] = postgresPackage ? "true" : "false", ["REPOSITORY_AVAILABLE"] = repositoryAvailable ? "true" : "false",
["REPOSITORY_ADDED"] = Path.Combine(directory, "repository-added"),
["BOOTSTRAP"] = Path.Combine(DeploymentFixture.Repository, "deploy/installer/bootstrap.sh"), ["DISTRO"] = distribution, ["VERSION"] = version
};
if (databaseAvailable) await File.WriteAllTextAsync(environment["DATABASE_READY"], "ready");
var result = await DeploymentFixture.Run("bash", [script], environment);
Assert.Equal(0, result.Code);
if (expectedError.Length > 0)
{
Assert.NotEqual(0, result.Code);
Assert.Contains(expectedError, result.Output);
var failedCommands = await File.ReadAllTextAsync(log);
Assert.DoesNotContain("install -y aspnetcore-runtime-10.0", failedCommands);
Assert.DoesNotContain("install -y postgresql", failedCommands);
return;
}
Assert.True(result.Code == 0, result.Output);
var commands = await File.ReadAllTextAsync(log);
Assert.Equal(!runtimeAvailable, commands.Contains("install -y aspnetcore-runtime-10.0"));
Assert.Equal(databaseRequired && !databaseAvailable, commands.Contains("install -y postgresql"));
Assert.Equal(databaseRequired && !databaseAvailable, commands.Contains("systemctl enable --now postgresql"));
Assert.Equal(!runtimeAvailable && distribution == "debian", commands.Contains("packages.microsoft.com/config/debian/" + version));
Assert.Equal(!runtimeAvailable && !runtimePackage && distribution == "debian", commands.Contains("packages.microsoft.com/config/debian/" + version));
}
finally { Directory.Delete(directory, true); }
}
+331
View File
@@ -0,0 +1,331 @@
# HealthApp energy workloads
JMeter 5.6.3 is installed on this development computer at `~/.local/bin/jmeter`.
Its launcher uses the installed Java 17; the default Java 26 cannot compile
JMeter's bundled Groovy scripts. The `jpgc-perfmon` 2.1 plugin is installed for live server monitoring.
Runs default to **30 minutes of warmup + 4 hours of measurement**. A few additional
seconds allow startup/draining. Only requests entirely inside the four-hour window
appear in `measured.csv`. Full raw samples remain in `samples.csv`. `run.json` and
`timeline.json` identify exact UTC measurement boundaries for your external meter.
## Scenarios
| Plan | User workflow |
|---|---|
| `recording` | View guidance/profile, save a home resting reading, retrieve it, view overview. |
| `review` | Profile, latest reading, filtered history, numerical insights, trends, overview. |
| `correction` | Record an erroneous/duplicate entry, correct it, check overview, delete that entry, confirm removal. |
| `mixed` | Expected session mix: 65% review, 30% recording, 5% correction. |
| `professional` | Assigned-patient list, profile/latest/history/insights/trends/overview; no writes. |
| `idle` | No measured API traffic; services remain running for the same observation period. |
Each thread retains its own account, patient and opaque token. Login occurs initially
and before token expiry, including during four-hour runs. Requests use the gateway;
IDs come from actual responses. Nonexpected HTTP statuses and semantic failures stop
the affected user and invalidate the run. Only newly created correction-scenario
observations are deleted. Baseline and ordinary recording observations remain.
Per-user seeded random generators produce independent **Gaussian delays**:
interaction mean 1 second, standard deviation 250 ms, minimum 500 ms; between-session mean
120 seconds, standard deviation 30 seconds. Interaction delays use a Gaussian truncated symmetrically between 500 and 1500 ms,
retaining a 1-second expected mean. Between-session negative draws are clamped to zero. Threads also ramp up over
120 seconds. The seed is recorded; OS scheduling still affects exact timings.
These are configurable experimental assumptions, not measured population behaviour.
The default session frequency represents sustained, accelerated prototype activity;
for less frequent patient visits increase `--session-pause-ms` and its deviation.
A closed-loop user waits for each response; throughput decreases when the server slows.
Concurrency means resident simulated users, including their idle/thinking time.
## Live NUC monitoring in JMeter
All six plans contain **jp@gc – PerfMon Metrics Collector**, including idle.
The listener connects over TCP to the agent on the target (default port 4444),
samples every second, and writes `perfmon.csv` directly on this computer
through JMeter during the run. No server log transfer is needed. In GUI mode the
listener shows live graphs; use CLI mode for actual energy experiments.
Collected host metrics: CPU combined utilisation and I/O wait (%), memory usage
(% and actual-used bytes), swap-used bytes, disk read/write bytes per second,
and network received/sent bytes per second. These are system totals, not per-service
attribution. Network/disk counters depend on SIGAR's device support; zero values on
an idle host do not establish their accuracy. Compare the readings against Linux
utilities before treating the agent as a validated measurement instrument.
The runner checks agent access/metric availability before starting. It records
`--perfmon-host`, `--perfmon-port` and `--perfmon-interval-ms` (default 1000) in
`run.json`; by default the agent host matches `--host`. Failed, missing or widely
spaced measurements invalidate monitoring. `perfmon-measured.csv` excludes warmup,
decodes the plugin's synthetic `elapsed` field into metric values/units, and retains
timestamps from this computer's collector, not server-origin timestamps.
**PerfMon's elapsed field is not HTTP latency.** Host metrics stay separate
from application request counts. Raw `perfmon.csv` contains warmup and measured data.
`run.json` also includes each metric's sample count, mean and maximum.
Keep the agent running on the NUC for the full warmup and measured run. Its TCP
connection is plain-text and provides no authentication; restrict port 4444 to the
load-generator computer. Restart it with `--no-exec --udp-port 0 --tcp-port 4444`
to disable the agent's executable custom metrics; these plans use only built-in metrics.
`--no-perfmon` is for isolated workflow testing and explicitly records that no server
monitoring was collected. The plugin must still be installed to load its JMX element.
The validation fixture uses this switch and does not connect to the NUC.
[PerfMon listener documentation](https://jmeter-plugins.org/wiki/PerfMon/),
[agent metrics/protocol](https://github.com/undera/perfmon-agent).
## Live Shelly power in JMeter
Every scenario, including idle, contains one **Shelly live power** thread. It polls
`http://192.168.1.44/rpc/Switch.GetStatus?id=0` every second directly from
JMeter, independently of simulated users. There is no cloud dependency and no
post-run network transfer. No switch/set/reset commands are sent.
`shelly.csv` is written while JMeter runs, with timestamps, request status,
`shelly_power_watts`, `shelly_voltage_volts`, `shelly_current_amps` and cumulative
`shelly_energy_wh`. Raw readings include warmup. `shelly-measured.csv` brackets only
the measured interval, interpolating its boundaries; `run.json` includes mean watts,
integrated joules/kWh and the counter's Wh delta converted to joules/kWh.
The timestamp is approximated by each polling request's midpoint on this computer.
Meter requests are excluded from the application's request-rate and latency summary.
JMeter's overall console summary includes meter polls; use `run.json` and
`measured.csv` for the application-only figures.
Energy from sampled power is the sum of the recorded in-window power values, each multiplied by the nominal polling interval. This assumes each reading represents that interval; actual polling timestamps may differ and sample coverage is reported. Counter deltas provide a separate cross-check;
the device's counter update granularity can make short runs report little or no
counter change despite nonzero power. Both boundary interpolation and meter accuracy
limit precision; this does not claim calibration. The plug measures what is connected
to its outlet, including the NUC's power-adapter losses. Connect only the intended
measured equipment. Its internal temperature is **not the NUC CPU temperature**.
The runner defaults to this plug and checks its status before starting. Override with
`--shelly-host`, `--shelly-port`, `--shelly-switch-id` or `--shelly-interval-ms`.
There is a short unmeasured drain after the four-hour window to obtain its closing
boundary. Missing samples, long gaps, failed polls and counter resets invalidate the
power measurement; they are not treated as zero watts. `--no-shelly` is for isolated
workflow testing, and records that power monitoring was disabled. The current plug
has authentication disabled; authenticated device access is not yet implemented.
The runner configures JMeter's `sample_variables` so the numeric columns are saved.
For a manual GUI/CLI launch, pass:
```bash
-Jsample_variables=shelly_power_watts,shelly_voltage_volts,shelly_current_amps,shelly_energy_wh
```
Use the runner for experiment timing, summaries and completeness checks. A new
power-monitoring-only check can be run without application requests:
```bash
python3 tools/energy-jmeter/verify-shelly.py --host 192.168.1.44 --output tools/energy-jmeter/results/shelly-check-new
```
[Shelly switch status and energy units](https://shelly-api-docs.shelly.cloud/gen2/ComponentsAndServices/Switch/).
## 1. Prepare distinct test accounts (outside measurement)
The installer initially supplies only one ordinary patient account. Use distinct
accounts for realistic many-patient runs. There is no registration API. This setup
uses the existing external gateway-account configuration and password hash tool.
It changes no application code or service boundaries.
The hash tool has already been built on this computer. To rebuild it:
```bash
dotnet publish tools/PasswordHash -c Release --self-contained false -p:UseAppHost=false -o tools/energy-jmeter/hash-tool
```
From the repository root, copy the supporting tools to the server:
```bash
scp -r tools/energy-jmeter steffen@192.168.1.125:~/healthapp-energy
```
On **testserver**, generate 100 additional synthetic accounts, preserve the old
configuration, and explicitly install the generated copy:
```bash
sudo python3 ~/healthapp-energy/create-accounts.py --gateway-env /etc/healthapp/api-gateway/service.env --output /var/lib/healthapp-energy-fixture --count 100 --dotnet /usr/bin/dotnet
sudo cp -a /etc/healthapp/api-gateway/service.env /etc/healthapp/api-gateway/service.env.before-energy
sudo install -m 600 /var/lib/healthapp-energy-fixture/gateway.env /etc/healthapp/api-gateway/service.env
sudo systemctl restart healthapp-api-gateway
sudo install -m 600 -o "$USER" -g "$(id -gn)" /var/lib/healthapp-energy-fixture/accounts.json "$HOME/energy-accounts.json"
sudo install -m 644 /var/lib/healthapp-installation/deployment/healthapp-ca.crt "$HOME/healthapp-ca.crt"
```
Keep these generated accounts/configuration private. Existing installer accounts
are retained. The generator refuses to overwrite an existing output or regenerate
an already-configured energy-account set. Review generated configuration before
installing it. Do not run this on clinical data.
Back on **this development computer**, from the repository root:
```bash
mkdir -p tools/energy-jmeter/.private
chmod 700 tools/energy-jmeter/.private
scp steffen@192.168.1.125:~/energy-accounts.json tools/energy-jmeter/.private/accounts.json
scp steffen@192.168.1.125:~/healthapp-ca.crt tools/energy-jmeter/.private/healthapp-ca.crt
chmod 600 tools/energy-jmeter/.private/accounts.json
python3 tools/energy-jmeter/prepare.py --base-url https://192.168.1.125:5443 --ca tools/energy-jmeter/.private/healthapp-ca.crt --accounts tools/energy-jmeter/.private/accounts.json --output tools/energy-jmeter/.private/dataset --days 30
```
This creates/reuses each account's profile and seeds 60 historical synthetic readings
per patient, including home/resting, clinic, after-activity and unknown contexts.
Preparation verifies TLS certificates/hostnames and happens outside the
measurement window. For repeat comparisons, restore the same synthetic database
snapshot and reuse the same account configuration; recording grows history over time.
Seeding alone does not reset workload-created records. Use a new preparation output
folder if reseeding against a restored database.
For an immediate read-only trial with the existing prototype account, export the
installer's `accounts.json` privately instead of creating accounts. Prepare it with
`prepare.py`, then explicitly use `--allow-shared-read-account` with `review`.
That measures concurrent sessions sharing one patient, not a many-patient population.
The reserved `installation-check` account is excluded from preparation.
Professional tests require preconfigured professional accounts and assignments
(see [authentication documentation](../../src/AUTHENTICATION.md)). Create a separate
private CSV with `account_id,password,patient_id`, one assigned target per professional.
The runner verifies role/assignments. The default unassigned professional will fail
preflight instead of silently benchmarking rejected requests.
## 2. Find a suitable concurrency before the four-hour run
For the 8 GB, 8th/9th-generation Intel NUC, try 10, 25, 50 and 100 users in short
capacity runs. Generate more accounts before trying 200. Age/RAM do not establish
capacity. Review CPU, RAM, thermal throttling, error rate and latency on the NUC.
Choose your acceptable latency before deciding which level to measure for four hours.
For example, this trial lasts 2 minutes of warmup plus 5 measured minutes:
```bash
python3 tools/energy-jmeter/run.py mixed --host 192.168.1.125 --ca tools/energy-jmeter/.private/healthapp-ca.crt --users-file tools/energy-jmeter/.private/dataset/users.csv --users 50 --warmup 120 --duration 300 --output tools/energy-jmeter/results/capacity-50
```
A short check identifies obvious overload; it does not establish thermal stability
or long-run capacity. Output directories must be new. Failed users are not silently
replaced. Do not use a partial/failed run as a successful four-hour measurement.
## 3. Run a full experiment
Ensure the NUC is powered through the Shelly plug at **192.168.1.44**, then run:
```bash
python3 tools/energy-jmeter/run.py mixed --host 192.168.1.125 --ca tools/energy-jmeter/.private/healthapp-ca.crt --users-file tools/energy-jmeter/.private/dataset/users.csv --users 100 --warmup 1800 --duration 14400 --output tools/energy-jmeter/results/mixed-100-run1
```
Substitute another scenario or concurrency as needed. `--warmup 600` or `1200`
selects 10/20 minutes; the four measured hours remain unchanged. Choose a warmup
that reaches stable server temperature/power rather than assuming a universal value.
`--seed 42`, `--think-min-ms`, `--think-mean-ms`, `--think-stddev-ms`, `--session-pause-ms` and
`--session-stddev-ms` control timing. Include these identically across comparisons.
Use the same-duration `idle` run to establish baseline power:
```bash
bash tools/energy-jmeter/run-idle.sh
```
The idle runner sends zero application requests, including during startup. No CA, credentials or dataset is needed. JMeter collects only PerfMon host metrics and Shelly power readings.
The application services/PostgreSQL stay running as they are. The runner does not start, stop or restart them. Keep the PerfMon agent running. The one-command launcher creates a timestamped result folder under `results/idle-*`. The load generator and HTML-report
creation stay on this computer, outside the NUC's energy measurement. Keep server
power settings, dataset, service versions, logging and other workloads consistent.
Record those settings, thermal state, meter sampling interval and clock synchronisation.
Repeat runs and vary their order to check drift. Only a brief monitoring-only JMeter check has been run against the NUC; no application load has been sent by Codex.
## 4. Read results and energy
`run.json` contains measurement boundaries, request/error counts, request rate,
p95 latency, random seed, timings and plan hash. JMeter CSV excludes response bodies,
request headers and passwords. The private runtime credential CSV is deleted at exit;
keep the whole result directory private and inspect logs before sharing.
JMeter now collects the Shelly readings live and the runner calculates measured-window energy automatically. For another external meter, export its readings as
CSV with `timestamp,power_watts` (timezone-qualified ISO timestamps, increasing,
covering the full interval), then integrate only the measured four hours:
```bash
python3 tools/energy-jmeter/energy.py tools/energy-jmeter/results/mixed-100-run1/run.json power.csv
```
The tool interpolates interval edges and integrates watts using trapezoids. It reports
joules, kWh, mean watts and joules per HTTP request. `--idle-watts VALUE` additionally
reports energy above the measured idle mean. A request is not a user session;
compare scenario/mix and achieved throughput when interpreting efficiency.
Raw meter data must be preserved; missing intervals cannot be repaired by JMeter. The same rule applies to Shelly polls.
JMeter's stock HTTPS client trusts test certificates. The Python runner verifies the
provided CA and hostname during preflight; JMeter traffic itself remains encrypted
but does not provide certificate validation. Do not describe this as a TLS security test.
## Verification
```bash
python3 tools/energy-jmeter/generate-plans.py
python3 tools/energy-jmeter/verify-plans.py
python3 tools/energy-jmeter/verify-perfmon.py
python3 tools/energy-jmeter/verify-shelly.py
python3 tools/energy-jmeter/verify-idle.py
```
The validation script exercises every plan against an isolated local HTTPS contract
stub, including dynamic IDs, token renewal, status/semantic assertions, deletion and
warmup exclusion. It does not prove capacity or replace the application's acceptance
suite. The real-server short capacity trial is required before a four-hour measurement.
References: [Apache release](https://jmeter.apache.org/download_jmeter.cgi),
[CLI load testing](https://jmeter.apache.org/usermanual/get-started.html),
[JMeter components](https://jmeter.apache.org/usermanual/component_reference.html).
For a short live monitoring-only check (no patient requests):
```bash
python3 tools/energy-jmeter/verify-perfmon.py --host 192.168.1.125 --output tools/energy-jmeter/results/perfmon-check-new
```
This verifies that JMeter saves readings while it is still running, then checks
metric coverage and decoding. A monitoring-only check succeeded against the NUC;
comparison with independent Linux readings is still needed to validate accuracy.
## Time-aligned graphs and one-second request reporting
Every finished run generates `report.html` (interactive), `report.png`, `report.svg`
and `per-second.csv`. The plotting dependency is Matplotlib, already installed on
this computer. If setting up another load generator, install Matplotlib there.
All panels share UTC timestamps and experiment-relative one-second intervals,
starting at the recorded warmup start. Warmup is shaded; measurement begins after
the exact configured warmup duration.
CPU, RAM, power, disk and network values are averaged only when multiple samples
fall into a second; missing readings stay blank and create graph gaps. Application
requests and failed requests are counted individually per second. Mean/p95/max
latency is grouped by request start time, with p95 using the nearest-rank definition.
Requests spanning the measurement end are excluded from measured application figures,
matching `run.json`. Meter requests and internal timing samples never count as
application traffic. Seconds without requests have zero request/error counts and
no response-time value. The graph keeps every one-second bin; a wide full-run view
can visually compress points. Use the interactive range controls to inspect seconds.
For a running experiment, generate a snapshot or keep refreshing its artifacts:
```bash
python3 tools/energy-jmeter/report.py tools/energy-jmeter/results/RUN_FOLDER
python3 tools/energy-jmeter/report.py tools/energy-jmeter/results/RUN_FOLDER --follow
```
`--follow` refreshes artifacts every minute, using one-second data, and generates the
final report when the run finishes. Open `report.html` locally and use **Refresh
snapshot** to load new data. It provides a shared cursor across panels and a measured-
window selection. The latest seconds of a running snapshot are provisional because
JMeter writes request samples after their responses arrive. Missing future seconds
are not plotted as zeros. Report creation runs on the load generator.
Verify aggregation with `python3 tools/energy-jmeter/verify-report.py`.
For intentionally heavy shared-data capacity trials, use `review`,
`--allow-shared-read-account`, `--capacity-trial` and the desired thread count.
`--capacity-trial` restarts a read-only session after failures to maintain the trial
duration. Errors are still recorded and the run is marked unsuccessful if any occur;
the graphs remain useful for finding capacity. This mode permits no write scenarios.
First-use certificate pinning, when used instead of the installation CA, trusts the
certificate presented on that first connection; it is not an independently verified CA.
The rationale and figures for the selected 26-thread loaded experiment are in [WORKLOAD-SELECTION.md](WORKLOAD-SELECTION.md).
+180
View File
@@ -0,0 +1,180 @@
# Why the loaded measurement uses 26 threads
**Decision, 9 October 2026:** use **26 JMeter threads** for the main loaded energy
experiment, with **30 minutes of warmup followed by four measured hours**. Collect
CPU, memory, power and request results at one-second resolution. This is the chosen
protocol; the four-hour loaded run has not yet been performed.
The aim is to produce substantial application load while preserving headroom for
background activity. The response-time knee informs the choice, but the main
experiment deliberately operates below its steep-rise region.
## Measurements used for the decision
Calibration used the same read-only review workflow and one shared patient dataset.
Each thread repeatedly retrieved profile, latest observation, filtered history,
insights, trends and overview, with an initial login and renewal if required.
Account provisioning and synthetic data preparation were separate from measurement.
This is concurrent use of one shared dataset, not 26 independently provisioned patients.
All comparable trials used:
- One-minute ramp/warmup followed by ten measured minutes.
- Gaussian request pauses with a **500 ms minimum**, **1,000 ms expected mean** and
**1,500 ms maximum**. The parent Gaussian standard deviation is 250 ms; symmetric
truncation preserves the expected mean and changes the resulting standard deviation.
- No additional pause between review sessions; this represents sustained active use.
- The same dataset, application deployment, workflow, seed and one-second monitoring.
- Sequential runs to prevent workload overlap. Mean response times exclude think time.
The initial trials with 100 ms mean pauses are excluded from the comparable curve.
The incomplete 80-thread trial is also excluded. The latest identical-pacing
30-thread repeat is used; it closely reproduced the earlier 30-thread result.
All 19 selected calibration points completed with zero failed requests and valid
monitoring. This does not establish the same behaviour for different patients,
data volumes, workflow mixes or deployment arrangements.
| Threads | Mean response | Requests/s | Mean CPU | Mean power |
|---:|---:|---:|---:|---:|
| 25 | 128 ms | 22.15 | 78.16% | 8.76 W |
| **26 — selected** | **139 ms** | **22.81** | **80.60%** | **8.90 W** |
| 27 | 148 ms | 23.52 | 82.96% | 9.04 W |
| 30 | 183 ms | 25.34 | 89.00% | 9.34 W |
| 35 | 280 ms | 27.32 | 95.65% | 9.65 W |
| 40 | 425 ms | 28.05 | 98.25% | 9.75 W |
| 50 | 785 ms | 27.95 | 98.72% | 9.81 W |
Full measured points: [calibration.csv](evidence/26-thread-choice/calibration.csv).
## Response-time knee
![Mean response time against thread count and measured CPU utilisation](evidence/26-thread-choice/mean-response-knee.png)
The curve steepens as utilisation approaches saturation. From 35 to 40 threads,
mean response time rises from 280 to 425 ms, while throughput grows only about 2.7%.
At 50 threads, response time rises further without increased throughput.
We adopted **35 threads as a practical knee marker**, based on the response-time
curve and a mean response time of approximately 280 ms being barely acceptable
for this experiment. The finer 26–39-thread trials support a gradual bend followed
by a steep-rise region, rather than a uniquely established abrupt threshold.
The figures use **mean response time only**. P95 remains in the original results
but is not mixed into this particular queueing comparison.
The simplified queueing model used to interpret the shape is:
\[
R = W + S,\qquad W = \frac{SU}{1-U},\qquad R = \frac{S}{1-U}.
\]
Here, `R` is mean response time, `W` waiting time, `S` service time and `U`
utilisation expressed as a fraction. Near saturation, a small increase in `U`
produces a disproportionately large increase in `R`.
This model motivates preserving headroom. The plots show **measured points**,
not a fitted theoretical curve: service time was not measured separately, and
whole-machine CPU utilisation is being used as a practical utilisation proxy.
The model does not prove a precise knee or distinguish the application's individual
queues and resources.
## Background activity and the headroom rule
![CPU during the four-hour idle baseline](evidence/26-thread-choice/idle-cpu-spikes.png)
The four-hour idle baseline made **zero application requests**, with services and
monitoring running. It recorded 14,395 CPU samples at nominal one-second intervals:
mean utilisation **0.505%**, maximum **11.055%**, seven samples at least 5% and one
sample at least 10%. These include monitoring overhead and other background work;
we did not collect process-level attribution.
Loaded trials had application requests in every measured second. Consequently,
those traces cannot isolate request-free background spikes or establish which
process caused a particular loaded-run peak.
The agreed conservative planning rule reserves the observed idle maximum as
**11.055 percentage points** against a chosen **95% CPU reference**:
\[
U_{\text{planning ceiling}} = 95\% - 11.055\text{ percentage points}
= 83.945\%.
\]
![Average CPU utilisation and the chosen headroom budget](evidence/26-thread-choice/cpu-headroom.png)
At 26 threads, average CPU is **80.603%**, leaving approximately **14.397 percentage
points** below the 95% reference: about **3.342 points beyond the reserved budget**.
At 27 threads, the average still meets the planning ceiling, but leaves only about
0.983 points beyond that budget. At 28 threads, average CPU is already above it.
We therefore chose **26 rather than 27 threads** for additional margin, and 26
rather than 25 to retain slightly more application load. It is also close to the
original approximately 80% utilisation objective. The measured mean response time
was 139 ms with zero failed requests.
The idle maximum is **not** a proven incremental disturbance that can simply be
added to loaded CPU, and it is not a guaranteed future maximum. Reserving its full
observed value is a planning assumption. The 95% reference is likewise our operating
criterion, not a demonstrated universal performance boundary.
## What the choice does not guarantee
![One-second CPU trace for the selected 26-thread calibration](evidence/26-thread-choice/selected-cpu-trace.png)
An average below the planning ceiling does not keep every second below it. The
26-thread trial reached **98.994% CPU**, with **25 of 600 samples at least 95%**
(4.17%) and seven at least 98% (1.17%). Those transient peaks caused no recorded
request errors in this ten-minute trial, but they show that saturation remains
possible. The choice reduces exposure; it does not guarantee its elimination.
Calibration contains one trial at most thread counts and only one matching repeat
at 30. Run order was generally ascending and was not randomised; thermal/background
drift and measurement variation have not been fully separated. Four-hour stability
must be assessed in the actual long run, and repeat measurements are needed to
quantify variability. CPU measurements are PerfMon/SIGAR readings and have not been
independently validated against Linux counters.
## Main loaded measurement protocol
Use the **same shared-data read-only review scenario**, with:
| Setting | Value |
|---|---|
| Concurrent threads | **26** |
| Ramp | 60 seconds, inside warmup |
| Warmup excluded from analysis | **1,800 seconds** |
| Measured duration | **14,400 seconds** |
| Request pauses | Gaussian, 500–1,500 ms, expected mean 1,000 ms |
| Between-session pause | None |
| CPU and Shelly polling | **1,000 ms** |
| Error handling | Record failures; begin the next read-only session |
Keep application configuration, dataset, monitoring, power settings and other
activity consistent across comparisons. Preserve raw measurements. Inspect
per-second CPU/latency/error traces rather than relying only on run averages.
The Shelly measures the connected equipment, including adapter losses; power-meter
accuracy has not been independently calibrated. Treat its cumulative counter delta
as a separate cross-check to integration of sampled watts.
See the [execution guide](README.md) for run commands and reporting. The experiment
runs from the development computer, using application and monitoring APIs, without
SSH or administrative changes to the NUC.
## Evidence and reproducibility
The evidence accompanying this document contains no passwords or tokens:
- [Calibration points](evidence/26-thread-choice/calibration.csv).
- [Idle CPU trace](evidence/26-thread-choice/idle-cpu.csv).
- [Selected workload CPU trace](evidence/26-thread-choice/selected-cpu.csv).
- [Calculated evidence summary and source run names](evidence/26-thread-choice/evidence-summary.json).
- PNG figures above and same-stem SVG files for export.
The original complete results remain under `tools/energy-jmeter/results/`, which
is Git-ignored. Regenerate this evidence from those files with:
```bash
python3 tools/energy-jmeter/document-choice.py
```
No architecture, service behaviour or authoritative requirements were changed by
this experiment decision.
+29
View File
@@ -0,0 +1,29 @@
#!/usr/bin/env python3
"""Generate additional synthetic accounts in a COPY of gateway configuration."""
import argparse, json, os, re, secrets, subprocess
from pathlib import Path
p=argparse.ArgumentParser()
p.add_argument('--gateway-env',required=True);p.add_argument('--output',required=True)
p.add_argument('--count',type=int,default=100);p.add_argument('--dotnet',default='dotnet')
p.add_argument('--hash-tool',default=str(Path(__file__).parent/'hash-tool/PasswordHash.dll'))
a=p.parse_args()
if not 1<=a.count<=10000: p.error('count must be 1..10000')
text=Path(a.gateway_env).read_text()
if 'energy-patient-' in text: p.error('Energy accounts already exist; reuse their credentials rather than overwrite')
indexes=[int(x) for x in re.findall(r'^Authentication__Accounts__(\d+)__AccountId=',text,re.M)]
if not indexes: p.error('No installer-created authentication accounts found')
out=Path(a.output);out.mkdir(mode=0o700,parents=True,exist_ok=False)
accounts=[]; lines=[]
for i in range(a.count):
account={'AccountId':f'energy-patient-{i+1:04d}','Role':'Patient','Password':secrets.token_hex(24)}
result=subprocess.run([a.dotnet,a.hash_tool],input=account['Password']+'\n',text=True,capture_output=True,check=True)
hashed=result.stdout.strip()
if not hashed or '\n' in hashed: raise RuntimeError('Password hash tool returned unexpected output')
index=max(indexes)+1+i
for key,value in [('AccountId',account['AccountId']),('Role','Patient'),('PasswordHash',hashed)]:
lines.append(f'Authentication__Accounts__{index}__{key}='+json.dumps(value))
accounts.append(account)
for name,value in [('gateway.env',text.rstrip()+'\n'+'\n'.join(lines)+'\n'),('accounts.json',json.dumps(accounts,indent=2))]:
path=out/name;path.write_text(value);os.chmod(path,0o600)
print(f'Generated {a.count} synthetic accounts. Original gateway configuration was not changed.')
print('Review and install',out/'gateway.env','then restart the gateway. Keep accounts.json private.')
+64
View File
@@ -0,0 +1,64 @@
#!/usr/bin/env python3
"""Export nonsecret measured evidence and figures supporting the 26-thread choice."""
from pathlib import Path
import argparse,csv,json,statistics,os,datetime as dt
HERE=Path(__file__).resolve().parent
p=argparse.ArgumentParser();p.add_argument('--results',type=Path,default=HERE/'results');p.add_argument('--output',type=Path,default=HERE/'evidence/26-thread-choice');a=p.parse_args()
a.output.mkdir(parents=True,exist_ok=True);os.environ.setdefault('MPLCONFIGDIR',str(a.results/'.figure-cache'))
import matplotlib
matplotlib.use('Agg')
import matplotlib.pyplot as plt
import matplotlib.dates as dates
rows=[]
for n in [15,20,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,50]:
run=2 if n==30 else 1;folder=a.results/f'capacity-shared-{n}-human-delay-run{run}'
m=json.loads((folder/'run.json').read_text())
assert m['exit_code']==0 and m['think_min_ms']==500 and m['think_mean_ms']==1000
with (folder/'measured.csv').open() as f:samples=list(csv.DictReader(f))
rows.append({'threads':n,'run':folder.name,'cpu_percent':m['server_metrics']['192.168.1.125 CPU combined']['mean'],'mean_response_ms':statistics.mean(int(r['elapsed']) for r in samples),'requests_per_second':m['measured_http_requests_per_second'],'power_watts':m['power_energy']['average_watts'],'failed_requests':m['measured_failed_http_samples']})
with (a.output/'calibration.csv').open('w') as f:w=csv.DictWriter(f,fieldnames=list(rows[0]),lineterminator='\n');w.writeheader();w.writerows(rows)
def cpu_trace(name,filename):
folder=a.results/name;m=json.loads((folder/'run.json').read_text())
with (folder/'perfmon.csv').open() as f:trace=[{'timestamp_ms':int(r['timeStamp']),'cpu_percent':float(r['elapsed'])/1000} for r in csv.DictReader(f) if r['label'].endswith(' CPU combined') and r['success']=='true' and m['measurement_start_ms']<=int(r['timeStamp'])<m['measurement_end_ms']]
with (a.output/filename).open('w') as f:w=csv.DictWriter(f,fieldnames=['timestamp_ms','cpu_percent'],lineterminator='\n');w.writeheader();w.writerows(trace)
return m,trace
idle,idle_trace=cpu_trace('idle-20261008T104130Z','idle-cpu.csv')
selected,selected_trace=cpu_trace('capacity-shared-26-human-delay-run1','selected-cpu.csv')
reserve=max(p['cpu_percent'] for p in idle_trace);ceiling=95-reserve
summary={'idle_run':'idle-20261008T104130Z','selected_run':'capacity-shared-26-human-delay-run1','observed_idle_peak_percent':reserve,'assumed_reserve_percentage_points':reserve,'planning_ceiling_percent':ceiling,'selected_cpu_mean_percent':selected['server_metrics']['192.168.1.125 CPU combined']['mean'],'selected_cpu_peak_percent':max(p['cpu_percent'] for p in selected_trace),'selected_samples':len(selected_trace),'selected_samples_ge95':sum(p['cpu_percent']>=95 for p in selected_trace),'selected_samples_ge98':sum(p['cpu_percent']>=98 for p in selected_trace),'idle_samples':len(idle_trace),'idle_samples_ge5':sum(p['cpu_percent']>=5 for p in idle_trace),'idle_samples_ge10':sum(p['cpu_percent']>=10 for p in idle_trace),'idle_power_watts':idle['power_energy']['average_watts'],'selected_power_watts':selected['power_energy']['average_watts'],'long_run_protocol':{'threads':26,'warmup_seconds':1800,'measurement_seconds':14400,'sampling_interval_ms':1000,'think_min_ms':500,'think_mean_ms':1000,'think_parent_gaussian_sd_ms':250,'think_max_ms':1500,'session_pause_ms':0},'qualification':'Observed idle peak is a planning reserve, not an independently measured incremental disturbance or guaranteed bound.'}
(a.output/'evidence-summary.json').write_text(json.dumps(summary,indent=2))
def save(fig,name):
fig.savefig(a.output/(name+'.png'),dpi=170);fig.savefig(a.output/(name+'.svg'));plt.close(fig)
svg=a.output/(name+'.svg');svg.write_text('\n'.join(line.rstrip() for line in svg.read_text().splitlines())+'\n')
fig,axes=plt.subplots(1,2,figsize=(13,5),layout='constrained')
for ax,xfield,xlabel in [(axes[0],'threads','Concurrent threads'),(axes[1],'cpu_percent','Mean whole-machine CPU utilisation (%)')]:
ax.plot([r[xfield] for r in rows],[r['mean_response_ms'] for r in rows],'o-',markersize=4,label='Measured mean response time')
choice=next(r for r in rows if r['threads']==26);ax.scatter([choice[xfield]],[choice['mean_response_ms']],s=110,color='#b34416',zorder=4,label='Selected: 26 threads')
for n in [26,35,40,50]:
r=next(r for r in rows if r['threads']==n);ax.annotate(str(n)+' threads',(r[xfield],r['mean_response_ms']),xytext=(-5,10),textcoords='offset points',ha='right',fontsize=8)
ax.set_xlabel(xlabel);ax.set_ylabel('Mean response time (ms)');ax.set_ylim(bottom=0);ax.grid(alpha=.25);ax.legend(loc='upper left',fontsize=8)
axes[1].set_xlim(45,100)
fig.suptitle('Selected workload is below the observed steep-rise region\nMatched request pacing and shared data; ten-minute calibration trials')
save(fig,'mean-response-knee')
fig,ax=plt.subplots(figsize=(10,5),layout='constrained')
ax.plot([r['threads'] for r in rows],[r['cpu_percent'] for r in rows],'o-',markersize=4,label='Measured mean CPU')
ax.axhline(95,color='#ad3828',linestyle='--',label='95% planning limit')
ax.axhline(ceiling,color='#86671d',linestyle='--',label=f'Planning ceiling: 95 − {reserve:.3f} = {ceiling:.3f}%')
choice=next(r for r in rows if r['threads']==26);ax.scatter([26],[choice['cpu_percent']],s=120,color='#217a52',zorder=4);ax.annotate(f'26 threads: {choice["cpu_percent"]:.1f}%',(26,choice['cpu_percent']),xytext=(-45,-32),textcoords='offset points',arrowprops={'arrowstyle':'->'})
ax.set_xlabel('Concurrent threads');ax.set_ylabel('Mean CPU utilisation (%)');ax.set_ylim(40,102);ax.grid(alpha=.25);ax.legend(loc='lower right',fontsize=8);ax.set_title('Headroom rule applied to average CPU — not a per-second guarantee')
save(fig,'cpu-headroom')
fig,ax=plt.subplots(figsize=(12,4),layout='constrained')
x=[dt.datetime.fromtimestamp(r['timestamp_ms']/1000,dt.timezone.utc) for r in idle_trace]
ax.plot(x,[r['cpu_percent'] for r in idle_trace],linewidth=.7)
peak=max(idle_trace,key=lambda r:r['cpu_percent']);instant=dt.datetime.fromtimestamp(peak['timestamp_ms']/1000,dt.timezone.utc)
ax.annotate(f'Observed maximum: {reserve:.3f}%',(instant,reserve),xytext=(20,-25),textcoords='offset points',arrowprops={'arrowstyle':'->'})
ax.xaxis.set_major_formatter(dates.DateFormatter('%H:%M',tz=dt.timezone.utc));ax.set_xlabel('UTC time on 2026-10-08');ax.set_ylabel('CPU utilisation (%)');ax.set_ylim(0,13);ax.grid(alpha=.25);ax.set_title('Four-hour idle baseline: zero application requests; monitoring active')
save(fig,'idle-cpu-spikes')
fig,ax=plt.subplots(figsize=(12,4),layout='constrained')
x=[(r['timestamp_ms']-selected['measurement_start_ms'])/1000 for r in selected_trace]
ax.plot(x,[r['cpu_percent'] for r in selected_trace],linewidth=.8,label='One-second CPU readings')
ax.axhline(choice['cpu_percent'],color='#217a52',label=f'Mean: {choice["cpu_percent"]:.1f}%')
ax.axhline(95,color='#ad3828',linestyle='--',label='95% reference')
ax.set_xlabel('Seconds into the ten-minute measured window');ax.set_ylabel('CPU utilisation (%)');ax.set_ylim(40,102);ax.grid(alpha=.25);ax.legend(loc='lower right',fontsize=8);ax.set_title('26 threads: transient saturation remains possible (25 / 600 samples ≥95%)')
save(fig,'selected-cpu-trace')
print('Exported four figures, calibration table, CPU traces and evidence summary:',a.output)
+26
View File
@@ -0,0 +1,26 @@
#!/usr/bin/env python3
"""Sum timestamped external power readings at the nominal polling interval."""
import argparse, csv, datetime as dt, json
from pathlib import Path
p=argparse.ArgumentParser();p.add_argument('run');p.add_argument('power_csv');p.add_argument('--idle-watts',type=float);p.add_argument('--interval-seconds',type=float,default=1);a=p.parse_args()
run=json.loads(Path(a.run).read_text());start=run['measurement_start_ms']/1000;end=run['measurement_end_ms']/1000
points=[]
with open(a.power_csv) as f:
for r in csv.DictReader(f):
instant=dt.datetime.fromisoformat(r['timestamp'].replace('Z','+00:00'))
if instant.tzinfo is None: p.error('Power timestamps require a timezone')
watts=float(r['power_watts'])
if not 0<=watts<float('inf'):p.error('Power must be finite and nonnegative')
points.append((instant.timestamp(),watts))
if len(points)<2 or any(b[0]<=a[0] for a,b in zip(points,points[1:])):p.error('Power timestamps must be strictly increasing')
if points[0][0]>start or points[-1][0]<end:p.error('Power samples must cover the entire measurement interval')
if a.interval_seconds<=0:p.error('Interval must be positive')
measured=[power for timestamp,power in points if start<=timestamp<end]
if not measured:p.error('No power readings in measurement window')
coverage=len(measured)*a.interval_seconds
joules=sum(measured)*a.interval_seconds
result={'duration_seconds':end-start,'power_sample_count':len(measured),'nominal_sample_coverage_seconds':coverage,'method':'sum of recorded power readings multiplied by nominal interval','joules':joules,'kWh':joules/3600000,'average_watts':sum(measured)/len(measured)}
if a.idle_watts is not None:result['joules_above_idle']=joules-a.idle_watts*coverage
count=run.get('measured_http_samples',0)
if count:result['joules_per_http_request']=joules/count
print(json.dumps(result,indent=2))
@@ -0,0 +1,20 @@
threads,run,cpu_percent,mean_response_ms,requests_per_second,power_watts,failed_requests
15,capacity-shared-15-human-delay-run1,50.895801666666664,79.34052499101043,13.905,7.311085382211325,0
20,capacity-shared-20-human-delay-run1,65.083935,98.86954928545255,18.19333333333333,8.0890766215625,0
25,capacity-shared-25-human-delay-run1,78.16213333333333,128.36280189601987,22.151666666666667,8.764036898464678,0
26,capacity-shared-26-human-delay-run1,80.60345333333333,139.38706613080015,22.808333333333334,8.899511694113961,0
27,capacity-shared-27-human-delay-run1,82.96233333333333,148.47303139839818,23.515,9.036443046141601,0
28,capacity-shared-28-human-delay-run1,85.14292333333333,161.7337208497682,24.085,9.17391177691059,0
29,capacity-shared-29-human-delay-run1,87.06948666666668,173.3995543250726,24.68166666666667,9.21969683437396,0
30,capacity-shared-30-human-delay-run2,88.99881333333333,182.9120626151013,25.34,9.337538094281125,0
31,capacity-shared-31-human-delay-run1,90.41707833333334,205.14021541655853,25.686666666666667,9.406692395193705,0
32,capacity-shared-32-human-delay-run1,92.08799333333333,218.39473851432928,26.22833333333333,9.47666378438836,0
33,capacity-shared-33-human-delay-run1,93.45843666666666,237.0786376158277,26.62,9.510238336982816,0
34,capacity-shared-34-human-delay-run1,94.94577166666667,253.21672816728167,27.1,9.625515573054285,0
35,capacity-shared-35-human-delay-run1,95.64982,279.99633900787114,27.315,9.653541583333334,0
36,capacity-shared-36-human-delay-run1,96.68018166666666,308.8980768064066,27.471666666666668,9.700332333333334,0
37,capacity-shared-37-human-delay-run1,97.42113666666667,338.35063367531683,27.616666666666667,9.73826068038247,0
38,capacity-shared-38-human-delay-run1,97.793315,381.2771442436006,27.476666666666667,9.750565151409038,0
39,capacity-shared-39-human-delay-run1,98.11210833333334,415.07466844304486,27.52166666666667,9.74681905188326,0
40,capacity-shared-40-human-delay-run1,98.25498333333333,424.66961792144514,28.048333333333332,9.748927936868148,0
50,capacity-shared-50-human-delay-run1,98.71679666666667,784.9196039840162,27.945,9.807314705581957,0
1 threads run cpu_percent mean_response_ms requests_per_second power_watts failed_requests
2 15 capacity-shared-15-human-delay-run1 50.895801666666664 79.34052499101043 13.905 7.311085382211325 0
3 20 capacity-shared-20-human-delay-run1 65.083935 98.86954928545255 18.19333333333333 8.0890766215625 0
4 25 capacity-shared-25-human-delay-run1 78.16213333333333 128.36280189601987 22.151666666666667 8.764036898464678 0
5 26 capacity-shared-26-human-delay-run1 80.60345333333333 139.38706613080015 22.808333333333334 8.899511694113961 0
6 27 capacity-shared-27-human-delay-run1 82.96233333333333 148.47303139839818 23.515 9.036443046141601 0
7 28 capacity-shared-28-human-delay-run1 85.14292333333333 161.7337208497682 24.085 9.17391177691059 0
8 29 capacity-shared-29-human-delay-run1 87.06948666666668 173.3995543250726 24.68166666666667 9.21969683437396 0
9 30 capacity-shared-30-human-delay-run2 88.99881333333333 182.9120626151013 25.34 9.337538094281125 0
10 31 capacity-shared-31-human-delay-run1 90.41707833333334 205.14021541655853 25.686666666666667 9.406692395193705 0
11 32 capacity-shared-32-human-delay-run1 92.08799333333333 218.39473851432928 26.22833333333333 9.47666378438836 0
12 33 capacity-shared-33-human-delay-run1 93.45843666666666 237.0786376158277 26.62 9.510238336982816 0
13 34 capacity-shared-34-human-delay-run1 94.94577166666667 253.21672816728167 27.1 9.625515573054285 0
14 35 capacity-shared-35-human-delay-run1 95.64982 279.99633900787114 27.315 9.653541583333334 0
15 36 capacity-shared-36-human-delay-run1 96.68018166666666 308.8980768064066 27.471666666666668 9.700332333333334 0
16 37 capacity-shared-37-human-delay-run1 97.42113666666667 338.35063367531683 27.616666666666667 9.73826068038247 0
17 38 capacity-shared-38-human-delay-run1 97.793315 381.2771442436006 27.476666666666667 9.750565151409038 0
18 39 capacity-shared-39-human-delay-run1 98.11210833333334 415.07466844304486 27.52166666666667 9.74681905188326 0
19 40 capacity-shared-40-human-delay-run1 98.25498333333333 424.66961792144514 28.048333333333332 9.748927936868148 0
20 50 capacity-shared-50-human-delay-run1 98.71679666666667 784.9196039840162 27.945 9.807314705581957 0
Binary file not shown.

After

Width:  |  Height:  |  Size: 91 KiB

File diff suppressed because it is too large. Load diff

After

Width:  |  Height:  |  Size: 49 KiB

@@ -0,0 +1,29 @@
{
"idle_run": "idle-20261008T104130Z",
"selected_run": "capacity-shared-26-human-delay-run1",
"observed_idle_peak_percent": 11.055,
"assumed_reserve_percentage_points": 11.055,
"planning_ceiling_percent": 83.945,
"selected_cpu_mean_percent": 80.60345333333333,
"selected_cpu_peak_percent": 98.994,
"selected_samples": 600,
"selected_samples_ge95": 25,
"selected_samples_ge98": 7,
"idle_samples": 14395,
"idle_samples_ge5": 7,
"idle_samples_ge10": 1,
"idle_power_watts": 4.450219402777778,
"selected_power_watts": 8.899511694113961,
"long_run_protocol": {
"threads": 26,
"warmup_seconds": 1800,
"measurement_seconds": 14400,
"sampling_interval_ms": 1000,
"think_min_ms": 500,
"think_mean_ms": 1000,
"think_parent_gaussian_sd_ms": 250,
"think_max_ms": 1500,
"session_pause_ms": 0
},
"qualification": "Observed idle peak is a planning reserve, not an independently measured incremental disturbance or guaranteed bound."
}
Binary file not shown.

After

Width:  |  Height:  |  Size: 74 KiB

File diff suppressed because it is too large. Load diff

After

Width:  |  Height:  |  Size: 278 KiB

File diff suppressed because it is too large. Load diff
Binary file not shown.

After

Width:  |  Height:  |  Size: 154 KiB

File diff suppressed because it is too large. Load diff

After

Width:  |  Height:  |  Size: 82 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 259 KiB

File diff suppressed because it is too large. Load diff

After

Width:  |  Height:  |  Size: 58 KiB

@@ -0,0 +1,601 @@
timestamp_ms,cpu_percent
1791502598833,72.222
1791502599833,90.909
1791502600833,86.934
1791502601834,76.02
1791502602834,61.224
1791502603834,76.5
1791502604834,92.893
1791502605834,83.838
1791502606835,76.53
1791502607835,90.954
1791502608835,73.604
1791502609835,72.081
1791502610836,79.797
1791502611836,90.862
1791502612836,74.747
1791502613836,77.435
1791502614837,96.482
1791502615837,77.777
1791502616837,81.313
1791502617838,86.5
1791502618838,83.838
1791502619838,74.242
1791502620838,72.959
1791502621838,84.924
1791502622839,76.884
1791502623839,89.847
1791502624839,73.096
1791502625839,83.919
1791502626840,73.846
1791502627840,84.848
1791502628840,81.313
1791502629840,85.929
1791502630841,79.081
1791502631841,76.142
1791502632841,84.422
1791502633841,64.974
1791502634842,92.385
1791502635842,83.333
1791502636842,82.323
1791502637842,73.096
1791502638843,85.858
1791502639843,76.923
1791502640843,82.323
1791502641843,85.279
1791502642843,84.343
1791502643844,90.862
1791502644844,71.938
1791502645844,80.904
1791502646844,72.588
1791502647845,77.272
1791502648845,88.888
1791502649845,80.303
1791502650845,84.343
1791502651846,73.604
1791502652846,83.756
1791502653846,68.205
1791502654846,79.695
1791502655846,89.949
1791502656847,78.68
1791502657847,86.363
1791502658847,78.68
1791502659847,72.588
1791502660847,82.142
1791502661848,81.818
1791502662848,81.218
1791502663848,82.323
1791502664848,86.934
1791502665849,68.367
1791502666849,72.864
1791502667849,87.878
1791502668849,85.929
1791502669849,95.959
1791502670850,89.795
1791502671850,84.343
1791502672850,75.757
1791502673850,69.035
1791502674850,76.142
1791502675851,87.437
1791502676851,84.848
1791502677851,74.489
1791502678851,98.5
1791502679851,55.329
1791502680851,86.294
1791502681852,66.326
1791502682852,83.919
1791502683852,82.142
1791502684852,74.242
1791502685852,86.363
1791502686853,73.0
1791502687853,80.412
1791502688853,73.0
1791502689853,87.309
1791502690853,85.427
1791502691854,76.767
1791502692854,86.432
1791502693854,79.081
1791502694854,77.272
1791502695855,78.499
1791502696855,72.959
1791502697855,84.924
1791502698855,88.442
1791502699855,81.122
1791502700856,78.68
1791502701856,77.04
1791502702856,77.664
1791502703856,75.634
1791502704856,88.383
1791502705857,72.081
1791502706857,98.507
1791502707857,67.346
1791502708857,76.649
1791502709857,67.525
1791502710858,86.432
1791502711858,91.414
1791502712858,83.838
1791502713858,84.263
1791502714858,80.102
1791502715859,74.0
1791502716859,78.68
1791502717859,82.741
1791502718859,80.71
1791502719859,84.924
1791502720860,84.422
1791502721860,73.604
1791502722860,71.212
1791502723860,87.817
1791502724860,79.899
1791502725861,88.888
1791502726861,76.884
1791502727861,83.756
1791502728861,76.142
1791502729861,85.353
1791502730862,87.755
1791502731862,80.303
1791502732862,77.386
1791502733862,87.878
1791502734863,69.897
1791502735863,88.888
1791502736863,81.218
1791502737863,69.191
1791502738863,85.858
1791502739864,97.0
1791502740864,70.618
1791502741864,67.676
1791502742864,86.432
1791502743864,74.489
1791502744865,74.242
1791502745865,91.919
1791502746865,98.507
1791502747865,58.974
1791502748865,85.572
1791502749866,84.263
1791502750866,71.212
1791502751866,74.747
1791502752866,98.994
1791502753866,75.376
1791502754867,79.797
1791502755867,90.909
1791502756867,75.252
1791502757867,69.035
1791502758867,89.393
1791502759868,80.71
1791502760868,83.582
1791502761868,89.847
1791502762868,82.412
1791502763868,62.244
1791502764869,80.612
1791502765869,79.187
1791502766869,80.0
1791502767869,78.974
1791502768869,87.437
1791502769870,68.527
1791502770870,75.252
1791502771870,87.5
1791502772870,79.695
1791502773870,88.0
1791502774871,78.787
1791502775871,85.858
1791502776871,80.808
1791502777871,72.588
1791502778871,90.954
1791502779872,80.303
1791502780872,84.343
1791502781872,80.102
1791502782872,97.5
1791502783872,65.989
1791502784873,74.747
1791502785873,81.725
1791502786873,89.393
1791502787873,77.272
1791502788873,79.695
1791502789874,90.909
1791502790874,66.497
1791502791874,83.756
1791502792874,84.422
1791502793874,78.974
1791502794875,87.373
1791502795875,77.551
1791502796875,84.0
1791502797875,76.02
1791502798875,74.747
1791502799876,82.323
1791502800876,87.939
1791502801876,78.172
1791502802876,83.582
1791502803876,79.292
1791502804877,79.187
1791502805877,73.737
1791502806877,81.725
1791502807877,85.353
1791502808877,80.102
1791502809877,81.313
1791502810878,87.373
1791502811878,80.5
1791502812878,77.777
1791502813878,74.874
1791502814878,85.786
1791502815879,82.914
1791502816879,88.5
1791502817879,74.619
1791502818879,85.279
1791502819879,73.979
1791502820879,76.649
1791502821880,75.757
1791502822880,87.373
1791502823880,96.0
1791502824880,70.351
1791502825880,73.333
1791502826881,83.417
1791502827881,84.343
1791502828881,74.747
1791502829881,89.34
1791502830881,92.385
1791502831882,83.417
1791502832882,69.035
1791502833882,75.252
1791502834882,86.868
1791502835882,81.909
1791502836882,79.187
1791502837883,75.879
1791502838883,97.487
1791502839883,68.844
1791502840883,70.351
1791502841883,77.948
1791502842884,88.383
1791502843884,96.984
1791502844884,83.756
1791502845884,81.909
1791502846884,78.68
1791502847885,73.096
1791502848885,83.417
1791502849885,86.294
1791502850885,78.894
1791502851885,79.081
1791502852885,89.898
1791502853886,75.634
1791502854886,64.141
1791502855886,95.477
1791502856886,77.272
1791502857886,85.786
1791502858887,82.828
1791502859887,91.457
1791502860887,66.836
1791502861887,85.204
1791502862887,75.124
1791502863887,82.828
1791502864888,80.303
1791502865888,80.904
1791502866888,79.695
1791502867888,77.272
1791502868888,80.5
1791502869889,81.909
1791502870889,81.313
1791502871889,97.474
1791502872889,78.391
1791502873889,64.974
1791502874890,67.857
1791502875890,88.442
1791502876890,78.68
1791502877890,76.142
1791502878890,94.444
1791502879890,79.5
1791502880891,57.142
1791502881891,76.262
1791502882891,83.333
1791502883891,78.0
1791502884891,87.437
1791502885892,82.323
1791502886892,87.373
1791502887892,69.387
1791502888892,76.884
1791502889892,78.172
1791502890892,76.767
1791502891893,90.954
1791502892893,81.313
1791502893893,80.303
1791502894893,75.252
1791502895893,72.588
1791502896894,87.878
1791502897894,89.898
1791502898894,96.446
1791502899894,77.499
1791502900894,81.725
1791502901895,85.858
1791502902895,69.23
1791502903895,84.422
1791502904895,90.954
1791502905895,82.828
1791502906895,82.233
1791502907896,81.218
1791502908896,74.874
1791502909896,71.717
1791502910896,73.604
1791502911896,97.487
1791502912896,82.914
1791502913897,84.343
1791502914897,89.393
1791502915897,67.676
1791502916897,70.918
1791502917897,85.353
1791502918898,81.407
1791502919898,71.794
1791502920898,89.949
1791502921898,84.0
1791502922898,75.126
1791502923899,77.889
1791502924899,81.122
1791502925899,83.919
1791502926899,79.797
1791502927899,89.447
1791502928900,79.695
1791502929900,78.68
1791502930900,73.869
1791502931900,94.472
1791502932900,73.979
1791502933901,85.427
1791502934901,79.396
1791502935901,97.0
1791502936901,60.406
1791502937901,70.707
1791502938901,89.393
1791502939902,77.777
1791502940902,72.727
1791502941902,84.771
1791502942902,84.848
1791502943902,77.889
1791502944902,88.383
1791502945903,79.695
1791502946903,76.767
1791502947903,76.262
1791502948903,91.37
1791502949903,90.954
1791502950904,73.604
1791502951904,74.747
1791502952904,83.248
1791502953904,87.939
1791502954904,76.02
1791502955904,89.898
1791502956905,68.527
1791502957905,87.309
1791502958905,80.303
1791502959905,73.869
1791502960905,92.893
1791502961905,83.673
1791502962906,79.396
1791502963906,81.909
1791502964907,83.5
1791502965907,65.816
1791502966907,79.695
1791502967907,77.272
1791502968907,89.898
1791502969908,72.588
1791502970908,80.808
1791502971908,77.777
1791502972908,79.292
1791502973908,79.292
1791502974908,76.41
1791502975909,74.747
1791502976909,82.412
1791502977909,83.756
1791502978909,76.884
1791502979909,81.122
1791502980910,82.914
1791502981910,72.959
1791502982910,70.707
1791502983910,88.832
1791502984910,70.558
1791502985911,90.355
1791502986911,85.858
1791502987911,70.707
1791502988911,80.808
1791502989911,80.904
1791502990911,84.771
1791502991912,84.422
1791502992912,76.262
1791502993912,81.725
1791502994912,91.919
1791502995912,78.391
1791502996913,72.081
1791502997913,84.343
1791502998913,89.949
1791502999913,68.181
1791503000913,83.248
1791503001913,77.777
1791503002914,79.292
1791503003914,80.102
1791503004914,83.417
1791503005914,76.649
1791503006914,75.252
1791503007915,84.422
1791503008915,76.142
1791503009915,78.894
1791503010915,82.914
1791503011915,73.979
1791503012915,96.984
1791503013916,61.111
1791503014916,77.664
1791503015916,98.484
1791503016916,74.371
1791503017916,73.604
1791503018917,96.969
1791503019917,86.363
1791503020917,69.696
1791503021917,84.263
1791503022917,90.954
1791503023917,71.794
1791503024918,81.0
1791503025918,78.787
1791503026918,79.899
1791503027918,80.102
1791503028918,77.664
1791503029919,79.292
1791503030919,95.0
1791503031919,72.588
1791503032919,78.68
1791503033919,76.649
1791503034919,81.909
1791503035920,84.422
1791503036920,78.172
1791503037920,86.868
1791503038920,83.838
1791503039920,83.163
1791503040920,77.551
1791503041921,73.232
1791503042921,76.41
1791503043921,87.373
1791503044921,88.832
1791503045921,76.884
1791503046922,86.294
1791503047922,62.626
1791503048922,92.424
1791503049922,79.899
1791503050922,73.604
1791503051923,87.939
1791503052923,78.172
1791503053923,72.081
1791503054923,77.664
1791503055923,77.499
1791503056924,85.279
1791503057924,78.282
1791503058924,95.0
1791503059924,63.959
1791503060924,84.924
1791503061924,78.172
1791503062925,74.619
1791503063925,92.893
1791503064925,87.5
1791503065925,83.756
1791503066925,85.858
1791503067926,73.737
1791503068926,77.664
1791503069926,77.272
1791503070926,93.939
1791503071926,83.919
1791503072926,71.573
1791503073927,75.126
1791503074927,84.924
1791503075927,86.802
1791503076927,82.089
1791503077927,85.279
1791503078927,88.888
1791503079928,75.252
1791503080928,91.878
1791503081928,69.696
1791503082928,84.924
1791503083928,80.203
1791503084929,82.741
1791503085929,81.218
1791503086929,81.538
1791503087929,83.838
1791503088929,73.737
1791503089929,90.909
1791503090930,73.096
1791503091930,86.934
1791503092930,83.417
1791503093930,78.061
1791503094930,91.414
1791503095930,67.857
1791503096931,84.577
1791503097931,78.68
1791503098931,73.737
1791503099931,95.959
1791503100931,87.562
1791503101932,79.292
1791503102932,70.558
1791503103932,80.904
1791503104932,84.848
1791503105932,78.391
1791503106932,83.417
1791503107933,79.187
1791503108933,88.888
1791503109933,66.834
1791503110933,78.061
1791503111933,83.919
1791503112933,74.242
1791503113934,93.0
1791503114934,65.816
1791503115934,78.894
1791503116934,76.884
1791503117934,85.714
1791503118935,82.5
1791503119935,58.375
1791503120935,98.009
1791503121935,62.755
1791503122935,76.53
1791503123935,93.467
1791503124936,75.126
1791503125936,72.081
1791503126936,77.948
1791503127936,90.404
1791503128936,78.68
1791503129936,78.282
1791503130937,78.172
1791503131937,71.938
1791503132937,82.914
1791503133937,74.619
1791503134937,94.472
1791503135938,80.203
1791503136938,68.02
1791503137938,81.218
1791503138938,78.68
1791503139938,82.323
1791503140939,74.242
1791503141939,98.492
1791503142939,72.727
1791503143939,82.323
1791503144939,75.51
1791503145939,87.437
1791503146940,75.897
1791503147940,82.412
1791503148940,83.838
1791503149940,77.157
1791503150940,82.653
1791503151940,80.303
1791503152941,88.888
1791503153941,81.909
1791503154941,88.324
1791503155941,70.707
1791503156941,85.858
1791503157942,80.71
1791503158942,85.427
1791503159942,69.897
1791503160942,66.834
1791503161942,94.472
1791503162942,90.0
1791503163943,67.171
1791503164943,77.777
1791503165943,88.383
1791503166943,59.595
1791503167943,69.543
1791503168943,96.5
1791503169944,67.512
1791503170944,69.897
1791503171944,93.034
1791503172944,79.797
1791503173944,65.816
1791503174945,83.756
1791503175945,90.0
1791503176945,68.367
1791503177945,78.894
1791503178945,89.393
1791503179945,80.203
1791503180946,64.615
1791503181946,81.632
1791503182946,80.904
1791503183946,88.324
1791503184946,84.183
1791503185947,78.787
1791503186947,83.248
1791503187947,87.939
1791503188947,82.323
1791503189947,81.725
1791503190947,88.888
1791503191948,76.649
1791503192948,73.979
1791503193948,94.472
1791503194948,63.451
1791503195948,91.919
1791503196949,66.836
1791503197949,84.263
1 timestamp_ms cpu_percent
2 1791502598833 72.222
3 1791502599833 90.909
4 1791502600833 86.934
5 1791502601834 76.02
6 1791502602834 61.224
7 1791502603834 76.5
8 1791502604834 92.893
9 1791502605834 83.838
10 1791502606835 76.53
11 1791502607835 90.954
12 1791502608835 73.604
13 1791502609835 72.081
14 1791502610836 79.797
15 1791502611836 90.862
16 1791502612836 74.747
17 1791502613836 77.435
18 1791502614837 96.482
19 1791502615837 77.777
20 1791502616837 81.313
21 1791502617838 86.5
22 1791502618838 83.838
23 1791502619838 74.242
24 1791502620838 72.959
25 1791502621838 84.924
26 1791502622839 76.884
27 1791502623839 89.847
28 1791502624839 73.096
29 1791502625839 83.919
30 1791502626840 73.846
31 1791502627840 84.848
32 1791502628840 81.313
33 1791502629840 85.929
34 1791502630841 79.081
35 1791502631841 76.142
36 1791502632841 84.422
37 1791502633841 64.974
38 1791502634842 92.385
39 1791502635842 83.333
40 1791502636842 82.323
41 1791502637842 73.096
42 1791502638843 85.858
43 1791502639843 76.923
44 1791502640843 82.323
45 1791502641843 85.279
46 1791502642843 84.343
47 1791502643844 90.862
48 1791502644844 71.938
49 1791502645844 80.904
50 1791502646844 72.588
51 1791502647845 77.272
52 1791502648845 88.888
53 1791502649845 80.303
54 1791502650845 84.343
55 1791502651846 73.604
56 1791502652846 83.756
57 1791502653846 68.205
58 1791502654846 79.695
59 1791502655846 89.949
60 1791502656847 78.68
61 1791502657847 86.363
62 1791502658847 78.68
63 1791502659847 72.588
64 1791502660847 82.142
65 1791502661848 81.818
66 1791502662848 81.218
67 1791502663848 82.323
68 1791502664848 86.934
69 1791502665849 68.367
70 1791502666849 72.864
71 1791502667849 87.878
72 1791502668849 85.929
73 1791502669849 95.959
74 1791502670850 89.795
75 1791502671850 84.343
76 1791502672850 75.757
77 1791502673850 69.035
78 1791502674850 76.142
79 1791502675851 87.437
80 1791502676851 84.848
81 1791502677851 74.489
82 1791502678851 98.5
83 1791502679851 55.329
84 1791502680851 86.294
85 1791502681852 66.326
86 1791502682852 83.919
87 1791502683852 82.142
88 1791502684852 74.242
89 1791502685852 86.363
90 1791502686853 73.0
91 1791502687853 80.412
92 1791502688853 73.0
93 1791502689853 87.309
94 1791502690853 85.427
95 1791502691854 76.767
96 1791502692854 86.432
97 1791502693854 79.081
98 1791502694854 77.272
99 1791502695855 78.499
100 1791502696855 72.959
101 1791502697855 84.924
102 1791502698855 88.442
103 1791502699855 81.122
104 1791502700856 78.68
105 1791502701856 77.04
106 1791502702856 77.664
107 1791502703856 75.634
108 1791502704856 88.383
109 1791502705857 72.081
110 1791502706857 98.507
111 1791502707857 67.346
112 1791502708857 76.649
113 1791502709857 67.525
114 1791502710858 86.432
115 1791502711858 91.414
116 1791502712858 83.838
117 1791502713858 84.263
118 1791502714858 80.102
119 1791502715859 74.0
120 1791502716859 78.68
121 1791502717859 82.741
122 1791502718859 80.71
123 1791502719859 84.924
124 1791502720860 84.422
125 1791502721860 73.604
126 1791502722860 71.212
127 1791502723860 87.817
128 1791502724860 79.899
129 1791502725861 88.888
130 1791502726861 76.884
131 1791502727861 83.756
132 1791502728861 76.142
133 1791502729861 85.353
134 1791502730862 87.755
135 1791502731862 80.303
136 1791502732862 77.386
137 1791502733862 87.878
138 1791502734863 69.897
139 1791502735863 88.888
140 1791502736863 81.218
141 1791502737863 69.191
142 1791502738863 85.858
143 1791502739864 97.0
144 1791502740864 70.618
145 1791502741864 67.676
146 1791502742864 86.432
147 1791502743864 74.489
148 1791502744865 74.242
149 1791502745865 91.919
150 1791502746865 98.507
151 1791502747865 58.974
152 1791502748865 85.572
153 1791502749866 84.263
154 1791502750866 71.212
155 1791502751866 74.747
156 1791502752866 98.994
157 1791502753866 75.376
158 1791502754867 79.797
159 1791502755867 90.909
160 1791502756867 75.252
161 1791502757867 69.035
162 1791502758867 89.393
163 1791502759868 80.71
164 1791502760868 83.582
165 1791502761868 89.847
166 1791502762868 82.412
167 1791502763868 62.244
168 1791502764869 80.612
169 1791502765869 79.187
170 1791502766869 80.0
171 1791502767869 78.974
172 1791502768869 87.437
173 1791502769870 68.527
174 1791502770870 75.252
175 1791502771870 87.5
176 1791502772870 79.695
177 1791502773870 88.0
178 1791502774871 78.787
179 1791502775871 85.858
180 1791502776871 80.808
181 1791502777871 72.588
182 1791502778871 90.954
183 1791502779872 80.303
184 1791502780872 84.343
185 1791502781872 80.102
186 1791502782872 97.5
187 1791502783872 65.989
188 1791502784873 74.747
189 1791502785873 81.725
190 1791502786873 89.393
191 1791502787873 77.272
192 1791502788873 79.695
193 1791502789874 90.909
194 1791502790874 66.497
195 1791502791874 83.756
196 1791502792874 84.422
197 1791502793874 78.974
198 1791502794875 87.373
199 1791502795875 77.551
200 1791502796875 84.0
201 1791502797875 76.02
202 1791502798875 74.747
203 1791502799876 82.323
204 1791502800876 87.939
205 1791502801876 78.172
206 1791502802876 83.582
207 1791502803876 79.292
208 1791502804877 79.187
209 1791502805877 73.737
210 1791502806877 81.725
211 1791502807877 85.353
212 1791502808877 80.102
213 1791502809877 81.313
214 1791502810878 87.373
215 1791502811878 80.5
216 1791502812878 77.777
217 1791502813878 74.874
218 1791502814878 85.786
219 1791502815879 82.914
220 1791502816879 88.5
221 1791502817879 74.619
222 1791502818879 85.279
223 1791502819879 73.979
224 1791502820879 76.649
225 1791502821880 75.757
226 1791502822880 87.373
227 1791502823880 96.0
228 1791502824880 70.351
229 1791502825880 73.333
230 1791502826881 83.417
231 1791502827881 84.343
232 1791502828881 74.747
233 1791502829881 89.34
234 1791502830881 92.385
235 1791502831882 83.417
236 1791502832882 69.035
237 1791502833882 75.252
238 1791502834882 86.868
239 1791502835882 81.909
240 1791502836882 79.187
241 1791502837883 75.879
242 1791502838883 97.487
243 1791502839883 68.844
244 1791502840883 70.351
245 1791502841883 77.948
246 1791502842884 88.383
247 1791502843884 96.984
248 1791502844884 83.756
249 1791502845884 81.909
250 1791502846884 78.68
251 1791502847885 73.096
252 1791502848885 83.417
253 1791502849885 86.294
254 1791502850885 78.894
255 1791502851885 79.081
256 1791502852885 89.898
257 1791502853886 75.634
258 1791502854886 64.141
259 1791502855886 95.477
260 1791502856886 77.272
261 1791502857886 85.786
262 1791502858887 82.828
263 1791502859887 91.457
264 1791502860887 66.836
265 1791502861887 85.204
266 1791502862887 75.124
267 1791502863887 82.828
268 1791502864888 80.303
269 1791502865888 80.904
270 1791502866888 79.695
271 1791502867888 77.272
272 1791502868888 80.5
273 1791502869889 81.909
274 1791502870889 81.313
275 1791502871889 97.474
276 1791502872889 78.391
277 1791502873889 64.974
278 1791502874890 67.857
279 1791502875890 88.442
280 1791502876890 78.68
281 1791502877890 76.142
282 1791502878890 94.444
283 1791502879890 79.5
284 1791502880891 57.142
285 1791502881891 76.262
286 1791502882891 83.333
287 1791502883891 78.0
288 1791502884891 87.437
289 1791502885892 82.323
290 1791502886892 87.373
291 1791502887892 69.387
292 1791502888892 76.884
293 1791502889892 78.172
294 1791502890892 76.767
295 1791502891893 90.954
296 1791502892893 81.313
297 1791502893893 80.303
298 1791502894893 75.252
299 1791502895893 72.588
300 1791502896894 87.878
301 1791502897894 89.898
302 1791502898894 96.446
303 1791502899894 77.499
304 1791502900894 81.725
305 1791502901895 85.858
306 1791502902895 69.23
307 1791502903895 84.422
308 1791502904895 90.954
309 1791502905895 82.828
310 1791502906895 82.233
311 1791502907896 81.218
312 1791502908896 74.874
313 1791502909896 71.717
314 1791502910896 73.604
315 1791502911896 97.487
316 1791502912896 82.914
317 1791502913897 84.343
318 1791502914897 89.393
319 1791502915897 67.676
320 1791502916897 70.918
321 1791502917897 85.353
322 1791502918898 81.407
323 1791502919898 71.794
324 1791502920898 89.949
325 1791502921898 84.0
326 1791502922898 75.126
327 1791502923899 77.889
328 1791502924899 81.122
329 1791502925899 83.919
330 1791502926899 79.797
331 1791502927899 89.447
332 1791502928900 79.695
333 1791502929900 78.68
334 1791502930900 73.869
335 1791502931900 94.472
336 1791502932900 73.979
337 1791502933901 85.427
338 1791502934901 79.396
339 1791502935901 97.0
340 1791502936901 60.406
341 1791502937901 70.707
342 1791502938901 89.393
343 1791502939902 77.777
344 1791502940902 72.727
345 1791502941902 84.771
346 1791502942902 84.848
347 1791502943902 77.889
348 1791502944902 88.383
349 1791502945903 79.695
350 1791502946903 76.767
351 1791502947903 76.262
352 1791502948903 91.37
353 1791502949903 90.954
354 1791502950904 73.604
355 1791502951904 74.747
356 1791502952904 83.248
357 1791502953904 87.939
358 1791502954904 76.02
359 1791502955904 89.898
360 1791502956905 68.527
361 1791502957905 87.309
362 1791502958905 80.303
363 1791502959905 73.869
364 1791502960905 92.893
365 1791502961905 83.673
366 1791502962906 79.396
367 1791502963906 81.909
368 1791502964907 83.5
369 1791502965907 65.816
370 1791502966907 79.695
371 1791502967907 77.272
372 1791502968907 89.898
373 1791502969908 72.588
374 1791502970908 80.808
375 1791502971908 77.777
376 1791502972908 79.292
377 1791502973908 79.292
378 1791502974908 76.41
379 1791502975909 74.747
380 1791502976909 82.412
381 1791502977909 83.756
382 1791502978909 76.884
383 1791502979909 81.122
384 1791502980910 82.914
385 1791502981910 72.959
386 1791502982910 70.707
387 1791502983910 88.832
388 1791502984910 70.558
389 1791502985911 90.355
390 1791502986911 85.858
391 1791502987911 70.707
392 1791502988911 80.808
393 1791502989911 80.904
394 1791502990911 84.771
395 1791502991912 84.422
396 1791502992912 76.262
397 1791502993912 81.725
398 1791502994912 91.919
399 1791502995912 78.391
400 1791502996913 72.081
401 1791502997913 84.343
402 1791502998913 89.949
403 1791502999913 68.181
404 1791503000913 83.248
405 1791503001913 77.777
406 1791503002914 79.292
407 1791503003914 80.102
408 1791503004914 83.417
409 1791503005914 76.649
410 1791503006914 75.252
411 1791503007915 84.422
412 1791503008915 76.142
413 1791503009915 78.894
414 1791503010915 82.914
415 1791503011915 73.979
416 1791503012915 96.984
417 1791503013916 61.111
418 1791503014916 77.664
419 1791503015916 98.484
420 1791503016916 74.371
421 1791503017916 73.604
422 1791503018917 96.969
423 1791503019917 86.363
424 1791503020917 69.696
425 1791503021917 84.263
426 1791503022917 90.954
427 1791503023917 71.794
428 1791503024918 81.0
429 1791503025918 78.787
430 1791503026918 79.899
431 1791503027918 80.102
432 1791503028918 77.664
433 1791503029919 79.292
434 1791503030919 95.0
435 1791503031919 72.588
436 1791503032919 78.68
437 1791503033919 76.649
438 1791503034919 81.909
439 1791503035920 84.422
440 1791503036920 78.172
441 1791503037920 86.868
442 1791503038920 83.838
443 1791503039920 83.163
444 1791503040920 77.551
445 1791503041921 73.232
446 1791503042921 76.41
447 1791503043921 87.373
448 1791503044921 88.832
449 1791503045921 76.884
450 1791503046922 86.294
451 1791503047922 62.626
452 1791503048922 92.424
453 1791503049922 79.899
454 1791503050922 73.604
455 1791503051923 87.939
456 1791503052923 78.172
457 1791503053923 72.081
458 1791503054923 77.664
459 1791503055923 77.499
460 1791503056924 85.279
461 1791503057924 78.282
462 1791503058924 95.0
463 1791503059924 63.959
464 1791503060924 84.924
465 1791503061924 78.172
466 1791503062925 74.619
467 1791503063925 92.893
468 1791503064925 87.5
469 1791503065925 83.756
470 1791503066925 85.858
471 1791503067926 73.737
472 1791503068926 77.664
473 1791503069926 77.272
474 1791503070926 93.939
475 1791503071926 83.919
476 1791503072926 71.573
477 1791503073927 75.126
478 1791503074927 84.924
479 1791503075927 86.802
480 1791503076927 82.089
481 1791503077927 85.279
482 1791503078927 88.888
483 1791503079928 75.252
484 1791503080928 91.878
485 1791503081928 69.696
486 1791503082928 84.924
487 1791503083928 80.203
488 1791503084929 82.741
489 1791503085929 81.218
490 1791503086929 81.538
491 1791503087929 83.838
492 1791503088929 73.737
493 1791503089929 90.909
494 1791503090930 73.096
495 1791503091930 86.934
496 1791503092930 83.417
497 1791503093930 78.061
498 1791503094930 91.414
499 1791503095930 67.857
500 1791503096931 84.577
501 1791503097931 78.68
502 1791503098931 73.737
503 1791503099931 95.959
504 1791503100931 87.562
505 1791503101932 79.292
506 1791503102932 70.558
507 1791503103932 80.904
508 1791503104932 84.848
509 1791503105932 78.391
510 1791503106932 83.417
511 1791503107933 79.187
512 1791503108933 88.888
513 1791503109933 66.834
514 1791503110933 78.061
515 1791503111933 83.919
516 1791503112933 74.242
517 1791503113934 93.0
518 1791503114934 65.816
519 1791503115934 78.894
520 1791503116934 76.884
521 1791503117934 85.714
522 1791503118935 82.5
523 1791503119935 58.375
524 1791503120935 98.009
525 1791503121935 62.755
526 1791503122935 76.53
527 1791503123935 93.467
528 1791503124936 75.126
529 1791503125936 72.081
530 1791503126936 77.948
531 1791503127936 90.404
532 1791503128936 78.68
533 1791503129936 78.282
534 1791503130937 78.172
535 1791503131937 71.938
536 1791503132937 82.914
537 1791503133937 74.619
538 1791503134937 94.472
539 1791503135938 80.203
540 1791503136938 68.02
541 1791503137938 81.218
542 1791503138938 78.68
543 1791503139938 82.323
544 1791503140939 74.242
545 1791503141939 98.492
546 1791503142939 72.727
547 1791503143939 82.323
548 1791503144939 75.51
549 1791503145939 87.437
550 1791503146940 75.897
551 1791503147940 82.412
552 1791503148940 83.838
553 1791503149940 77.157
554 1791503150940 82.653
555 1791503151940 80.303
556 1791503152941 88.888
557 1791503153941 81.909
558 1791503154941 88.324
559 1791503155941 70.707
560 1791503156941 85.858
561 1791503157942 80.71
562 1791503158942 85.427
563 1791503159942 69.897
564 1791503160942 66.834
565 1791503161942 94.472
566 1791503162942 90.0
567 1791503163943 67.171
568 1791503164943 77.777
569 1791503165943 88.383
570 1791503166943 59.595
571 1791503167943 69.543
572 1791503168943 96.5
573 1791503169944 67.512
574 1791503170944 69.897
575 1791503171944 93.034
576 1791503172944 79.797
577 1791503173944 65.816
578 1791503174945 83.756
579 1791503175945 90.0
580 1791503176945 68.367
581 1791503177945 78.894
582 1791503178945 89.393
583 1791503179945 80.203
584 1791503180946 64.615
585 1791503181946 81.632
586 1791503182946 80.904
587 1791503183946 88.324
588 1791503184946 84.183
589 1791503185947 78.787
590 1791503186947 83.248
591 1791503187947 87.939
592 1791503188947 82.323
593 1791503189947 81.725
594 1791503190947 88.888
595 1791503191948 76.649
596 1791503192948 73.979
597 1791503193948 94.472
598 1791503194948 63.451
599 1791503195948 91.919
600 1791503196949 66.836
601 1791503197949 84.263
+186
View File
@@ -0,0 +1,186 @@
#!/usr/bin/env python3
"""Generate JMeter plans with the PerfMon listener; no application changes required."""
from pathlib import Path
import xml.etree.ElementTree as E
from perfmon import METRICS
OUT = Path(__file__).parent / 'plans'
def prop(parent, name, value, kind='stringProp'):
E.SubElement(parent, kind, name=name).text = str(value).lower() if isinstance(value, bool) else str(value)
def element(tree, tag, gui, name, **attrs):
e = E.SubElement(tree, tag, guiclass=gui, testclass=tag, testname=name, enabled='true', **attrs)
return e, E.SubElement(tree, 'hashTree')
def script(tree, tag, name, code):
e, t = element(tree, tag, tag+'Gui', name)
for k,v in [('scriptLanguage','groovy'),('cacheKey','true'),('filename',''),('parameters',''),('script',code)]: prop(e,k,v)
return t
def request(tree, name, method, path, body='', status=200, check=''):
e, t = element(tree,'HTTPSamplerProxy','HttpTestSampleGui','HTTP '+name)
args = E.SubElement(e,'elementProp',name='HTTPsampler.Arguments',elementType='Arguments',guiclass='HTTPArgumentsPanel',testclass='Arguments',enabled='true')
collection = E.SubElement(args,'collectionProp',name='Arguments.arguments')
if body:
arg = E.SubElement(collection,'elementProp',name='',elementType='HTTPArgument')
prop(arg,'HTTPArgument.always_encode',False,'boolProp'); prop(arg,'Argument.value',body); prop(arg,'Argument.metadata','=')
for k,v in [('HTTPSampler.domain','${__P(host,127.0.0.1)}'),('HTTPSampler.port','${__P(port,5443)}'),('HTTPSampler.protocol','https'),('HTTPSampler.path',path),('HTTPSampler.method',method),('HTTPSampler.implementation','HttpClient4'),('HTTPSampler.connect_timeout','10000'),('HTTPSampler.response_timeout','30000')]: prop(e,k,v)
for k,v in [('HTTPSampler.postBodyRaw',bool(body)),('HTTPSampler.follow_redirects',False),('HTTPSampler.auto_redirects',False),('HTTPSampler.use_keepalive',True),('HTTPSampler.DO_MULTIPART_POST',False)]: prop(e,k,v,'boolProp')
# HTTP status and semantic checks fail the thread rather than generating cascades.
script(t,'JSR223Assertion','Expected response',f'''if (prev.getResponseCode() != '{status}') {{
AssertionResult.setFailure(true); AssertionResult.setFailureMessage('Unexpected HTTP status: '+prev.getResponseCode()); return
}}
// Expected negative outcomes (e.g. deletion confirmed with 404) are successful checks.
prev.setSuccessful(true)
{('def json = new groovy.json.JsonSlurper().parseText(prev.getResponseDataAsString())' if check else '')}
{check}
''')
script(t,'JSR223Timer','Gaussian interaction pause', """def rng = vars.getObject('user_random')
double mean = Double.parseDouble(props.getProperty('think_mean_ms','1000'))
double deviation = Double.parseDouble(props.getProperty('think_stddev_ms','250'))
double minimum = Double.parseDouble(props.getProperty('think_min_ms','500'))
// Symmetric truncation keeps the expected mean at the configured value.
double maximum = 2 * mean - minimum
if (deviation == 0 || maximum == minimum) return Math.round(mean)
double delay
while (true) {
delay = mean + rng.nextGaussian() * deviation
if (delay >= minimum && delay <= maximum) return Math.round(delay)
}
""")
PERIOD = 'from=${period_from}&to=${period_to}'
PATIENT = '/api/patients/${patient_id}'
def review(t, professional=False):
if professional:
request(t,'Assigned patients','GET','/api/professionals/me/patients',check="assert json.any { it.patientId == vars.get('patient_id') } : 'Target patient is not assigned'")
request(t,'Read profile','GET',PATIENT if professional else '/api/patients/me',check="assert json.patientId == vars.get('patient_id')")
request(t,'Latest reading','GET',PATIENT+'/observations/latest',check="assert json.patientId == vars.get('patient_id')")
request(t,'Home resting history','GET',PATIENT+'/observations?'+PERIOD+'&setting=Home&activityCondition=AtRest',check="assert json instanceof List && !json.empty : 'Seed observations first'")
request(t,'Numerical insights','GET',PATIENT+'/insights?'+PERIOD+'&setting=Home&activityCondition=AtRest',check="assert json.contributingCount > 0")
request(t,'Trends','GET',PATIENT+'/trends?'+PERIOD)
overview(t)
def overview(t):
request(t,'Health overview','GET',PATIENT+'/overview?'+PERIOD,check="assert json.patient.patientId == vars.get('patient_id'); assert json.latestObservation != null; assert json.insight != null")
def record(t, correction=False):
request(t,'Measurement guidance','GET','/api/measurement-guidance?setting=Home&activityCondition=AtRest')
request(t,'Read own profile','GET','/api/patients/me',check="assert json.patientId == vars.get('patient_id')")
request(t,'Record synthetic measurement','POST',PATIENT+'/observations','${observation_body}',201,"assert json.patientId == vars.get('patient_id'); assert json.observationId; vars.put('observation_id',json.observationId)")
if correction:
request(t,'Correct entry and context','PATCH','/api/observations/${observation_id}','{"systolic":128,"measurementContext":{"additionalCircumstances":"Corrected synthetic entry"}}',check="assert json.systolic == 128")
request(t,'Confirm saved reading','GET','/api/observations/${observation_id}',check="assert json.observationId == vars.get('observation_id')")
overview(t)
if correction:
request(t,'Remove duplicate test entry','DELETE','/api/observations/${observation_id}',status=204)
request(t,'Confirm removal','GET','/api/observations/${observation_id}',status=404)
def shelly_group(tree):
group,gt=element(tree,'ThreadGroup','ThreadGroupGui','Shelly live power')
prop(group,'ThreadGroup.on_sample_error','continue')
loop=E.SubElement(group,'elementProp',name='ThreadGroup.main_controller',elementType='LoopController',guiclass='LoopControlPanel',testclass='LoopController',enabled='true')
prop(loop,'LoopController.continue_forever',False,'boolProp');prop(loop,'LoopController.loops',-1)
for k,v in [('ThreadGroup.num_threads','1'),('ThreadGroup.ramp_time','0'),('ThreadGroup.duration','${__P(total_duration_seconds,16210)}'),('ThreadGroup.delay','0')]:prop(group,k,v)
prop(group,'ThreadGroup.scheduler',True,'boolProp')
e,t=element(gt,'HTTPSamplerProxy','HttpTestSampleGui','POWER Shelly status')
E.SubElement(E.SubElement(e,'elementProp',name='HTTPsampler.Arguments',elementType='Arguments'),'collectionProp',name='Arguments.arguments')
for k,v in [('HTTPSampler.domain','${__P(shelly_host,192.168.1.44)}'),('HTTPSampler.port','${__P(shelly_port,80)}'),('HTTPSampler.protocol','http'),('HTTPSampler.path','/rpc/Switch.GetStatus?id=${__P(shelly_switch_id,0)}'),('HTTPSampler.method','GET'),('HTTPSampler.implementation','HttpClient4'),('HTTPSampler.connect_timeout','3000'),('HTTPSampler.response_timeout','3000')]:prop(e,k,v)
for k,v in [('HTTPSampler.follow_redirects',False),('HTTPSampler.use_keepalive',True)]:prop(e,k,v,'boolProp')
script(t,'JSR223Timer','Fixed meter cadence', "if (!vars.get('shelly_last_poll_ms')) return 0L; return Math.max(0L, Long.parseLong(vars.get('shelly_last_poll_ms')) + Long.parseLong(props.getProperty('shelly_interval_ms','1000')) - System.currentTimeMillis())")
script(t,'JSR223PreProcessor','Clear stale power values', "['shelly_power_watts','shelly_voltage_volts','shelly_current_amps','shelly_energy_wh'].each { vars.put(it,'') }")
script(t,'JSR223Assertion','Validate and extract plug readings', """vars.put('shelly_last_poll_ms',prev.getStartTime().toString())
try {
assert prev.getResponseCode() == '200'
def json=new groovy.json.JsonSlurper().parseText(prev.getResponseDataAsString())
assert json.output == true : 'Outlet is off'
def readings=[shelly_power_watts:json.apower,shelly_voltage_volts:json.voltage,shelly_current_amps:json.current,shelly_energy_wh:json.aenergy?.total]
readings.each { key,value -> assert value instanceof Number && Double.isFinite(value.doubleValue()) && value >= 0; vars.put(key,value.toString()) }
} catch (Throwable error) {
AssertionResult.setFailure(true);AssertionResult.setFailureMessage('Shelly status/measurement unavailable');prev.setSuccessful(false)
}
""")
collector,_=element(gt,'ResultCollector','SimpleDataWriter','Shelly measurements saved live')
prop(collector,'filename','${__P(shelly_file,shelly.csv)}');prop(collector,'ResultCollector.error_logging',False,'boolProp')
for scenario in ['recording','review','correction','professional','mixed','idle']:
root=E.Element('jmeterTestPlan',version='1.2',properties='5.0',jmeter='5.6.3'); tree=E.SubElement(root,'hashTree')
plan, pt=element(tree,'TestPlan','TestPlanGui','HealthApp energy: '+scenario)
prop(plan,'TestPlan.comments','Synthetic closed-loop sessions; default duration four hours. Setup is external; Shelly power is collected live without changing the outlet.')
prop(plan,'TestPlan.functional_mode',False,'boolProp'); prop(plan,'TestPlan.serialize_threadgroups',False,'boolProp')
E.SubElement(E.SubElement(plan,'elementProp',name='TestPlan.user_defined_variables',elementType='Arguments',guiclass='ArgumentsPanel',testclass='Arguments',enabled='true'),'collectionProp',name='Arguments.arguments')
shelly_group(pt)
collector, _ = element(pt,'kg.apc.jmeter.perfmon.PerfMonCollector','kg.apc.jmeter.vizualizers.PerfMonGui','NUC live CPU RAM disk and network')
collector.set('enabled','true')
prop(collector,'filename','${__P(perfmon_file,perfmon.csv)}')
prop(collector,'ResultCollector.error_logging',False,'boolProp')
connections=E.SubElement(collector,'collectionProp',name='metricConnections')
for i,(kind,param,unit) in enumerate(METRICS):
row=E.SubElement(connections,'collectionProp',name=str(i))
for j,value in enumerate(['${__P(perfmon_host,192.168.1.125)}','${__P(perfmon_port,4444)}',kind,param]):prop(row,str(j),value)
group, gt=element(pt,'ThreadGroup','ThreadGroupGui','Users')
prop(group,'ThreadGroup.on_sample_error','stopthread')
loop=E.SubElement(group,'elementProp',name='ThreadGroup.main_controller',elementType='LoopController',guiclass='LoopControlPanel',testclass='LoopController',enabled='true')
prop(loop,'LoopController.continue_forever',False,'boolProp'); prop(loop,'LoopController.loops',-1)
for k,v in [('ThreadGroup.num_threads','${__P(users,1)}'),('ThreadGroup.ramp_time','${__P(ramp_seconds,60)}'),('ThreadGroup.duration','${__P(total_duration_seconds,16210)}'),('ThreadGroup.delay','0')]: prop(group,k,v)
prop(group,'ThreadGroup.scheduler',True,'boolProp'); prop(group,'ThreadGroup.same_user_on_next_iteration',True,'boolProp')
if scenario=='idle':
prop(group,'ThreadGroup.num_threads','1');prop(group,'ThreadGroup.ramp_time','0')
once, ot=element(gt,'OnceOnlyController','OnceOnlyControllerGui','Record idle measurement window')
script(ot,'JSR223Sampler','Idle timing', '''long start=System.currentTimeMillis()
long measurement=start+Long.parseLong(props.getProperty('warmup_seconds','1800'))*1000
long end=measurement+Long.parseLong(props.getProperty('duration_seconds','14400'))*1000
if (props.get('timeline_file')) new File(props.get('timeline_file')).text=groovy.json.JsonOutput.toJson([warmup_start_ms:start,measurement_start_ms:measurement,measurement_end_ms:end])
''')
pause,_=element(gt,'TestAction','TestActionGui','Idle wait; no application requests')
prop(pause,'ActionProcessor.action',1,'intProp');prop(pause,'ActionProcessor.target',0,'intProp');prop(pause,'ActionProcessor.duration','1000')
E.indent(root);E.ElementTree(root).write(OUT/(scenario+'.jmx'),encoding='utf-8',xml_declaration=True)
continue
headers, _=element(gt,'HeaderManager','HeaderPanel','JSON and bearer token')
coll=E.SubElement(headers,'collectionProp',name='HeaderManager.headers')
for name,value in [('Content-Type','application/json'),('Authorization','Bearer ${token}')]:
h=E.SubElement(coll,'elementProp',name='',elementType='Header');prop(h,'Header.name',name);prop(h,'Header.value',value)
once, ot=element(gt,'OnceOnlyController','OnceOnlyControllerGui','Assign one account per user')
script(ot,'JSR223Sampler','Initialize user', '''def rows = new File(props.get('users_file')).readLines('UTF-8').drop(1).findAll { it.trim() }
def row = rows[ctx.getThreadNum()].split(',', -1)
vars.put('account_id', row[0]); vars.put('password', row[1]); vars.put('patient_id', row[2])
vars.put('token', ''); vars.put('expires_at', '0'); vars.put('session_number','0')
vars.putObject('user_random', new Random(Long.parseLong(props.getProperty('random_seed','42')) + ctx.getThreadNum()))
synchronized(props) {
if (props.get('timeline_file') && !props.get('workload_start_ms')) {
long start = System.currentTimeMillis()
long measurement = start + Long.parseLong(props.getProperty('warmup_seconds','1800')) * 1000
long end = measurement + Long.parseLong(props.getProperty('duration_seconds','14400')) * 1000
props.put('workload_start_ms',start.toString())
new File(props.get('timeline_file')).text = groovy.json.JsonOutput.toJson([warmup_start_ms:start,measurement_start_ms:measurement,measurement_end_ms:end])
}
}
''')
script(gt,'JSR223Sampler','Prepare session', '''def now = java.time.Instant.now()
vars.put('refresh_login', (now.epochSecond >= Long.parseLong(vars.get('expires_at')) - 60).toString())
vars.put('login_body',groovy.json.JsonOutput.toJson([accountId:vars.get('account_id'),password:vars.get('password')]))
vars.put('period_from',props.get('period_from')); vars.put('period_to',props.get('period_to'))
int n = Integer.parseInt(vars.get('session_number')); vars.put('session_number',(n+1).toString())
// Random session mix: expected 65% review, 30% recording, 5% correction.
int slot = vars.getObject('user_random').nextInt(20)
vars.put('session_kind',slot < 13 ? 'review' : slot < 19 ? 'recording' : 'correction')
double mean = Double.parseDouble(props.getProperty('session_pause_ms','120000'))
double deviation = Double.parseDouble(props.getProperty('session_stddev_ms','30000'))
vars.put('session_delay_ms',Math.max(0L,Math.round(mean + vars.getObject('user_random').nextGaussian()*deviation)).toString())
vars.put('observation_body',groovy.json.JsonOutput.toJson([measuredAt:now.toString(),systolic:128+(n%7),diastolic:82+(n%4),pulse:68+(n%6),measurementContext:[setting:'Home',activityCondition:'AtRest',restDurationMinutes:5,bodyPosition:'Seated'],note:'Synthetic JMeter energy workload']))
''')
login, lt=element(gt,'IfController','IfControllerPanel','Login or renew expired token')
prop(login,'IfController.condition','${refresh_login}');prop(login,'IfController.evaluateAll',False,'boolProp');prop(login,'IfController.useExpression',True,'boolProp')
request(lt,'Login','POST','/api/authentication/login','${login_body}',check="assert json.accessToken; vars.put('token',json.accessToken); vars.put('expires_at',(java.time.Instant.now().epochSecond + (json.expiresIn as long)).toString())")
if scenario=='mixed':
for kind in ['review','recording','correction']:
branch,bt=element(gt,'IfController','IfControllerPanel',kind+' session')
prop(branch,'IfController.condition',"${__groovy(vars.get('session_kind') == '"+kind+"')}");prop(branch,'IfController.useExpression',True,'boolProp');prop(branch,'IfController.evaluateAll',False,'boolProp')
review(bt) if kind=='review' else record(bt,kind=='correction')
elif scenario in ['review','professional']: review(gt,scenario=='professional')
else: record(gt,scenario=='correction')
pause, _ = element(gt,'TestAction','TestActionGui','Between-session pause')
prop(pause,'ActionProcessor.action',1,'intProp'); prop(pause,'ActionProcessor.target',0,'intProp'); prop(pause,'ActionProcessor.duration','${session_delay_ms}')
E.indent(root); E.ElementTree(root).write(OUT/(scenario+'.jmx'),encoding='utf-8',xml_declaration=True)
+35
View File
@@ -0,0 +1,35 @@
"""PerfMon agent preflight and JMeter's metric-file decoding."""
import csv, math, socket
METRICS=[('CPU','combined','percent'),('CPU','iowait','percent'),('Memory','usedperc','percent'),('Memory','actualused','bytes'),('Swap','used','bytes'),('Disks I/O','readbytes','bytes/second'),('Disks I/O','writebytes','bytes/second'),('Network I/O','bytesrecv','bytes/second'),('Network I/O','bytessent','bytes/second')]
TYPES={'CPU':'cpu','Memory':'memory','Swap':'swap','Disks I/O':'disks','Network I/O':'network'}
def check_agent(host,port):
specs=[TYPES[k]+':'+param for k,param,_ in METRICS]
with socket.create_connection((host,port),timeout=5) as s:
s.settimeout(5);s.sendall(('metrics-single:'+'\t'.join(specs)+'\n').encode())
values=s.makefile('r').readline(8192).strip().split('\t')
if len(values)!=len(specs):raise ValueError('PerfMon returned an incomplete metric response')
if any(not math.isfinite(float(v)) or float(v)<0 for v in values):raise ValueError('PerfMon reported unavailable/invalid metrics')
return dict(zip(specs,map(float,values)))
def summarize(raw,output,start,end,interval_ms):
with raw.open() as f: rows=list(csv.DictReader(f))
result=[];by_metric={}
for row in rows:
# PerfMon encodes the metric as synthetic elapsed milliseconds, not HTTP latency.
if row.get('success','true').lower()!='true':raise ValueError('PerfMon collector reported a failed sample')
value=float(row['elapsed'])/1000
if not math.isfinite(value) or value<0:raise ValueError('PerfMon collector reported a metric error')
timestamp=int(row['timeStamp'])
if not start<=timestamp<=end:continue
label=row['label']; unit=next((unit for kind,param,unit in METRICS if label.endswith(kind+' '+param)),'unknown')
if unit=='unknown':raise ValueError('Unknown PerfMon label: '+label)
result.append({'timestamp_ms':timestamp,'metric':label,'value':value,'unit':unit})
by_metric.setdefault(label,[]).append((timestamp,value))
if len(by_metric)!=len(METRICS):raise ValueError('Measured interval is missing required PerfMon metrics')
stats={}
for label,points in by_metric.items():
points.sort();gaps=[b[0]-a[0] for a,b in zip(points,points[1:])]
if max([points[0][0]-start,end-points[-1][0],*gaps])>interval_ms*3:raise ValueError('Gap in live monitoring: '+label)
stats[label]={'samples':len(points),'mean':sum(v for _,v in points)/len(points),'max':max(v for _,v in points)}
with output.open('w') as f:
w=csv.DictWriter(f,fieldnames=['timestamp_ms','metric','value','unit']);w.writeheader();w.writerows(result)
return stats
+745
View File
@@ -0,0 +1,745 @@
<?xml version='1.0' encoding='utf-8'?>
<jmeterTestPlan version="1.2" properties="5.0" jmeter="5.6.3">
<hashTree>
<TestPlan guiclass="TestPlanGui" testclass="TestPlan" testname="HealthApp energy: correction" enabled="true">
<stringProp name="TestPlan.comments">Synthetic closed-loop sessions; default duration four hours. Setup is external; Shelly power is collected live without changing the outlet.</stringProp>
<boolProp name="TestPlan.functional_mode">false</boolProp>
<boolProp name="TestPlan.serialize_threadgroups">false</boolProp>
<elementProp name="TestPlan.user_defined_variables" elementType="Arguments" guiclass="ArgumentsPanel" testclass="Arguments" enabled="true">
<collectionProp name="Arguments.arguments" />
</elementProp>
</TestPlan>
<hashTree>
<ThreadGroup guiclass="ThreadGroupGui" testclass="ThreadGroup" testname="Shelly live power" enabled="true">
<stringProp name="ThreadGroup.on_sample_error">continue</stringProp>
<elementProp name="ThreadGroup.main_controller" elementType="LoopController" guiclass="LoopControlPanel" testclass="LoopController" enabled="true">
<boolProp name="LoopController.continue_forever">false</boolProp>
<stringProp name="LoopController.loops">-1</stringProp>
</elementProp>
<stringProp name="ThreadGroup.num_threads">1</stringProp>
<stringProp name="ThreadGroup.ramp_time">0</stringProp>
<stringProp name="ThreadGroup.duration">${__P(total_duration_seconds,16210)}</stringProp>
<stringProp name="ThreadGroup.delay">0</stringProp>
<boolProp name="ThreadGroup.scheduler">true</boolProp>
</ThreadGroup>
<hashTree>
<HTTPSamplerProxy guiclass="HttpTestSampleGui" testclass="HTTPSamplerProxy" testname="POWER Shelly status" enabled="true">
<elementProp name="HTTPsampler.Arguments" elementType="Arguments">
<collectionProp name="Arguments.arguments" />
</elementProp>
<stringProp name="HTTPSampler.domain">${__P(shelly_host,192.168.1.44)}</stringProp>
<stringProp name="HTTPSampler.port">${__P(shelly_port,80)}</stringProp>
<stringProp name="HTTPSampler.protocol">http</stringProp>
<stringProp name="HTTPSampler.path">/rpc/Switch.GetStatus?id=${__P(shelly_switch_id,0)}</stringProp>
<stringProp name="HTTPSampler.method">GET</stringProp>
<stringProp name="HTTPSampler.implementation">HttpClient4</stringProp>
<stringProp name="HTTPSampler.connect_timeout">3000</stringProp>
<stringProp name="HTTPSampler.response_timeout">3000</stringProp>
<boolProp name="HTTPSampler.follow_redirects">false</boolProp>
<boolProp name="HTTPSampler.use_keepalive">true</boolProp>
</HTTPSamplerProxy>
<hashTree>
<JSR223Timer guiclass="JSR223TimerGui" testclass="JSR223Timer" testname="Fixed meter cadence" enabled="true">
<stringProp name="scriptLanguage">groovy</stringProp>
<stringProp name="cacheKey">true</stringProp>
<stringProp name="filename" />
<stringProp name="parameters" />
<stringProp name="script">if (!vars.get('shelly_last_poll_ms')) return 0L; return Math.max(0L, Long.parseLong(vars.get('shelly_last_poll_ms')) + Long.parseLong(props.getProperty('shelly_interval_ms','1000')) - System.currentTimeMillis())</stringProp>
</JSR223Timer>
<hashTree />
<JSR223PreProcessor guiclass="JSR223PreProcessorGui" testclass="JSR223PreProcessor" testname="Clear stale power values" enabled="true">
<stringProp name="scriptLanguage">groovy</stringProp>
<stringProp name="cacheKey">true</stringProp>
<stringProp name="filename" />
<stringProp name="parameters" />
<stringProp name="script">['shelly_power_watts','shelly_voltage_volts','shelly_current_amps','shelly_energy_wh'].each { vars.put(it,'') }</stringProp>
</JSR223PreProcessor>
<hashTree />
<JSR223Assertion guiclass="JSR223AssertionGui" testclass="JSR223Assertion" testname="Validate and extract plug readings" enabled="true">
<stringProp name="scriptLanguage">groovy</stringProp>
<stringProp name="cacheKey">true</stringProp>
<stringProp name="filename" />
<stringProp name="parameters" />
<stringProp name="script">vars.put('shelly_last_poll_ms',prev.getStartTime().toString())
try {
assert prev.getResponseCode() == '200'
def json=new groovy.json.JsonSlurper().parseText(prev.getResponseDataAsString())
assert json.output == true : 'Outlet is off'
def readings=[shelly_power_watts:json.apower,shelly_voltage_volts:json.voltage,shelly_current_amps:json.current,shelly_energy_wh:json.aenergy?.total]
readings.each { key,value -&gt; assert value instanceof Number &amp;&amp; Double.isFinite(value.doubleValue()) &amp;&amp; value &gt;= 0; vars.put(key,value.toString()) }
} catch (Throwable error) {
AssertionResult.setFailure(true);AssertionResult.setFailureMessage('Shelly status/measurement unavailable');prev.setSuccessful(false)
}
</stringProp>
</JSR223Assertion>
<hashTree />
</hashTree>
<ResultCollector guiclass="SimpleDataWriter" testclass="ResultCollector" testname="Shelly measurements saved live" enabled="true">
<stringProp name="filename">${__P(shelly_file,shelly.csv)}</stringProp>
<boolProp name="ResultCollector.error_logging">false</boolProp>
</ResultCollector>
<hashTree />
</hashTree>
<kg.apc.jmeter.perfmon.PerfMonCollector guiclass="kg.apc.jmeter.vizualizers.PerfMonGui" testclass="kg.apc.jmeter.perfmon.PerfMonCollector" testname="NUC live CPU RAM disk and network" enabled="true">
<stringProp name="filename">${__P(perfmon_file,perfmon.csv)}</stringProp>
<boolProp name="ResultCollector.error_logging">false</boolProp>
<collectionProp name="metricConnections">
<collectionProp name="0">
<stringProp name="0">${__P(perfmon_host,192.168.1.125)}</stringProp>
<stringProp name="1">${__P(perfmon_port,4444)}</stringProp>
<stringProp name="2">CPU</stringProp>
<stringProp name="3">combined</stringProp>
</collectionProp>
<collectionProp name="1">
<stringProp name="0">${__P(perfmon_host,192.168.1.125)}</stringProp>
<stringProp name="1">${__P(perfmon_port,4444)}</stringProp>
<stringProp name="2">CPU</stringProp>
<stringProp name="3">iowait</stringProp>
</collectionProp>
<collectionProp name="2">
<stringProp name="0">${__P(perfmon_host,192.168.1.125)}</stringProp>
<stringProp name="1">${__P(perfmon_port,4444)}</stringProp>
<stringProp name="2">Memory</stringProp>
<stringProp name="3">usedperc</stringProp>
</collectionProp>
<collectionProp name="3">
<stringProp name="0">${__P(perfmon_host,192.168.1.125)}</stringProp>
<stringProp name="1">${__P(perfmon_port,4444)}</stringProp>
<stringProp name="2">Memory</stringProp>
<stringProp name="3">actualused</stringProp>
</collectionProp>
<collectionProp name="4">
<stringProp name="0">${__P(perfmon_host,192.168.1.125)}</stringProp>
<stringProp name="1">${__P(perfmon_port,4444)}</stringProp>
<stringProp name="2">Swap</stringProp>
<stringProp name="3">used</stringProp>
</collectionProp>
<collectionProp name="5">
<stringProp name="0">${__P(perfmon_host,192.168.1.125)}</stringProp>
<stringProp name="1">${__P(perfmon_port,4444)}</stringProp>
<stringProp name="2">Disks I/O</stringProp>
<stringProp name="3">readbytes</stringProp>
</collectionProp>
<collectionProp name="6">
<stringProp name="0">${__P(perfmon_host,192.168.1.125)}</stringProp>
<stringProp name="1">${__P(perfmon_port,4444)}</stringProp>
<stringProp name="2">Disks I/O</stringProp>
<stringProp name="3">writebytes</stringProp>
</collectionProp>
<collectionProp name="7">
<stringProp name="0">${__P(perfmon_host,192.168.1.125)}</stringProp>
<stringProp name="1">${__P(perfmon_port,4444)}</stringProp>
<stringProp name="2">Network I/O</stringProp>
<stringProp name="3">bytesrecv</stringProp>
</collectionProp>
<collectionProp name="8">
<stringProp name="0">${__P(perfmon_host,192.168.1.125)}</stringProp>
<stringProp name="1">${__P(perfmon_port,4444)}</stringProp>
<stringProp name="2">Network I/O</stringProp>
<stringProp name="3">bytessent</stringProp>
</collectionProp>
</collectionProp>
</kg.apc.jmeter.perfmon.PerfMonCollector>
<hashTree />
<ThreadGroup guiclass="ThreadGroupGui" testclass="ThreadGroup" testname="Users" enabled="true">
<stringProp name="ThreadGroup.on_sample_error">stopthread</stringProp>
<elementProp name="ThreadGroup.main_controller" elementType="LoopController" guiclass="LoopControlPanel" testclass="LoopController" enabled="true">
<boolProp name="LoopController.continue_forever">false</boolProp>
<stringProp name="LoopController.loops">-1</stringProp>
</elementProp>
<stringProp name="ThreadGroup.num_threads">${__P(users,1)}</stringProp>
<stringProp name="ThreadGroup.ramp_time">${__P(ramp_seconds,60)}</stringProp>
<stringProp name="ThreadGroup.duration">${__P(total_duration_seconds,16210)}</stringProp>
<stringProp name="ThreadGroup.delay">0</stringProp>
<boolProp name="ThreadGroup.scheduler">true</boolProp>
<boolProp name="ThreadGroup.same_user_on_next_iteration">true</boolProp>
</ThreadGroup>
<hashTree>
<HeaderManager guiclass="HeaderPanel" testclass="HeaderManager" testname="JSON and bearer token" enabled="true">
<collectionProp name="HeaderManager.headers">
<elementProp name="" elementType="Header">
<stringProp name="Header.name">Content-Type</stringProp>
<stringProp name="Header.value">application/json</stringProp>
</elementProp>
<elementProp name="" elementType="Header">
<stringProp name="Header.name">Authorization</stringProp>
<stringProp name="Header.value">Bearer ${token}</stringProp>
</elementProp>
</collectionProp>
</HeaderManager>
<hashTree />
<OnceOnlyController guiclass="OnceOnlyControllerGui" testclass="OnceOnlyController" testname="Assign one account per user" enabled="true" />
<hashTree>
<JSR223Sampler guiclass="JSR223SamplerGui" testclass="JSR223Sampler" testname="Initialize user" enabled="true">
<stringProp name="scriptLanguage">groovy</stringProp>
<stringProp name="cacheKey">true</stringProp>
<stringProp name="filename" />
<stringProp name="parameters" />
<stringProp name="script">def rows = new File(props.get('users_file')).readLines('UTF-8').drop(1).findAll { it.trim() }
def row = rows[ctx.getThreadNum()].split(',', -1)
vars.put('account_id', row[0]); vars.put('password', row[1]); vars.put('patient_id', row[2])
vars.put('token', ''); vars.put('expires_at', '0'); vars.put('session_number','0')
vars.putObject('user_random', new Random(Long.parseLong(props.getProperty('random_seed','42')) + ctx.getThreadNum()))
synchronized(props) {
if (props.get('timeline_file') &amp;&amp; !props.get('workload_start_ms')) {
long start = System.currentTimeMillis()
long measurement = start + Long.parseLong(props.getProperty('warmup_seconds','1800')) * 1000
long end = measurement + Long.parseLong(props.getProperty('duration_seconds','14400')) * 1000
props.put('workload_start_ms',start.toString())
new File(props.get('timeline_file')).text = groovy.json.JsonOutput.toJson([warmup_start_ms:start,measurement_start_ms:measurement,measurement_end_ms:end])
}
}
</stringProp>
</JSR223Sampler>
<hashTree />
</hashTree>
<JSR223Sampler guiclass="JSR223SamplerGui" testclass="JSR223Sampler" testname="Prepare session" enabled="true">
<stringProp name="scriptLanguage">groovy</stringProp>
<stringProp name="cacheKey">true</stringProp>
<stringProp name="filename" />
<stringProp name="parameters" />
<stringProp name="script">def now = java.time.Instant.now()
vars.put('refresh_login', (now.epochSecond &gt;= Long.parseLong(vars.get('expires_at')) - 60).toString())
vars.put('login_body',groovy.json.JsonOutput.toJson([accountId:vars.get('account_id'),password:vars.get('password')]))
vars.put('period_from',props.get('period_from')); vars.put('period_to',props.get('period_to'))
int n = Integer.parseInt(vars.get('session_number')); vars.put('session_number',(n+1).toString())
// Random session mix: expected 65% review, 30% recording, 5% correction.
int slot = vars.getObject('user_random').nextInt(20)
vars.put('session_kind',slot &lt; 13 ? 'review' : slot &lt; 19 ? 'recording' : 'correction')
double mean = Double.parseDouble(props.getProperty('session_pause_ms','120000'))
double deviation = Double.parseDouble(props.getProperty('session_stddev_ms','30000'))
vars.put('session_delay_ms',Math.max(0L,Math.round(mean + vars.getObject('user_random').nextGaussian()*deviation)).toString())
vars.put('observation_body',groovy.json.JsonOutput.toJson([measuredAt:now.toString(),systolic:128+(n%7),diastolic:82+(n%4),pulse:68+(n%6),measurementContext:[setting:'Home',activityCondition:'AtRest',restDurationMinutes:5,bodyPosition:'Seated'],note:'Synthetic JMeter energy workload']))
</stringProp>
</JSR223Sampler>
<hashTree />
<IfController guiclass="IfControllerPanel" testclass="IfController" testname="Login or renew expired token" enabled="true">
<stringProp name="IfController.condition">${refresh_login}</stringProp>
<boolProp name="IfController.evaluateAll">false</boolProp>
<boolProp name="IfController.useExpression">true</boolProp>
</IfController>
<hashTree>
<HTTPSamplerProxy guiclass="HttpTestSampleGui" testclass="HTTPSamplerProxy" testname="HTTP Login" enabled="true">
<elementProp name="HTTPsampler.Arguments" elementType="Arguments" guiclass="HTTPArgumentsPanel" testclass="Arguments" enabled="true">
<collectionProp name="Arguments.arguments">
<elementProp name="" elementType="HTTPArgument">
<boolProp name="HTTPArgument.always_encode">false</boolProp>
<stringProp name="Argument.value">${login_body}</stringProp>
<stringProp name="Argument.metadata">=</stringProp>
</elementProp>
</collectionProp>
</elementProp>
<stringProp name="HTTPSampler.domain">${__P(host,127.0.0.1)}</stringProp>
<stringProp name="HTTPSampler.port">${__P(port,5443)}</stringProp>
<stringProp name="HTTPSampler.protocol">https</stringProp>
<stringProp name="HTTPSampler.path">/api/authentication/login</stringProp>
<stringProp name="HTTPSampler.method">POST</stringProp>
<stringProp name="HTTPSampler.implementation">HttpClient4</stringProp>
<stringProp name="HTTPSampler.connect_timeout">10000</stringProp>
<stringProp name="HTTPSampler.response_timeout">30000</stringProp>
<boolProp name="HTTPSampler.postBodyRaw">true</boolProp>
<boolProp name="HTTPSampler.follow_redirects">false</boolProp>
<boolProp name="HTTPSampler.auto_redirects">false</boolProp>
<boolProp name="HTTPSampler.use_keepalive">true</boolProp>
<boolProp name="HTTPSampler.DO_MULTIPART_POST">false</boolProp>
</HTTPSamplerProxy>
<hashTree>
<JSR223Assertion guiclass="JSR223AssertionGui" testclass="JSR223Assertion" testname="Expected response" enabled="true">
<stringProp name="scriptLanguage">groovy</stringProp>
<stringProp name="cacheKey">true</stringProp>
<stringProp name="filename" />
<stringProp name="parameters" />
<stringProp name="script">if (prev.getResponseCode() != '200') {
AssertionResult.setFailure(true); AssertionResult.setFailureMessage('Unexpected HTTP status: '+prev.getResponseCode()); return
}
// Expected negative outcomes (e.g. deletion confirmed with 404) are successful checks.
prev.setSuccessful(true)
def json = new groovy.json.JsonSlurper().parseText(prev.getResponseDataAsString())
assert json.accessToken; vars.put('token',json.accessToken); vars.put('expires_at',(java.time.Instant.now().epochSecond + (json.expiresIn as long)).toString())
</stringProp>
</JSR223Assertion>
<hashTree />
<JSR223Timer guiclass="JSR223TimerGui" testclass="JSR223Timer" testname="Gaussian interaction pause" enabled="true">
<stringProp name="scriptLanguage">groovy</stringProp>
<stringProp name="cacheKey">true</stringProp>
<stringProp name="filename" />
<stringProp name="parameters" />
<stringProp name="script">def rng = vars.getObject('user_random')
double mean = Double.parseDouble(props.getProperty('think_mean_ms','1000'))
double deviation = Double.parseDouble(props.getProperty('think_stddev_ms','250'))
double minimum = Double.parseDouble(props.getProperty('think_min_ms','500'))
// Symmetric truncation keeps the expected mean at the configured value.
double maximum = 2 * mean - minimum
if (deviation == 0 || maximum == minimum) return Math.round(mean)
double delay
while (true) {
delay = mean + rng.nextGaussian() * deviation
if (delay &gt;= minimum &amp;&amp; delay &lt;= maximum) return Math.round(delay)
}
</stringProp>
</JSR223Timer>
<hashTree />
</hashTree>
</hashTree>
<HTTPSamplerProxy guiclass="HttpTestSampleGui" testclass="HTTPSamplerProxy" testname="HTTP Measurement guidance" enabled="true">
<elementProp name="HTTPsampler.Arguments" elementType="Arguments" guiclass="HTTPArgumentsPanel" testclass="Arguments" enabled="true">
<collectionProp name="Arguments.arguments" />
</elementProp>
<stringProp name="HTTPSampler.domain">${__P(host,127.0.0.1)}</stringProp>
<stringProp name="HTTPSampler.port">${__P(port,5443)}</stringProp>
<stringProp name="HTTPSampler.protocol">https</stringProp>
<stringProp name="HTTPSampler.path">/api/measurement-guidance?setting=Home&amp;activityCondition=AtRest</stringProp>
<stringProp name="HTTPSampler.method">GET</stringProp>
<stringProp name="HTTPSampler.implementation">HttpClient4</stringProp>
<stringProp name="HTTPSampler.connect_timeout">10000</stringProp>
<stringProp name="HTTPSampler.response_timeout">30000</stringProp>
<boolProp name="HTTPSampler.postBodyRaw">false</boolProp>
<boolProp name="HTTPSampler.follow_redirects">false</boolProp>
<boolProp name="HTTPSampler.auto_redirects">false</boolProp>
<boolProp name="HTTPSampler.use_keepalive">true</boolProp>
<boolProp name="HTTPSampler.DO_MULTIPART_POST">false</boolProp>
</HTTPSamplerProxy>
<hashTree>
<JSR223Assertion guiclass="JSR223AssertionGui" testclass="JSR223Assertion" testname="Expected response" enabled="true">
<stringProp name="scriptLanguage">groovy</stringProp>
<stringProp name="cacheKey">true</stringProp>
<stringProp name="filename" />
<stringProp name="parameters" />
<stringProp name="script">if (prev.getResponseCode() != '200') {
AssertionResult.setFailure(true); AssertionResult.setFailureMessage('Unexpected HTTP status: '+prev.getResponseCode()); return
}
// Expected negative outcomes (e.g. deletion confirmed with 404) are successful checks.
prev.setSuccessful(true)
</stringProp>
</JSR223Assertion>
<hashTree />
<JSR223Timer guiclass="JSR223TimerGui" testclass="JSR223Timer" testname="Gaussian interaction pause" enabled="true">
<stringProp name="scriptLanguage">groovy</stringProp>
<stringProp name="cacheKey">true</stringProp>
<stringProp name="filename" />
<stringProp name="parameters" />
<stringProp name="script">def rng = vars.getObject('user_random')
double mean = Double.parseDouble(props.getProperty('think_mean_ms','1000'))
double deviation = Double.parseDouble(props.getProperty('think_stddev_ms','250'))
double minimum = Double.parseDouble(props.getProperty('think_min_ms','500'))
// Symmetric truncation keeps the expected mean at the configured value.
double maximum = 2 * mean - minimum
if (deviation == 0 || maximum == minimum) return Math.round(mean)
double delay
while (true) {
delay = mean + rng.nextGaussian() * deviation
if (delay &gt;= minimum &amp;&amp; delay &lt;= maximum) return Math.round(delay)
}
</stringProp>
</JSR223Timer>
<hashTree />
</hashTree>
<HTTPSamplerProxy guiclass="HttpTestSampleGui" testclass="HTTPSamplerProxy" testname="HTTP Read own profile" enabled="true">
<elementProp name="HTTPsampler.Arguments" elementType="Arguments" guiclass="HTTPArgumentsPanel" testclass="Arguments" enabled="true">
<collectionProp name="Arguments.arguments" />
</elementProp>
<stringProp name="HTTPSampler.domain">${__P(host,127.0.0.1)}</stringProp>
<stringProp name="HTTPSampler.port">${__P(port,5443)}</stringProp>
<stringProp name="HTTPSampler.protocol">https</stringProp>
<stringProp name="HTTPSampler.path">/api/patients/me</stringProp>
<stringProp name="HTTPSampler.method">GET</stringProp>
<stringProp name="HTTPSampler.implementation">HttpClient4</stringProp>
<stringProp name="HTTPSampler.connect_timeout">10000</stringProp>
<stringProp name="HTTPSampler.response_timeout">30000</stringProp>
<boolProp name="HTTPSampler.postBodyRaw">false</boolProp>
<boolProp name="HTTPSampler.follow_redirects">false</boolProp>
<boolProp name="HTTPSampler.auto_redirects">false</boolProp>
<boolProp name="HTTPSampler.use_keepalive">true</boolProp>
<boolProp name="HTTPSampler.DO_MULTIPART_POST">false</boolProp>
</HTTPSamplerProxy>
<hashTree>
<JSR223Assertion guiclass="JSR223AssertionGui" testclass="JSR223Assertion" testname="Expected response" enabled="true">
<stringProp name="scriptLanguage">groovy</stringProp>
<stringProp name="cacheKey">true</stringProp>
<stringProp name="filename" />
<stringProp name="parameters" />
<stringProp name="script">if (prev.getResponseCode() != '200') {
AssertionResult.setFailure(true); AssertionResult.setFailureMessage('Unexpected HTTP status: '+prev.getResponseCode()); return
}
// Expected negative outcomes (e.g. deletion confirmed with 404) are successful checks.
prev.setSuccessful(true)
def json = new groovy.json.JsonSlurper().parseText(prev.getResponseDataAsString())
assert json.patientId == vars.get('patient_id')
</stringProp>
</JSR223Assertion>
<hashTree />
<JSR223Timer guiclass="JSR223TimerGui" testclass="JSR223Timer" testname="Gaussian interaction pause" enabled="true">
<stringProp name="scriptLanguage">groovy</stringProp>
<stringProp name="cacheKey">true</stringProp>
<stringProp name="filename" />
<stringProp name="parameters" />
<stringProp name="script">def rng = vars.getObject('user_random')
double mean = Double.parseDouble(props.getProperty('think_mean_ms','1000'))
double deviation = Double.parseDouble(props.getProperty('think_stddev_ms','250'))
double minimum = Double.parseDouble(props.getProperty('think_min_ms','500'))
// Symmetric truncation keeps the expected mean at the configured value.
double maximum = 2 * mean - minimum
if (deviation == 0 || maximum == minimum) return Math.round(mean)
double delay
while (true) {
delay = mean + rng.nextGaussian() * deviation
if (delay &gt;= minimum &amp;&amp; delay &lt;= maximum) return Math.round(delay)
}
</stringProp>
</JSR223Timer>
<hashTree />
</hashTree>
<HTTPSamplerProxy guiclass="HttpTestSampleGui" testclass="HTTPSamplerProxy" testname="HTTP Record synthetic measurement" enabled="true">
<elementProp name="HTTPsampler.Arguments" elementType="Arguments" guiclass="HTTPArgumentsPanel" testclass="Arguments" enabled="true">
<collectionProp name="Arguments.arguments">
<elementProp name="" elementType="HTTPArgument">
<boolProp name="HTTPArgument.always_encode">false</boolProp>
<stringProp name="Argument.value">${observation_body}</stringProp>
<stringProp name="Argument.metadata">=</stringProp>
</elementProp>
</collectionProp>
</elementProp>
<stringProp name="HTTPSampler.domain">${__P(host,127.0.0.1)}</stringProp>
<stringProp name="HTTPSampler.port">${__P(port,5443)}</stringProp>
<stringProp name="HTTPSampler.protocol">https</stringProp>
<stringProp name="HTTPSampler.path">/api/patients/${patient_id}/observations</stringProp>
<stringProp name="HTTPSampler.method">POST</stringProp>
<stringProp name="HTTPSampler.implementation">HttpClient4</stringProp>
<stringProp name="HTTPSampler.connect_timeout">10000</stringProp>
<stringProp name="HTTPSampler.response_timeout">30000</stringProp>
<boolProp name="HTTPSampler.postBodyRaw">true</boolProp>
<boolProp name="HTTPSampler.follow_redirects">false</boolProp>
<boolProp name="HTTPSampler.auto_redirects">false</boolProp>
<boolProp name="HTTPSampler.use_keepalive">true</boolProp>
<boolProp name="HTTPSampler.DO_MULTIPART_POST">false</boolProp>
</HTTPSamplerProxy>
<hashTree>
<JSR223Assertion guiclass="JSR223AssertionGui" testclass="JSR223Assertion" testname="Expected response" enabled="true">
<stringProp name="scriptLanguage">groovy</stringProp>
<stringProp name="cacheKey">true</stringProp>
<stringProp name="filename" />
<stringProp name="parameters" />
<stringProp name="script">if (prev.getResponseCode() != '201') {
AssertionResult.setFailure(true); AssertionResult.setFailureMessage('Unexpected HTTP status: '+prev.getResponseCode()); return
}
// Expected negative outcomes (e.g. deletion confirmed with 404) are successful checks.
prev.setSuccessful(true)
def json = new groovy.json.JsonSlurper().parseText(prev.getResponseDataAsString())
assert json.patientId == vars.get('patient_id'); assert json.observationId; vars.put('observation_id',json.observationId)
</stringProp>
</JSR223Assertion>
<hashTree />
<JSR223Timer guiclass="JSR223TimerGui" testclass="JSR223Timer" testname="Gaussian interaction pause" enabled="true">
<stringProp name="scriptLanguage">groovy</stringProp>
<stringProp name="cacheKey">true</stringProp>
<stringProp name="filename" />
<stringProp name="parameters" />
<stringProp name="script">def rng = vars.getObject('user_random')
double mean = Double.parseDouble(props.getProperty('think_mean_ms','1000'))
double deviation = Double.parseDouble(props.getProperty('think_stddev_ms','250'))
double minimum = Double.parseDouble(props.getProperty('think_min_ms','500'))
// Symmetric truncation keeps the expected mean at the configured value.
double maximum = 2 * mean - minimum
if (deviation == 0 || maximum == minimum) return Math.round(mean)
double delay
while (true) {
delay = mean + rng.nextGaussian() * deviation
if (delay &gt;= minimum &amp;&amp; delay &lt;= maximum) return Math.round(delay)
}
</stringProp>
</JSR223Timer>
<hashTree />
</hashTree>
<HTTPSamplerProxy guiclass="HttpTestSampleGui" testclass="HTTPSamplerProxy" testname="HTTP Correct entry and context" enabled="true">
<elementProp name="HTTPsampler.Arguments" elementType="Arguments" guiclass="HTTPArgumentsPanel" testclass="Arguments" enabled="true">
<collectionProp name="Arguments.arguments">
<elementProp name="" elementType="HTTPArgument">
<boolProp name="HTTPArgument.always_encode">false</boolProp>
<stringProp name="Argument.value">{"systolic":128,"measurementContext":{"additionalCircumstances":"Corrected synthetic entry"}}</stringProp>
<stringProp name="Argument.metadata">=</stringProp>
</elementProp>
</collectionProp>
</elementProp>
<stringProp name="HTTPSampler.domain">${__P(host,127.0.0.1)}</stringProp>
<stringProp name="HTTPSampler.port">${__P(port,5443)}</stringProp>
<stringProp name="HTTPSampler.protocol">https</stringProp>
<stringProp name="HTTPSampler.path">/api/observations/${observation_id}</stringProp>
<stringProp name="HTTPSampler.method">PATCH</stringProp>
<stringProp name="HTTPSampler.implementation">HttpClient4</stringProp>
<stringProp name="HTTPSampler.connect_timeout">10000</stringProp>
<stringProp name="HTTPSampler.response_timeout">30000</stringProp>
<boolProp name="HTTPSampler.postBodyRaw">true</boolProp>
<boolProp name="HTTPSampler.follow_redirects">false</boolProp>
<boolProp name="HTTPSampler.auto_redirects">false</boolProp>
<boolProp name="HTTPSampler.use_keepalive">true</boolProp>
<boolProp name="HTTPSampler.DO_MULTIPART_POST">false</boolProp>
</HTTPSamplerProxy>
<hashTree>
<JSR223Assertion guiclass="JSR223AssertionGui" testclass="JSR223Assertion" testname="Expected response" enabled="true">
<stringProp name="scriptLanguage">groovy</stringProp>
<stringProp name="cacheKey">true</stringProp>
<stringProp name="filename" />
<stringProp name="parameters" />
<stringProp name="script">if (prev.getResponseCode() != '200') {
AssertionResult.setFailure(true); AssertionResult.setFailureMessage('Unexpected HTTP status: '+prev.getResponseCode()); return
}
// Expected negative outcomes (e.g. deletion confirmed with 404) are successful checks.
prev.setSuccessful(true)
def json = new groovy.json.JsonSlurper().parseText(prev.getResponseDataAsString())
assert json.systolic == 128
</stringProp>
</JSR223Assertion>
<hashTree />
<JSR223Timer guiclass="JSR223TimerGui" testclass="JSR223Timer" testname="Gaussian interaction pause" enabled="true">
<stringProp name="scriptLanguage">groovy</stringProp>
<stringProp name="cacheKey">true</stringProp>
<stringProp name="filename" />
<stringProp name="parameters" />
<stringProp name="script">def rng = vars.getObject('user_random')
double mean = Double.parseDouble(props.getProperty('think_mean_ms','1000'))
double deviation = Double.parseDouble(props.getProperty('think_stddev_ms','250'))
double minimum = Double.parseDouble(props.getProperty('think_min_ms','500'))
// Symmetric truncation keeps the expected mean at the configured value.
double maximum = 2 * mean - minimum
if (deviation == 0 || maximum == minimum) return Math.round(mean)
double delay
while (true) {
delay = mean + rng.nextGaussian() * deviation
if (delay &gt;= minimum &amp;&amp; delay &lt;= maximum) return Math.round(delay)
}
</stringProp>
</JSR223Timer>
<hashTree />
</hashTree>
<HTTPSamplerProxy guiclass="HttpTestSampleGui" testclass="HTTPSamplerProxy" testname="HTTP Confirm saved reading" enabled="true">
<elementProp name="HTTPsampler.Arguments" elementType="Arguments" guiclass="HTTPArgumentsPanel" testclass="Arguments" enabled="true">
<collectionProp name="Arguments.arguments" />
</elementProp>
<stringProp name="HTTPSampler.domain">${__P(host,127.0.0.1)}</stringProp>
<stringProp name="HTTPSampler.port">${__P(port,5443)}</stringProp>
<stringProp name="HTTPSampler.protocol">https</stringProp>
<stringProp name="HTTPSampler.path">/api/observations/${observation_id}</stringProp>
<stringProp name="HTTPSampler.method">GET</stringProp>
<stringProp name="HTTPSampler.implementation">HttpClient4</stringProp>
<stringProp name="HTTPSampler.connect_timeout">10000</stringProp>
<stringProp name="HTTPSampler.response_timeout">30000</stringProp>
<boolProp name="HTTPSampler.postBodyRaw">false</boolProp>
<boolProp name="HTTPSampler.follow_redirects">false</boolProp>
<boolProp name="HTTPSampler.auto_redirects">false</boolProp>
<boolProp name="HTTPSampler.use_keepalive">true</boolProp>
<boolProp name="HTTPSampler.DO_MULTIPART_POST">false</boolProp>
</HTTPSamplerProxy>
<hashTree>
<JSR223Assertion guiclass="JSR223AssertionGui" testclass="JSR223Assertion" testname="Expected response" enabled="true">
<stringProp name="scriptLanguage">groovy</stringProp>
<stringProp name="cacheKey">true</stringProp>
<stringProp name="filename" />
<stringProp name="parameters" />
<stringProp name="script">if (prev.getResponseCode() != '200') {
AssertionResult.setFailure(true); AssertionResult.setFailureMessage('Unexpected HTTP status: '+prev.getResponseCode()); return
}
// Expected negative outcomes (e.g. deletion confirmed with 404) are successful checks.
prev.setSuccessful(true)
def json = new groovy.json.JsonSlurper().parseText(prev.getResponseDataAsString())
assert json.observationId == vars.get('observation_id')
</stringProp>
</JSR223Assertion>
<hashTree />
<JSR223Timer guiclass="JSR223TimerGui" testclass="JSR223Timer" testname="Gaussian interaction pause" enabled="true">
<stringProp name="scriptLanguage">groovy</stringProp>
<stringProp name="cacheKey">true</stringProp>
<stringProp name="filename" />
<stringProp name="parameters" />
<stringProp name="script">def rng = vars.getObject('user_random')
double mean = Double.parseDouble(props.getProperty('think_mean_ms','1000'))
double deviation = Double.parseDouble(props.getProperty('think_stddev_ms','250'))
double minimum = Double.parseDouble(props.getProperty('think_min_ms','500'))
// Symmetric truncation keeps the expected mean at the configured value.
double maximum = 2 * mean - minimum
if (deviation == 0 || maximum == minimum) return Math.round(mean)
double delay
while (true) {
delay = mean + rng.nextGaussian() * deviation
if (delay &gt;= minimum &amp;&amp; delay &lt;= maximum) return Math.round(delay)
}
</stringProp>
</JSR223Timer>
<hashTree />
</hashTree>
<HTTPSamplerProxy guiclass="HttpTestSampleGui" testclass="HTTPSamplerProxy" testname="HTTP Health overview" enabled="true">
<elementProp name="HTTPsampler.Arguments" elementType="Arguments" guiclass="HTTPArgumentsPanel" testclass="Arguments" enabled="true">
<collectionProp name="Arguments.arguments" />
</elementProp>
<stringProp name="HTTPSampler.domain">${__P(host,127.0.0.1)}</stringProp>
<stringProp name="HTTPSampler.port">${__P(port,5443)}</stringProp>
<stringProp name="HTTPSampler.protocol">https</stringProp>
<stringProp name="HTTPSampler.path">/api/patients/${patient_id}/overview?from=${period_from}&amp;to=${period_to}</stringProp>
<stringProp name="HTTPSampler.method">GET</stringProp>
<stringProp name="HTTPSampler.implementation">HttpClient4</stringProp>
<stringProp name="HTTPSampler.connect_timeout">10000</stringProp>
<stringProp name="HTTPSampler.response_timeout">30000</stringProp>
<boolProp name="HTTPSampler.postBodyRaw">false</boolProp>
<boolProp name="HTTPSampler.follow_redirects">false</boolProp>
<boolProp name="HTTPSampler.auto_redirects">false</boolProp>
<boolProp name="HTTPSampler.use_keepalive">true</boolProp>
<boolProp name="HTTPSampler.DO_MULTIPART_POST">false</boolProp>
</HTTPSamplerProxy>
<hashTree>
<JSR223Assertion guiclass="JSR223AssertionGui" testclass="JSR223Assertion" testname="Expected response" enabled="true">
<stringProp name="scriptLanguage">groovy</stringProp>
<stringProp name="cacheKey">true</stringProp>
<stringProp name="filename" />
<stringProp name="parameters" />
<stringProp name="script">if (prev.getResponseCode() != '200') {
AssertionResult.setFailure(true); AssertionResult.setFailureMessage('Unexpected HTTP status: '+prev.getResponseCode()); return
}
// Expected negative outcomes (e.g. deletion confirmed with 404) are successful checks.
prev.setSuccessful(true)
def json = new groovy.json.JsonSlurper().parseText(prev.getResponseDataAsString())
assert json.patient.patientId == vars.get('patient_id'); assert json.latestObservation != null; assert json.insight != null
</stringProp>
</JSR223Assertion>
<hashTree />
<JSR223Timer guiclass="JSR223TimerGui" testclass="JSR223Timer" testname="Gaussian interaction pause" enabled="true">
<stringProp name="scriptLanguage">groovy</stringProp>
<stringProp name="cacheKey">true</stringProp>
<stringProp name="filename" />
<stringProp name="parameters" />
<stringProp name="script">def rng = vars.getObject('user_random')
double mean = Double.parseDouble(props.getProperty('think_mean_ms','1000'))
double deviation = Double.parseDouble(props.getProperty('think_stddev_ms','250'))
double minimum = Double.parseDouble(props.getProperty('think_min_ms','500'))
// Symmetric truncation keeps the expected mean at the configured value.
double maximum = 2 * mean - minimum
if (deviation == 0 || maximum == minimum) return Math.round(mean)
double delay
while (true) {
delay = mean + rng.nextGaussian() * deviation
if (delay &gt;= minimum &amp;&amp; delay &lt;= maximum) return Math.round(delay)
}
</stringProp>
</JSR223Timer>
<hashTree />
</hashTree>
<HTTPSamplerProxy guiclass="HttpTestSampleGui" testclass="HTTPSamplerProxy" testname="HTTP Remove duplicate test entry" enabled="true">
<elementProp name="HTTPsampler.Arguments" elementType="Arguments" guiclass="HTTPArgumentsPanel" testclass="Arguments" enabled="true">
<collectionProp name="Arguments.arguments" />
</elementProp>
<stringProp name="HTTPSampler.domain">${__P(host,127.0.0.1)}</stringProp>
<stringProp name="HTTPSampler.port">${__P(port,5443)}</stringProp>
<stringProp name="HTTPSampler.protocol">https</stringProp>
<stringProp name="HTTPSampler.path">/api/observations/${observation_id}</stringProp>
<stringProp name="HTTPSampler.method">DELETE</stringProp>
<stringProp name="HTTPSampler.implementation">HttpClient4</stringProp>
<stringProp name="HTTPSampler.connect_timeout">10000</stringProp>
<stringProp name="HTTPSampler.response_timeout">30000</stringProp>
<boolProp name="HTTPSampler.postBodyRaw">false</boolProp>
<boolProp name="HTTPSampler.follow_redirects">false</boolProp>
<boolProp name="HTTPSampler.auto_redirects">false</boolProp>
<boolProp name="HTTPSampler.use_keepalive">true</boolProp>
<boolProp name="HTTPSampler.DO_MULTIPART_POST">false</boolProp>
</HTTPSamplerProxy>
<hashTree>
<JSR223Assertion guiclass="JSR223AssertionGui" testclass="JSR223Assertion" testname="Expected response" enabled="true">
<stringProp name="scriptLanguage">groovy</stringProp>
<stringProp name="cacheKey">true</stringProp>
<stringProp name="filename" />
<stringProp name="parameters" />
<stringProp name="script">if (prev.getResponseCode() != '204') {
AssertionResult.setFailure(true); AssertionResult.setFailureMessage('Unexpected HTTP status: '+prev.getResponseCode()); return
}
// Expected negative outcomes (e.g. deletion confirmed with 404) are successful checks.
prev.setSuccessful(true)
</stringProp>
</JSR223Assertion>
<hashTree />
<JSR223Timer guiclass="JSR223TimerGui" testclass="JSR223Timer" testname="Gaussian interaction pause" enabled="true">
<stringProp name="scriptLanguage">groovy</stringProp>
<stringProp name="cacheKey">true</stringProp>
<stringProp name="filename" />
<stringProp name="parameters" />
<stringProp name="script">def rng = vars.getObject('user_random')
double mean = Double.parseDouble(props.getProperty('think_mean_ms','1000'))
double deviation = Double.parseDouble(props.getProperty('think_stddev_ms','250'))
double minimum = Double.parseDouble(props.getProperty('think_min_ms','500'))
// Symmetric truncation keeps the expected mean at the configured value.
double maximum = 2 * mean - minimum
if (deviation == 0 || maximum == minimum) return Math.round(mean)
double delay
while (true) {
delay = mean + rng.nextGaussian() * deviation
if (delay &gt;= minimum &amp;&amp; delay &lt;= maximum) return Math.round(delay)
}
</stringProp>
</JSR223Timer>
<hashTree />
</hashTree>
<HTTPSamplerProxy guiclass="HttpTestSampleGui" testclass="HTTPSamplerProxy" testname="HTTP Confirm removal" enabled="true">
<elementProp name="HTTPsampler.Arguments" elementType="Arguments" guiclass="HTTPArgumentsPanel" testclass="Arguments" enabled="true">
<collectionProp name="Arguments.arguments" />
</elementProp>
<stringProp name="HTTPSampler.domain">${__P(host,127.0.0.1)}</stringProp>
<stringProp name="HTTPSampler.port">${__P(port,5443)}</stringProp>
<stringProp name="HTTPSampler.protocol">https</stringProp>
<stringProp name="HTTPSampler.path">/api/observations/${observation_id}</stringProp>
<stringProp name="HTTPSampler.method">GET</stringProp>
<stringProp name="HTTPSampler.implementation">HttpClient4</stringProp>
<stringProp name="HTTPSampler.connect_timeout">10000</stringProp>
<stringProp name="HTTPSampler.response_timeout">30000</stringProp>
<boolProp name="HTTPSampler.postBodyRaw">false</boolProp>
<boolProp name="HTTPSampler.follow_redirects">false</boolProp>
<boolProp name="HTTPSampler.auto_redirects">false</boolProp>
<boolProp name="HTTPSampler.use_keepalive">true</boolProp>
<boolProp name="HTTPSampler.DO_MULTIPART_POST">false</boolProp>
</HTTPSamplerProxy>
<hashTree>
<JSR223Assertion guiclass="JSR223AssertionGui" testclass="JSR223Assertion" testname="Expected response" enabled="true">
<stringProp name="scriptLanguage">groovy</stringProp>
<stringProp name="cacheKey">true</stringProp>
<stringProp name="filename" />
<stringProp name="parameters" />
<stringProp name="script">if (prev.getResponseCode() != '404') {
AssertionResult.setFailure(true); AssertionResult.setFailureMessage('Unexpected HTTP status: '+prev.getResponseCode()); return
}
// Expected negative outcomes (e.g. deletion confirmed with 404) are successful checks.
prev.setSuccessful(true)
</stringProp>
</JSR223Assertion>
<hashTree />
<JSR223Timer guiclass="JSR223TimerGui" testclass="JSR223Timer" testname="Gaussian interaction pause" enabled="true">
<stringProp name="scriptLanguage">groovy</stringProp>
<stringProp name="cacheKey">true</stringProp>
<stringProp name="filename" />
<stringProp name="parameters" />
<stringProp name="script">def rng = vars.getObject('user_random')
double mean = Double.parseDouble(props.getProperty('think_mean_ms','1000'))
double deviation = Double.parseDouble(props.getProperty('think_stddev_ms','250'))
double minimum = Double.parseDouble(props.getProperty('think_min_ms','500'))
// Symmetric truncation keeps the expected mean at the configured value.
double maximum = 2 * mean - minimum
if (deviation == 0 || maximum == minimum) return Math.round(mean)
double delay
while (true) {
delay = mean + rng.nextGaussian() * deviation
if (delay &gt;= minimum &amp;&amp; delay &lt;= maximum) return Math.round(delay)
}
</stringProp>
</JSR223Timer>
<hashTree />
</hashTree>
<TestAction guiclass="TestActionGui" testclass="TestAction" testname="Between-session pause" enabled="true">
<intProp name="ActionProcessor.action">1</intProp>
<intProp name="ActionProcessor.target">0</intProp>
<stringProp name="ActionProcessor.duration">${session_delay_ms}</stringProp>
</TestAction>
<hashTree />
</hashTree>
</hashTree>
</hashTree>
</jmeterTestPlan>
+184
View File
@@ -0,0 +1,184 @@
<?xml version='1.0' encoding='utf-8'?>
<jmeterTestPlan version="1.2" properties="5.0" jmeter="5.6.3">
<hashTree>
<TestPlan guiclass="TestPlanGui" testclass="TestPlan" testname="HealthApp energy: idle" enabled="true">
<stringProp name="TestPlan.comments">Synthetic closed-loop sessions; default duration four hours. Setup is external; Shelly power is collected live without changing the outlet.</stringProp>
<boolProp name="TestPlan.functional_mode">false</boolProp>
<boolProp name="TestPlan.serialize_threadgroups">false</boolProp>
<elementProp name="TestPlan.user_defined_variables" elementType="Arguments" guiclass="ArgumentsPanel" testclass="Arguments" enabled="true">
<collectionProp name="Arguments.arguments" />
</elementProp>
</TestPlan>
<hashTree>
<ThreadGroup guiclass="ThreadGroupGui" testclass="ThreadGroup" testname="Shelly live power" enabled="true">
<stringProp name="ThreadGroup.on_sample_error">continue</stringProp>
<elementProp name="ThreadGroup.main_controller" elementType="LoopController" guiclass="LoopControlPanel" testclass="LoopController" enabled="true">
<boolProp name="LoopController.continue_forever">false</boolProp>
<stringProp name="LoopController.loops">-1</stringProp>
</elementProp>
<stringProp name="ThreadGroup.num_threads">1</stringProp>
<stringProp name="ThreadGroup.ramp_time">0</stringProp>
<stringProp name="ThreadGroup.duration">${__P(total_duration_seconds,16210)}</stringProp>
<stringProp name="ThreadGroup.delay">0</stringProp>
<boolProp name="ThreadGroup.scheduler">true</boolProp>
</ThreadGroup>
<hashTree>
<HTTPSamplerProxy guiclass="HttpTestSampleGui" testclass="HTTPSamplerProxy" testname="POWER Shelly status" enabled="true">
<elementProp name="HTTPsampler.Arguments" elementType="Arguments">
<collectionProp name="Arguments.arguments" />
</elementProp>
<stringProp name="HTTPSampler.domain">${__P(shelly_host,192.168.1.44)}</stringProp>
<stringProp name="HTTPSampler.port">${__P(shelly_port,80)}</stringProp>
<stringProp name="HTTPSampler.protocol">http</stringProp>
<stringProp name="HTTPSampler.path">/rpc/Switch.GetStatus?id=${__P(shelly_switch_id,0)}</stringProp>
<stringProp name="HTTPSampler.method">GET</stringProp>
<stringProp name="HTTPSampler.implementation">HttpClient4</stringProp>
<stringProp name="HTTPSampler.connect_timeout">3000</stringProp>
<stringProp name="HTTPSampler.response_timeout">3000</stringProp>
<boolProp name="HTTPSampler.follow_redirects">false</boolProp>
<boolProp name="HTTPSampler.use_keepalive">true</boolProp>
</HTTPSamplerProxy>
<hashTree>
<JSR223Timer guiclass="JSR223TimerGui" testclass="JSR223Timer" testname="Fixed meter cadence" enabled="true">
<stringProp name="scriptLanguage">groovy</stringProp>
<stringProp name="cacheKey">true</stringProp>
<stringProp name="filename" />
<stringProp name="parameters" />
<stringProp name="script">if (!vars.get('shelly_last_poll_ms')) return 0L; return Math.max(0L, Long.parseLong(vars.get('shelly_last_poll_ms')) + Long.parseLong(props.getProperty('shelly_interval_ms','1000')) - System.currentTimeMillis())</stringProp>
</JSR223Timer>
<hashTree />
<JSR223PreProcessor guiclass="JSR223PreProcessorGui" testclass="JSR223PreProcessor" testname="Clear stale power values" enabled="true">
<stringProp name="scriptLanguage">groovy</stringProp>
<stringProp name="cacheKey">true</stringProp>
<stringProp name="filename" />
<stringProp name="parameters" />
<stringProp name="script">['shelly_power_watts','shelly_voltage_volts','shelly_current_amps','shelly_energy_wh'].each { vars.put(it,'') }</stringProp>
</JSR223PreProcessor>
<hashTree />
<JSR223Assertion guiclass="JSR223AssertionGui" testclass="JSR223Assertion" testname="Validate and extract plug readings" enabled="true">
<stringProp name="scriptLanguage">groovy</stringProp>
<stringProp name="cacheKey">true</stringProp>
<stringProp name="filename" />
<stringProp name="parameters" />
<stringProp name="script">vars.put('shelly_last_poll_ms',prev.getStartTime().toString())
try {
assert prev.getResponseCode() == '200'
def json=new groovy.json.JsonSlurper().parseText(prev.getResponseDataAsString())
assert json.output == true : 'Outlet is off'
def readings=[shelly_power_watts:json.apower,shelly_voltage_volts:json.voltage,shelly_current_amps:json.current,shelly_energy_wh:json.aenergy?.total]
readings.each { key,value -&gt; assert value instanceof Number &amp;&amp; Double.isFinite(value.doubleValue()) &amp;&amp; value &gt;= 0; vars.put(key,value.toString()) }
} catch (Throwable error) {
AssertionResult.setFailure(true);AssertionResult.setFailureMessage('Shelly status/measurement unavailable');prev.setSuccessful(false)
}
</stringProp>
</JSR223Assertion>
<hashTree />
</hashTree>
<ResultCollector guiclass="SimpleDataWriter" testclass="ResultCollector" testname="Shelly measurements saved live" enabled="true">
<stringProp name="filename">${__P(shelly_file,shelly.csv)}</stringProp>
<boolProp name="ResultCollector.error_logging">false</boolProp>
</ResultCollector>
<hashTree />
</hashTree>
<kg.apc.jmeter.perfmon.PerfMonCollector guiclass="kg.apc.jmeter.vizualizers.PerfMonGui" testclass="kg.apc.jmeter.perfmon.PerfMonCollector" testname="NUC live CPU RAM disk and network" enabled="true">
<stringProp name="filename">${__P(perfmon_file,perfmon.csv)}</stringProp>
<boolProp name="ResultCollector.error_logging">false</boolProp>
<collectionProp name="metricConnections">
<collectionProp name="0">
<stringProp name="0">${__P(perfmon_host,192.168.1.125)}</stringProp>
<stringProp name="1">${__P(perfmon_port,4444)}</stringProp>
<stringProp name="2">CPU</stringProp>
<stringProp name="3">combined</stringProp>
</collectionProp>
<collectionProp name="1">
<stringProp name="0">${__P(perfmon_host,192.168.1.125)}</stringProp>
<stringProp name="1">${__P(perfmon_port,4444)}</stringProp>
<stringProp name="2">CPU</stringProp>
<stringProp name="3">iowait</stringProp>
</collectionProp>
<collectionProp name="2">
<stringProp name="0">${__P(perfmon_host,192.168.1.125)}</stringProp>
<stringProp name="1">${__P(perfmon_port,4444)}</stringProp>
<stringProp name="2">Memory</stringProp>
<stringProp name="3">usedperc</stringProp>
</collectionProp>
<collectionProp name="3">
<stringProp name="0">${__P(perfmon_host,192.168.1.125)}</stringProp>
<stringProp name="1">${__P(perfmon_port,4444)}</stringProp>
<stringProp name="2">Memory</stringProp>
<stringProp name="3">actualused</stringProp>
</collectionProp>
<collectionProp name="4">
<stringProp name="0">${__P(perfmon_host,192.168.1.125)}</stringProp>
<stringProp name="1">${__P(perfmon_port,4444)}</stringProp>
<stringProp name="2">Swap</stringProp>
<stringProp name="3">used</stringProp>
</collectionProp>
<collectionProp name="5">
<stringProp name="0">${__P(perfmon_host,192.168.1.125)}</stringProp>
<stringProp name="1">${__P(perfmon_port,4444)}</stringProp>
<stringProp name="2">Disks I/O</stringProp>
<stringProp name="3">readbytes</stringProp>
</collectionProp>
<collectionProp name="6">
<stringProp name="0">${__P(perfmon_host,192.168.1.125)}</stringProp>
<stringProp name="1">${__P(perfmon_port,4444)}</stringProp>
<stringProp name="2">Disks I/O</stringProp>
<stringProp name="3">writebytes</stringProp>
</collectionProp>
<collectionProp name="7">
<stringProp name="0">${__P(perfmon_host,192.168.1.125)}</stringProp>
<stringProp name="1">${__P(perfmon_port,4444)}</stringProp>
<stringProp name="2">Network I/O</stringProp>
<stringProp name="3">bytesrecv</stringProp>
</collectionProp>
<collectionProp name="8">
<stringProp name="0">${__P(perfmon_host,192.168.1.125)}</stringProp>
<stringProp name="1">${__P(perfmon_port,4444)}</stringProp>
<stringProp name="2">Network I/O</stringProp>
<stringProp name="3">bytessent</stringProp>
</collectionProp>
</collectionProp>
</kg.apc.jmeter.perfmon.PerfMonCollector>
<hashTree />
<ThreadGroup guiclass="ThreadGroupGui" testclass="ThreadGroup" testname="Users" enabled="true">
<stringProp name="ThreadGroup.on_sample_error">stopthread</stringProp>
<elementProp name="ThreadGroup.main_controller" elementType="LoopController" guiclass="LoopControlPanel" testclass="LoopController" enabled="true">
<boolProp name="LoopController.continue_forever">false</boolProp>
<stringProp name="LoopController.loops">-1</stringProp>
</elementProp>
<stringProp name="ThreadGroup.num_threads">${__P(users,1)}</stringProp>
<stringProp name="ThreadGroup.ramp_time">${__P(ramp_seconds,60)}</stringProp>
<stringProp name="ThreadGroup.duration">${__P(total_duration_seconds,16210)}</stringProp>
<stringProp name="ThreadGroup.delay">0</stringProp>
<boolProp name="ThreadGroup.scheduler">true</boolProp>
<boolProp name="ThreadGroup.same_user_on_next_iteration">true</boolProp>
<stringProp name="ThreadGroup.num_threads">1</stringProp>
<stringProp name="ThreadGroup.ramp_time">0</stringProp>
</ThreadGroup>
<hashTree>
<OnceOnlyController guiclass="OnceOnlyControllerGui" testclass="OnceOnlyController" testname="Record idle measurement window" enabled="true" />
<hashTree>
<JSR223Sampler guiclass="JSR223SamplerGui" testclass="JSR223Sampler" testname="Idle timing" enabled="true">
<stringProp name="scriptLanguage">groovy</stringProp>
<stringProp name="cacheKey">true</stringProp>
<stringProp name="filename" />
<stringProp name="parameters" />
<stringProp name="script">long start=System.currentTimeMillis()
long measurement=start+Long.parseLong(props.getProperty('warmup_seconds','1800'))*1000
long end=measurement+Long.parseLong(props.getProperty('duration_seconds','14400'))*1000
if (props.get('timeline_file')) new File(props.get('timeline_file')).text=groovy.json.JsonOutput.toJson([warmup_start_ms:start,measurement_start_ms:measurement,measurement_end_ms:end])
</stringProp>
</JSR223Sampler>
<hashTree />
</hashTree>
<TestAction guiclass="TestActionGui" testclass="TestAction" testname="Idle wait; no application requests" enabled="true">
<intProp name="ActionProcessor.action">1</intProp>
<intProp name="ActionProcessor.target">0</intProp>
<stringProp name="ActionProcessor.duration">1000</stringProp>
</TestAction>
<hashTree />
</hashTree>
</hashTree>
</hashTree>
</jmeterTestPlan>
File diff suppressed because it is too large. Load diff
+678
View File
@@ -0,0 +1,678 @@
<?xml version='1.0' encoding='utf-8'?>
<jmeterTestPlan version="1.2" properties="5.0" jmeter="5.6.3">
<hashTree>
<TestPlan guiclass="TestPlanGui" testclass="TestPlan" testname="HealthApp energy: professional" enabled="true">
<stringProp name="TestPlan.comments">Synthetic closed-loop sessions; default duration four hours. Setup is external; Shelly power is collected live without changing the outlet.</stringProp>
<boolProp name="TestPlan.functional_mode">false</boolProp>
<boolProp name="TestPlan.serialize_threadgroups">false</boolProp>
<elementProp name="TestPlan.user_defined_variables" elementType="Arguments" guiclass="ArgumentsPanel" testclass="Arguments" enabled="true">
<collectionProp name="Arguments.arguments" />
</elementProp>
</TestPlan>
<hashTree>
<ThreadGroup guiclass="ThreadGroupGui" testclass="ThreadGroup" testname="Shelly live power" enabled="true">
<stringProp name="ThreadGroup.on_sample_error">continue</stringProp>
<elementProp name="ThreadGroup.main_controller" elementType="LoopController" guiclass="LoopControlPanel" testclass="LoopController" enabled="true">
<boolProp name="LoopController.continue_forever">false</boolProp>
<stringProp name="LoopController.loops">-1</stringProp>
</elementProp>
<stringProp name="ThreadGroup.num_threads">1</stringProp>
<stringProp name="ThreadGroup.ramp_time">0</stringProp>
<stringProp name="ThreadGroup.duration">${__P(total_duration_seconds,16210)}</stringProp>
<stringProp name="ThreadGroup.delay">0</stringProp>
<boolProp name="ThreadGroup.scheduler">true</boolProp>
</ThreadGroup>
<hashTree>
<HTTPSamplerProxy guiclass="HttpTestSampleGui" testclass="HTTPSamplerProxy" testname="POWER Shelly status" enabled="true">
<elementProp name="HTTPsampler.Arguments" elementType="Arguments">
<collectionProp name="Arguments.arguments" />
</elementProp>
<stringProp name="HTTPSampler.domain">${__P(shelly_host,192.168.1.44)}</stringProp>
<stringProp name="HTTPSampler.port">${__P(shelly_port,80)}</stringProp>
<stringProp name="HTTPSampler.protocol">http</stringProp>
<stringProp name="HTTPSampler.path">/rpc/Switch.GetStatus?id=${__P(shelly_switch_id,0)}</stringProp>
<stringProp name="HTTPSampler.method">GET</stringProp>
<stringProp name="HTTPSampler.implementation">HttpClient4</stringProp>
<stringProp name="HTTPSampler.connect_timeout">3000</stringProp>
<stringProp name="HTTPSampler.response_timeout">3000</stringProp>
<boolProp name="HTTPSampler.follow_redirects">false</boolProp>
<boolProp name="HTTPSampler.use_keepalive">true</boolProp>
</HTTPSamplerProxy>
<hashTree>
<JSR223Timer guiclass="JSR223TimerGui" testclass="JSR223Timer" testname="Fixed meter cadence" enabled="true">
<stringProp name="scriptLanguage">groovy</stringProp>
<stringProp name="cacheKey">true</stringProp>
<stringProp name="filename" />
<stringProp name="parameters" />
<stringProp name="script">if (!vars.get('shelly_last_poll_ms')) return 0L; return Math.max(0L, Long.parseLong(vars.get('shelly_last_poll_ms')) + Long.parseLong(props.getProperty('shelly_interval_ms','1000')) - System.currentTimeMillis())</stringProp>
</JSR223Timer>
<hashTree />
<JSR223PreProcessor guiclass="JSR223PreProcessorGui" testclass="JSR223PreProcessor" testname="Clear stale power values" enabled="true">
<stringProp name="scriptLanguage">groovy</stringProp>
<stringProp name="cacheKey">true</stringProp>
<stringProp name="filename" />
<stringProp name="parameters" />
<stringProp name="script">['shelly_power_watts','shelly_voltage_volts','shelly_current_amps','shelly_energy_wh'].each { vars.put(it,'') }</stringProp>
</JSR223PreProcessor>
<hashTree />
<JSR223Assertion guiclass="JSR223AssertionGui" testclass="JSR223Assertion" testname="Validate and extract plug readings" enabled="true">
<stringProp name="scriptLanguage">groovy</stringProp>
<stringProp name="cacheKey">true</stringProp>
<stringProp name="filename" />
<stringProp name="parameters" />
<stringProp name="script">vars.put('shelly_last_poll_ms',prev.getStartTime().toString())
try {
assert prev.getResponseCode() == '200'
def json=new groovy.json.JsonSlurper().parseText(prev.getResponseDataAsString())
assert json.output == true : 'Outlet is off'
def readings=[shelly_power_watts:json.apower,shelly_voltage_volts:json.voltage,shelly_current_amps:json.current,shelly_energy_wh:json.aenergy?.total]
readings.each { key,value -&gt; assert value instanceof Number &amp;&amp; Double.isFinite(value.doubleValue()) &amp;&amp; value &gt;= 0; vars.put(key,value.toString()) }
} catch (Throwable error) {
AssertionResult.setFailure(true);AssertionResult.setFailureMessage('Shelly status/measurement unavailable');prev.setSuccessful(false)
}
</stringProp>
</JSR223Assertion>
<hashTree />
</hashTree>
<ResultCollector guiclass="SimpleDataWriter" testclass="ResultCollector" testname="Shelly measurements saved live" enabled="true">
<stringProp name="filename">${__P(shelly_file,shelly.csv)}</stringProp>
<boolProp name="ResultCollector.error_logging">false</boolProp>
</ResultCollector>
<hashTree />
</hashTree>
<kg.apc.jmeter.perfmon.PerfMonCollector guiclass="kg.apc.jmeter.vizualizers.PerfMonGui" testclass="kg.apc.jmeter.perfmon.PerfMonCollector" testname="NUC live CPU RAM disk and network" enabled="true">
<stringProp name="filename">${__P(perfmon_file,perfmon.csv)}</stringProp>
<boolProp name="ResultCollector.error_logging">false</boolProp>
<collectionProp name="metricConnections">
<collectionProp name="0">
<stringProp name="0">${__P(perfmon_host,192.168.1.125)}</stringProp>
<stringProp name="1">${__P(perfmon_port,4444)}</stringProp>
<stringProp name="2">CPU</stringProp>
<stringProp name="3">combined</stringProp>
</collectionProp>
<collectionProp name="1">
<stringProp name="0">${__P(perfmon_host,192.168.1.125)}</stringProp>
<stringProp name="1">${__P(perfmon_port,4444)}</stringProp>
<stringProp name="2">CPU</stringProp>
<stringProp name="3">iowait</stringProp>
</collectionProp>
<collectionProp name="2">
<stringProp name="0">${__P(perfmon_host,192.168.1.125)}</stringProp>
<stringProp name="1">${__P(perfmon_port,4444)}</stringProp>
<stringProp name="2">Memory</stringProp>
<stringProp name="3">usedperc</stringProp>
</collectionProp>
<collectionProp name="3">
<stringProp name="0">${__P(perfmon_host,192.168.1.125)}</stringProp>
<stringProp name="1">${__P(perfmon_port,4444)}</stringProp>
<stringProp name="2">Memory</stringProp>
<stringProp name="3">actualused</stringProp>
</collectionProp>
<collectionProp name="4">
<stringProp name="0">${__P(perfmon_host,192.168.1.125)}</stringProp>
<stringProp name="1">${__P(perfmon_port,4444)}</stringProp>
<stringProp name="2">Swap</stringProp>
<stringProp name="3">used</stringProp>
</collectionProp>
<collectionProp name="5">
<stringProp name="0">${__P(perfmon_host,192.168.1.125)}</stringProp>
<stringProp name="1">${__P(perfmon_port,4444)}</stringProp>
<stringProp name="2">Disks I/O</stringProp>
<stringProp name="3">readbytes</stringProp>
</collectionProp>
<collectionProp name="6">
<stringProp name="0">${__P(perfmon_host,192.168.1.125)}</stringProp>
<stringProp name="1">${__P(perfmon_port,4444)}</stringProp>
<stringProp name="2">Disks I/O</stringProp>
<stringProp name="3">writebytes</stringProp>
</collectionProp>
<collectionProp name="7">
<stringProp name="0">${__P(perfmon_host,192.168.1.125)}</stringProp>
<stringProp name="1">${__P(perfmon_port,4444)}</stringProp>
<stringProp name="2">Network I/O</stringProp>
<stringProp name="3">bytesrecv</stringProp>
</collectionProp>
<collectionProp name="8">
<stringProp name="0">${__P(perfmon_host,192.168.1.125)}</stringProp>
<stringProp name="1">${__P(perfmon_port,4444)}</stringProp>
<stringProp name="2">Network I/O</stringProp>
<stringProp name="3">bytessent</stringProp>
</collectionProp>
</collectionProp>
</kg.apc.jmeter.perfmon.PerfMonCollector>
<hashTree />
<ThreadGroup guiclass="ThreadGroupGui" testclass="ThreadGroup" testname="Users" enabled="true">
<stringProp name="ThreadGroup.on_sample_error">stopthread</stringProp>
<elementProp name="ThreadGroup.main_controller" elementType="LoopController" guiclass="LoopControlPanel" testclass="LoopController" enabled="true">
<boolProp name="LoopController.continue_forever">false</boolProp>
<stringProp name="LoopController.loops">-1</stringProp>
</elementProp>
<stringProp name="ThreadGroup.num_threads">${__P(users,1)}</stringProp>
<stringProp name="ThreadGroup.ramp_time">${__P(ramp_seconds,60)}</stringProp>
<stringProp name="ThreadGroup.duration">${__P(total_duration_seconds,16210)}</stringProp>
<stringProp name="ThreadGroup.delay">0</stringProp>
<boolProp name="ThreadGroup.scheduler">true</boolProp>
<boolProp name="ThreadGroup.same_user_on_next_iteration">true</boolProp>
</ThreadGroup>
<hashTree>
<HeaderManager guiclass="HeaderPanel" testclass="HeaderManager" testname="JSON and bearer token" enabled="true">
<collectionProp name="HeaderManager.headers">
<elementProp name="" elementType="Header">
<stringProp name="Header.name">Content-Type</stringProp>
<stringProp name="Header.value">application/json</stringProp>
</elementProp>
<elementProp name="" elementType="Header">
<stringProp name="Header.name">Authorization</stringProp>
<stringProp name="Header.value">Bearer ${token}</stringProp>
</elementProp>
</collectionProp>
</HeaderManager>
<hashTree />
<OnceOnlyController guiclass="OnceOnlyControllerGui" testclass="OnceOnlyController" testname="Assign one account per user" enabled="true" />
<hashTree>
<JSR223Sampler guiclass="JSR223SamplerGui" testclass="JSR223Sampler" testname="Initialize user" enabled="true">
<stringProp name="scriptLanguage">groovy</stringProp>
<stringProp name="cacheKey">true</stringProp>
<stringProp name="filename" />
<stringProp name="parameters" />
<stringProp name="script">def rows = new File(props.get('users_file')).readLines('UTF-8').drop(1).findAll { it.trim() }
def row = rows[ctx.getThreadNum()].split(',', -1)
vars.put('account_id', row[0]); vars.put('password', row[1]); vars.put('patient_id', row[2])
vars.put('token', ''); vars.put('expires_at', '0'); vars.put('session_number','0')
vars.putObject('user_random', new Random(Long.parseLong(props.getProperty('random_seed','42')) + ctx.getThreadNum()))
synchronized(props) {
if (props.get('timeline_file') &amp;&amp; !props.get('workload_start_ms')) {
long start = System.currentTimeMillis()
long measurement = start + Long.parseLong(props.getProperty('warmup_seconds','1800')) * 1000
long end = measurement + Long.parseLong(props.getProperty('duration_seconds','14400')) * 1000
props.put('workload_start_ms',start.toString())
new File(props.get('timeline_file')).text = groovy.json.JsonOutput.toJson([warmup_start_ms:start,measurement_start_ms:measurement,measurement_end_ms:end])
}
}
</stringProp>
</JSR223Sampler>
<hashTree />
</hashTree>
<JSR223Sampler guiclass="JSR223SamplerGui" testclass="JSR223Sampler" testname="Prepare session" enabled="true">
<stringProp name="scriptLanguage">groovy</stringProp>
<stringProp name="cacheKey">true</stringProp>
<stringProp name="filename" />
<stringProp name="parameters" />
<stringProp name="script">def now = java.time.Instant.now()
vars.put('refresh_login', (now.epochSecond &gt;= Long.parseLong(vars.get('expires_at')) - 60).toString())
vars.put('login_body',groovy.json.JsonOutput.toJson([accountId:vars.get('account_id'),password:vars.get('password')]))
vars.put('period_from',props.get('period_from')); vars.put('period_to',props.get('period_to'))
int n = Integer.parseInt(vars.get('session_number')); vars.put('session_number',(n+1).toString())
// Random session mix: expected 65% review, 30% recording, 5% correction.
int slot = vars.getObject('user_random').nextInt(20)
vars.put('session_kind',slot &lt; 13 ? 'review' : slot &lt; 19 ? 'recording' : 'correction')
double mean = Double.parseDouble(props.getProperty('session_pause_ms','120000'))
double deviation = Double.parseDouble(props.getProperty('session_stddev_ms','30000'))
vars.put('session_delay_ms',Math.max(0L,Math.round(mean + vars.getObject('user_random').nextGaussian()*deviation)).toString())
vars.put('observation_body',groovy.json.JsonOutput.toJson([measuredAt:now.toString(),systolic:128+(n%7),diastolic:82+(n%4),pulse:68+(n%6),measurementContext:[setting:'Home',activityCondition:'AtRest',restDurationMinutes:5,bodyPosition:'Seated'],note:'Synthetic JMeter energy workload']))
</stringProp>
</JSR223Sampler>
<hashTree />
<IfController guiclass="IfControllerPanel" testclass="IfController" testname="Login or renew expired token" enabled="true">
<stringProp name="IfController.condition">${refresh_login}</stringProp>
<boolProp name="IfController.evaluateAll">false</boolProp>
<boolProp name="IfController.useExpression">true</boolProp>
</IfController>
<hashTree>
<HTTPSamplerProxy guiclass="HttpTestSampleGui" testclass="HTTPSamplerProxy" testname="HTTP Login" enabled="true">
<elementProp name="HTTPsampler.Arguments" elementType="Arguments" guiclass="HTTPArgumentsPanel" testclass="Arguments" enabled="true">
<collectionProp name="Arguments.arguments">
<elementProp name="" elementType="HTTPArgument">
<boolProp name="HTTPArgument.always_encode">false</boolProp>
<stringProp name="Argument.value">${login_body}</stringProp>
<stringProp name="Argument.metadata">=</stringProp>
</elementProp>
</collectionProp>
</elementProp>
<stringProp name="HTTPSampler.domain">${__P(host,127.0.0.1)}</stringProp>
<stringProp name="HTTPSampler.port">${__P(port,5443)}</stringProp>
<stringProp name="HTTPSampler.protocol">https</stringProp>
<stringProp name="HTTPSampler.path">/api/authentication/login</stringProp>
<stringProp name="HTTPSampler.method">POST</stringProp>
<stringProp name="HTTPSampler.implementation">HttpClient4</stringProp>
<stringProp name="HTTPSampler.connect_timeout">10000</stringProp>
<stringProp name="HTTPSampler.response_timeout">30000</stringProp>
<boolProp name="HTTPSampler.postBodyRaw">true</boolProp>
<boolProp name="HTTPSampler.follow_redirects">false</boolProp>
<boolProp name="HTTPSampler.auto_redirects">false</boolProp>
<boolProp name="HTTPSampler.use_keepalive">true</boolProp>
<boolProp name="HTTPSampler.DO_MULTIPART_POST">false</boolProp>
</HTTPSamplerProxy>
<hashTree>
<JSR223Assertion guiclass="JSR223AssertionGui" testclass="JSR223Assertion" testname="Expected response" enabled="true">
<stringProp name="scriptLanguage">groovy</stringProp>
<stringProp name="cacheKey">true</stringProp>
<stringProp name="filename" />
<stringProp name="parameters" />
<stringProp name="script">if (prev.getResponseCode() != '200') {
AssertionResult.setFailure(true); AssertionResult.setFailureMessage('Unexpected HTTP status: '+prev.getResponseCode()); return
}
// Expected negative outcomes (e.g. deletion confirmed with 404) are successful checks.
prev.setSuccessful(true)
def json = new groovy.json.JsonSlurper().parseText(prev.getResponseDataAsString())
assert json.accessToken; vars.put('token',json.accessToken); vars.put('expires_at',(java.time.Instant.now().epochSecond + (json.expiresIn as long)).toString())
</stringProp>
</JSR223Assertion>
<hashTree />
<JSR223Timer guiclass="JSR223TimerGui" testclass="JSR223Timer" testname="Gaussian interaction pause" enabled="true">
<stringProp name="scriptLanguage">groovy</stringProp>
<stringProp name="cacheKey">true</stringProp>
<stringProp name="filename" />
<stringProp name="parameters" />
<stringProp name="script">def rng = vars.getObject('user_random')
double mean = Double.parseDouble(props.getProperty('think_mean_ms','1000'))
double deviation = Double.parseDouble(props.getProperty('think_stddev_ms','250'))
double minimum = Double.parseDouble(props.getProperty('think_min_ms','500'))
// Symmetric truncation keeps the expected mean at the configured value.
double maximum = 2 * mean - minimum
if (deviation == 0 || maximum == minimum) return Math.round(mean)
double delay
while (true) {
delay = mean + rng.nextGaussian() * deviation
if (delay &gt;= minimum &amp;&amp; delay &lt;= maximum) return Math.round(delay)
}
</stringProp>
</JSR223Timer>
<hashTree />
</hashTree>
</hashTree>
<HTTPSamplerProxy guiclass="HttpTestSampleGui" testclass="HTTPSamplerProxy" testname="HTTP Assigned patients" enabled="true">
<elementProp name="HTTPsampler.Arguments" elementType="Arguments" guiclass="HTTPArgumentsPanel" testclass="Arguments" enabled="true">
<collectionProp name="Arguments.arguments" />
</elementProp>
<stringProp name="HTTPSampler.domain">${__P(host,127.0.0.1)}</stringProp>
<stringProp name="HTTPSampler.port">${__P(port,5443)}</stringProp>
<stringProp name="HTTPSampler.protocol">https</stringProp>
<stringProp name="HTTPSampler.path">/api/professionals/me/patients</stringProp>
<stringProp name="HTTPSampler.method">GET</stringProp>
<stringProp name="HTTPSampler.implementation">HttpClient4</stringProp>
<stringProp name="HTTPSampler.connect_timeout">10000</stringProp>
<stringProp name="HTTPSampler.response_timeout">30000</stringProp>
<boolProp name="HTTPSampler.postBodyRaw">false</boolProp>
<boolProp name="HTTPSampler.follow_redirects">false</boolProp>
<boolProp name="HTTPSampler.auto_redirects">false</boolProp>
<boolProp name="HTTPSampler.use_keepalive">true</boolProp>
<boolProp name="HTTPSampler.DO_MULTIPART_POST">false</boolProp>
</HTTPSamplerProxy>
<hashTree>
<JSR223Assertion guiclass="JSR223AssertionGui" testclass="JSR223Assertion" testname="Expected response" enabled="true">
<stringProp name="scriptLanguage">groovy</stringProp>
<stringProp name="cacheKey">true</stringProp>
<stringProp name="filename" />
<stringProp name="parameters" />
<stringProp name="script">if (prev.getResponseCode() != '200') {
AssertionResult.setFailure(true); AssertionResult.setFailureMessage('Unexpected HTTP status: '+prev.getResponseCode()); return
}
// Expected negative outcomes (e.g. deletion confirmed with 404) are successful checks.
prev.setSuccessful(true)
def json = new groovy.json.JsonSlurper().parseText(prev.getResponseDataAsString())
assert json.any { it.patientId == vars.get('patient_id') } : 'Target patient is not assigned'
</stringProp>
</JSR223Assertion>
<hashTree />
<JSR223Timer guiclass="JSR223TimerGui" testclass="JSR223Timer" testname="Gaussian interaction pause" enabled="true">
<stringProp name="scriptLanguage">groovy</stringProp>
<stringProp name="cacheKey">true</stringProp>
<stringProp name="filename" />
<stringProp name="parameters" />
<stringProp name="script">def rng = vars.getObject('user_random')
double mean = Double.parseDouble(props.getProperty('think_mean_ms','1000'))
double deviation = Double.parseDouble(props.getProperty('think_stddev_ms','250'))
double minimum = Double.parseDouble(props.getProperty('think_min_ms','500'))
// Symmetric truncation keeps the expected mean at the configured value.
double maximum = 2 * mean - minimum
if (deviation == 0 || maximum == minimum) return Math.round(mean)
double delay
while (true) {
delay = mean + rng.nextGaussian() * deviation
if (delay &gt;= minimum &amp;&amp; delay &lt;= maximum) return Math.round(delay)
}
</stringProp>
</JSR223Timer>
<hashTree />
</hashTree>
<HTTPSamplerProxy guiclass="HttpTestSampleGui" testclass="HTTPSamplerProxy" testname="HTTP Read profile" enabled="true">
<elementProp name="HTTPsampler.Arguments" elementType="Arguments" guiclass="HTTPArgumentsPanel" testclass="Arguments" enabled="true">
<collectionProp name="Arguments.arguments" />
</elementProp>
<stringProp name="HTTPSampler.domain">${__P(host,127.0.0.1)}</stringProp>
<stringProp name="HTTPSampler.port">${__P(port,5443)}</stringProp>
<stringProp name="HTTPSampler.protocol">https</stringProp>
<stringProp name="HTTPSampler.path">/api/patients/${patient_id}</stringProp>
<stringProp name="HTTPSampler.method">GET</stringProp>
<stringProp name="HTTPSampler.implementation">HttpClient4</stringProp>
<stringProp name="HTTPSampler.connect_timeout">10000</stringProp>
<stringProp name="HTTPSampler.response_timeout">30000</stringProp>
<boolProp name="HTTPSampler.postBodyRaw">false</boolProp>
<boolProp name="HTTPSampler.follow_redirects">false</boolProp>
<boolProp name="HTTPSampler.auto_redirects">false</boolProp>
<boolProp name="HTTPSampler.use_keepalive">true</boolProp>
<boolProp name="HTTPSampler.DO_MULTIPART_POST">false</boolProp>
</HTTPSamplerProxy>
<hashTree>
<JSR223Assertion guiclass="JSR223AssertionGui" testclass="JSR223Assertion" testname="Expected response" enabled="true">
<stringProp name="scriptLanguage">groovy</stringProp>
<stringProp name="cacheKey">true</stringProp>
<stringProp name="filename" />
<stringProp name="parameters" />
<stringProp name="script">if (prev.getResponseCode() != '200') {
AssertionResult.setFailure(true); AssertionResult.setFailureMessage('Unexpected HTTP status: '+prev.getResponseCode()); return
}
// Expected negative outcomes (e.g. deletion confirmed with 404) are successful checks.
prev.setSuccessful(true)
def json = new groovy.json.JsonSlurper().parseText(prev.getResponseDataAsString())
assert json.patientId == vars.get('patient_id')
</stringProp>
</JSR223Assertion>
<hashTree />
<JSR223Timer guiclass="JSR223TimerGui" testclass="JSR223Timer" testname="Gaussian interaction pause" enabled="true">
<stringProp name="scriptLanguage">groovy</stringProp>
<stringProp name="cacheKey">true</stringProp>
<stringProp name="filename" />
<stringProp name="parameters" />
<stringProp name="script">def rng = vars.getObject('user_random')
double mean = Double.parseDouble(props.getProperty('think_mean_ms','1000'))
double deviation = Double.parseDouble(props.getProperty('think_stddev_ms','250'))
double minimum = Double.parseDouble(props.getProperty('think_min_ms','500'))
// Symmetric truncation keeps the expected mean at the configured value.
double maximum = 2 * mean - minimum
if (deviation == 0 || maximum == minimum) return Math.round(mean)
double delay
while (true) {
delay = mean + rng.nextGaussian() * deviation
if (delay &gt;= minimum &amp;&amp; delay &lt;= maximum) return Math.round(delay)
}
</stringProp>
</JSR223Timer>
<hashTree />
</hashTree>
<HTTPSamplerProxy guiclass="HttpTestSampleGui" testclass="HTTPSamplerProxy" testname="HTTP Latest reading" enabled="true">
<elementProp name="HTTPsampler.Arguments" elementType="Arguments" guiclass="HTTPArgumentsPanel" testclass="Arguments" enabled="true">
<collectionProp name="Arguments.arguments" />
</elementProp>
<stringProp name="HTTPSampler.domain">${__P(host,127.0.0.1)}</stringProp>
<stringProp name="HTTPSampler.port">${__P(port,5443)}</stringProp>
<stringProp name="HTTPSampler.protocol">https</stringProp>
<stringProp name="HTTPSampler.path">/api/patients/${patient_id}/observations/latest</stringProp>
<stringProp name="HTTPSampler.method">GET</stringProp>
<stringProp name="HTTPSampler.implementation">HttpClient4</stringProp>
<stringProp name="HTTPSampler.connect_timeout">10000</stringProp>
<stringProp name="HTTPSampler.response_timeout">30000</stringProp>
<boolProp name="HTTPSampler.postBodyRaw">false</boolProp>
<boolProp name="HTTPSampler.follow_redirects">false</boolProp>
<boolProp name="HTTPSampler.auto_redirects">false</boolProp>
<boolProp name="HTTPSampler.use_keepalive">true</boolProp>
<boolProp name="HTTPSampler.DO_MULTIPART_POST">false</boolProp>
</HTTPSamplerProxy>
<hashTree>
<JSR223Assertion guiclass="JSR223AssertionGui" testclass="JSR223Assertion" testname="Expected response" enabled="true">
<stringProp name="scriptLanguage">groovy</stringProp>
<stringProp name="cacheKey">true</stringProp>
<stringProp name="filename" />
<stringProp name="parameters" />
<stringProp name="script">if (prev.getResponseCode() != '200') {
AssertionResult.setFailure(true); AssertionResult.setFailureMessage('Unexpected HTTP status: '+prev.getResponseCode()); return
}
// Expected negative outcomes (e.g. deletion confirmed with 404) are successful checks.
prev.setSuccessful(true)
def json = new groovy.json.JsonSlurper().parseText(prev.getResponseDataAsString())
assert json.patientId == vars.get('patient_id')
</stringProp>
</JSR223Assertion>
<hashTree />
<JSR223Timer guiclass="JSR223TimerGui" testclass="JSR223Timer" testname="Gaussian interaction pause" enabled="true">
<stringProp name="scriptLanguage">groovy</stringProp>
<stringProp name="cacheKey">true</stringProp>
<stringProp name="filename" />
<stringProp name="parameters" />
<stringProp name="script">def rng = vars.getObject('user_random')
double mean = Double.parseDouble(props.getProperty('think_mean_ms','1000'))
double deviation = Double.parseDouble(props.getProperty('think_stddev_ms','250'))
double minimum = Double.parseDouble(props.getProperty('think_min_ms','500'))
// Symmetric truncation keeps the expected mean at the configured value.
double maximum = 2 * mean - minimum
if (deviation == 0 || maximum == minimum) return Math.round(mean)
double delay
while (true) {
delay = mean + rng.nextGaussian() * deviation
if (delay &gt;= minimum &amp;&amp; delay &lt;= maximum) return Math.round(delay)
}
</stringProp>
</JSR223Timer>
<hashTree />
</hashTree>
<HTTPSamplerProxy guiclass="HttpTestSampleGui" testclass="HTTPSamplerProxy" testname="HTTP Home resting history" enabled="true">
<elementProp name="HTTPsampler.Arguments" elementType="Arguments" guiclass="HTTPArgumentsPanel" testclass="Arguments" enabled="true">
<collectionProp name="Arguments.arguments" />
</elementProp>
<stringProp name="HTTPSampler.domain">${__P(host,127.0.0.1)}</stringProp>
<stringProp name="HTTPSampler.port">${__P(port,5443)}</stringProp>
<stringProp name="HTTPSampler.protocol">https</stringProp>
<stringProp name="HTTPSampler.path">/api/patients/${patient_id}/observations?from=${period_from}&amp;to=${period_to}&amp;setting=Home&amp;activityCondition=AtRest</stringProp>
<stringProp name="HTTPSampler.method">GET</stringProp>
<stringProp name="HTTPSampler.implementation">HttpClient4</stringProp>
<stringProp name="HTTPSampler.connect_timeout">10000</stringProp>
<stringProp name="HTTPSampler.response_timeout">30000</stringProp>
<boolProp name="HTTPSampler.postBodyRaw">false</boolProp>
<boolProp name="HTTPSampler.follow_redirects">false</boolProp>
<boolProp name="HTTPSampler.auto_redirects">false</boolProp>
<boolProp name="HTTPSampler.use_keepalive">true</boolProp>
<boolProp name="HTTPSampler.DO_MULTIPART_POST">false</boolProp>
</HTTPSamplerProxy>
<hashTree>
<JSR223Assertion guiclass="JSR223AssertionGui" testclass="JSR223Assertion" testname="Expected response" enabled="true">
<stringProp name="scriptLanguage">groovy</stringProp>
<stringProp name="cacheKey">true</stringProp>
<stringProp name="filename" />
<stringProp name="parameters" />
<stringProp name="script">if (prev.getResponseCode() != '200') {
AssertionResult.setFailure(true); AssertionResult.setFailureMessage('Unexpected HTTP status: '+prev.getResponseCode()); return
}
// Expected negative outcomes (e.g. deletion confirmed with 404) are successful checks.
prev.setSuccessful(true)
def json = new groovy.json.JsonSlurper().parseText(prev.getResponseDataAsString())
assert json instanceof List &amp;&amp; !json.empty : 'Seed observations first'
</stringProp>
</JSR223Assertion>
<hashTree />
<JSR223Timer guiclass="JSR223TimerGui" testclass="JSR223Timer" testname="Gaussian interaction pause" enabled="true">
<stringProp name="scriptLanguage">groovy</stringProp>
<stringProp name="cacheKey">true</stringProp>
<stringProp name="filename" />
<stringProp name="parameters" />
<stringProp name="script">def rng = vars.getObject('user_random')
double mean = Double.parseDouble(props.getProperty('think_mean_ms','1000'))
double deviation = Double.parseDouble(props.getProperty('think_stddev_ms','250'))
double minimum = Double.parseDouble(props.getProperty('think_min_ms','500'))
// Symmetric truncation keeps the expected mean at the configured value.
double maximum = 2 * mean - minimum
if (deviation == 0 || maximum == minimum) return Math.round(mean)
double delay
while (true) {
delay = mean + rng.nextGaussian() * deviation
if (delay &gt;= minimum &amp;&amp; delay &lt;= maximum) return Math.round(delay)
}
</stringProp>
</JSR223Timer>
<hashTree />
</hashTree>
<HTTPSamplerProxy guiclass="HttpTestSampleGui" testclass="HTTPSamplerProxy" testname="HTTP Numerical insights" enabled="true">
<elementProp name="HTTPsampler.Arguments" elementType="Arguments" guiclass="HTTPArgumentsPanel" testclass="Arguments" enabled="true">
<collectionProp name="Arguments.arguments" />
</elementProp>
<stringProp name="HTTPSampler.domain">${__P(host,127.0.0.1)}</stringProp>
<stringProp name="HTTPSampler.port">${__P(port,5443)}</stringProp>
<stringProp name="HTTPSampler.protocol">https</stringProp>
<stringProp name="HTTPSampler.path">/api/patients/${patient_id}/insights?from=${period_from}&amp;to=${period_to}&amp;setting=Home&amp;activityCondition=AtRest</stringProp>
<stringProp name="HTTPSampler.method">GET</stringProp>
<stringProp name="HTTPSampler.implementation">HttpClient4</stringProp>
<stringProp name="HTTPSampler.connect_timeout">10000</stringProp>
<stringProp name="HTTPSampler.response_timeout">30000</stringProp>
<boolProp name="HTTPSampler.postBodyRaw">false</boolProp>
<boolProp name="HTTPSampler.follow_redirects">false</boolProp>
<boolProp name="HTTPSampler.auto_redirects">false</boolProp>
<boolProp name="HTTPSampler.use_keepalive">true</boolProp>
<boolProp name="HTTPSampler.DO_MULTIPART_POST">false</boolProp>
</HTTPSamplerProxy>
<hashTree>
<JSR223Assertion guiclass="JSR223AssertionGui" testclass="JSR223Assertion" testname="Expected response" enabled="true">
<stringProp name="scriptLanguage">groovy</stringProp>
<stringProp name="cacheKey">true</stringProp>
<stringProp name="filename" />
<stringProp name="parameters" />
<stringProp name="script">if (prev.getResponseCode() != '200') {
AssertionResult.setFailure(true); AssertionResult.setFailureMessage('Unexpected HTTP status: '+prev.getResponseCode()); return
}
// Expected negative outcomes (e.g. deletion confirmed with 404) are successful checks.
prev.setSuccessful(true)
def json = new groovy.json.JsonSlurper().parseText(prev.getResponseDataAsString())
assert json.contributingCount &gt; 0
</stringProp>
</JSR223Assertion>
<hashTree />
<JSR223Timer guiclass="JSR223TimerGui" testclass="JSR223Timer" testname="Gaussian interaction pause" enabled="true">
<stringProp name="scriptLanguage">groovy</stringProp>
<stringProp name="cacheKey">true</stringProp>
<stringProp name="filename" />
<stringProp name="parameters" />
<stringProp name="script">def rng = vars.getObject('user_random')
double mean = Double.parseDouble(props.getProperty('think_mean_ms','1000'))
double deviation = Double.parseDouble(props.getProperty('think_stddev_ms','250'))
double minimum = Double.parseDouble(props.getProperty('think_min_ms','500'))
// Symmetric truncation keeps the expected mean at the configured value.
double maximum = 2 * mean - minimum
if (deviation == 0 || maximum == minimum) return Math.round(mean)
double delay
while (true) {
delay = mean + rng.nextGaussian() * deviation
if (delay &gt;= minimum &amp;&amp; delay &lt;= maximum) return Math.round(delay)
}
</stringProp>
</JSR223Timer>
<hashTree />
</hashTree>
<HTTPSamplerProxy guiclass="HttpTestSampleGui" testclass="HTTPSamplerProxy" testname="HTTP Trends" enabled="true">
<elementProp name="HTTPsampler.Arguments" elementType="Arguments" guiclass="HTTPArgumentsPanel" testclass="Arguments" enabled="true">
<collectionProp name="Arguments.arguments" />
</elementProp>
<stringProp name="HTTPSampler.domain">${__P(host,127.0.0.1)}</stringProp>
<stringProp name="HTTPSampler.port">${__P(port,5443)}</stringProp>
<stringProp name="HTTPSampler.protocol">https</stringProp>
<stringProp name="HTTPSampler.path">/api/patients/${patient_id}/trends?from=${period_from}&amp;to=${period_to}</stringProp>
<stringProp name="HTTPSampler.method">GET</stringProp>
<stringProp name="HTTPSampler.implementation">HttpClient4</stringProp>
<stringProp name="HTTPSampler.connect_timeout">10000</stringProp>
<stringProp name="HTTPSampler.response_timeout">30000</stringProp>
<boolProp name="HTTPSampler.postBodyRaw">false</boolProp>
<boolProp name="HTTPSampler.follow_redirects">false</boolProp>
<boolProp name="HTTPSampler.auto_redirects">false</boolProp>
<boolProp name="HTTPSampler.use_keepalive">true</boolProp>
<boolProp name="HTTPSampler.DO_MULTIPART_POST">false</boolProp>
</HTTPSamplerProxy>
<hashTree>
<JSR223Assertion guiclass="JSR223AssertionGui" testclass="JSR223Assertion" testname="Expected response" enabled="true">
<stringProp name="scriptLanguage">groovy</stringProp>
<stringProp name="cacheKey">true</stringProp>
<stringProp name="filename" />
<stringProp name="parameters" />
<stringProp name="script">if (prev.getResponseCode() != '200') {
AssertionResult.setFailure(true); AssertionResult.setFailureMessage('Unexpected HTTP status: '+prev.getResponseCode()); return
}
// Expected negative outcomes (e.g. deletion confirmed with 404) are successful checks.
prev.setSuccessful(true)
</stringProp>
</JSR223Assertion>
<hashTree />
<JSR223Timer guiclass="JSR223TimerGui" testclass="JSR223Timer" testname="Gaussian interaction pause" enabled="true">
<stringProp name="scriptLanguage">groovy</stringProp>
<stringProp name="cacheKey">true</stringProp>
<stringProp name="filename" />
<stringProp name="parameters" />
<stringProp name="script">def rng = vars.getObject('user_random')
double mean = Double.parseDouble(props.getProperty('think_mean_ms','1000'))
double deviation = Double.parseDouble(props.getProperty('think_stddev_ms','250'))
double minimum = Double.parseDouble(props.getProperty('think_min_ms','500'))
// Symmetric truncation keeps the expected mean at the configured value.
double maximum = 2 * mean - minimum
if (deviation == 0 || maximum == minimum) return Math.round(mean)
double delay
while (true) {
delay = mean + rng.nextGaussian() * deviation
if (delay &gt;= minimum &amp;&amp; delay &lt;= maximum) return Math.round(delay)
}
</stringProp>
</JSR223Timer>
<hashTree />
</hashTree>
<HTTPSamplerProxy guiclass="HttpTestSampleGui" testclass="HTTPSamplerProxy" testname="HTTP Health overview" enabled="true">
<elementProp name="HTTPsampler.Arguments" elementType="Arguments" guiclass="HTTPArgumentsPanel" testclass="Arguments" enabled="true">
<collectionProp name="Arguments.arguments" />
</elementProp>
<stringProp name="HTTPSampler.domain">${__P(host,127.0.0.1)}</stringProp>
<stringProp name="HTTPSampler.port">${__P(port,5443)}</stringProp>
<stringProp name="HTTPSampler.protocol">https</stringProp>
<stringProp name="HTTPSampler.path">/api/patients/${patient_id}/overview?from=${period_from}&amp;to=${period_to}</stringProp>
<stringProp name="HTTPSampler.method">GET</stringProp>
<stringProp name="HTTPSampler.implementation">HttpClient4</stringProp>
<stringProp name="HTTPSampler.connect_timeout">10000</stringProp>
<stringProp name="HTTPSampler.response_timeout">30000</stringProp>
<boolProp name="HTTPSampler.postBodyRaw">false</boolProp>
<boolProp name="HTTPSampler.follow_redirects">false</boolProp>
<boolProp name="HTTPSampler.auto_redirects">false</boolProp>
<boolProp name="HTTPSampler.use_keepalive">true</boolProp>
<boolProp name="HTTPSampler.DO_MULTIPART_POST">false</boolProp>
</HTTPSamplerProxy>
<hashTree>
<JSR223Assertion guiclass="JSR223AssertionGui" testclass="JSR223Assertion" testname="Expected response" enabled="true">
<stringProp name="scriptLanguage">groovy</stringProp>
<stringProp name="cacheKey">true</stringProp>
<stringProp name="filename" />
<stringProp name="parameters" />
<stringProp name="script">if (prev.getResponseCode() != '200') {
AssertionResult.setFailure(true); AssertionResult.setFailureMessage('Unexpected HTTP status: '+prev.getResponseCode()); return
}
// Expected negative outcomes (e.g. deletion confirmed with 404) are successful checks.
prev.setSuccessful(true)
def json = new groovy.json.JsonSlurper().parseText(prev.getResponseDataAsString())
assert json.patient.patientId == vars.get('patient_id'); assert json.latestObservation != null; assert json.insight != null
</stringProp>
</JSR223Assertion>
<hashTree />
<JSR223Timer guiclass="JSR223TimerGui" testclass="JSR223Timer" testname="Gaussian interaction pause" enabled="true">
<stringProp name="scriptLanguage">groovy</stringProp>
<stringProp name="cacheKey">true</stringProp>
<stringProp name="filename" />
<stringProp name="parameters" />
<stringProp name="script">def rng = vars.getObject('user_random')
double mean = Double.parseDouble(props.getProperty('think_mean_ms','1000'))
double deviation = Double.parseDouble(props.getProperty('think_stddev_ms','250'))
double minimum = Double.parseDouble(props.getProperty('think_min_ms','500'))
// Symmetric truncation keeps the expected mean at the configured value.
double maximum = 2 * mean - minimum
if (deviation == 0 || maximum == minimum) return Math.round(mean)
double delay
while (true) {
delay = mean + rng.nextGaussian() * deviation
if (delay &gt;= minimum &amp;&amp; delay &lt;= maximum) return Math.round(delay)
}
</stringProp>
</JSR223Timer>
<hashTree />
</hashTree>
<TestAction guiclass="TestActionGui" testclass="TestAction" testname="Between-session pause" enabled="true">
<intProp name="ActionProcessor.action">1</intProp>
<intProp name="ActionProcessor.target">0</intProp>
<stringProp name="ActionProcessor.duration">${session_delay_ms}</stringProp>
</TestAction>
<hashTree />
</hashTree>
</hashTree>
</hashTree>
</jmeterTestPlan>
+574
View File
@@ -0,0 +1,574 @@
<?xml version='1.0' encoding='utf-8'?>
<jmeterTestPlan version="1.2" properties="5.0" jmeter="5.6.3">
<hashTree>
<TestPlan guiclass="TestPlanGui" testclass="TestPlan" testname="HealthApp energy: recording" enabled="true">
<stringProp name="TestPlan.comments">Synthetic closed-loop sessions; default duration four hours. Setup is external; Shelly power is collected live without changing the outlet.</stringProp>
<boolProp name="TestPlan.functional_mode">false</boolProp>
<boolProp name="TestPlan.serialize_threadgroups">false</boolProp>
<elementProp name="TestPlan.user_defined_variables" elementType="Arguments" guiclass="ArgumentsPanel" testclass="Arguments" enabled="true">
<collectionProp name="Arguments.arguments" />
</elementProp>
</TestPlan>
<hashTree>
<ThreadGroup guiclass="ThreadGroupGui" testclass="ThreadGroup" testname="Shelly live power" enabled="true">
<stringProp name="ThreadGroup.on_sample_error">continue</stringProp>
<elementProp name="ThreadGroup.main_controller" elementType="LoopController" guiclass="LoopControlPanel" testclass="LoopController" enabled="true">
<boolProp name="LoopController.continue_forever">false</boolProp>
<stringProp name="LoopController.loops">-1</stringProp>
</elementProp>
<stringProp name="ThreadGroup.num_threads">1</stringProp>
<stringProp name="ThreadGroup.ramp_time">0</stringProp>
<stringProp name="ThreadGroup.duration">${__P(total_duration_seconds,16210)}</stringProp>
<stringProp name="ThreadGroup.delay">0</stringProp>
<boolProp name="ThreadGroup.scheduler">true</boolProp>
</ThreadGroup>
<hashTree>
<HTTPSamplerProxy guiclass="HttpTestSampleGui" testclass="HTTPSamplerProxy" testname="POWER Shelly status" enabled="true">
<elementProp name="HTTPsampler.Arguments" elementType="Arguments">
<collectionProp name="Arguments.arguments" />
</elementProp>
<stringProp name="HTTPSampler.domain">${__P(shelly_host,192.168.1.44)}</stringProp>
<stringProp name="HTTPSampler.port">${__P(shelly_port,80)}</stringProp>
<stringProp name="HTTPSampler.protocol">http</stringProp>
<stringProp name="HTTPSampler.path">/rpc/Switch.GetStatus?id=${__P(shelly_switch_id,0)}</stringProp>
<stringProp name="HTTPSampler.method">GET</stringProp>
<stringProp name="HTTPSampler.implementation">HttpClient4</stringProp>
<stringProp name="HTTPSampler.connect_timeout">3000</stringProp>
<stringProp name="HTTPSampler.response_timeout">3000</stringProp>
<boolProp name="HTTPSampler.follow_redirects">false</boolProp>
<boolProp name="HTTPSampler.use_keepalive">true</boolProp>
</HTTPSamplerProxy>
<hashTree>
<JSR223Timer guiclass="JSR223TimerGui" testclass="JSR223Timer" testname="Fixed meter cadence" enabled="true">
<stringProp name="scriptLanguage">groovy</stringProp>
<stringProp name="cacheKey">true</stringProp>
<stringProp name="filename" />
<stringProp name="parameters" />
<stringProp name="script">if (!vars.get('shelly_last_poll_ms')) return 0L; return Math.max(0L, Long.parseLong(vars.get('shelly_last_poll_ms')) + Long.parseLong(props.getProperty('shelly_interval_ms','1000')) - System.currentTimeMillis())</stringProp>
</JSR223Timer>
<hashTree />
<JSR223PreProcessor guiclass="JSR223PreProcessorGui" testclass="JSR223PreProcessor" testname="Clear stale power values" enabled="true">
<stringProp name="scriptLanguage">groovy</stringProp>
<stringProp name="cacheKey">true</stringProp>
<stringProp name="filename" />
<stringProp name="parameters" />
<stringProp name="script">['shelly_power_watts','shelly_voltage_volts','shelly_current_amps','shelly_energy_wh'].each { vars.put(it,'') }</stringProp>
</JSR223PreProcessor>
<hashTree />
<JSR223Assertion guiclass="JSR223AssertionGui" testclass="JSR223Assertion" testname="Validate and extract plug readings" enabled="true">
<stringProp name="scriptLanguage">groovy</stringProp>
<stringProp name="cacheKey">true</stringProp>
<stringProp name="filename" />
<stringProp name="parameters" />
<stringProp name="script">vars.put('shelly_last_poll_ms',prev.getStartTime().toString())
try {
assert prev.getResponseCode() == '200'
def json=new groovy.json.JsonSlurper().parseText(prev.getResponseDataAsString())
assert json.output == true : 'Outlet is off'
def readings=[shelly_power_watts:json.apower,shelly_voltage_volts:json.voltage,shelly_current_amps:json.current,shelly_energy_wh:json.aenergy?.total]
readings.each { key,value -&gt; assert value instanceof Number &amp;&amp; Double.isFinite(value.doubleValue()) &amp;&amp; value &gt;= 0; vars.put(key,value.toString()) }
} catch (Throwable error) {
AssertionResult.setFailure(true);AssertionResult.setFailureMessage('Shelly status/measurement unavailable');prev.setSuccessful(false)
}
</stringProp>
</JSR223Assertion>
<hashTree />
</hashTree>
<ResultCollector guiclass="SimpleDataWriter" testclass="ResultCollector" testname="Shelly measurements saved live" enabled="true">
<stringProp name="filename">${__P(shelly_file,shelly.csv)}</stringProp>
<boolProp name="ResultCollector.error_logging">false</boolProp>
</ResultCollector>
<hashTree />
</hashTree>
<kg.apc.jmeter.perfmon.PerfMonCollector guiclass="kg.apc.jmeter.vizualizers.PerfMonGui" testclass="kg.apc.jmeter.perfmon.PerfMonCollector" testname="NUC live CPU RAM disk and network" enabled="true">
<stringProp name="filename">${__P(perfmon_file,perfmon.csv)}</stringProp>
<boolProp name="ResultCollector.error_logging">false</boolProp>
<collectionProp name="metricConnections">
<collectionProp name="0">
<stringProp name="0">${__P(perfmon_host,192.168.1.125)}</stringProp>
<stringProp name="1">${__P(perfmon_port,4444)}</stringProp>
<stringProp name="2">CPU</stringProp>
<stringProp name="3">combined</stringProp>
</collectionProp>
<collectionProp name="1">
<stringProp name="0">${__P(perfmon_host,192.168.1.125)}</stringProp>
<stringProp name="1">${__P(perfmon_port,4444)}</stringProp>
<stringProp name="2">CPU</stringProp>
<stringProp name="3">iowait</stringProp>
</collectionProp>
<collectionProp name="2">
<stringProp name="0">${__P(perfmon_host,192.168.1.125)}</stringProp>
<stringProp name="1">${__P(perfmon_port,4444)}</stringProp>
<stringProp name="2">Memory</stringProp>
<stringProp name="3">usedperc</stringProp>
</collectionProp>
<collectionProp name="3">
<stringProp name="0">${__P(perfmon_host,192.168.1.125)}</stringProp>
<stringProp name="1">${__P(perfmon_port,4444)}</stringProp>
<stringProp name="2">Memory</stringProp>
<stringProp name="3">actualused</stringProp>
</collectionProp>
<collectionProp name="4">
<stringProp name="0">${__P(perfmon_host,192.168.1.125)}</stringProp>
<stringProp name="1">${__P(perfmon_port,4444)}</stringProp>
<stringProp name="2">Swap</stringProp>
<stringProp name="3">used</stringProp>
</collectionProp>
<collectionProp name="5">
<stringProp name="0">${__P(perfmon_host,192.168.1.125)}</stringProp>
<stringProp name="1">${__P(perfmon_port,4444)}</stringProp>
<stringProp name="2">Disks I/O</stringProp>
<stringProp name="3">readbytes</stringProp>
</collectionProp>
<collectionProp name="6">
<stringProp name="0">${__P(perfmon_host,192.168.1.125)}</stringProp>
<stringProp name="1">${__P(perfmon_port,4444)}</stringProp>
<stringProp name="2">Disks I/O</stringProp>
<stringProp name="3">writebytes</stringProp>
</collectionProp>
<collectionProp name="7">
<stringProp name="0">${__P(perfmon_host,192.168.1.125)}</stringProp>
<stringProp name="1">${__P(perfmon_port,4444)}</stringProp>
<stringProp name="2">Network I/O</stringProp>
<stringProp name="3">bytesrecv</stringProp>
</collectionProp>
<collectionProp name="8">
<stringProp name="0">${__P(perfmon_host,192.168.1.125)}</stringProp>
<stringProp name="1">${__P(perfmon_port,4444)}</stringProp>
<stringProp name="2">Network I/O</stringProp>
<stringProp name="3">bytessent</stringProp>
</collectionProp>
</collectionProp>
</kg.apc.jmeter.perfmon.PerfMonCollector>
<hashTree />
<ThreadGroup guiclass="ThreadGroupGui" testclass="ThreadGroup" testname="Users" enabled="true">
<stringProp name="ThreadGroup.on_sample_error">stopthread</stringProp>
<elementProp name="ThreadGroup.main_controller" elementType="LoopController" guiclass="LoopControlPanel" testclass="LoopController" enabled="true">
<boolProp name="LoopController.continue_forever">false</boolProp>
<stringProp name="LoopController.loops">-1</stringProp>
</elementProp>
<stringProp name="ThreadGroup.num_threads">${__P(users,1)}</stringProp>
<stringProp name="ThreadGroup.ramp_time">${__P(ramp_seconds,60)}</stringProp>
<stringProp name="ThreadGroup.duration">${__P(total_duration_seconds,16210)}</stringProp>
<stringProp name="ThreadGroup.delay">0</stringProp>
<boolProp name="ThreadGroup.scheduler">true</boolProp>
<boolProp name="ThreadGroup.same_user_on_next_iteration">true</boolProp>
</ThreadGroup>
<hashTree>
<HeaderManager guiclass="HeaderPanel" testclass="HeaderManager" testname="JSON and bearer token" enabled="true">
<collectionProp name="HeaderManager.headers">
<elementProp name="" elementType="Header">
<stringProp name="Header.name">Content-Type</stringProp>
<stringProp name="Header.value">application/json</stringProp>
</elementProp>
<elementProp name="" elementType="Header">
<stringProp name="Header.name">Authorization</stringProp>
<stringProp name="Header.value">Bearer ${token}</stringProp>
</elementProp>
</collectionProp>
</HeaderManager>
<hashTree />
<OnceOnlyController guiclass="OnceOnlyControllerGui" testclass="OnceOnlyController" testname="Assign one account per user" enabled="true" />
<hashTree>
<JSR223Sampler guiclass="JSR223SamplerGui" testclass="JSR223Sampler" testname="Initialize user" enabled="true">
<stringProp name="scriptLanguage">groovy</stringProp>
<stringProp name="cacheKey">true</stringProp>
<stringProp name="filename" />
<stringProp name="parameters" />
<stringProp name="script">def rows = new File(props.get('users_file')).readLines('UTF-8').drop(1).findAll { it.trim() }
def row = rows[ctx.getThreadNum()].split(',', -1)
vars.put('account_id', row[0]); vars.put('password', row[1]); vars.put('patient_id', row[2])
vars.put('token', ''); vars.put('expires_at', '0'); vars.put('session_number','0')
vars.putObject('user_random', new Random(Long.parseLong(props.getProperty('random_seed','42')) + ctx.getThreadNum()))
synchronized(props) {
if (props.get('timeline_file') &amp;&amp; !props.get('workload_start_ms')) {
long start = System.currentTimeMillis()
long measurement = start + Long.parseLong(props.getProperty('warmup_seconds','1800')) * 1000
long end = measurement + Long.parseLong(props.getProperty('duration_seconds','14400')) * 1000
props.put('workload_start_ms',start.toString())
new File(props.get('timeline_file')).text = groovy.json.JsonOutput.toJson([warmup_start_ms:start,measurement_start_ms:measurement,measurement_end_ms:end])
}
}
</stringProp>
</JSR223Sampler>
<hashTree />
</hashTree>
<JSR223Sampler guiclass="JSR223SamplerGui" testclass="JSR223Sampler" testname="Prepare session" enabled="true">
<stringProp name="scriptLanguage">groovy</stringProp>
<stringProp name="cacheKey">true</stringProp>
<stringProp name="filename" />
<stringProp name="parameters" />
<stringProp name="script">def now = java.time.Instant.now()
vars.put('refresh_login', (now.epochSecond &gt;= Long.parseLong(vars.get('expires_at')) - 60).toString())
vars.put('login_body',groovy.json.JsonOutput.toJson([accountId:vars.get('account_id'),password:vars.get('password')]))
vars.put('period_from',props.get('period_from')); vars.put('period_to',props.get('period_to'))
int n = Integer.parseInt(vars.get('session_number')); vars.put('session_number',(n+1).toString())
// Random session mix: expected 65% review, 30% recording, 5% correction.
int slot = vars.getObject('user_random').nextInt(20)
vars.put('session_kind',slot &lt; 13 ? 'review' : slot &lt; 19 ? 'recording' : 'correction')
double mean = Double.parseDouble(props.getProperty('session_pause_ms','120000'))
double deviation = Double.parseDouble(props.getProperty('session_stddev_ms','30000'))
vars.put('session_delay_ms',Math.max(0L,Math.round(mean + vars.getObject('user_random').nextGaussian()*deviation)).toString())
vars.put('observation_body',groovy.json.JsonOutput.toJson([measuredAt:now.toString(),systolic:128+(n%7),diastolic:82+(n%4),pulse:68+(n%6),measurementContext:[setting:'Home',activityCondition:'AtRest',restDurationMinutes:5,bodyPosition:'Seated'],note:'Synthetic JMeter energy workload']))
</stringProp>
</JSR223Sampler>
<hashTree />
<IfController guiclass="IfControllerPanel" testclass="IfController" testname="Login or renew expired token" enabled="true">
<stringProp name="IfController.condition">${refresh_login}</stringProp>
<boolProp name="IfController.evaluateAll">false</boolProp>
<boolProp name="IfController.useExpression">true</boolProp>
</IfController>
<hashTree>
<HTTPSamplerProxy guiclass="HttpTestSampleGui" testclass="HTTPSamplerProxy" testname="HTTP Login" enabled="true">
<elementProp name="HTTPsampler.Arguments" elementType="Arguments" guiclass="HTTPArgumentsPanel" testclass="Arguments" enabled="true">
<collectionProp name="Arguments.arguments">
<elementProp name="" elementType="HTTPArgument">
<boolProp name="HTTPArgument.always_encode">false</boolProp>
<stringProp name="Argument.value">${login_body}</stringProp>
<stringProp name="Argument.metadata">=</stringProp>
</elementProp>
</collectionProp>
</elementProp>
<stringProp name="HTTPSampler.domain">${__P(host,127.0.0.1)}</stringProp>
<stringProp name="HTTPSampler.port">${__P(port,5443)}</stringProp>
<stringProp name="HTTPSampler.protocol">https</stringProp>
<stringProp name="HTTPSampler.path">/api/authentication/login</stringProp>
<stringProp name="HTTPSampler.method">POST</stringProp>
<stringProp name="HTTPSampler.implementation">HttpClient4</stringProp>
<stringProp name="HTTPSampler.connect_timeout">10000</stringProp>
<stringProp name="HTTPSampler.response_timeout">30000</stringProp>
<boolProp name="HTTPSampler.postBodyRaw">true</boolProp>
<boolProp name="HTTPSampler.follow_redirects">false</boolProp>
<boolProp name="HTTPSampler.auto_redirects">false</boolProp>
<boolProp name="HTTPSampler.use_keepalive">true</boolProp>
<boolProp name="HTTPSampler.DO_MULTIPART_POST">false</boolProp>
</HTTPSamplerProxy>
<hashTree>
<JSR223Assertion guiclass="JSR223AssertionGui" testclass="JSR223Assertion" testname="Expected response" enabled="true">
<stringProp name="scriptLanguage">groovy</stringProp>
<stringProp name="cacheKey">true</stringProp>
<stringProp name="filename" />
<stringProp name="parameters" />
<stringProp name="script">if (prev.getResponseCode() != '200') {
AssertionResult.setFailure(true); AssertionResult.setFailureMessage('Unexpected HTTP status: '+prev.getResponseCode()); return
}
// Expected negative outcomes (e.g. deletion confirmed with 404) are successful checks.
prev.setSuccessful(true)
def json = new groovy.json.JsonSlurper().parseText(prev.getResponseDataAsString())
assert json.accessToken; vars.put('token',json.accessToken); vars.put('expires_at',(java.time.Instant.now().epochSecond + (json.expiresIn as long)).toString())
</stringProp>
</JSR223Assertion>
<hashTree />
<JSR223Timer guiclass="JSR223TimerGui" testclass="JSR223Timer" testname="Gaussian interaction pause" enabled="true">
<stringProp name="scriptLanguage">groovy</stringProp>
<stringProp name="cacheKey">true</stringProp>
<stringProp name="filename" />
<stringProp name="parameters" />
<stringProp name="script">def rng = vars.getObject('user_random')
double mean = Double.parseDouble(props.getProperty('think_mean_ms','1000'))
double deviation = Double.parseDouble(props.getProperty('think_stddev_ms','250'))
double minimum = Double.parseDouble(props.getProperty('think_min_ms','500'))
// Symmetric truncation keeps the expected mean at the configured value.
double maximum = 2 * mean - minimum
if (deviation == 0 || maximum == minimum) return Math.round(mean)
double delay
while (true) {
delay = mean + rng.nextGaussian() * deviation
if (delay &gt;= minimum &amp;&amp; delay &lt;= maximum) return Math.round(delay)
}
</stringProp>
</JSR223Timer>
<hashTree />
</hashTree>
</hashTree>
<HTTPSamplerProxy guiclass="HttpTestSampleGui" testclass="HTTPSamplerProxy" testname="HTTP Measurement guidance" enabled="true">
<elementProp name="HTTPsampler.Arguments" elementType="Arguments" guiclass="HTTPArgumentsPanel" testclass="Arguments" enabled="true">
<collectionProp name="Arguments.arguments" />
</elementProp>
<stringProp name="HTTPSampler.domain">${__P(host,127.0.0.1)}</stringProp>
<stringProp name="HTTPSampler.port">${__P(port,5443)}</stringProp>
<stringProp name="HTTPSampler.protocol">https</stringProp>
<stringProp name="HTTPSampler.path">/api/measurement-guidance?setting=Home&amp;activityCondition=AtRest</stringProp>
<stringProp name="HTTPSampler.method">GET</stringProp>
<stringProp name="HTTPSampler.implementation">HttpClient4</stringProp>
<stringProp name="HTTPSampler.connect_timeout">10000</stringProp>
<stringProp name="HTTPSampler.response_timeout">30000</stringProp>
<boolProp name="HTTPSampler.postBodyRaw">false</boolProp>
<boolProp name="HTTPSampler.follow_redirects">false</boolProp>
<boolProp name="HTTPSampler.auto_redirects">false</boolProp>
<boolProp name="HTTPSampler.use_keepalive">true</boolProp>
<boolProp name="HTTPSampler.DO_MULTIPART_POST">false</boolProp>
</HTTPSamplerProxy>
<hashTree>
<JSR223Assertion guiclass="JSR223AssertionGui" testclass="JSR223Assertion" testname="Expected response" enabled="true">
<stringProp name="scriptLanguage">groovy</stringProp>
<stringProp name="cacheKey">true</stringProp>
<stringProp name="filename" />
<stringProp name="parameters" />
<stringProp name="script">if (prev.getResponseCode() != '200') {
AssertionResult.setFailure(true); AssertionResult.setFailureMessage('Unexpected HTTP status: '+prev.getResponseCode()); return
}
// Expected negative outcomes (e.g. deletion confirmed with 404) are successful checks.
prev.setSuccessful(true)
</stringProp>
</JSR223Assertion>
<hashTree />
<JSR223Timer guiclass="JSR223TimerGui" testclass="JSR223Timer" testname="Gaussian interaction pause" enabled="true">
<stringProp name="scriptLanguage">groovy</stringProp>
<stringProp name="cacheKey">true</stringProp>
<stringProp name="filename" />
<stringProp name="parameters" />
<stringProp name="script">def rng = vars.getObject('user_random')
double mean = Double.parseDouble(props.getProperty('think_mean_ms','1000'))
double deviation = Double.parseDouble(props.getProperty('think_stddev_ms','250'))
double minimum = Double.parseDouble(props.getProperty('think_min_ms','500'))
// Symmetric truncation keeps the expected mean at the configured value.
double maximum = 2 * mean - minimum
if (deviation == 0 || maximum == minimum) return Math.round(mean)
double delay
while (true) {
delay = mean + rng.nextGaussian() * deviation
if (delay &gt;= minimum &amp;&amp; delay &lt;= maximum) return Math.round(delay)
}
</stringProp>
</JSR223Timer>
<hashTree />
</hashTree>
<HTTPSamplerProxy guiclass="HttpTestSampleGui" testclass="HTTPSamplerProxy" testname="HTTP Read own profile" enabled="true">
<elementProp name="HTTPsampler.Arguments" elementType="Arguments" guiclass="HTTPArgumentsPanel" testclass="Arguments" enabled="true">
<collectionProp name="Arguments.arguments" />
</elementProp>
<stringProp name="HTTPSampler.domain">${__P(host,127.0.0.1)}</stringProp>
<stringProp name="HTTPSampler.port">${__P(port,5443)}</stringProp>
<stringProp name="HTTPSampler.protocol">https</stringProp>
<stringProp name="HTTPSampler.path">/api/patients/me</stringProp>
<stringProp name="HTTPSampler.method">GET</stringProp>
<stringProp name="HTTPSampler.implementation">HttpClient4</stringProp>
<stringProp name="HTTPSampler.connect_timeout">10000</stringProp>
<stringProp name="HTTPSampler.response_timeout">30000</stringProp>
<boolProp name="HTTPSampler.postBodyRaw">false</boolProp>
<boolProp name="HTTPSampler.follow_redirects">false</boolProp>
<boolProp name="HTTPSampler.auto_redirects">false</boolProp>
<boolProp name="HTTPSampler.use_keepalive">true</boolProp>
<boolProp name="HTTPSampler.DO_MULTIPART_POST">false</boolProp>
</HTTPSamplerProxy>
<hashTree>
<JSR223Assertion guiclass="JSR223AssertionGui" testclass="JSR223Assertion" testname="Expected response" enabled="true">
<stringProp name="scriptLanguage">groovy</stringProp>
<stringProp name="cacheKey">true</stringProp>
<stringProp name="filename" />
<stringProp name="parameters" />
<stringProp name="script">if (prev.getResponseCode() != '200') {
AssertionResult.setFailure(true); AssertionResult.setFailureMessage('Unexpected HTTP status: '+prev.getResponseCode()); return
}
// Expected negative outcomes (e.g. deletion confirmed with 404) are successful checks.
prev.setSuccessful(true)
def json = new groovy.json.JsonSlurper().parseText(prev.getResponseDataAsString())
assert json.patientId == vars.get('patient_id')
</stringProp>
</JSR223Assertion>
<hashTree />
<JSR223Timer guiclass="JSR223TimerGui" testclass="JSR223Timer" testname="Gaussian interaction pause" enabled="true">
<stringProp name="scriptLanguage">groovy</stringProp>
<stringProp name="cacheKey">true</stringProp>
<stringProp name="filename" />
<stringProp name="parameters" />
<stringProp name="script">def rng = vars.getObject('user_random')
double mean = Double.parseDouble(props.getProperty('think_mean_ms','1000'))
double deviation = Double.parseDouble(props.getProperty('think_stddev_ms','250'))
double minimum = Double.parseDouble(props.getProperty('think_min_ms','500'))
// Symmetric truncation keeps the expected mean at the configured value.
double maximum = 2 * mean - minimum
if (deviation == 0 || maximum == minimum) return Math.round(mean)
double delay
while (true) {
delay = mean + rng.nextGaussian() * deviation
if (delay &gt;= minimum &amp;&amp; delay &lt;= maximum) return Math.round(delay)
}
</stringProp>
</JSR223Timer>
<hashTree />
</hashTree>
<HTTPSamplerProxy guiclass="HttpTestSampleGui" testclass="HTTPSamplerProxy" testname="HTTP Record synthetic measurement" enabled="true">
<elementProp name="HTTPsampler.Arguments" elementType="Arguments" guiclass="HTTPArgumentsPanel" testclass="Arguments" enabled="true">
<collectionProp name="Arguments.arguments">
<elementProp name="" elementType="HTTPArgument">
<boolProp name="HTTPArgument.always_encode">false</boolProp>
<stringProp name="Argument.value">${observation_body}</stringProp>
<stringProp name="Argument.metadata">=</stringProp>
</elementProp>
</collectionProp>
</elementProp>
<stringProp name="HTTPSampler.domain">${__P(host,127.0.0.1)}</stringProp>
<stringProp name="HTTPSampler.port">${__P(port,5443)}</stringProp>
<stringProp name="HTTPSampler.protocol">https</stringProp>
<stringProp name="HTTPSampler.path">/api/patients/${patient_id}/observations</stringProp>
<stringProp name="HTTPSampler.method">POST</stringProp>
<stringProp name="HTTPSampler.implementation">HttpClient4</stringProp>
<stringProp name="HTTPSampler.connect_timeout">10000</stringProp>
<stringProp name="HTTPSampler.response_timeout">30000</stringProp>
<boolProp name="HTTPSampler.postBodyRaw">true</boolProp>
<boolProp name="HTTPSampler.follow_redirects">false</boolProp>
<boolProp name="HTTPSampler.auto_redirects">false</boolProp>
<boolProp name="HTTPSampler.use_keepalive">true</boolProp>
<boolProp name="HTTPSampler.DO_MULTIPART_POST">false</boolProp>
</HTTPSamplerProxy>
<hashTree>
<JSR223Assertion guiclass="JSR223AssertionGui" testclass="JSR223Assertion" testname="Expected response" enabled="true">
<stringProp name="scriptLanguage">groovy</stringProp>
<stringProp name="cacheKey">true</stringProp>
<stringProp name="filename" />
<stringProp name="parameters" />
<stringProp name="script">if (prev.getResponseCode() != '201') {
AssertionResult.setFailure(true); AssertionResult.setFailureMessage('Unexpected HTTP status: '+prev.getResponseCode()); return
}
// Expected negative outcomes (e.g. deletion confirmed with 404) are successful checks.
prev.setSuccessful(true)
def json = new groovy.json.JsonSlurper().parseText(prev.getResponseDataAsString())
assert json.patientId == vars.get('patient_id'); assert json.observationId; vars.put('observation_id',json.observationId)
</stringProp>
</JSR223Assertion>
<hashTree />
<JSR223Timer guiclass="JSR223TimerGui" testclass="JSR223Timer" testname="Gaussian interaction pause" enabled="true">
<stringProp name="scriptLanguage">groovy</stringProp>
<stringProp name="cacheKey">true</stringProp>
<stringProp name="filename" />
<stringProp name="parameters" />
<stringProp name="script">def rng = vars.getObject('user_random')
double mean = Double.parseDouble(props.getProperty('think_mean_ms','1000'))
double deviation = Double.parseDouble(props.getProperty('think_stddev_ms','250'))
double minimum = Double.parseDouble(props.getProperty('think_min_ms','500'))
// Symmetric truncation keeps the expected mean at the configured value.
double maximum = 2 * mean - minimum
if (deviation == 0 || maximum == minimum) return Math.round(mean)
double delay
while (true) {
delay = mean + rng.nextGaussian() * deviation
if (delay &gt;= minimum &amp;&amp; delay &lt;= maximum) return Math.round(delay)
}
</stringProp>
</JSR223Timer>
<hashTree />
</hashTree>
<HTTPSamplerProxy guiclass="HttpTestSampleGui" testclass="HTTPSamplerProxy" testname="HTTP Confirm saved reading" enabled="true">
<elementProp name="HTTPsampler.Arguments" elementType="Arguments" guiclass="HTTPArgumentsPanel" testclass="Arguments" enabled="true">
<collectionProp name="Arguments.arguments" />
</elementProp>
<stringProp name="HTTPSampler.domain">${__P(host,127.0.0.1)}</stringProp>
<stringProp name="HTTPSampler.port">${__P(port,5443)}</stringProp>
<stringProp name="HTTPSampler.protocol">https</stringProp>
<stringProp name="HTTPSampler.path">/api/observations/${observation_id}</stringProp>
<stringProp name="HTTPSampler.method">GET</stringProp>
<stringProp name="HTTPSampler.implementation">HttpClient4</stringProp>
<stringProp name="HTTPSampler.connect_timeout">10000</stringProp>
<stringProp name="HTTPSampler.response_timeout">30000</stringProp>
<boolProp name="HTTPSampler.postBodyRaw">false</boolProp>
<boolProp name="HTTPSampler.follow_redirects">false</boolProp>
<boolProp name="HTTPSampler.auto_redirects">false</boolProp>
<boolProp name="HTTPSampler.use_keepalive">true</boolProp>
<boolProp name="HTTPSampler.DO_MULTIPART_POST">false</boolProp>
</HTTPSamplerProxy>
<hashTree>
<JSR223Assertion guiclass="JSR223AssertionGui" testclass="JSR223Assertion" testname="Expected response" enabled="true">
<stringProp name="scriptLanguage">groovy</stringProp>
<stringProp name="cacheKey">true</stringProp>
<stringProp name="filename" />
<stringProp name="parameters" />
<stringProp name="script">if (prev.getResponseCode() != '200') {
AssertionResult.setFailure(true); AssertionResult.setFailureMessage('Unexpected HTTP status: '+prev.getResponseCode()); return
}
// Expected negative outcomes (e.g. deletion confirmed with 404) are successful checks.
prev.setSuccessful(true)
def json = new groovy.json.JsonSlurper().parseText(prev.getResponseDataAsString())
assert json.observationId == vars.get('observation_id')
</stringProp>
</JSR223Assertion>
<hashTree />
<JSR223Timer guiclass="JSR223TimerGui" testclass="JSR223Timer" testname="Gaussian interaction pause" enabled="true">
<stringProp name="scriptLanguage">groovy</stringProp>
<stringProp name="cacheKey">true</stringProp>
<stringProp name="filename" />
<stringProp name="parameters" />
<stringProp name="script">def rng = vars.getObject('user_random')
double mean = Double.parseDouble(props.getProperty('think_mean_ms','1000'))
double deviation = Double.parseDouble(props.getProperty('think_stddev_ms','250'))
double minimum = Double.parseDouble(props.getProperty('think_min_ms','500'))
// Symmetric truncation keeps the expected mean at the configured value.
double maximum = 2 * mean - minimum
if (deviation == 0 || maximum == minimum) return Math.round(mean)
double delay
while (true) {
delay = mean + rng.nextGaussian() * deviation
if (delay &gt;= minimum &amp;&amp; delay &lt;= maximum) return Math.round(delay)
}
</stringProp>
</JSR223Timer>
<hashTree />
</hashTree>
<HTTPSamplerProxy guiclass="HttpTestSampleGui" testclass="HTTPSamplerProxy" testname="HTTP Health overview" enabled="true">
<elementProp name="HTTPsampler.Arguments" elementType="Arguments" guiclass="HTTPArgumentsPanel" testclass="Arguments" enabled="true">
<collectionProp name="Arguments.arguments" />
</elementProp>
<stringProp name="HTTPSampler.domain">${__P(host,127.0.0.1)}</stringProp>
<stringProp name="HTTPSampler.port">${__P(port,5443)}</stringProp>
<stringProp name="HTTPSampler.protocol">https</stringProp>
<stringProp name="HTTPSampler.path">/api/patients/${patient_id}/overview?from=${period_from}&amp;to=${period_to}</stringProp>
<stringProp name="HTTPSampler.method">GET</stringProp>
<stringProp name="HTTPSampler.implementation">HttpClient4</stringProp>
<stringProp name="HTTPSampler.connect_timeout">10000</stringProp>
<stringProp name="HTTPSampler.response_timeout">30000</stringProp>
<boolProp name="HTTPSampler.postBodyRaw">false</boolProp>
<boolProp name="HTTPSampler.follow_redirects">false</boolProp>
<boolProp name="HTTPSampler.auto_redirects">false</boolProp>
<boolProp name="HTTPSampler.use_keepalive">true</boolProp>
<boolProp name="HTTPSampler.DO_MULTIPART_POST">false</boolProp>
</HTTPSamplerProxy>
<hashTree>
<JSR223Assertion guiclass="JSR223AssertionGui" testclass="JSR223Assertion" testname="Expected response" enabled="true">
<stringProp name="scriptLanguage">groovy</stringProp>
<stringProp name="cacheKey">true</stringProp>
<stringProp name="filename" />
<stringProp name="parameters" />
<stringProp name="script">if (prev.getResponseCode() != '200') {
AssertionResult.setFailure(true); AssertionResult.setFailureMessage('Unexpected HTTP status: '+prev.getResponseCode()); return
}
// Expected negative outcomes (e.g. deletion confirmed with 404) are successful checks.
prev.setSuccessful(true)
def json = new groovy.json.JsonSlurper().parseText(prev.getResponseDataAsString())
assert json.patient.patientId == vars.get('patient_id'); assert json.latestObservation != null; assert json.insight != null
</stringProp>
</JSR223Assertion>
<hashTree />
<JSR223Timer guiclass="JSR223TimerGui" testclass="JSR223Timer" testname="Gaussian interaction pause" enabled="true">
<stringProp name="scriptLanguage">groovy</stringProp>
<stringProp name="cacheKey">true</stringProp>
<stringProp name="filename" />
<stringProp name="parameters" />
<stringProp name="script">def rng = vars.getObject('user_random')
double mean = Double.parseDouble(props.getProperty('think_mean_ms','1000'))
double deviation = Double.parseDouble(props.getProperty('think_stddev_ms','250'))
double minimum = Double.parseDouble(props.getProperty('think_min_ms','500'))
// Symmetric truncation keeps the expected mean at the configured value.
double maximum = 2 * mean - minimum
if (deviation == 0 || maximum == minimum) return Math.round(mean)
double delay
while (true) {
delay = mean + rng.nextGaussian() * deviation
if (delay &gt;= minimum &amp;&amp; delay &lt;= maximum) return Math.round(delay)
}
</stringProp>
</JSR223Timer>
<hashTree />
</hashTree>
<TestAction guiclass="TestActionGui" testclass="TestAction" testname="Between-session pause" enabled="true">
<intProp name="ActionProcessor.action">1</intProp>
<intProp name="ActionProcessor.target">0</intProp>
<stringProp name="ActionProcessor.duration">${session_delay_ms}</stringProp>
</TestAction>
<hashTree />
</hashTree>
</hashTree>
</hashTree>
</jmeterTestPlan>
+623
View File
@@ -0,0 +1,623 @@
<?xml version='1.0' encoding='utf-8'?>
<jmeterTestPlan version="1.2" properties="5.0" jmeter="5.6.3">
<hashTree>
<TestPlan guiclass="TestPlanGui" testclass="TestPlan" testname="HealthApp energy: review" enabled="true">
<stringProp name="TestPlan.comments">Synthetic closed-loop sessions; default duration four hours. Setup is external; Shelly power is collected live without changing the outlet.</stringProp>
<boolProp name="TestPlan.functional_mode">false</boolProp>
<boolProp name="TestPlan.serialize_threadgroups">false</boolProp>
<elementProp name="TestPlan.user_defined_variables" elementType="Arguments" guiclass="ArgumentsPanel" testclass="Arguments" enabled="true">
<collectionProp name="Arguments.arguments" />
</elementProp>
</TestPlan>
<hashTree>
<ThreadGroup guiclass="ThreadGroupGui" testclass="ThreadGroup" testname="Shelly live power" enabled="true">
<stringProp name="ThreadGroup.on_sample_error">continue</stringProp>
<elementProp name="ThreadGroup.main_controller" elementType="LoopController" guiclass="LoopControlPanel" testclass="LoopController" enabled="true">
<boolProp name="LoopController.continue_forever">false</boolProp>
<stringProp name="LoopController.loops">-1</stringProp>
</elementProp>
<stringProp name="ThreadGroup.num_threads">1</stringProp>
<stringProp name="ThreadGroup.ramp_time">0</stringProp>
<stringProp name="ThreadGroup.duration">${__P(total_duration_seconds,16210)}</stringProp>
<stringProp name="ThreadGroup.delay">0</stringProp>
<boolProp name="ThreadGroup.scheduler">true</boolProp>
</ThreadGroup>
<hashTree>
<HTTPSamplerProxy guiclass="HttpTestSampleGui" testclass="HTTPSamplerProxy" testname="POWER Shelly status" enabled="true">
<elementProp name="HTTPsampler.Arguments" elementType="Arguments">
<collectionProp name="Arguments.arguments" />
</elementProp>
<stringProp name="HTTPSampler.domain">${__P(shelly_host,192.168.1.44)}</stringProp>
<stringProp name="HTTPSampler.port">${__P(shelly_port,80)}</stringProp>
<stringProp name="HTTPSampler.protocol">http</stringProp>
<stringProp name="HTTPSampler.path">/rpc/Switch.GetStatus?id=${__P(shelly_switch_id,0)}</stringProp>
<stringProp name="HTTPSampler.method">GET</stringProp>
<stringProp name="HTTPSampler.implementation">HttpClient4</stringProp>
<stringProp name="HTTPSampler.connect_timeout">3000</stringProp>
<stringProp name="HTTPSampler.response_timeout">3000</stringProp>
<boolProp name="HTTPSampler.follow_redirects">false</boolProp>
<boolProp name="HTTPSampler.use_keepalive">true</boolProp>
</HTTPSamplerProxy>
<hashTree>
<JSR223Timer guiclass="JSR223TimerGui" testclass="JSR223Timer" testname="Fixed meter cadence" enabled="true">
<stringProp name="scriptLanguage">groovy</stringProp>
<stringProp name="cacheKey">true</stringProp>
<stringProp name="filename" />
<stringProp name="parameters" />
<stringProp name="script">if (!vars.get('shelly_last_poll_ms')) return 0L; return Math.max(0L, Long.parseLong(vars.get('shelly_last_poll_ms')) + Long.parseLong(props.getProperty('shelly_interval_ms','1000')) - System.currentTimeMillis())</stringProp>
</JSR223Timer>
<hashTree />
<JSR223PreProcessor guiclass="JSR223PreProcessorGui" testclass="JSR223PreProcessor" testname="Clear stale power values" enabled="true">
<stringProp name="scriptLanguage">groovy</stringProp>
<stringProp name="cacheKey">true</stringProp>
<stringProp name="filename" />
<stringProp name="parameters" />
<stringProp name="script">['shelly_power_watts','shelly_voltage_volts','shelly_current_amps','shelly_energy_wh'].each { vars.put(it,'') }</stringProp>
</JSR223PreProcessor>
<hashTree />
<JSR223Assertion guiclass="JSR223AssertionGui" testclass="JSR223Assertion" testname="Validate and extract plug readings" enabled="true">
<stringProp name="scriptLanguage">groovy</stringProp>
<stringProp name="cacheKey">true</stringProp>
<stringProp name="filename" />
<stringProp name="parameters" />
<stringProp name="script">vars.put('shelly_last_poll_ms',prev.getStartTime().toString())
try {
assert prev.getResponseCode() == '200'
def json=new groovy.json.JsonSlurper().parseText(prev.getResponseDataAsString())
assert json.output == true : 'Outlet is off'
def readings=[shelly_power_watts:json.apower,shelly_voltage_volts:json.voltage,shelly_current_amps:json.current,shelly_energy_wh:json.aenergy?.total]
readings.each { key,value -&gt; assert value instanceof Number &amp;&amp; Double.isFinite(value.doubleValue()) &amp;&amp; value &gt;= 0; vars.put(key,value.toString()) }
} catch (Throwable error) {
AssertionResult.setFailure(true);AssertionResult.setFailureMessage('Shelly status/measurement unavailable');prev.setSuccessful(false)
}
</stringProp>
</JSR223Assertion>
<hashTree />
</hashTree>
<ResultCollector guiclass="SimpleDataWriter" testclass="ResultCollector" testname="Shelly measurements saved live" enabled="true">
<stringProp name="filename">${__P(shelly_file,shelly.csv)}</stringProp>
<boolProp name="ResultCollector.error_logging">false</boolProp>
</ResultCollector>
<hashTree />
</hashTree>
<kg.apc.jmeter.perfmon.PerfMonCollector guiclass="kg.apc.jmeter.vizualizers.PerfMonGui" testclass="kg.apc.jmeter.perfmon.PerfMonCollector" testname="NUC live CPU RAM disk and network" enabled="true">
<stringProp name="filename">${__P(perfmon_file,perfmon.csv)}</stringProp>
<boolProp name="ResultCollector.error_logging">false</boolProp>
<collectionProp name="metricConnections">
<collectionProp name="0">
<stringProp name="0">${__P(perfmon_host,192.168.1.125)}</stringProp>
<stringProp name="1">${__P(perfmon_port,4444)}</stringProp>
<stringProp name="2">CPU</stringProp>
<stringProp name="3">combined</stringProp>
</collectionProp>
<collectionProp name="1">
<stringProp name="0">${__P(perfmon_host,192.168.1.125)}</stringProp>
<stringProp name="1">${__P(perfmon_port,4444)}</stringProp>
<stringProp name="2">CPU</stringProp>
<stringProp name="3">iowait</stringProp>
</collectionProp>
<collectionProp name="2">
<stringProp name="0">${__P(perfmon_host,192.168.1.125)}</stringProp>
<stringProp name="1">${__P(perfmon_port,4444)}</stringProp>
<stringProp name="2">Memory</stringProp>
<stringProp name="3">usedperc</stringProp>
</collectionProp>
<collectionProp name="3">
<stringProp name="0">${__P(perfmon_host,192.168.1.125)}</stringProp>
<stringProp name="1">${__P(perfmon_port,4444)}</stringProp>
<stringProp name="2">Memory</stringProp>
<stringProp name="3">actualused</stringProp>
</collectionProp>
<collectionProp name="4">
<stringProp name="0">${__P(perfmon_host,192.168.1.125)}</stringProp>
<stringProp name="1">${__P(perfmon_port,4444)}</stringProp>
<stringProp name="2">Swap</stringProp>
<stringProp name="3">used</stringProp>
</collectionProp>
<collectionProp name="5">
<stringProp name="0">${__P(perfmon_host,192.168.1.125)}</stringProp>
<stringProp name="1">${__P(perfmon_port,4444)}</stringProp>
<stringProp name="2">Disks I/O</stringProp>
<stringProp name="3">readbytes</stringProp>
</collectionProp>
<collectionProp name="6">
<stringProp name="0">${__P(perfmon_host,192.168.1.125)}</stringProp>
<stringProp name="1">${__P(perfmon_port,4444)}</stringProp>
<stringProp name="2">Disks I/O</stringProp>
<stringProp name="3">writebytes</stringProp>
</collectionProp>
<collectionProp name="7">
<stringProp name="0">${__P(perfmon_host,192.168.1.125)}</stringProp>
<stringProp name="1">${__P(perfmon_port,4444)}</stringProp>
<stringProp name="2">Network I/O</stringProp>
<stringProp name="3">bytesrecv</stringProp>
</collectionProp>
<collectionProp name="8">
<stringProp name="0">${__P(perfmon_host,192.168.1.125)}</stringProp>
<stringProp name="1">${__P(perfmon_port,4444)}</stringProp>
<stringProp name="2">Network I/O</stringProp>
<stringProp name="3">bytessent</stringProp>
</collectionProp>
</collectionProp>
</kg.apc.jmeter.perfmon.PerfMonCollector>
<hashTree />
<ThreadGroup guiclass="ThreadGroupGui" testclass="ThreadGroup" testname="Users" enabled="true">
<stringProp name="ThreadGroup.on_sample_error">stopthread</stringProp>
<elementProp name="ThreadGroup.main_controller" elementType="LoopController" guiclass="LoopControlPanel" testclass="LoopController" enabled="true">
<boolProp name="LoopController.continue_forever">false</boolProp>
<stringProp name="LoopController.loops">-1</stringProp>
</elementProp>
<stringProp name="ThreadGroup.num_threads">${__P(users,1)}</stringProp>
<stringProp name="ThreadGroup.ramp_time">${__P(ramp_seconds,60)}</stringProp>
<stringProp name="ThreadGroup.duration">${__P(total_duration_seconds,16210)}</stringProp>
<stringProp name="ThreadGroup.delay">0</stringProp>
<boolProp name="ThreadGroup.scheduler">true</boolProp>
<boolProp name="ThreadGroup.same_user_on_next_iteration">true</boolProp>
</ThreadGroup>
<hashTree>
<HeaderManager guiclass="HeaderPanel" testclass="HeaderManager" testname="JSON and bearer token" enabled="true">
<collectionProp name="HeaderManager.headers">
<elementProp name="" elementType="Header">
<stringProp name="Header.name">Content-Type</stringProp>
<stringProp name="Header.value">application/json</stringProp>
</elementProp>
<elementProp name="" elementType="Header">
<stringProp name="Header.name">Authorization</stringProp>
<stringProp name="Header.value">Bearer ${token}</stringProp>
</elementProp>
</collectionProp>
</HeaderManager>
<hashTree />
<OnceOnlyController guiclass="OnceOnlyControllerGui" testclass="OnceOnlyController" testname="Assign one account per user" enabled="true" />
<hashTree>
<JSR223Sampler guiclass="JSR223SamplerGui" testclass="JSR223Sampler" testname="Initialize user" enabled="true">
<stringProp name="scriptLanguage">groovy</stringProp>
<stringProp name="cacheKey">true</stringProp>
<stringProp name="filename" />
<stringProp name="parameters" />
<stringProp name="script">def rows = new File(props.get('users_file')).readLines('UTF-8').drop(1).findAll { it.trim() }
def row = rows[ctx.getThreadNum()].split(',', -1)
vars.put('account_id', row[0]); vars.put('password', row[1]); vars.put('patient_id', row[2])
vars.put('token', ''); vars.put('expires_at', '0'); vars.put('session_number','0')
vars.putObject('user_random', new Random(Long.parseLong(props.getProperty('random_seed','42')) + ctx.getThreadNum()))
synchronized(props) {
if (props.get('timeline_file') &amp;&amp; !props.get('workload_start_ms')) {
long start = System.currentTimeMillis()
long measurement = start + Long.parseLong(props.getProperty('warmup_seconds','1800')) * 1000
long end = measurement + Long.parseLong(props.getProperty('duration_seconds','14400')) * 1000
props.put('workload_start_ms',start.toString())
new File(props.get('timeline_file')).text = groovy.json.JsonOutput.toJson([warmup_start_ms:start,measurement_start_ms:measurement,measurement_end_ms:end])
}
}
</stringProp>
</JSR223Sampler>
<hashTree />
</hashTree>
<JSR223Sampler guiclass="JSR223SamplerGui" testclass="JSR223Sampler" testname="Prepare session" enabled="true">
<stringProp name="scriptLanguage">groovy</stringProp>
<stringProp name="cacheKey">true</stringProp>
<stringProp name="filename" />
<stringProp name="parameters" />
<stringProp name="script">def now = java.time.Instant.now()
vars.put('refresh_login', (now.epochSecond &gt;= Long.parseLong(vars.get('expires_at')) - 60).toString())
vars.put('login_body',groovy.json.JsonOutput.toJson([accountId:vars.get('account_id'),password:vars.get('password')]))
vars.put('period_from',props.get('period_from')); vars.put('period_to',props.get('period_to'))
int n = Integer.parseInt(vars.get('session_number')); vars.put('session_number',(n+1).toString())
// Random session mix: expected 65% review, 30% recording, 5% correction.
int slot = vars.getObject('user_random').nextInt(20)
vars.put('session_kind',slot &lt; 13 ? 'review' : slot &lt; 19 ? 'recording' : 'correction')
double mean = Double.parseDouble(props.getProperty('session_pause_ms','120000'))
double deviation = Double.parseDouble(props.getProperty('session_stddev_ms','30000'))
vars.put('session_delay_ms',Math.max(0L,Math.round(mean + vars.getObject('user_random').nextGaussian()*deviation)).toString())
vars.put('observation_body',groovy.json.JsonOutput.toJson([measuredAt:now.toString(),systolic:128+(n%7),diastolic:82+(n%4),pulse:68+(n%6),measurementContext:[setting:'Home',activityCondition:'AtRest',restDurationMinutes:5,bodyPosition:'Seated'],note:'Synthetic JMeter energy workload']))
</stringProp>
</JSR223Sampler>
<hashTree />
<IfController guiclass="IfControllerPanel" testclass="IfController" testname="Login or renew expired token" enabled="true">
<stringProp name="IfController.condition">${refresh_login}</stringProp>
<boolProp name="IfController.evaluateAll">false</boolProp>
<boolProp name="IfController.useExpression">true</boolProp>
</IfController>
<hashTree>
<HTTPSamplerProxy guiclass="HttpTestSampleGui" testclass="HTTPSamplerProxy" testname="HTTP Login" enabled="true">
<elementProp name="HTTPsampler.Arguments" elementType="Arguments" guiclass="HTTPArgumentsPanel" testclass="Arguments" enabled="true">
<collectionProp name="Arguments.arguments">
<elementProp name="" elementType="HTTPArgument">
<boolProp name="HTTPArgument.always_encode">false</boolProp>
<stringProp name="Argument.value">${login_body}</stringProp>
<stringProp name="Argument.metadata">=</stringProp>
</elementProp>
</collectionProp>
</elementProp>
<stringProp name="HTTPSampler.domain">${__P(host,127.0.0.1)}</stringProp>
<stringProp name="HTTPSampler.port">${__P(port,5443)}</stringProp>
<stringProp name="HTTPSampler.protocol">https</stringProp>
<stringProp name="HTTPSampler.path">/api/authentication/login</stringProp>
<stringProp name="HTTPSampler.method">POST</stringProp>
<stringProp name="HTTPSampler.implementation">HttpClient4</stringProp>
<stringProp name="HTTPSampler.connect_timeout">10000</stringProp>
<stringProp name="HTTPSampler.response_timeout">30000</stringProp>
<boolProp name="HTTPSampler.postBodyRaw">true</boolProp>
<boolProp name="HTTPSampler.follow_redirects">false</boolProp>
<boolProp name="HTTPSampler.auto_redirects">false</boolProp>
<boolProp name="HTTPSampler.use_keepalive">true</boolProp>
<boolProp name="HTTPSampler.DO_MULTIPART_POST">false</boolProp>
</HTTPSamplerProxy>
<hashTree>
<JSR223Assertion guiclass="JSR223AssertionGui" testclass="JSR223Assertion" testname="Expected response" enabled="true">
<stringProp name="scriptLanguage">groovy</stringProp>
<stringProp name="cacheKey">true</stringProp>
<stringProp name="filename" />
<stringProp name="parameters" />
<stringProp name="script">if (prev.getResponseCode() != '200') {
AssertionResult.setFailure(true); AssertionResult.setFailureMessage('Unexpected HTTP status: '+prev.getResponseCode()); return
}
// Expected negative outcomes (e.g. deletion confirmed with 404) are successful checks.
prev.setSuccessful(true)
def json = new groovy.json.JsonSlurper().parseText(prev.getResponseDataAsString())
assert json.accessToken; vars.put('token',json.accessToken); vars.put('expires_at',(java.time.Instant.now().epochSecond + (json.expiresIn as long)).toString())
</stringProp>
</JSR223Assertion>
<hashTree />
<JSR223Timer guiclass="JSR223TimerGui" testclass="JSR223Timer" testname="Gaussian interaction pause" enabled="true">
<stringProp name="scriptLanguage">groovy</stringProp>
<stringProp name="cacheKey">true</stringProp>
<stringProp name="filename" />
<stringProp name="parameters" />
<stringProp name="script">def rng = vars.getObject('user_random')
double mean = Double.parseDouble(props.getProperty('think_mean_ms','1000'))
double deviation = Double.parseDouble(props.getProperty('think_stddev_ms','250'))
double minimum = Double.parseDouble(props.getProperty('think_min_ms','500'))
// Symmetric truncation keeps the expected mean at the configured value.
double maximum = 2 * mean - minimum
if (deviation == 0 || maximum == minimum) return Math.round(mean)
double delay
while (true) {
delay = mean + rng.nextGaussian() * deviation
if (delay &gt;= minimum &amp;&amp; delay &lt;= maximum) return Math.round(delay)
}
</stringProp>
</JSR223Timer>
<hashTree />
</hashTree>
</hashTree>
<HTTPSamplerProxy guiclass="HttpTestSampleGui" testclass="HTTPSamplerProxy" testname="HTTP Read profile" enabled="true">
<elementProp name="HTTPsampler.Arguments" elementType="Arguments" guiclass="HTTPArgumentsPanel" testclass="Arguments" enabled="true">
<collectionProp name="Arguments.arguments" />
</elementProp>
<stringProp name="HTTPSampler.domain">${__P(host,127.0.0.1)}</stringProp>
<stringProp name="HTTPSampler.port">${__P(port,5443)}</stringProp>
<stringProp name="HTTPSampler.protocol">https</stringProp>
<stringProp name="HTTPSampler.path">/api/patients/me</stringProp>
<stringProp name="HTTPSampler.method">GET</stringProp>
<stringProp name="HTTPSampler.implementation">HttpClient4</stringProp>
<stringProp name="HTTPSampler.connect_timeout">10000</stringProp>
<stringProp name="HTTPSampler.response_timeout">30000</stringProp>
<boolProp name="HTTPSampler.postBodyRaw">false</boolProp>
<boolProp name="HTTPSampler.follow_redirects">false</boolProp>
<boolProp name="HTTPSampler.auto_redirects">false</boolProp>
<boolProp name="HTTPSampler.use_keepalive">true</boolProp>
<boolProp name="HTTPSampler.DO_MULTIPART_POST">false</boolProp>
</HTTPSamplerProxy>
<hashTree>
<JSR223Assertion guiclass="JSR223AssertionGui" testclass="JSR223Assertion" testname="Expected response" enabled="true">
<stringProp name="scriptLanguage">groovy</stringProp>
<stringProp name="cacheKey">true</stringProp>
<stringProp name="filename" />
<stringProp name="parameters" />
<stringProp name="script">if (prev.getResponseCode() != '200') {
AssertionResult.setFailure(true); AssertionResult.setFailureMessage('Unexpected HTTP status: '+prev.getResponseCode()); return
}
// Expected negative outcomes (e.g. deletion confirmed with 404) are successful checks.
prev.setSuccessful(true)
def json = new groovy.json.JsonSlurper().parseText(prev.getResponseDataAsString())
assert json.patientId == vars.get('patient_id')
</stringProp>
</JSR223Assertion>
<hashTree />
<JSR223Timer guiclass="JSR223TimerGui" testclass="JSR223Timer" testname="Gaussian interaction pause" enabled="true">
<stringProp name="scriptLanguage">groovy</stringProp>
<stringProp name="cacheKey">true</stringProp>
<stringProp name="filename" />
<stringProp name="parameters" />
<stringProp name="script">def rng = vars.getObject('user_random')
double mean = Double.parseDouble(props.getProperty('think_mean_ms','1000'))
double deviation = Double.parseDouble(props.getProperty('think_stddev_ms','250'))
double minimum = Double.parseDouble(props.getProperty('think_min_ms','500'))
// Symmetric truncation keeps the expected mean at the configured value.
double maximum = 2 * mean - minimum
if (deviation == 0 || maximum == minimum) return Math.round(mean)
double delay
while (true) {
delay = mean + rng.nextGaussian() * deviation
if (delay &gt;= minimum &amp;&amp; delay &lt;= maximum) return Math.round(delay)
}
</stringProp>
</JSR223Timer>
<hashTree />
</hashTree>
<HTTPSamplerProxy guiclass="HttpTestSampleGui" testclass="HTTPSamplerProxy" testname="HTTP Latest reading" enabled="true">
<elementProp name="HTTPsampler.Arguments" elementType="Arguments" guiclass="HTTPArgumentsPanel" testclass="Arguments" enabled="true">
<collectionProp name="Arguments.arguments" />
</elementProp>
<stringProp name="HTTPSampler.domain">${__P(host,127.0.0.1)}</stringProp>
<stringProp name="HTTPSampler.port">${__P(port,5443)}</stringProp>
<stringProp name="HTTPSampler.protocol">https</stringProp>
<stringProp name="HTTPSampler.path">/api/patients/${patient_id}/observations/latest</stringProp>
<stringProp name="HTTPSampler.method">GET</stringProp>
<stringProp name="HTTPSampler.implementation">HttpClient4</stringProp>
<stringProp name="HTTPSampler.connect_timeout">10000</stringProp>
<stringProp name="HTTPSampler.response_timeout">30000</stringProp>
<boolProp name="HTTPSampler.postBodyRaw">false</boolProp>
<boolProp name="HTTPSampler.follow_redirects">false</boolProp>
<boolProp name="HTTPSampler.auto_redirects">false</boolProp>
<boolProp name="HTTPSampler.use_keepalive">true</boolProp>
<boolProp name="HTTPSampler.DO_MULTIPART_POST">false</boolProp>
</HTTPSamplerProxy>
<hashTree>
<JSR223Assertion guiclass="JSR223AssertionGui" testclass="JSR223Assertion" testname="Expected response" enabled="true">
<stringProp name="scriptLanguage">groovy</stringProp>
<stringProp name="cacheKey">true</stringProp>
<stringProp name="filename" />
<stringProp name="parameters" />
<stringProp name="script">if (prev.getResponseCode() != '200') {
AssertionResult.setFailure(true); AssertionResult.setFailureMessage('Unexpected HTTP status: '+prev.getResponseCode()); return
}
// Expected negative outcomes (e.g. deletion confirmed with 404) are successful checks.
prev.setSuccessful(true)
def json = new groovy.json.JsonSlurper().parseText(prev.getResponseDataAsString())
assert json.patientId == vars.get('patient_id')
</stringProp>
</JSR223Assertion>
<hashTree />
<JSR223Timer guiclass="JSR223TimerGui" testclass="JSR223Timer" testname="Gaussian interaction pause" enabled="true">
<stringProp name="scriptLanguage">groovy</stringProp>
<stringProp name="cacheKey">true</stringProp>
<stringProp name="filename" />
<stringProp name="parameters" />
<stringProp name="script">def rng = vars.getObject('user_random')
double mean = Double.parseDouble(props.getProperty('think_mean_ms','1000'))
double deviation = Double.parseDouble(props.getProperty('think_stddev_ms','250'))
double minimum = Double.parseDouble(props.getProperty('think_min_ms','500'))
// Symmetric truncation keeps the expected mean at the configured value.
double maximum = 2 * mean - minimum
if (deviation == 0 || maximum == minimum) return Math.round(mean)
double delay
while (true) {
delay = mean + rng.nextGaussian() * deviation
if (delay &gt;= minimum &amp;&amp; delay &lt;= maximum) return Math.round(delay)
}
</stringProp>
</JSR223Timer>
<hashTree />
</hashTree>
<HTTPSamplerProxy guiclass="HttpTestSampleGui" testclass="HTTPSamplerProxy" testname="HTTP Home resting history" enabled="true">
<elementProp name="HTTPsampler.Arguments" elementType="Arguments" guiclass="HTTPArgumentsPanel" testclass="Arguments" enabled="true">
<collectionProp name="Arguments.arguments" />
</elementProp>
<stringProp name="HTTPSampler.domain">${__P(host,127.0.0.1)}</stringProp>
<stringProp name="HTTPSampler.port">${__P(port,5443)}</stringProp>
<stringProp name="HTTPSampler.protocol">https</stringProp>
<stringProp name="HTTPSampler.path">/api/patients/${patient_id}/observations?from=${period_from}&amp;to=${period_to}&amp;setting=Home&amp;activityCondition=AtRest</stringProp>
<stringProp name="HTTPSampler.method">GET</stringProp>
<stringProp name="HTTPSampler.implementation">HttpClient4</stringProp>
<stringProp name="HTTPSampler.connect_timeout">10000</stringProp>
<stringProp name="HTTPSampler.response_timeout">30000</stringProp>
<boolProp name="HTTPSampler.postBodyRaw">false</boolProp>
<boolProp name="HTTPSampler.follow_redirects">false</boolProp>
<boolProp name="HTTPSampler.auto_redirects">false</boolProp>
<boolProp name="HTTPSampler.use_keepalive">true</boolProp>
<boolProp name="HTTPSampler.DO_MULTIPART_POST">false</boolProp>
</HTTPSamplerProxy>
<hashTree>
<JSR223Assertion guiclass="JSR223AssertionGui" testclass="JSR223Assertion" testname="Expected response" enabled="true">
<stringProp name="scriptLanguage">groovy</stringProp>
<stringProp name="cacheKey">true</stringProp>
<stringProp name="filename" />
<stringProp name="parameters" />
<stringProp name="script">if (prev.getResponseCode() != '200') {
AssertionResult.setFailure(true); AssertionResult.setFailureMessage('Unexpected HTTP status: '+prev.getResponseCode()); return
}
// Expected negative outcomes (e.g. deletion confirmed with 404) are successful checks.
prev.setSuccessful(true)
def json = new groovy.json.JsonSlurper().parseText(prev.getResponseDataAsString())
assert json instanceof List &amp;&amp; !json.empty : 'Seed observations first'
</stringProp>
</JSR223Assertion>
<hashTree />
<JSR223Timer guiclass="JSR223TimerGui" testclass="JSR223Timer" testname="Gaussian interaction pause" enabled="true">
<stringProp name="scriptLanguage">groovy</stringProp>
<stringProp name="cacheKey">true</stringProp>
<stringProp name="filename" />
<stringProp name="parameters" />
<stringProp name="script">def rng = vars.getObject('user_random')
double mean = Double.parseDouble(props.getProperty('think_mean_ms','1000'))
double deviation = Double.parseDouble(props.getProperty('think_stddev_ms','250'))
double minimum = Double.parseDouble(props.getProperty('think_min_ms','500'))
// Symmetric truncation keeps the expected mean at the configured value.
double maximum = 2 * mean - minimum
if (deviation == 0 || maximum == minimum) return Math.round(mean)
double delay
while (true) {
delay = mean + rng.nextGaussian() * deviation
if (delay &gt;= minimum &amp;&amp; delay &lt;= maximum) return Math.round(delay)
}
</stringProp>
</JSR223Timer>
<hashTree />
</hashTree>
<HTTPSamplerProxy guiclass="HttpTestSampleGui" testclass="HTTPSamplerProxy" testname="HTTP Numerical insights" enabled="true">
<elementProp name="HTTPsampler.Arguments" elementType="Arguments" guiclass="HTTPArgumentsPanel" testclass="Arguments" enabled="true">
<collectionProp name="Arguments.arguments" />
</elementProp>
<stringProp name="HTTPSampler.domain">${__P(host,127.0.0.1)}</stringProp>
<stringProp name="HTTPSampler.port">${__P(port,5443)}</stringProp>
<stringProp name="HTTPSampler.protocol">https</stringProp>
<stringProp name="HTTPSampler.path">/api/patients/${patient_id}/insights?from=${period_from}&amp;to=${period_to}&amp;setting=Home&amp;activityCondition=AtRest</stringProp>
<stringProp name="HTTPSampler.method">GET</stringProp>
<stringProp name="HTTPSampler.implementation">HttpClient4</stringProp>
<stringProp name="HTTPSampler.connect_timeout">10000</stringProp>
<stringProp name="HTTPSampler.response_timeout">30000</stringProp>
<boolProp name="HTTPSampler.postBodyRaw">false</boolProp>
<boolProp name="HTTPSampler.follow_redirects">false</boolProp>
<boolProp name="HTTPSampler.auto_redirects">false</boolProp>
<boolProp name="HTTPSampler.use_keepalive">true</boolProp>
<boolProp name="HTTPSampler.DO_MULTIPART_POST">false</boolProp>
</HTTPSamplerProxy>
<hashTree>
<JSR223Assertion guiclass="JSR223AssertionGui" testclass="JSR223Assertion" testname="Expected response" enabled="true">
<stringProp name="scriptLanguage">groovy</stringProp>
<stringProp name="cacheKey">true</stringProp>
<stringProp name="filename" />
<stringProp name="parameters" />
<stringProp name="script">if (prev.getResponseCode() != '200') {
AssertionResult.setFailure(true); AssertionResult.setFailureMessage('Unexpected HTTP status: '+prev.getResponseCode()); return
}
// Expected negative outcomes (e.g. deletion confirmed with 404) are successful checks.
prev.setSuccessful(true)
def json = new groovy.json.JsonSlurper().parseText(prev.getResponseDataAsString())
assert json.contributingCount &gt; 0
</stringProp>
</JSR223Assertion>
<hashTree />
<JSR223Timer guiclass="JSR223TimerGui" testclass="JSR223Timer" testname="Gaussian interaction pause" enabled="true">
<stringProp name="scriptLanguage">groovy</stringProp>
<stringProp name="cacheKey">true</stringProp>
<stringProp name="filename" />
<stringProp name="parameters" />
<stringProp name="script">def rng = vars.getObject('user_random')
double mean = Double.parseDouble(props.getProperty('think_mean_ms','1000'))
double deviation = Double.parseDouble(props.getProperty('think_stddev_ms','250'))
double minimum = Double.parseDouble(props.getProperty('think_min_ms','500'))
// Symmetric truncation keeps the expected mean at the configured value.
double maximum = 2 * mean - minimum
if (deviation == 0 || maximum == minimum) return Math.round(mean)
double delay
while (true) {
delay = mean + rng.nextGaussian() * deviation
if (delay &gt;= minimum &amp;&amp; delay &lt;= maximum) return Math.round(delay)
}
</stringProp>
</JSR223Timer>
<hashTree />
</hashTree>
<HTTPSamplerProxy guiclass="HttpTestSampleGui" testclass="HTTPSamplerProxy" testname="HTTP Trends" enabled="true">
<elementProp name="HTTPsampler.Arguments" elementType="Arguments" guiclass="HTTPArgumentsPanel" testclass="Arguments" enabled="true">
<collectionProp name="Arguments.arguments" />
</elementProp>
<stringProp name="HTTPSampler.domain">${__P(host,127.0.0.1)}</stringProp>
<stringProp name="HTTPSampler.port">${__P(port,5443)}</stringProp>
<stringProp name="HTTPSampler.protocol">https</stringProp>
<stringProp name="HTTPSampler.path">/api/patients/${patient_id}/trends?from=${period_from}&amp;to=${period_to}</stringProp>
<stringProp name="HTTPSampler.method">GET</stringProp>
<stringProp name="HTTPSampler.implementation">HttpClient4</stringProp>
<stringProp name="HTTPSampler.connect_timeout">10000</stringProp>
<stringProp name="HTTPSampler.response_timeout">30000</stringProp>
<boolProp name="HTTPSampler.postBodyRaw">false</boolProp>
<boolProp name="HTTPSampler.follow_redirects">false</boolProp>
<boolProp name="HTTPSampler.auto_redirects">false</boolProp>
<boolProp name="HTTPSampler.use_keepalive">true</boolProp>
<boolProp name="HTTPSampler.DO_MULTIPART_POST">false</boolProp>
</HTTPSamplerProxy>
<hashTree>
<JSR223Assertion guiclass="JSR223AssertionGui" testclass="JSR223Assertion" testname="Expected response" enabled="true">
<stringProp name="scriptLanguage">groovy</stringProp>
<stringProp name="cacheKey">true</stringProp>
<stringProp name="filename" />
<stringProp name="parameters" />
<stringProp name="script">if (prev.getResponseCode() != '200') {
AssertionResult.setFailure(true); AssertionResult.setFailureMessage('Unexpected HTTP status: '+prev.getResponseCode()); return
}
// Expected negative outcomes (e.g. deletion confirmed with 404) are successful checks.
prev.setSuccessful(true)
</stringProp>
</JSR223Assertion>
<hashTree />
<JSR223Timer guiclass="JSR223TimerGui" testclass="JSR223Timer" testname="Gaussian interaction pause" enabled="true">
<stringProp name="scriptLanguage">groovy</stringProp>
<stringProp name="cacheKey">true</stringProp>
<stringProp name="filename" />
<stringProp name="parameters" />
<stringProp name="script">def rng = vars.getObject('user_random')
double mean = Double.parseDouble(props.getProperty('think_mean_ms','1000'))
double deviation = Double.parseDouble(props.getProperty('think_stddev_ms','250'))
double minimum = Double.parseDouble(props.getProperty('think_min_ms','500'))
// Symmetric truncation keeps the expected mean at the configured value.
double maximum = 2 * mean - minimum
if (deviation == 0 || maximum == minimum) return Math.round(mean)
double delay
while (true) {
delay = mean + rng.nextGaussian() * deviation
if (delay &gt;= minimum &amp;&amp; delay &lt;= maximum) return Math.round(delay)
}
</stringProp>
</JSR223Timer>
<hashTree />
</hashTree>
<HTTPSamplerProxy guiclass="HttpTestSampleGui" testclass="HTTPSamplerProxy" testname="HTTP Health overview" enabled="true">
<elementProp name="HTTPsampler.Arguments" elementType="Arguments" guiclass="HTTPArgumentsPanel" testclass="Arguments" enabled="true">
<collectionProp name="Arguments.arguments" />
</elementProp>
<stringProp name="HTTPSampler.domain">${__P(host,127.0.0.1)}</stringProp>
<stringProp name="HTTPSampler.port">${__P(port,5443)}</stringProp>
<stringProp name="HTTPSampler.protocol">https</stringProp>
<stringProp name="HTTPSampler.path">/api/patients/${patient_id}/overview?from=${period_from}&amp;to=${period_to}</stringProp>
<stringProp name="HTTPSampler.method">GET</stringProp>
<stringProp name="HTTPSampler.implementation">HttpClient4</stringProp>
<stringProp name="HTTPSampler.connect_timeout">10000</stringProp>
<stringProp name="HTTPSampler.response_timeout">30000</stringProp>
<boolProp name="HTTPSampler.postBodyRaw">false</boolProp>
<boolProp name="HTTPSampler.follow_redirects">false</boolProp>
<boolProp name="HTTPSampler.auto_redirects">false</boolProp>
<boolProp name="HTTPSampler.use_keepalive">true</boolProp>
<boolProp name="HTTPSampler.DO_MULTIPART_POST">false</boolProp>
</HTTPSamplerProxy>
<hashTree>
<JSR223Assertion guiclass="JSR223AssertionGui" testclass="JSR223Assertion" testname="Expected response" enabled="true">
<stringProp name="scriptLanguage">groovy</stringProp>
<stringProp name="cacheKey">true</stringProp>
<stringProp name="filename" />
<stringProp name="parameters" />
<stringProp name="script">if (prev.getResponseCode() != '200') {
AssertionResult.setFailure(true); AssertionResult.setFailureMessage('Unexpected HTTP status: '+prev.getResponseCode()); return
}
// Expected negative outcomes (e.g. deletion confirmed with 404) are successful checks.
prev.setSuccessful(true)
def json = new groovy.json.JsonSlurper().parseText(prev.getResponseDataAsString())
assert json.patient.patientId == vars.get('patient_id'); assert json.latestObservation != null; assert json.insight != null
</stringProp>
</JSR223Assertion>
<hashTree />
<JSR223Timer guiclass="JSR223TimerGui" testclass="JSR223Timer" testname="Gaussian interaction pause" enabled="true">
<stringProp name="scriptLanguage">groovy</stringProp>
<stringProp name="cacheKey">true</stringProp>
<stringProp name="filename" />
<stringProp name="parameters" />
<stringProp name="script">def rng = vars.getObject('user_random')
double mean = Double.parseDouble(props.getProperty('think_mean_ms','1000'))
double deviation = Double.parseDouble(props.getProperty('think_stddev_ms','250'))
double minimum = Double.parseDouble(props.getProperty('think_min_ms','500'))
// Symmetric truncation keeps the expected mean at the configured value.
double maximum = 2 * mean - minimum
if (deviation == 0 || maximum == minimum) return Math.round(mean)
double delay
while (true) {
delay = mean + rng.nextGaussian() * deviation
if (delay &gt;= minimum &amp;&amp; delay &lt;= maximum) return Math.round(delay)
}
</stringProp>
</JSR223Timer>
<hashTree />
</hashTree>
<TestAction guiclass="TestActionGui" testclass="TestAction" testname="Between-session pause" enabled="true">
<intProp name="ActionProcessor.action">1</intProp>
<intProp name="ActionProcessor.target">0</intProp>
<stringProp name="ActionProcessor.duration">${session_delay_ms}</stringProp>
</TestAction>
<hashTree />
</hashTree>
</hashTree>
</hashTree>
</jmeterTestPlan>
+49
View File
@@ -0,0 +1,49 @@
#!/usr/bin/env python3
"""Prepare synthetic profiles/history outside the measurement window."""
import argparse, csv, datetime as dt, json, os, ssl, urllib.request, urllib.error
from pathlib import Path
p=argparse.ArgumentParser()
p.add_argument('--base-url', required=True); p.add_argument('--ca', required=True)
p.add_argument('--accounts', required=True, help='Private JSON: AccountId, Password, Role')
p.add_argument('--output', required=True); p.add_argument('--days', type=int, default=30)
a=p.parse_args()
if not a.base_url.startswith('https://'): p.error('HTTPS is required')
if not 2 <= a.days <= 365: p.error('days must be 2..365')
context=ssl.create_default_context(cafile=a.ca)
def call(method,path,body=None,token=None):
headers={'Content-Type':'application/json'}
if token: headers['Authorization']='Bearer '+token
req=urllib.request.Request(a.base_url.rstrip('/')+path, data=json.dumps(body).encode() if body is not None else None, headers=headers,method=method)
try:
with urllib.request.urlopen(req,context=context,timeout=60) as r: return r.status,json.load(r)
except urllib.error.HTTPError as e:
if e.code==404: return 404,None
raise RuntimeError(f'{method} {path}: HTTP {e.code}') from None
out=Path(a.output)
out.mkdir(mode=0o700,parents=True,exist_ok=True); os.chmod(out,0o700)
if (out/'users.csv').exists(): p.error('Output users.csv already exists; use a new directory')
rows=[]
for account in json.loads(Path(a.accounts).read_text()):
if account['Role']!='Patient' or account['AccountId']=='installation-check': continue
_,login=call('POST','/api/authentication/login',{'accountId':account['AccountId'],'password':account['Password']})
token=login['accessToken']
status,profile=call('GET','/api/patients/me',token=token)
if status==404:
_,profile=call('POST','/api/patients',{'name':'Synthetic energy test '+account['AccountId'],'dateOfBirth':'1990-01-01','contactInfo':'energy@example.test'},token)
pid=profile['patientId']
now=dt.datetime.now(dt.timezone.utc)
# Seed only absent exact synthetic timestamps; rerunning does not duplicate baseline rows.
start=(now-dt.timedelta(days=a.days)).replace(hour=0,minute=0,second=0,microsecond=0)
_,existing=call('GET',f'/api/patients/{pid}/observations?from={start.isoformat().replace("+00:00","Z")}&to={now.isoformat().replace("+00:00","Z")}',token=token)
times={o['measuredAt'].rstrip('Z') for o in existing}
for day in range(a.days):
for hour in [8,18]:
instant=(start+dt.timedelta(days=day,hours=hour)).isoformat().replace('+00:00','Z')
if instant.rstrip('Z') in times: continue
call('POST',f'/api/patients/{pid}/observations',{'measuredAt':instant,'systolic':122+day%12,'diastolic':76+day%8,'pulse':62+day%10,'measurementContext':{'setting':'Clinic' if day%10==0 else 'Unknown' if day%10==1 else 'Home','activityCondition':'AfterActivity' if day%10==2 else 'Unknown' if day%10==1 else 'AtRest','restDurationMinutes':None if day%10 in [1,2] else 5,'bodyPosition':None if day%10==1 else 'Seated'},'note':'Synthetic energy baseline'},token)
rows.append([account['AccountId'],account['Password'],pid])
print('Prepared synthetic patient:',account['AccountId'])
with (out/'users.csv').open('x') as f:
os.chmod(f.name,0o600); w=csv.writer(f);w.writerow(['account_id','password','patient_id']);w.writerows(rows)
if not rows: raise SystemExit('No patient accounts supplied')
print(f'Prepared {len(rows)} patients; private CSV: {out / "users.csv"}')
+25
View File
@@ -0,0 +1,25 @@
<!doctype html><html lang="en"><meta charset="utf-8"><title>HealthApp measurement report</title>
<style>body{font:15px system-ui;margin:24px;background:#f6f8fb;color:#182230}header,section{background:white;padding:18px;margin-bottom:16px;border-radius:8px}canvas{width:100%;height:210px}h2{font-size:16px;margin:0 0 8px}.controls{position:sticky;top:0;background:white;padding:12px;z-index:2;border-bottom:1px solid #ccc}input{width:220px}#cursor{font-family:monospace}small{color:#485566}</style>
<header><h1>HealthApp — one-second measurements</h1><p id="status"></p><p id="window"></p><small>All panels share the same UTC timeline. Grey shading marks warmup. Missing measurements are gaps, never zero-filled. Latency is grouped by request start time; intervals with no requests have no latency value. Counter values are the plug’s absolute Wh counter.</small></header>
<div class="controls"><button onclick="location.reload()">Refresh snapshot</button> <button id="all">Include warmup</button> <button id="measured">Measured window</button> <label>From second <input id="from" type="number" min="0"></label> <label>To second <input id="to" type="number" min="1"></label><p id="cursor">Move over any graph to inspect the same second across all panels.</p></div><main id="charts"></main>
<script type="application/json" id="data">PAYLOAD_JSON</script><script>
const data=JSON.parse(document.getElementById('data').textContent),rows=data.rows,fields=data.fields,idx=Object.fromEntries(fields.map((f,i)=>[f,i]));
const panels=[['CPU (%)',['cpu_percent','cpu_iowait_percent']],['RAM (%)',['ram_percent']],['RAM / swap (MiB)',['ram_MiB','swap_MiB']],['Power (W)',['power_watts']],['Application requests / errors per second',['requests_s','errors_s']],['Application latency (ms)',['latency_mean_ms','latency_p95_ms','latency_max_ms']],['Disk / network (KiB/s)',['disk_read_KiB_s','disk_write_KiB_s','network_receive_KiB_s','network_send_KiB_s']],['Plug counter (Wh)',['energy_counter_Wh']]];
const colors=['#176bc1','#dc5a18','#379d55','#9450bd'];let lo=0,hi=rows.length-1,selected=null;
const date=t=>new Date(t).toISOString();document.getElementById('status').textContent=`${data.scenario}: ${data.status}. ${rows.length} recorded one-second intervals.`;
document.getElementById('window').textContent=`Measured window: ${date(data.timeline.measurement_start_ms)} — ${date(data.timeline.measurement_end_ms)}. All times UTC.`;
document.getElementById('measured').disabled=rows[rows.length-1][0]<data.timeline.measurement_start_ms;
const canvases=panels.map(([title,keys])=>{const s=document.createElement('section');s.innerHTML=`<h2>${title}</h2><canvas></canvas><small></small>`;document.getElementById('charts').append(s);return {canvas:s.querySelector('canvas'),legend:s.querySelector('small'),keys}});
function draw(){for(const {canvas,legend,keys} of canvases){const rect=canvas.getBoundingClientRect(),dpr=window.devicePixelRatio||1;canvas.width=rect.width*dpr;canvas.height=210*dpr;const c=canvas.getContext('2d');c.scale(dpr,dpr);const w=rect.width,h=210,left=55,right=w-15,top=12,bottom=h-32;
const x=i=>left+(right-left)*(i-lo)/Math.max(1,hi-lo);let max=1;for(let i=lo;i<=hi;i++)for(const k of keys){const v=rows[i][idx[k]];if(v!==null)max=Math.max(max,v)}max*=1.08;const y=v=>bottom-(bottom-top)*v/max;
const warmupIndex=(data.timeline.measurement_start_ms-rows[0][0])/1000;if(warmupIndex>lo){c.fillStyle='#e9ebee';c.fillRect(left,top,Math.max(0,Math.min(right,x(warmupIndex))-left),bottom-top)}
c.font='11px system-ui';for(let j=0;j<=4;j++){const yy=bottom-j*(bottom-top)/4;c.strokeStyle='#e4e7ec';c.beginPath();c.moveTo(left,yy);c.lineTo(right,yy);c.stroke();c.fillStyle='#526070';c.fillText((max*j/4).toFixed(max<10?2:0),2,yy+3)}
keys.forEach((k,n)=>{c.strokeStyle=colors[n];c.lineWidth=1.2;c.beginPath();let pen=false;for(let i=lo;i<=hi;i++){const v=rows[i][idx[k]];if(v===null){pen=false;continue}if(!pen)c.moveTo(x(i),y(v));else c.lineTo(x(i),y(v));pen=true}c.stroke()});
c.fillStyle='#526070';for(let j=0;j<=3;j++){const i=Math.round(lo+(hi-lo)*j/3);c.fillText(date(rows[i][0]).slice(11,19),Math.max(left,Math.min(right-55,x(i)-22)),h-10)}
if(selected!==null&&selected>=lo&&selected<=hi){c.strokeStyle='#182230';c.beginPath();c.moveTo(x(selected),top);c.lineTo(x(selected),bottom);c.stroke()}
legend.innerHTML=keys.map((k,n)=>`<span style="color:${colors[n]}">${k}${selected===null?'':': '+(rows[selected][idx[k]]===null?'missing':rows[selected][idx[k]].toFixed(3))}</span>`).join(' · ');
canvas.onmousemove=e=>{selected=Math.max(lo,Math.min(hi,Math.round(lo+(e.offsetX-left)/(right-left)*Math.max(1,hi-lo))));document.getElementById('cursor').textContent=`${date(rows[selected][0])} — ${rows[selected][idx.phase]}`;draw()};}}
function limits(a,b){lo=Math.max(0,Math.min(rows.length-1,a));hi=Math.max(lo,Math.min(rows.length-1,b));selected=null;document.getElementById('from').value=lo;document.getElementById('to').value=hi;draw()}
document.getElementById('all').onclick=()=>limits(0,rows.length-1);document.getElementById('measured').onclick=()=>limits(Math.floor((data.timeline.measurement_start_ms-rows[0][0])/1000),rows.length-1);
for(const id of ['from','to'])document.getElementById(id).onchange=()=>limits(Number(document.getElementById('from').value),Number(document.getElementById('to').value));window.onresize=draw;limits(0,rows.length-1);
</script></html>
+109
View File
@@ -0,0 +1,109 @@
#!/usr/bin/env python3
"""Align raw JMeter measurements into experiment-relative one-second bins."""
import os,time
import argparse,csv,datetime as dt,json,math
from pathlib import Path
FIELDS=['timestamp_ms','phase','cpu_percent','cpu_iowait_percent','ram_percent','ram_MiB','swap_MiB','power_watts','energy_counter_Wh','disk_read_KiB_s','disk_write_KiB_s','network_receive_KiB_s','network_send_KiB_s','requests_s','errors_s','error_percent','latency_mean_ms','latency_p95_ms','latency_max_ms','power_poll_errors_s']
METRIC_FIELDS={'CPU combined':('cpu_percent',1),'CPU iowait':('cpu_iowait_percent',1),'Memory usedperc':('ram_percent',1),'Memory actualused':('ram_MiB',1/1048576),'Swap used':('swap_MiB',1/1048576),'Disks I/O readbytes':('disk_read_KiB_s',1/1024),'Disks I/O writebytes':('disk_write_KiB_s',1/1024),'Network I/O bytesrecv':('network_receive_KiB_s',1/1024),'Network I/O bytessent':('network_send_KiB_s',1/1024)}
def read_csv(path):
if not path.exists():return []
with path.open(newline='') as f:
# Autoflush can expose the final line during a write; ignore incomplete rows.
return [r for r in csv.DictReader(f) if r and None not in r and all(v is not None for v in r.values())]
def finished(meta):
return ('finished_utc' in meta
and (not meta.get('perfmon',{}).get('enabled') or 'server_metrics' in meta or 'monitoring_error' in meta)
and (not meta.get('shelly',{}).get('enabled') or 'power_energy' in meta or 'power_error' in meta))
def build(folder):
folder=Path(folder);meta=json.loads((folder/'run.json').read_text());timeline=json.loads((folder/'timeline.json').read_text())
start=timeline['warmup_start_ms'];measurement_start=timeline['measurement_start_ms'];end=timeline['measurement_end_ms']
bins={};latest=start;bad_rows=0
def bucket(timestamp):
nonlocal latest
if not start<=timestamp<end:return None
index=int((timestamp-start)//1000);latest=max(latest,timestamp)
return bins.setdefault(index,{'averages':{},'latencies':[],'requests_s':0,'errors_s':0,'power_poll_errors_s':0})
def reading(timestamp,field,value):
row=bucket(timestamp)
if row is not None and math.isfinite(value):row['averages'].setdefault(field,[]).append(value)
for r in read_csv(folder/'perfmon.csv'):
try:
if r.get('success','true').lower()!='true':continue
timestamp=float(r['timeStamp']);value=float(r['elapsed'])/1000
if value<0:continue
for suffix,(field,scale) in METRIC_FIELDS.items():
if r['label'].endswith(' '+suffix):reading(timestamp,field,value*scale);break
except (ValueError,KeyError,TypeError):bad_rows+=1
for r in read_csv(folder/'shelly.csv'):
try:
timestamp=float(r['timeStamp'])+float(r['elapsed'])/2
row=bucket(timestamp)
if r['success'].lower()!='true':
if row is not None:row['power_poll_errors_s']+=1
continue
reading(timestamp,'power_watts',float(r['shelly_power_watts']))
reading(timestamp,'energy_counter_Wh',float(r['shelly_energy_wh']))
except (ValueError,KeyError,TypeError):bad_rows+=1
for r in read_csv(folder/'samples.csv'):
try:
if not r['label'].startswith('HTTP '):continue
row=bucket(float(r['timeStamp']))
if row is None:continue
if float(r['timeStamp'])>=measurement_start and float(r['timeStamp'])+float(r['elapsed'])>end:continue
row['requests_s']+=1;row['errors_s']+=r['success'].lower()!='true';row['latencies'].append(float(r['elapsed']))
except (ValueError,KeyError,TypeError):bad_rows+=1
completed=finished(meta)
if completed:
finish=int(dt.datetime.fromisoformat(meta['finished_utc']).timestamp()*1000)
observed_end=min(end,finish)
else:observed_end=min(end,int(latest)+1)
count=max(1,math.ceil((observed_end-start)/1000));rows=[]
for index in range(count):
timestamp=start+index*1000;source=bins.get(index,{'averages':{},'latencies':[],'requests_s':0,'errors_s':0,'power_poll_errors_s':0})
row={field:None for field in FIELDS};row.update(timestamp_ms=timestamp,phase='warmup' if timestamp<measurement_start else 'measurement')
for field,values in source['averages'].items():row[field]=sum(values)/len(values)
for field in ['requests_s','errors_s','power_poll_errors_s']:row[field]=source[field]
latencies=sorted(source['latencies'])
if latencies:
row.update(error_percent=100*source['errors_s']/len(latencies),latency_mean_ms=sum(latencies)/len(latencies),latency_p95_ms=latencies[max(0,math.ceil(.95*len(latencies))-1)],latency_max_ms=max(latencies))
rows.append(row)
with (folder/'per-second.csv').open('w') as f:
w=csv.DictWriter(f,fieldnames=FIELDS);w.writeheader();w.writerows(rows)
payload={'fields':FIELDS,'rows':[[r[k] for k in FIELDS] for r in rows],'timeline':timeline,'status':'completed' if meta.get('exit_code')==0 else 'incomplete/failed' if completed else 'running — snapshot','scenario':meta['scenario'],'skipped_rows':bad_rows,'interval_ms':1000}
encoded=json.dumps(payload,separators=(',',':'),allow_nan=False).replace('<','\\u003c')
template=(Path(__file__).parent/'report-template.html').read_text()
(folder/'report.html').write_text(template.replace('PAYLOAD_JSON',encoded))
plot(rows,timeline,folder,payload['status'])
print(f'Report saved: {folder / "report.html"}; {count} one-second intervals; {payload["status"]}')
return rows
PANELS=[('CPU utilisation (%)',['cpu_percent','cpu_iowait_percent']),('RAM usage (%)',['ram_percent']),('RAM / swap (MiB)',['ram_MiB','swap_MiB']),('Power (W)',['power_watts']),('Application requests / errors per second',['requests_s','errors_s']),('Application latency (ms)',['latency_mean_ms','latency_p95_ms','latency_max_ms']),('Disk / network (KiB/s)',['disk_read_KiB_s','disk_write_KiB_s','network_receive_KiB_s','network_send_KiB_s']),('Plug energy counter (Wh)',['energy_counter_Wh'])]
def plot(rows,timeline,folder,status):
os.environ.setdefault('MPLCONFIGDIR',str(folder/'.matplotlib'))
import matplotlib
matplotlib.use('Agg')
import matplotlib.pyplot as plt
import matplotlib.dates as mdates
times=[dt.datetime.fromtimestamp(r['timestamp_ms']/1000,dt.timezone.utc) for r in rows]
warmup_end=dt.datetime.fromtimestamp(timeline['measurement_start_ms']/1000,dt.timezone.utc)
finish=dt.datetime.fromtimestamp(timeline['measurement_end_ms']/1000,dt.timezone.utc)
figure,axes=plt.subplots(len(PANELS),1,sharex=True,figsize=(16,19),layout='constrained')
for ax,(title,fields) in zip(axes,PANELS):
for field in fields:ax.plot(times,[float('nan') if r[field] is None else r[field] for r in rows],label=field,linewidth=.8)
ax.set_ylabel(title);ax.grid(alpha=.2);ax.legend(loc='upper right',fontsize=7)
if times[0]<warmup_end:ax.axvspan(times[0],min(warmup_end,times[-1]),color='gray',alpha=.15)
if times[0]<=warmup_end<=times[-1]:ax.axvline(warmup_end,color='black',linestyle='--',linewidth=.8)
ax.set_ylim(bottom=0)
if fields[0]=='requests_s' and not any(r['requests_s'] for r in rows):
ax.set_ylim(-.05,1);ax.text(.5,.5,'Zero application requests',transform=ax.transAxes,ha='center')
if fields[0]=='latency_mean_ms' and all(r['latency_mean_ms'] is None for r in rows):
ax.set_ylim(0,1);ax.text(.5,.5,'No requests: response time unavailable',transform=ax.transAxes,ha='center')
axes[-1].xaxis.set_major_formatter(mdates.DateFormatter('%H:%M:%S',tz=dt.timezone.utc))
axes[-1].set_xlabel('UTC time — experiment-relative one-second bins; shaded area is warmup')
figure.suptitle('HealthApp measurements — '+status+'\nMeasured window: '+warmup_end.isoformat()+' to '+finish.isoformat(),fontsize=13)
figure.savefig(folder/'report.png',dpi=150);figure.savefig(folder/'report.svg');plt.close(figure)
if __name__=='__main__':
parser=argparse.ArgumentParser();parser.add_argument('run_folder');parser.add_argument('--follow',action='store_true');args=parser.parse_args()
while True:
build(args.run_folder)
if not args.follow or finished(json.loads((Path(args.run_folder)/'run.json').read_text())):break
time.sleep(60)
+10
View File
@@ -0,0 +1,10 @@
#!/usr/bin/env bash
set -euo pipefail
script_dir=$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" && pwd)
run_id=$(date -u +%Y%m%dT%H%M%SZ)
exec python3 "$script_dir/run.py" idle \
--host "${HEALTHAPP_HOST:-192.168.1.125}" \
--shelly-host "${SHELLY_HOST:-192.168.1.44}" \
--warmup 1800 --duration 14400 \
--perfmon-interval-ms 1000 --shelly-interval-ms 1000 \
--output "$script_dir/results/idle-$run_id" "$@"
+150
View File
@@ -0,0 +1,150 @@
#!/usr/bin/env python3
"""Preflight and run JMeter; record actual timing for external power measurements."""
import xml.etree.ElementTree as E
import argparse, csv, datetime as dt, hashlib, json, os, platform, subprocess, time, ssl, urllib.request
from pathlib import Path
from perfmon import check_agent, summarize
import shelly
HERE=Path(__file__).resolve().parent
p=argparse.ArgumentParser()
p.add_argument('scenario',choices=['recording','review','correction','professional','mixed','idle'])
p.add_argument('--host',required=True);p.add_argument('--port',type=int,default=5443)
p.add_argument('--ca');p.add_argument('--users-file');p.add_argument('--users',type=int,default=50)
p.add_argument('--warmup',type=int,default=1800);p.add_argument('--duration',type=int,default=14400);p.add_argument('--ramp',type=int,default=120)
p.add_argument('--think-min-ms',type=int,default=500);p.add_argument('--think-mean-ms',type=int,default=1000);p.add_argument('--think-stddev-ms',type=int,default=250)
p.add_argument('--session-pause-ms',type=int,default=120000)
p.add_argument('--session-stddev-ms',type=int,default=30000);p.add_argument('--seed',type=int,default=42)
p.add_argument('--output',required=True);p.add_argument('--jmeter',default=str(Path.home()/'.local/bin/jmeter'))
p.add_argument('--allow-shared-read-account',action='store_true')
p.add_argument('--capacity-trial',action='store_true',help='Read-only trial: restart a session after an error so the configured duration is retained')
p.add_argument('--perfmon-host');p.add_argument('--perfmon-port',type=int,default=4444)
p.add_argument('--perfmon-interval-ms',type=int,default=1000);p.add_argument('--no-perfmon',action='store_true')
p.add_argument('--shelly-host',default='192.168.1.44');p.add_argument('--shelly-port',type=int,default=80)
p.add_argument('--shelly-switch-id',type=int,default=0);p.add_argument('--shelly-interval-ms',type=int,default=1000);p.add_argument('--no-shelly',action='store_true')
a=p.parse_args()
if a.capacity_trial and a.scenario not in ['review','professional']:p.error('Capacity trial is restricted to read-only workloads')
if a.users<1 or a.duration<1 or a.warmup<0 or a.ramp<0 or min(a.think_min_ms,a.think_mean_ms,a.think_stddev_ms,a.session_pause_ms,a.session_stddev_ms)<0: p.error('Invalid timing/concurrency')
if a.think_mean_ms<a.think_min_ms:p.error('Think-time mean must be at least the minimum')
if a.scenario!='idle' and not a.users_file: p.error('--users-file is required')
if a.scenario!='idle' and not a.ca: p.error('--ca is required for application scenarios')
if a.scenario=='idle' and a.users_file:p.error('Idle does not use accounts; omit --users-file')
if a.perfmon_interval_ms<1000 or a.perfmon_interval_ms%1000: p.error('PerfMon interval must be a whole number of seconds, at least 1000 ms')
agent_host=a.perfmon_host or a.host
if not a.no_perfmon: check_agent(agent_host,a.perfmon_port)
if a.shelly_interval_ms<1000 or a.shelly_switch_id<0:p.error('Invalid Shelly interval/switch ID')
shelly_info=None if a.no_shelly else shelly.check_plug(a.shelly_host,a.shelly_port,a.shelly_switch_id)
rows=[]
if a.users_file:
with open(a.users_file,newline='') as f:
reader=csv.DictReader(f)
if reader.fieldnames!=['account_id','password','patient_id']: p.error('CSV columns must be account_id,password,patient_id')
rows=list(reader)
if not rows or any(not all(r.values()) or any(c in v for v in r.values() for c in ',\n\r"') for r in rows): p.error('CSV contains empty or unsupported values')
if len({r['account_id'] for r in rows})!=len(rows): p.error('CSV must contain distinct accounts')
if len(rows)<a.users:
if not a.allow_shared_read_account or a.scenario not in ['review','professional']: p.error('Provide at least one distinct account per user. Shared accounts are allowed only for explicitly labelled read-only runs.')
rows=(rows*((a.users+len(rows)-1)//len(rows)))[:a.users]
if a.scenario!='idle':
context=ssl.create_default_context(cafile=a.ca)
with urllib.request.urlopen(f'https://{a.host}:{a.port}/api/measurement-guidance',context=context,timeout=15) as r:
if r.status!=200: p.error('Gateway preflight failed')
# Fail before a long run if accounts, profiles, baseline data or assignments are missing.
def get(path,token=None,body=None):
headers={'Content-Type':'application/json'}
if token: headers['Authorization']='Bearer '+token
req=urllib.request.Request(f'https://{a.host}:{a.port}'+path,headers=headers,data=json.dumps(body).encode() if body else None)
with urllib.request.urlopen(req,context=context,timeout=60) as r: return json.load(r)
now=dt.datetime.now(dt.timezone.utc)
period_from=(now-dt.timedelta(days=31)).replace(hour=0,minute=0,second=0,microsecond=0).isoformat().replace('+00:00','Z')
period_to=(now+dt.timedelta(seconds=a.warmup+a.duration+3600)).isoformat().replace('+00:00','Z')
for row in {r['account_id']:r for r in rows}.values():
login=get('/api/authentication/login',body={'accountId':row['account_id'],'password':row['password']});token=login['accessToken']
if a.scenario=='professional':
if login['role']!='HealthcareProfessional' or not any(x['patientId']==row['patient_id'] for x in get('/api/professionals/me/patients',token)): p.error('Professional account lacks the required assignment')
elif get('/api/patients/me',token)['patientId']!=row['patient_id']: p.error('CSV patient does not belong to its account')
overview=get('/api/patients/'+row['patient_id']+'/overview?from='+period_from+'&to='+period_to,token)
if overview['insight'] is None or overview['latestObservation'] is None: p.error('Seed patient history before running')
out=Path(a.output).resolve();out.mkdir(parents=True,mode=0o700,exist_ok=False)
metadata={'scenario':a.scenario,'users':0 if a.scenario=='idle' else a.users,'measurement_duration_seconds':a.duration,'warmup_seconds':a.warmup,'ramp_seconds':0 if a.scenario=='idle' else a.ramp,'think_min_ms':a.think_min_ms,'think_max_ms':2*a.think_mean_ms-a.think_min_ms,'think_distribution':'symmetrically truncated Gaussian','think_mean_ms':a.think_mean_ms,'think_stddev_ms':a.think_stddev_ms,'session_pause_ms':a.session_pause_ms,'session_stddev_ms':a.session_stddev_ms,'random_seed':a.seed,'host':a.host,'port':a.port,'period_from':period_from,'period_to':period_to,'load_generator':platform.platform(),'distinct_accounts':len({r['account_id'] for r in rows}),'login':'none; no application requests' if a.scenario=='idle' else 'initial login and renewal before expiry included','energy':'Shelly status polled live by JMeter; calculations exclude warmup'}
runtime_csv=out/'runtime-users.csv'
with runtime_csv.open('x') as f:
os.chmod(f.name,0o600); w=csv.DictWriter(f,fieldnames=['account_id','password','patient_id']);w.writeheader();w.writerows(rows)
source_plan=HERE/'plans'/(a.scenario+'.jmx');metadata['plan_sha256']=hashlib.sha256(source_plan.read_bytes()).hexdigest()
plan=out/'runtime.jmx'; document=E.parse(source_plan)
for collector in document.iter('kg.apc.jmeter.perfmon.PerfMonCollector'):
collector.set('enabled','false' if a.no_perfmon else 'true')
for group in document.iter('ThreadGroup'):
if a.capacity_trial and group.get('testname')=='Users':
for setting in group.findall('stringProp'):
if setting.get('name')=='ThreadGroup.on_sample_error':setting.text='startnextloop'
if group.get('testname')=='Shelly live power':group.set('enabled','false' if a.no_shelly else 'true')
document.write(plan,encoding='utf-8',xml_declaration=True)
drain_seconds=max(5,a.shelly_interval_ms//1000+5) if not a.no_shelly else 5
total_duration_seconds=a.warmup+a.duration+drain_seconds
cmd=[a.jmeter,'-n','-t',str(plan),'-l',str(out/'samples.csv'),'-j',str(out/'jmeter.log'),'-Jhost='+a.host,'-Jport='+str(a.port),'-Jusers_file='+str(runtime_csv),'-Jusers='+str(a.users),'-Jduration_seconds='+str(a.duration),'-Jwarmup_seconds='+str(a.warmup),'-Jtotal_duration_seconds='+str(total_duration_seconds),'-Jtimeline_file='+str(out/'timeline.json'),'-Jramp_seconds='+str(a.ramp),'-Jthink_min_ms='+str(a.think_min_ms),'-Jthink_mean_ms='+str(a.think_mean_ms),'-Jthink_stddev_ms='+str(a.think_stddev_ms),'-Jsession_pause_ms='+str(a.session_pause_ms),'-Jsession_stddev_ms='+str(a.session_stddev_ms),'-Jrandom_seed='+str(a.seed),'-Jperiod_from='+period_from,'-Jperiod_to='+period_to,'-Jjmeter.save.saveservice.autoflush=true','-Jjmeter.save.saveservice.output_format=csv','-Jjmeter.save.saveservice.print_field_names=true','-Jjmeter.save.saveservice.response_data=false','-Jjmeter.save.saveservice.samplerData=false','-Jjmeter.save.saveservice.requestHeaders=false','-Jjmeter.save.saveservice.responseHeaders=false']
metadata['jmeter_version']=subprocess.check_output([a.jmeter,'--version'],text=True).strip()
cmd += ['-Jperfmon_host='+agent_host,'-Jperfmon_port='+str(a.perfmon_port),'-Jperfmon_file='+str(out/'perfmon.csv'),'-JjmeterPlugin.perfmon.interval='+str(a.perfmon_interval_ms),'-JjmeterPlugin.perfmon.useUDP=false']
cmd += ['-Jshelly_host='+a.shelly_host,'-Jshelly_port='+str(a.shelly_port),'-Jshelly_switch_id='+str(a.shelly_switch_id),'-Jshelly_interval_ms='+str(a.shelly_interval_ms),'-Jshelly_file='+str(out/'shelly.csv'),'-Jsample_variables='+','.join(shelly.VARIABLES)]
metadata['capacity_trial']=a.capacity_trial
metadata['error_policy']='restart session on error' if a.capacity_trial else 'stop user on error'
metadata['shelly']={'enabled':not a.no_shelly,'host':a.shelly_host,'port':a.shelly_port,'switch_id':a.shelly_switch_id,'interval_ms':a.shelly_interval_ms,'device':shelly_info}
metadata['perfmon']={'enabled':not a.no_perfmon,'host':agent_host,'port':a.perfmon_port,'interval_ms':a.perfmon_interval_ms}
metadata['started_utc']=dt.datetime.now(dt.timezone.utc).isoformat(); started=time.monotonic()
(out/'run.json').write_text(json.dumps(metadata,indent=2))
print('Measurement workload starts:',metadata['started_utc'],flush=True)
code=0
try:
code=subprocess.call(cmd)
except KeyboardInterrupt: code=130
finally:
metadata['finished_utc']=dt.datetime.now(dt.timezone.utc).isoformat();metadata['actual_elapsed_seconds']=time.monotonic()-started;metadata['exit_code']=code
(out/'run.json').write_text(json.dumps(metadata,indent=2))
runtime_csv.unlink(missing_ok=True)
if (out/'timeline.json').exists():
timeline=json.loads((out/'timeline.json').read_text());metadata.update(timeline)
for name in ['warmup_start','measurement_start','measurement_end']:
metadata[name+'_utc']=dt.datetime.fromtimestamp(timeline[name+'_ms']/1000,dt.timezone.utc).isoformat()
if a.scenario=='idle':
with (out/'samples.csv').open() as f: idle_samples=list(csv.DictReader(f))
app_samples=[r for r in idle_samples if r['label'].startswith('HTTP ')]
metadata.update(http_samples=len(app_samples),measured_http_samples=len(app_samples),measured_http_requests_per_second=0,failed_samples_including_scripts=sum(r['success'].lower()!='true' for r in idle_samples))
if app_samples or metadata['failed_samples_including_scripts']:
print('Idle baseline contains application requests or failed samples');code=1
if metadata['actual_elapsed_seconds']+2<a.warmup+a.duration:
print('Idle baseline stopped early; measurement is incomplete');code=1
if a.scenario!='idle' and (out/'samples.csv').exists():
with (out/'samples.csv').open() as f: all_samples=list(csv.DictReader(f))
samples=[r for r in all_samples if r['label'].startswith('HTTP ')]
all_failed=sum(r['success'].lower()!='true' for r in all_samples)
failed=sum(r['success'].lower()!='true' for r in samples)
measured=[r for r in samples if metadata.get('measurement_start_ms',float('inf')) <= int(r['timeStamp']) and int(r['timeStamp'])+int(r['elapsed']) <= metadata.get('measurement_end_ms',0)]
if measured:
with (out/'measured.csv').open('w') as f:
w=csv.DictWriter(f,fieldnames=list(measured[0]));w.writeheader();w.writerows(measured)
latencies=sorted(int(r['elapsed']) for r in measured)
metadata.update(failed_samples_including_scripts=all_failed,http_samples=len(samples),failed_http_samples=failed,measured_http_samples=len(measured),measured_failed_http_samples=sum(r['success'].lower()!='true' for r in measured),measured_http_requests_per_second=len(measured)/a.duration,p95_latency_ms=latencies[min(len(latencies)-1,int(len(latencies)*.95))] if latencies else None)
print(f'HTTP samples: {len(samples)}; failures: {failed}; measured samples: {len(measured)}')
if all_failed or not measured: code=1
if metadata['actual_elapsed_seconds']+2<a.warmup+a.duration: print('Run stopped early; measurement is incomplete');code=1
if not a.no_perfmon:
try:
metadata['server_metrics']=summarize(out/'perfmon.csv',out/'perfmon-measured.csv',metadata['measurement_start_ms'],metadata['measurement_end_ms'],a.perfmon_interval_ms)
print('Live PerfMon metrics saved and measurement interval validated')
except (OSError,ValueError,KeyError) as error:
metadata['monitoring_error']=str(error);print('Invalid monitoring:',error);code=1
if not a.no_shelly:
try:
metadata['power_energy']=shelly.summarize(out/'shelly.csv',out/'shelly-measured.csv',metadata['measurement_start_ms'],metadata['measurement_end_ms'],a.shelly_interval_ms)
print('Live Shelly power and measured-window energy saved')
except (OSError,ValueError,KeyError) as error:
metadata['power_error']=str(error);print('Invalid power measurement:',error);code=1
metadata['exit_code']=code
(out/'run.json').write_text(json.dumps(metadata,indent=2))
if (out/'timeline.json').exists():
try:
from report import build
build(out)
except Exception as error:
print('Graph generation failed; raw measurements are preserved:',error)
metadata['report_error']=str(error);(out/'run.json').write_text(json.dumps(metadata,indent=2))
raise SystemExit(code)
+40
View File
@@ -0,0 +1,40 @@
"""Shelly read-only preflight and measured-window energy calculations."""
import csv, json, math, urllib.request
VARIABLES=['shelly_power_watts','shelly_voltage_volts','shelly_current_amps','shelly_energy_wh']
def check_plug(host,port=80,switch_id=0):
def read(method):
with urllib.request.urlopen(f'http://{host}:{port}/rpc/{method}',timeout=5) as r:return json.load(r)
info=read('Shelly.GetDeviceInfo');status=read(f'Switch.GetStatus?id={switch_id}')
if info.get('auth_en'):raise ValueError('Shelly authentication is enabled; this integration requires the current unauthenticated LAN API')
if status.get('output') is not True:raise ValueError('Shelly outlet is off')
values=[status.get('apower'),status.get('voltage'),status.get('current'),status.get('aenergy',{}).get('total')]
if any(not isinstance(v,(float,int)) or not math.isfinite(v) or v<0 for v in values):raise ValueError('Shelly power/voltage/current/energy readings are unavailable')
return {k:info.get(k) for k in ['model','gen','ver','app']}
def summarize(raw,measured,start_ms,end_ms,interval_ms):
with raw.open() as f:rows=list(csv.DictReader(f))
points=[]
for row in rows:
if row['label']!='POWER Shelly status':continue
if row['success'].lower()!='true':raise ValueError('A Shelly status poll failed; energy measurement is incomplete')
values=[float(row[k]) for k in VARIABLES]
if any(not math.isfinite(v) or v<0 for v in values):raise ValueError('Invalid Shelly metric')
# Approximate the device sampling instant by the HTTP request midpoint.
timestamp=int(row['timeStamp'])+int(row['elapsed'])/2
points.append((timestamp,*values))
points.sort()
if len(points)<2 or points[0][0]>start_ms or points[-1][0]<end_ms:raise ValueError('Shelly samples do not bracket the full measured interval')
if any(b[0]<=a[0] or b[0]-a[0]>interval_ms*3 or b[4]<a[4] for a,b in zip(points,points[1:])):raise ValueError('Shelly samples contain gaps, duplicate timestamps or an energy counter reset')
def boundary(time):
for a,b in zip(points,points[1:]):
if a[0]<=time<=b[0]:return (time,*(a[i]+(b[i]-a[i])*(time-a[0])/(b[0]-a[0]) for i in range(1,5)))
raise ValueError('Missing boundary')
selected=[boundary(start_ms),*(p for p in points if start_ms<p[0]<end_ms),boundary(end_ms)]
# Each recorded power reading represents one nominal polling interval.
# Do not interpolate power or invent readings at the window boundaries.
measured_points=[p for p in points if start_ms<=p[0]<end_ms]
if not measured_points:raise ValueError('No Shelly power readings inside the measured interval')
joules=sum(p[1] for p in measured_points)*(interval_ms/1000)
watt_hours=selected[-1][4]-selected[0][4]
with measured.open('w') as f:
w=csv.writer(f);w.writerow(['timestamp_ms','power_watts','voltage_volts','current_amps','energy_wh']);w.writerows(selected)
return {'measurement_seconds':(end_ms-start_ms)/1000,'samples_including_interpolated_boundaries':len(selected),'power_sample_count':len(measured_points),'nominal_sample_interval_ms':interval_ms,'nominal_sample_coverage_seconds':len(measured_points)*interval_ms/1000,'energy_method':'sum of recorded power readings multiplied by nominal polling interval; assumes each reading represents that interval','integrated_joules':joules,'integrated_kWh':joules/3600000,'average_watts':sum(p[1] for p in measured_points)/len(measured_points),'counter_delta_Wh':watt_hours,'counter_joules':watt_hours*3600,'counter_kWh':watt_hours/1000,'boundary_method':'Energy counter and exported plot boundaries interpolated; power sum uses only recorded in-window samples; timestamps approximate HTTP request midpoint'}
+26
View File
@@ -0,0 +1,26 @@
#!/usr/bin/env python3
"""Verify the idle runner makes zero application requests, including preflight."""
import csv,json,subprocess,tempfile,threading
from pathlib import Path
from http.server import BaseHTTPRequestHandler,ThreadingHTTPServer
HERE=Path(__file__).parent
class Application(BaseHTTPRequestHandler):
requests=0
def do_GET(self):
type(self).requests+=1;self.send_response(500);self.end_headers()
do_POST=do_GET
def log_message(self,*args):pass
server=ThreadingHTTPServer(('127.0.0.1',0),Application)
threading.Thread(target=server.serve_forever,daemon=True).start()
try:
with tempfile.TemporaryDirectory(prefix='healthapp-idle-') as name:
out=Path(name)/'run'
result=subprocess.run(['python3',str(HERE/'run.py'),'idle','--host','127.0.0.1','--port',str(server.server_port),'--no-perfmon','--no-shelly','--warmup','1','--duration','3','--output',str(out)],capture_output=True,text=True)
assert result.returncode==0,result.stdout+result.stderr
data=json.loads((out/'run.json').read_text())
assert Application.requests==0 and data['http_samples']==0 and data['users']==0
assert data['measurement_end_ms']-data['measurement_start_ms']==3000
assert data['measurement_start_ms']-data['warmup_start_ms']==1000
with (out/'samples.csv').open() as f:assert all(not r['label'].startswith('HTTP ') for r in csv.DictReader(f))
print('Idle baseline passed: no application calls or login, no CA/accounts needed, warmup excluded')
finally:server.shutdown()
+45
View File
@@ -0,0 +1,45 @@
#!/usr/bin/env python3
"""Verify metric decoding; optionally verify a live JMeter-to-agent connection."""
import argparse, csv, json, subprocess, tempfile, time
from pathlib import Path
import xml.etree.ElementTree as E
from perfmon import METRICS, check_agent, summarize
p=argparse.ArgumentParser();p.add_argument('--host');p.add_argument('--port',type=int,default=4444);p.add_argument('--output');a=p.parse_args()
with tempfile.TemporaryDirectory(prefix='healthapp-perfmon-unit-') as name:
root=Path(name);raw=root/'raw.csv'
def fixture(skip=None,gap=False):
with raw.open('w') as f:
writer=csv.DictWriter(f,fieldnames=['timeStamp','elapsed','label']);writer.writeheader()
for timestamp in ([5000,25000] if gap else range(0,30001,5000)):
for kind,param,unit in METRICS:
if (kind,param)==skip:continue
writer.writerow({'timeStamp':timestamp,'elapsed':73250 if kind=='CPU' else 123000,'label':'fixture '+kind+' '+param})
fixture();stats=summarize(raw,root/'measured.csv',5000,25000,5000)
assert stats['fixture CPU combined']['mean']==73.25
assert len(stats)==9 and all(s['samples']==5 for s in stats.values())
for skipped,gap in [(('CPU','combined'),False),(None,True)]:
fixture(skipped,gap)
try:summarize(raw,root/'invalid.csv',5000,25000,5000)
except ValueError:pass
else:raise AssertionError('Missing metrics/collection gaps were accepted')
print('Metric decoding, warmup exclusion and gap detection passed')
if a.host:
if not a.output:p.error('--output is required for a live check')
check_agent(a.host,a.port)
out=Path(a.output).resolve();out.mkdir(parents=True,mode=0o700,exist_ok=False)
document=E.parse(Path(__file__).parent/'plans/idle.jmx')
for group in document.iter('ThreadGroup'):
if group.get('testname')=='Shelly live power':group.set('enabled','false')
plan=out/'idle.jmx';document.write(plan)
cmd=[str(Path.home()/'.local/bin/jmeter'),'-n','-t',str(plan),'-l',str(out/'samples.csv'),'-j',str(out/'jmeter.log'),'-Jperfmon_host='+a.host,'-Jperfmon_port='+str(a.port),'-Jperfmon_file='+str(out/'perfmon.csv'),'-JjmeterPlugin.perfmon.interval=5000','-JjmeterPlugin.perfmon.useUDP=false','-Jjmeter.save.saveservice.autoflush=true','-Jwarmup_seconds=5','-Jduration_seconds=20','-Jtotal_duration_seconds=30','-Jtimeline_file='+str(out/'timeline.json')]
process=subprocess.Popen(cmd);saved_live=False
while process.poll() is None:
raw=out/'perfmon.csv'
if raw.exists() and raw.stat().st_size>0:saved_live=True
time.sleep(.25)
assert process.returncode==0 and saved_live, 'Metrics were not saved while JMeter was running'
timeline=json.loads((out/'timeline.json').read_text())
stats=summarize(out/'perfmon.csv',out/'perfmon-measured.csv',timeline['measurement_start_ms'],timeline['measurement_end_ms'],5000)
(out/'summary.json').write_text(json.dumps(stats,indent=2))
print('Live JMeter collection passed: nine metrics written during the run; no application load sent')
print('Results:',out)
+101
View File
@@ -0,0 +1,101 @@
#!/usr/bin/env python3
"""Exercise every generated plan against a local HTTPS contract stub, not testserver."""
import datetime, json, os, ssl, subprocess, tempfile, threading, uuid
from http.server import BaseHTTPRequestHandler, ThreadingHTTPServer
from pathlib import Path
import xml.etree.ElementTree as E
from urllib.parse import urlsplit
HERE=Path(__file__).resolve().parent
class Handler(BaseHTTPRequestHandler):
protocol_version='HTTP/1.1'
observations={}; tokens={}; logins=0; break_insights=False
def log_message(self,*args): pass
def handle_request(self):
path=urlsplit(self.path).path
body=json.loads(self.rfile.read(int(self.headers.get('Content-Length',0))) or '{}')
code=200; data={}
if path=='/api/measurement-guidance': data={'available':True}
elif path=='/api/authentication/login':
if body.get('password')!='test': code=401
else:
token=str(uuid.uuid4());self.tokens[token]=body['accountId'];type(self).logins+=1
data={'accessToken':token,'expiresIn':65,'role':'Patient','tokenType':'Bearer'}
elif self.headers.get('Authorization','').removeprefix('Bearer ') not in self.tokens: code=401
elif path=='/api/professionals/me/patients': data=[{'patientId':'patient-0'},{'patientId':'patient-1'}]
elif path=='/api/patients/me':
account=self.tokens[self.headers['Authorization'].removeprefix('Bearer ')]
data={'patientId':'patient-'+account.split('-')[-1]}
elif path.startswith('/api/observations/'):
oid=path.split('/')[-1]
if oid not in self.observations: code=404
elif self.command=='DELETE': del self.observations[oid];code=204
else:
if self.command=='PATCH':self.observations[oid].update(body)
data=self.observations[oid]
elif path.startswith('/api/patients/'):
pid=path.split('/')[3];profile={'patientId':pid}
baseline={'patientId':pid,'observationId':'baseline','systolic':128,'diastolic':82,'pulse':68,'measuredAt':'2026-09-01T08:00:00'}
if path.endswith('/observations'):
if self.command=='POST':
if not body.get('measuredAt') or body.get('measurementContext',{}).get('setting') not in ['Home','Clinic','Other','Unknown']:code=400
else:
oid=str(uuid.uuid4());data=dict(body,patientId=pid,observationId=oid);self.observations[oid]=data;code=201
else:data=[baseline]
elif path.endswith('/latest'):data=baseline
elif path.endswith('/overview'):data={'patient':profile,'latestObservation':baseline,'insight':{'contributingCount':60}}
elif path.endswith('/insights'):
data={'contributingCount':60}
if self.break_insights: code=503
elif path.endswith('/trends'):data={'patientId':pid}
else:data=profile
else:code=404
payload=b'' if code==204 else json.dumps(data).encode()
self.send_response(code);self.send_header('Content-Type','application/json');self.send_header('Content-Length',str(len(payload)));self.end_headers();self.wfile.write(payload)
do_GET=do_POST=do_PATCH=do_DELETE=handle_request
with tempfile.TemporaryDirectory(prefix='healthapp-jmeter-verify-') as temp:
root=Path(temp);cert=root/'cert.pem';key=root/'key.pem'
subprocess.run(['openssl','req','-x509','-newkey','rsa:2048','-nodes','-days','1','-keyout',str(key),'-out',str(cert),'-subj','/CN=127.0.0.1','-addext','subjectAltName=IP:127.0.0.1'],check=True,capture_output=True)
server=ThreadingHTTPServer(('127.0.0.1',0),Handler);context=ssl.SSLContext(ssl.PROTOCOL_TLS_SERVER);context.load_cert_chain(cert,key);server.socket=context.wrap_socket(server.socket,server_side=True)
threading.Thread(target=server.serve_forever,daemon=True).start()
users=root/'users.csv';users.write_text('account_id,password,patient_id\naccount-0,test,patient-0\naccount-1,test,patient-1\n')
accounts=root/'accounts.json'
accounts.write_text(json.dumps([{'AccountId':f'account-{i}','Password':'test','Role':'Patient'} for i in range(2)]))
prepared=subprocess.run(['python3',str(HERE/'prepare.py'),'--base-url',f'https://127.0.0.1:{server.server_port}','--ca',str(cert),'--accounts',str(accounts),'--output',str(root/'dataset'),'--days','4'],capture_output=True,text=True)
assert prepared.returncode==0, prepared.stderr
assert len(Handler.observations)==16
assert set(o['measurementContext']['setting'] for o in Handler.observations.values())=={'Home','Clinic','Unknown'}
assert (root/'dataset/users.csv').stat().st_mode & 0o777 == 0o600
print('Synthetic dataset preparation passed')
# Professional runner preflight is intentionally separate: fixture credentials are patient roles.
for scenario in ['recording','review','correction','mixed']:
initial_logins=Handler.logins
result=subprocess.run(['python3',str(HERE/'run.py'),scenario,'--no-perfmon','--no-shelly','--host','127.0.0.1','--port',str(server.server_port),'--ca',str(cert),'--users-file',str(users),'--users','2','--warmup','1','--duration','6','--ramp','0','--think-min-ms','0','--think-mean-ms','10','--think-stddev-ms','5','--session-pause-ms','100','--session-stddev-ms','25','--output',str(root/scenario)],capture_output=True,text=True)
if result.returncode:
print(result.stdout,result.stderr)
print((root/scenario/'jmeter.log').read_text()[-6000:])
raise SystemExit('Plan verification failed: '+scenario)
assert Handler.logins - initial_logins >= 6, 'Initial login and token renewal were not exercised'
data=json.loads((root/scenario/'run.json').read_text());assert data['measurement_end_ms']-data['measurement_start_ms']==6000; assert data['measured_http_samples']>0; print(scenario, 'passed;',data['http_samples'],'HTTP samples;', data['failed_http_samples'],'failures')
# Run the professional plan directly so its assigned-patient semantic assertion is exercised.
professional=E.parse(HERE/'plans/professional.jmx')
for collector in professional.iter('kg.apc.jmeter.perfmon.PerfMonCollector'):collector.set('enabled','false')
for group in professional.iter('ThreadGroup'):
if group.get('testname')=='Shelly live power':group.set('enabled','false')
professional.write(root/'professional.jmx')
result=subprocess.run([str(Path.home()/'.local/bin/jmeter'),'-n','-t',str(root/'professional.jmx'),'-l',str(root/'professional.csv'),'-j',str(root/'professional.log'),'-Jperfmon_enabled=false','-Jhost=127.0.0.1','-Jport='+str(server.server_port),'-Jusers_file='+str(users),'-Jusers=2','-Jtotal_duration_seconds=8','-Jramp_seconds=0','-Jthink_min_ms=0','-Jthink_mean_ms=0','-Jthink_stddev_ms=0','-Jsession_pause_ms=100','-Jsession_stddev_ms=25','-Jperiod_from=2026-01-01T00:00:00Z','-Jperiod_to=2027-01-01T00:00:00Z'],capture_output=True,text=True)
import csv
with (root/'professional.csv').open() as f: samples=list(csv.DictReader(f))
assert result.returncode==0 and samples and all(r['success']=='true' for r in samples), result.stdout+result.stderr
print('professional passed;',len(samples),'samples; token renewal exercised across all plans')
Handler.break_insights=True
failed=subprocess.run(['python3',str(HERE/'run.py'),'review','--no-perfmon','--no-shelly','--host','127.0.0.1','--port',str(server.server_port),'--ca',str(cert),'--users-file',str(users),'--users','2','--warmup','0','--duration','5','--ramp','0','--think-min-ms','0','--think-mean-ms','0','--think-stddev-ms','0','--session-pause-ms','0','--session-stddev-ms','0','--output',str(root/'expected-failure')],capture_output=True,text=True)
assert failed.returncode!=0
assert json.loads((root/'expected-failure/run.json').read_text())['failed_http_samples']>0
print('Unexpected upstream failure correctly invalidates the run')
# Constant 100 W for 4 measured hours is exactly 1,440,000 J / 0.4 kWh.
energy_run=root/'energy-run.json';energy_run.write_text(json.dumps({'measurement_start_ms':1000000,'measurement_end_ms':15400000,'measured_http_samples':100}))
power=root/'power.csv';power.write_text('timestamp,power_watts\n1970-01-01T00:00:00Z,100\n1970-01-01T05:00:00Z,100\n')
energy=subprocess.run(['python3',str(HERE/'energy.py'),str(energy_run),str(power)],capture_output=True,text=True,check=True)
energy_result=json.loads(energy.stdout); assert energy_result['joules']==1440000 and energy_result['kWh']==0.4
print('Four-hour power integration passed')
server.shutdown()
+25
View File
@@ -0,0 +1,25 @@
#!/usr/bin/env python3
"""Verify clock alignment, one-second aggregation and missing-data semantics."""
import csv,datetime as dt,json,tempfile
from pathlib import Path
import report
with tempfile.TemporaryDirectory(prefix='healthapp-report-') as name:
folder=Path(name);start=1000000
(folder/'timeline.json').write_text(json.dumps({'warmup_start_ms':start,'measurement_start_ms':start+2000,'measurement_end_ms':start+5000}))
(folder/'run.json').write_text(json.dumps({'scenario':'mixed','exit_code':0,'finished_utc':dt.datetime.fromtimestamp((start+5000)/1000,dt.timezone.utc).isoformat()}))
def write(name,fields,rows):
with (folder/name).open('w') as f:w=csv.DictWriter(f,fieldnames=fields);w.writeheader();w.writerows(rows)
write('samples.csv',['timeStamp','elapsed','label','success'],[{'timeStamp':start+2050,'elapsed':200,'label':'HTTP Read profile','success':'true'},{'timeStamp':start+2200,'elapsed':1000,'label':'HTTP Read overview','success':'false'},{'timeStamp':start+2250,'elapsed':10,'label':'POWER Shelly status','success':'true'}])
write('perfmon.csv',['timeStamp','elapsed','label','success'],[{'timeStamp':start+2100,'elapsed':30000,'label':'NUC CPU combined','success':'true'},{'timeStamp':start+2800,'elapsed':50000,'label':'NUC CPU combined','success':'true'},{'timeStamp':start+2110,'elapsed':104857600000,'label':'NUC Memory actualused','success':'true'}])
write('shelly.csv',['timeStamp','elapsed','label','success','shelly_power_watts','shelly_energy_wh'],[{'timeStamp':start+2150,'elapsed':100,'label':'POWER Shelly status','success':'true','shelly_power_watts':20,'shelly_energy_wh':3}])
original=report.plot;report.plot=lambda *args:None
rows=report.build(folder)
report.plot=original
assert len(rows)==5
assert rows[2]['phase']=='measurement' and rows[1]['phase']=='warmup'
assert rows[2]['cpu_percent']==40 and rows[2]['ram_MiB']==100 and rows[2]['power_watts']==20
assert rows[2]['requests_s']==2 and rows[2]['errors_s']==1 and rows[2]['error_percent']==50
assert rows[2]['latency_mean_ms']==600 and rows[2]['latency_p95_ms']==1000
assert rows[3]['cpu_percent'] is None and rows[3]['latency_mean_ms'] is None and rows[3]['requests_s']==0
assert (folder/'report.html').exists() and (folder/'per-second.csv').exists()
print('One-second request/latency/error aggregation, UTC alignment, warmup and missing measurements passed')
+64
View File
@@ -0,0 +1,64 @@
#!/usr/bin/env python3
"""Check power math and optionally exercise live JMeter-to-Shelly collection."""
import argparse, csv, json, subprocess, tempfile, time, xml.etree.ElementTree as E
from pathlib import Path
import shelly
p=argparse.ArgumentParser();p.add_argument('--host');p.add_argument('--port',type=int,default=80);p.add_argument('--output');a=p.parse_args()
with tempfile.TemporaryDirectory(prefix='healthapp-shelly-test-') as name:
root=Path(name);raw=root/'power.csv'
with raw.open('w') as f:
fields=['timeStamp','elapsed','label','success',*shelly.VARIABLES];w=csv.DictWriter(f,fieldnames=fields);w.writeheader()
for t in range(0,20001,1000):
w.writerow(dict(zip(fields,[t,0,'POWER Shelly status','true',100,230,.5,t/36000])))
result=shelly.summarize(raw,root/'measured.csv',2500,17500,1000)
assert result['integrated_joules']==1500 and abs(result['counter_joules']-1500)<.0001
assert result['measurement_seconds']==15 and result['average_watts']==100
assert result['power_sample_count']==15 and result['nominal_sample_coverage_seconds']==15
# Variable power distinguishes a direct sample sum from trapezoidal integration.
with raw.open() as f: variable=list(csv.DictReader(f))
variable[3]['shelly_power_watts']='200'
with raw.open('w') as f:
w=csv.DictWriter(f,fieldnames=fields);w.writeheader();w.writerows(variable)
variable_result=shelly.summarize(raw,root/'variable.csv',2500,17500,1000)
assert variable_result['integrated_joules']==1600
for start,end in [(-1000,17500),(2500,25000)]:
try:shelly.summarize(raw,root/'bad.csv',start,end,1000)
except ValueError:pass
else:raise AssertionError('Incomplete coverage accepted')
with raw.open() as f:rows=list(csv.DictReader(f))
for variant in ['gap','reset','failed']:
bad=list(rows)
if variant=='gap':bad=[r for r in bad if not 5000<int(r['timeStamp'])<15000]
elif variant=='reset':bad=[dict(r,shelly_energy_wh='0') if int(r['timeStamp'])>=10000 else r for r in bad]
else:bad[6]=dict(bad[6],success='false')
path=root/(variant+'.csv')
with path.open('w') as f:w=csv.DictWriter(f,fieldnames=fields);w.writeheader();w.writerows(bad)
try:shelly.summarize(path,root/'bad.csv',2500,17500,1000)
except ValueError:pass
else:raise AssertionError(variant+' accepted')
with raw.open('w') as f:
w=csv.DictWriter(f,fieldnames=fields);w.writeheader()
for t in range(0,16500001,300000):
w.writerow(dict(zip(fields,[t,0,'POWER Shelly status','true',100,230,.5,t/36000])))
long_run=shelly.summarize(raw,root/'four-hours.csv',1800000,16200000,300000)
assert long_run['measurement_seconds']==14400 and long_run['integrated_joules']==1440000
assert long_run['counter_kWh']==.4
print('Shelly energy calculation, warmup exclusion, gaps, resets and failed-poll checks passed')
if a.host:
if not a.output:p.error('--output is required for live verification')
print('Device:',shelly.check_plug(a.host,a.port))
out=Path(a.output).resolve();out.mkdir(parents=True,mode=0o700,exist_ok=False)
document=E.parse(Path(__file__).parent/'plans/idle.jmx')
for collector in document.iter('kg.apc.jmeter.perfmon.PerfMonCollector'):collector.set('enabled','false')
plan=out/'idle.jmx';document.write(plan)
command=[str(Path.home()/'.local/bin/jmeter'),'-n','-t',str(plan),'-l',str(out/'samples.csv'),'-j',str(out/'jmeter.log'),'-Jshelly_host='+a.host,'-Jshelly_port='+str(a.port),'-Jshelly_file='+str(out/'shelly.csv'),'-Jsample_variables='+','.join(shelly.VARIABLES),'-Jjmeter.save.saveservice.autoflush=true','-Jwarmup_seconds=5','-Jduration_seconds=20','-Jtotal_duration_seconds=35','-Jtimeline_file='+str(out/'timeline.json')]
process=subprocess.Popen(command);live=False
while process.poll() is None:
file=out/'shelly.csv'
if file.exists() and file.stat().st_size>0:live=True
time.sleep(.25)
assert process.returncode==0 and live,'Power readings were not written while JMeter was running'
timeline=json.loads((out/'timeline.json').read_text())
result=shelly.summarize(out/'shelly.csv',out/'shelly-measured.csv',timeline['measurement_start_ms'],timeline['measurement_end_ms'],5000)
(out/'summary.json').write_text(json.dumps(result,indent=2));print(json.dumps(result,indent=2))
print('Live Shelly JMeter collection passed; no switching commands or application requests sent')