Complete US-05 observation context retrieval acceptance coverage

This commit is contained in:
Steffen committed 2026-10-05 11:56:38 +02:00
1 parent cfacaa0c24
commit 3bfa7ea149
2 files changed
+157

No files matched your search

+8
View File
@@ -108,6 +108,14 @@ table; no new table, service or dependency is introduced. Existing rows receive
unknown categories and null details without changing their measurements, timestamps
or text. Context filtering and context-only updates remain under US-07/US-08.
US-05 context retrieval is covered independently of creation: dedicated tests seed
saved observations directly and request them through the authenticated gateway.
They verify complete context with its measurements/timestamp after restart, partial
and unknown context, preservation of historical free text, missing-observation
behaviour, rejected unauthorised reads, and identical context for an assigned
professional and the owner. This uses the existing retrieval endpoint and DTO added
with US-04; no further production code or migration is needed for US-05.
The Observation Service checks patient existence by calling the gateway's patient retrieval API over HTTP before saving. It has no reference to Patient/Profile implementation code and no access to that service's database. Missing patients return `404`; validation failures return `400`. Patient lookup failures return `502` or `504` and do not save an observation. Measurement timestamps without an offset represent UTC clock values and are stored as supplied, independently of the host time zone; timestamps with an offset are normalized to UTC. PostgreSQL uses the diagram's `timestamp` columns without a time-zone component.
`GET /api/patients/{patientId}/observations/latest` returns `200` with that patient's observation having the greatest measurement timestamp, regardless of recording order. It returns `404` when no observation is available. Equal measurement timestamps are resolved consistently by observation identifier; US-06 does not prescribe which tied observation to return. Selection happens in the Observation Service's own database through the documented controller/application-service/repository layers.