Files

88 lines
4.2 KiB
Markdown
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# US-07 — View blood-pressure observation history
The [common requirements](00-common-requirements.md) apply to this story.
**User story**
> As a patient, I want to view my blood-pressure observations for a selected period so that I can review my measurement history.
## Functional requirements
Observation history shall include the recorded context of each observation. Users shall be able to select observations by setting, activity condition, or both, including an explicit unknown/not-recorded selection for either dimension.
When both dimensions are selected, an observation must match both. Without context selections, all otherwise eligible observations shall be returned, including those with missing context. Results shall identify the applied selections and retain the existing ascending measurement-time order and inclusive period boundaries.
Ambiguous historical text shall not count as a confirmed match for Home, Clinic, or an activity category. No matching observations shall produce an empty collection. Unsupported selection values shall be rejected with an explanation.
## Acceptance criteria
```gherkin
Feature: View blood-pressure observation history
Scenario: Retrieve observations within a period
Given a patient has observations recorded at
| measuredAt | systolic | diastolic | pulse |
| 2026-09-01T08:00:00 | 120 | 80 | 60 |
| 2026-09-05T08:00:00 | 125 | 82 | 65 |
| 2026-09-10T08:00:00 | 130 | 84 | 70 |
When observations are requested from "2026-09-03T00:00:00" to "2026-09-08T23:59:59"
Then exactly 1 observation is returned
And the returned observation was measured at "2026-09-05T08:00:00"
Scenario: Return observations in chronological order
Given a patient has multiple observations within the requested period
When the observation history is requested
Then the observations are returned in chronological order by measurement timestamp
Scenario: No observations exist within the requested period
Given a patient exists
And no observations exist within the requested period
When the observation history is requested
Then an empty observation collection is returned
Scenario: Reject an invalid period
Given a patient exists
When observations are requested with an end time earlier than the start time
Then the request is rejected
```
```gherkin
Feature: US-07 — Distinguish history by setting and conditions
Scenario: Select home observations
Given a patient has home, clinic, and unknown-setting observations within the period
When history is requested for Home
Then only home observations within the period are returned with their context
Scenario: Combine setting and activity
Given a patient has home-resting, home-after-activity, and clinic-resting observations in the period
When history is requested for Home and At rest
Then only home-resting observations are returned
Scenario: Select unknown context
Given some observations have no known setting
When history is requested for unknown setting
Then only observations with unknown setting are returned
Scenario: No selection excludes nothing on context alone
Given observations in the period have complete, partial, and absent context
When history is requested without context selections
Then all those observations are returned in ascending measurement-time order
Scenario: No matching observations
Given no observations match the selected context and period
When history is requested with those selections
Then an empty collection is returned
Scenario: Reject unsupported selection
When history is requested with an unsupported activity-condition selection
Then the request is rejected with an explanation
Scenario: Preserve patient and boundary rules
Given matching observations exist for the patient exactly at both period boundaries
And matching observations also exist outside the period and for another patient
When the patient’s history is requested for that period and context
Then both boundary observations are returned
And the outside-period and other-patient observations are excluded
```