Files

67 lines
3.0 KiB
Markdown

# US-06 — View the latest blood-pressure observation
The [common requirements](00-common-requirements.md) apply to this story.
**User story**
> As a patient, I want to see my latest blood-pressure observation so that I can quickly review my most recent measurement.
## Functional requirements
The latest observation shall include its recorded context as defined in US-04. Select the greatest measurement timestamp. If multiple observations share it, select the latest original recording time. A later edit does not change original recording time. If those times also tie, use a documented deterministic final tie rule so unchanged data yields the same result. This selection is independent of context completeness and does not determine US-11 trend direction. A recent observation shall not be replaced with an older observation merely because the older one has more suitable conditions.
## Acceptance criteria
```gherkin
Feature: View latest blood-pressure observation
Scenario: Return the most recent observation
Given a patient has observations recorded at
| measuredAt | systolic | diastolic | pulse |
| 2026-09-10T08:00:00 | 130 | 84 | 70 |
| 2026-09-12T08:00:00 | 126 | 80 | 66 |
| 2026-09-11T08:00:00 | 128 | 82 | 68 |
When the latest observation is requested
Then the observation measured at "2026-09-12T08:00:00" is returned
Scenario: Patient has no observations
Given a patient exists
And the patient has no recorded observations
When the latest observation is requested
Then the result indicates that no observation is available
```
```gherkin
Feature: US-06 — Include context with the latest observation
Scenario: Return context of latest observation
Given an authorised patient has an older resting observation and a newer after-activity observation
When the latest observation is requested
Then the newer observation is returned with its after-activity context
Scenario: Do not substitute a more complete observation
Given the latest observation has no recorded context
And an older observation has complete context
When the latest observation is requested
Then the latest observation is returned
And its context is represented as unknown
Scenario: Preserve timestamp tie selection
Given two observations share the latest measurement timestamp and have different settings
And the second observation was recorded most recently
When the latest observation is requested
Then the second observation is returned with its own setting
Scenario: No observations
Given the patient has no observations
When the latest observation is requested
Then the system reports that no observation is available
```
```gherkin
Scenario: Resolve a complete timestamp tie reproducibly
Given two observations share the latest measurement timestamp and original recording time
When the latest observation is requested repeatedly without data changes
Then the same observation is returned under the documented final tie rule
```