Restructure project requirements and design documentation

This commit is contained in:
Steffen committed 2026-10-04 16:20:06 +02:00
1 parent fa5e20f4d6
commit ebf50827d6
32 files changed
+2078 -485

No files matched your search

@@ -0,0 +1,112 @@
# US-10 — View calculated health insight for a period
The [common requirements](00-common-requirements.md) apply to this story.
**User story**
> As a patient, I want to see calculated statistics for my observations over a selected period so that I can understand the measurements I have recorded.
## Functional requirements
Users shall be able to request the existing numerical insight for a selected setting, activity condition, or both, using the same selection meanings as US-07. Without context selections, the existing all-observations-in-period calculation remains available.
The returned insight shall identify the applied context selections and number of contributing observations. Calculate arithmetic means for systolic pressure, diastolic pressure, and pulse, and minimum/maximum values for systolic and diastolic pressure. Round final means to two decimal places using half-up rounding, without intermediate rounding. Extrema retain the recorded values. A single observation is sufficient: its values are the means and its blood-pressure values are both the minima and maxima. Numeric representation need not retain trailing zero characters. Unknown context shall not prevent numerical calculations, but shall not match a known category.
A result spanning different or unknown conditions shall make that fact apparent. A pooled numerical average shall not be labelled a clinically comparable resting or home measurement series unless the supporting context justifies that description. This story does not replace descriptive averages with a diagnostic monitoring protocol.
If selection leaves no observations, the system shall report that no insight can be calculated for the selection. Context corrections and deletions shall be reflected in subsequent calculations.
## Acceptance criteria
```gherkin
Feature: View calculated health insight
Scenario: Calculate averages for a period
Given a patient has the following observations within the requested period
| systolic | diastolic | pulse |
| 120 | 80 | 60 |
| 130 | 84 | 70 |
When health insight is requested for that period
Then the average systolic value is 125
And the average diastolic value is 82
And the average pulse value is 65
Scenario: Calculate minimum and maximum blood-pressure values
Given a patient has the following observations within the requested period
| systolic | diastolic | pulse |
| 118 | 76 | 61 |
| 130 | 84 | 70 |
| 124 | 80 | 66 |
When health insight is requested for that period
Then the minimum systolic value is 118
And the maximum systolic value is 130
And the minimum diastolic value is 76
And the maximum diastolic value is 84
Scenario: Insight uses only observations in the requested period
Given a patient has observations both inside and outside the requested period
When health insight is requested for that period
Then only observations within the requested period contribute to the calculated values
Scenario: No observations exist in the requested period
Given a patient exists
And no observations exist within the requested period
When health insight is requested
Then the result indicates that insufficient observation data is available for calculation
Scenario: Reject an invalid insight period
Given a patient exists
When health insight is requested with an end time earlier than the start time
Then the request is rejected
```
```gherkin
Feature: US-10 — Calculate insight for selected measurement contexts
Scenario: Calculate from selected context only
Given the period contains two home-resting observations with systolic values 120 and 130
And a clinic-resting observation with systolic value 160
When insight is requested for Home and At rest
Then average systolic pressure is 125.00
And the result identifies Home, At rest, and two contributing observations
Scenario: No filter preserves pooled calculation
Given the period contains observations with different and unknown conditions
When insight is requested without context selections
Then all eligible observations contribute to the existing numerical calculations
And the mixed or unknown context is made apparent
Scenario: One selected observation
Given exactly one observation matches the selected period and context
When insight is requested for that selection
Then each mean equals that observation’s corresponding value
And each blood-pressure minimum and maximum equals its corresponding value
Scenario: No matching observations
Given observations exist in the period but none match the context selection
When insight is requested for that selection
Then the system reports that no insight can be calculated for the selection
Scenario: Correction changes membership
Given an observation’s setting was corrected from Home to Clinic
When home-only insight is requested for its period
Then that observation does not contribute to the home-only calculation
Scenario: Reject unsupported selection
When insight is requested with an unsupported setting selection
Then the request is rejected with an explanation
```
```gherkin
Scenario: Round a halfway mean upwards
Given eight eligible observations have systolic values 120, 120, 120, 120, 120, 120, 120, and 121
When insight is requested for their period
Then the average systolic value is 120.13
```
```gherkin
Scenario: Round a repeating fractional mean
Given three eligible observations have systolic values 120, 120, and 121
When insight is requested for their period
Then the average systolic value is 120.33
```