Update architecture persistence diagrams and add implementation review
This commit is contained in:
1 parent
076e675c81
commit
b6342afdad
3 files changed
+56
No files matched your search
@@ -0,0 +1,56 @@
|
||||
# Current requirements versus implementation
|
||||
|
||||
Reviewed on 2026-10-05 against commit `0ce9b2b`, all current US-01–US-15 files and the common requirements. This is an implementation coverage review, not a proposed replacement of requirements. No implementation or authoritative documentation was changed.
|
||||
|
||||
The latest implementation validation passed 111 tests. Those tests were not rerun for this static review: the implementation has not changed. Passing the existing suite does not establish coverage of the new context, professional-access, trend and overview criteria.
|
||||
|
||||
## Story coverage
|
||||
|
||||
| Story | Current coverage | Remaining work |
|
||||
| --- | --- | --- |
|
||||
| US-01 Create profile | Implemented for patients | None identified in the story-specific creation behaviour. Authentication, persistent association, duplicate/concurrent creation, retry/recovery and restart are implemented and tested. |
|
||||
| US-02 View profile | Implemented for patients | Assigned professional reads depend on US-14's common access requirements. |
|
||||
| US-03 Update profile | Implemented for patients | Extend professional-write rejection tests across this operation under US-14. The gateway already rejects professionals by default. |
|
||||
| US-04 Record observation | Original numerical behaviour implemented; revised story partial | Add independently recordable setting and activity, optional preparation/device/cuff/circumstance details, persistence and migration, category validation, and context response coverage. Preserve optional/legacy text and do not invent missing categories. |
|
||||
| US-05 View observation | Numerical values and legacy text returned with patient ownership checks; revised story partial | Return structured saved context and distinguish unknown values; test partial context and historical free text alongside new context. |
|
||||
| US-06 Latest observation | Greatest measurement timestamp implemented; revised story partial | Return structured context. Change ties to original recording time before the deterministic identifier rule; verify edits do not affect recording time. |
|
||||
| US-07 Observation history | Patient/period filtering, chronology and inclusive bounds implemented; revised story partial | Setting/activity/combined/unknown selections; selection metadata; structured context in every observation; invalid category rejection and matching-boundary tests. |
|
||||
| US-08 Update observation | Numerical correction implemented; revised story partial | Add, correct and clear individual context values without erasing omitted values. Current request requires all three numerical fields, so context-only updates are impossible. Verify atomic invalid-category rejection and fresh selection/assessment membership. |
|
||||
| US-09 Delete observation | Core deletion implemented | It already removes the entire row, including legacy context, and recalculated summaries exclude deleted observations. New structured-context, filtered-history and trend assertions depend on US-04/07/11; verify those integrations before treating all new criteria as covered. No separate context lifecycle is needed. |
|
||||
| US-10 Numerical insight | Original summaries implemented; revised story partial | Two-decimal half-up final rounding, context selections, contributing count, applied-selection metadata and mixed/unknown-context explanation. Retain single-observation behaviour, extrema, bounds and freshness. |
|
||||
| US-11 Health trend | Not implemented | Add the endpoint and separate metric assessment results; reproducible documented full-period methods; direction, reversals, variation, sufficiency, reference comparisons, clinical limitations, context selection/comparability and fresh results. Evidence-based clinical interpretation must satisfy the current story rather than the obsolete endpoint-only suggestion. |
|
||||
| US-12 Health overview | Not implemented | Build the independent Health Overview service and HTTP clients through the gateway, with its controller/contracts/configuration/systemd deployment. Aggregate profile, latest overall observation and selected-period insight, retaining metadata and explanations. No trend component is required. |
|
||||
| US-13 Patient authentication | Implemented for existing APIs | Login, hashed credentials, expiry/tampering rejection, ownership, no-profile state, service protection and public guidance are covered. Add equivalent access tests as trend/overview endpoints appear. US-14's professional permissions are separate unfinished work. |
|
||||
| US-14 Professional access | Trusted professional login and default rejection exist; story partial | Predefined assignments; own assignment-list endpoint; empty-list behaviour; assigned-patient read policy; resource-ID ownership/assignment checks; unassigned access and write rejection tests for every relevant API. Current middleware denies all professional patient-data operations. |
|
||||
| US-15 Measurement guidance | Implemented | Public ordered home instructions, source/review metadata, unknown setting, activity/pulse limitations, optionality, no patient-service calls and explicit unavailable guidance are covered. Keep the recorded source review current when content changes. |
|
||||
|
||||
All patient-specific reads remain subject to the common US-14 rule for assigned professionals. Consequently, implementation of a patient's own operation does not mean the complete system-wide role matrix is finished.
|
||||
|
||||
## Concrete code mismatches
|
||||
|
||||
1. **US-06 recording-time tie rule:** `src/ObservationService/Persistence/SqlObservationRepository.cs` orders latest results by `MeasuredAt`, then `ObservationId`. It does not use the persisted `CreatedAt` as the second criterion. Two equally timed observations can therefore return the older recorded observation, contrary to the new acceptance scenario.
|
||||
2. **US-10 rounding:** `src/InsightsService/Domain/InsightCalculator.cs` returns unrounded decimal arithmetic means. For the new eight-value fixture it calculates `120.125`, while the required result is `120.13`; for 120, 120, 121 it returns a repeating decimal representation rather than `120.33`. Existing fractional tests use `.5`, which does not expose this mismatch.
|
||||
3. **Context is only free text:** `RecordObservationRequest`, `ObservationDto` and `BloodPressureObservation` currently expose legacy `Context` and `Note`; there is no independently selectable setting/activity/preparation model. New properties submitted by a client are not implemented or persisted. The API must not be considered compliant just because a submission returns success.
|
||||
4. **Context-only update rejection:** `UpdateObservationRequest` requires systolic, diastolic and pulse and contains no context properties. The new context-only requests cannot fulfil US-08.
|
||||
5. **No context filters or result metadata:** observation history and insight endpoints bind only the period, with no setting/activity selections. The insight DTO has no contributing count or context explanation. Supplying a filter query does not produce the required filtered result.
|
||||
6. **Professional access denied wholesale:** `PatientAccessMiddleware` explicitly permits the Patient policy and denies other non-service roles. This is safe interim behaviour, but does not satisfy assigned professional reads.
|
||||
7. **Trend and overview absent:** there is no trend calculation/route or Health Overview project. Authentication fallback is not a substitute for implementing those stories or testing their access.
|
||||
|
||||
## Architecture and implementation boundaries
|
||||
|
||||
The updated draw.io models already authorise structured observation context and separate assessment results. Implement those changes inside the existing Observation/Insights services; shared production libraries or new context services are unnecessary. The documented Health Overview boundary does require its own independently runnable service. Continue gateway-routed HTTP access, service-owned databases and on-demand Insights calculation without generated-result persistence.
|
||||
|
||||
US-13's existing transport/credential design must extend to the Overview service when it is introduced. Its internal reads need explicit scoped service access; the current internal authentication handler recognises only Observation and Insights. Preserve patient authentication and ownership for both new public endpoints.
|
||||
|
||||
Document the exact interpretation of offset-free timestamps explicitly when updating implementation notes. Current code preserves their clock values and normalises offset-bearing input to UTC; the common requirements require a machine-independent documented instant interpretation. This is a documentation clarification, not a reason to invent a new time-zone feature.
|
||||
|
||||
## Recommended work order
|
||||
|
||||
1. Complete US-14 for existing APIs and retain access tests for future endpoints.
|
||||
2. Complete structured context recording under US-04, including retrieval necessary to prove saved data.
|
||||
3. Update US-05 and US-06, then US-07 and US-08, one logical story commit at a time.
|
||||
4. Verify US-09 with context and filtering, and complete US-10 including its rounding fixtures.
|
||||
5. Implement US-11 and US-12 independently using their documented dependencies. US-12 depends on numerical insight, not on US-11's trend output.
|
||||
6. Verify the complete role/context/period acceptance suite across all services before claiming full specification coverage or using it for architectural comparison.
|
||||
|
||||
No new contradictory requirements were identified in this review. The findings are unfinished implementation and missing acceptance coverage.
|
||||
Reference in new issue
Block a user