Implement US-08 partial observation and context corrections
This commit is contained in:
1 parent
ce03038ce1
commit
5aefe52853
10 files changed
+447
-11
No files matched your search
+37
-2
@@ -106,7 +106,7 @@ Apply the `RecordedMeasurementContext` Observation migration before starting the
|
||||
updated service. EF Core maps the owned value to columns in the same observation
|
||||
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 is implemented under US-07; context-only updates remain under US-08.
|
||||
or text. Context filtering is implemented under US-07; partial context updates are implemented under US-08.
|
||||
|
||||
US-05 context retrieval is covered independently of creation: dedicated tests seed
|
||||
saved observations directly and request them through the authenticated gateway.
|
||||
@@ -149,7 +149,42 @@ Existing Insights requests continue to consume the unchanged unfiltered array. N
|
||||
|
||||
`PUT /api/observations/{observationId}` corrects the measured values using a JSON body containing required positive integer `systolic`, `diastolic`, and `pulse` fields. It returns `200` with the updated observation, preserving its identifier, patient, measurement time, context, note, and creation timestamp while updating the modification timestamp. Missing observations return `404` without insertion; invalid requests return `400` without changes. Corrections are visible through specific retrieval, latest retrieval, and history. The Observation Service owns the update; no patient-profile lookup or database schema change is required.
|
||||
|
||||
US-08 tests cover the documented correction and rejection scenarios, correction of all three values, persistence after restart, preservation of other fields and creation time, modification timestamps, visibility in latest/history, unaffected other observations, and missing/malformed values. No new dependencies are introduced.
|
||||
`PATCH /api/observations/{observationId}` accepts a partial JSON object. For example:
|
||||
|
||||
```json
|
||||
{
|
||||
"measurementContext": {
|
||||
"setting": "Clinic",
|
||||
"activityCondition": null,
|
||||
"deviceDetails": "Corrected device"
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
Only supplied fields change. Within `measurementContext`, setting/activity nulls
|
||||
clear the category to `Unknown`; null optional details clear them without changing
|
||||
other details. An explicit `measurementContext: null` clears the whole structured
|
||||
object to unknown categories and null details, while retaining legacy text and
|
||||
notes. Omission of the object preserves it. Optional `context` and `note` can also
|
||||
be changed or cleared with null. Optional `systolic`, `diastolic` and `pulse` support
|
||||
individual positive-integer corrections; they cannot be cleared. Empty patches or
|
||||
objects containing no supported changes return `400`. Creation time, measurement
|
||||
time, patient association and observation identifier cannot be changed by patches.
|
||||
|
||||
Successful patches return `200` with the updated observation and modification time.
|
||||
Validation occurs before any changes are saved; unsupported fields/categories, negative
|
||||
rest duration, non-positive/null numerical values and malformed input reject the
|
||||
whole request with `400` validation details. Missing observations return `404`
|
||||
without insertion. Ownership restrictions apply to the actual observation patient;
|
||||
professionals cannot patch even assigned patients. The existing `PUT` endpoint
|
||||
retains its complete numerical-correction contract and rejects unsupported fields
|
||||
rather than silently ignoring context supplied on that route. Use `PATCH` for context
|
||||
updates. Both routes use the same
|
||||
Observation-owned update operation and save changes atomically. Subsequent reads,
|
||||
latest observations and filtered history use current recorded context. US-11 trend
|
||||
integration remains to be verified when that endpoint is implemented.
|
||||
|
||||
US-08 tests cover the original full numerical corrections and rejection scenarios plus context-only/single-value patches, historical context additions, individual field corrections/clears, whole-context clearing, preservation of omitted data and creation time, persistence after restart, fresh filter membership, atomic rejection, missing observations and access restrictions. No new dependencies are introduced.
|
||||
|
||||
`DELETE /api/observations/{observationId}` removes the observation and returns `204 No Content`. A missing or previously deleted observation returns `404`. The Observation Service deletes the row from its own database in a single statement; deleted observations disappear from specific retrieval, history, and latest selection. Other observations and the patient profile are preserved.
|
||||
|
||||
|
||||
Reference in new issue
Block a user