Files
HealthAppRepositoryB/Docs/Requirements/us11-health-trend.md
T

316 lines
16 KiB
Markdown
Raw 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-11 — View a health trend
The [common requirements](00-common-requirements.md) apply to this story.
**User story**
As a user reviewing a patient’s health measurements, I want to see how systolic blood pressure, diastolic blood pressure, and pulse develop over a selected period, so that I can understand their direction, variation, and whether the observed development may be favourable or concerning.
## Functional requirements
### Measurements and period
The assessment shall include systolic blood pressure, diastolic blood pressure, and pulse, reported separately with their respective units.
Only observations belonging to the selected patient and period shall contribute to the assessment. Measurements shall be evaluated according to their measurement timestamps.
### Measurement levels
The assessment shall describe the observed measurement levels and compare them with applicable Danish or European clinical reference values.
Reference values shall be appropriate to the measurement setting. Home blood-pressure measurements shall not automatically be interpreted using clinic-measurement thresholds.
The explanation shall identify the reference values used and distinguish reference thresholds from individual treatment targets. It shall not imply that a general reference value is a personalised treatment goal.
### Direction over time
The assessment shall describe whether each measurement generally increases, decreases, or shows no clear direction over the selected period.
The direction assessment shall consider measurements throughout the period. It shall not rely solely on the first and last observations.
Where the measurements show a reversal or conflicting movements, the explanation shall describe this rather than imply a consistent increase or decrease.
### Observed variation
The assessment shall describe the amount of variation within the selected period, including intermediate excursions that would be hidden by comparing only the beginning and end.
Observed variation shall be distinguished from overall direction. A measurement may decrease overall while also showing substantial variation.
The system shall not classify a period as clinically stable or unstable using an arbitrary maximum–minimum threshold. A clinical classification of variation shall only be provided where an applicable, documented clinical rule supports it.
### Interpretation and hints
The assessment shall explain whether the observed development may be favourable, concerning, mixed, or cannot be interpreted from the available information.
The explanation shall consider measurement levels together with direction and variation. It shall not assume that:
- Decreasing values are always favourable.
- Increasing values are always concerning.
- Limited variation means the measurements are healthy.
- Equal beginning and ending values mean the period was uneventful.
Systolic pressure, diastolic pressure, and pulse may support different interpretations. Where they do, the result shall explain the differences rather than force a single overall good/bad conclusion.
Hints shall describe the basis and limitations of the interpretation without presenting a diagnosis or recommending changes to medication.
### Measurement conditions and sufficient data
Clinical interpretation shall account for relevant measurement conditions where these are available, including whether measurements were taken at rest and whether they were recorded at home or in a clinical setting.
The system shall distinguish between having enough data to describe numerical changes and having enough suitable data to support a clinical interpretation.
Where the available observations do not support an assessment, the result shall identify which part cannot be assessed and explain why. It shall not silently assume missing measurement conditions or manufacture a conclusion.
### Current observations
The assessment shall reflect the current observations, including corrections and deletions. Each requested assessment shall reflect the current observations. The baseline calculation and persistence design is specified under Architecture.
### Mathematical methods
The implementation may select or develop mathematical methods for assessing measurement levels, direction, and variation. No particular formula or algorithm is prescribed.
The chosen methods shall satisfy the functional requirements and acceptance criteria, produce reproducible results, and be documented with their assumptions and limitations.
Mathematical methods shall not introduce unsupported clinical thresholds or interpretations. Clinical reference values and rules used to describe a result as potentially favourable or concerning shall be grounded in applicable Danish or European guidance. Where that guidance does not support a conclusion, the result shall communicate the limitation.
### Context selection and comparability
Users shall be able to request assessments for a selected setting, activity condition, or both, using the same meanings as US-07 and US-10. Each of systolic pressure, diastolic pressure, and pulse shall be assessed separately. Results shall identify their selections and the number of contributing observations.
Without context selection, the assessment shall cover eligible observations in the period and distinguish any mixed conditions. Users shall be able to compare separate context selections over the same period; each result shall identify its basis. Comparing a clinic series with a home series shall not by itself be described as improvement or deterioration over time.
Comparability shall be assessed from recorded setting, activity condition, and relevant optional preparation details. The explanation shall distinguish supported comparable conditions, known differences, and insufficient context. It shall identify the evidence or missing information behind that assessment. It shall not infer comparability from similar numerical values or from matching broad categories alone when other relevant details are unknown. No manually supplied consistency score is required.
Missing optional preparation details limit only claims that depend on those details. They do not automatically prevent a setting-appropriate reference comparison supported by the known information. Applicable Danish or European guidance determines which details are necessary for each clinical claim; the explanation shall distinguish the supported comparison from remaining uncertainty.
Sufficient numerical observations may still support direction and variation when context is absent. Clinical interpretation shall explain its limits and use applicable Danish/European guidance. The system shall not assume home, rest, or guideline-compliant technique from absent, ambiguous, or conflicting context.
Selected subsets shall satisfy the mathematical methods’ own sufficiency rules. Empty selections, a single observation, or a series with no temporal separation shall not produce an invented temporal direction. Supported descriptive values may still be returned with an explicit explanation of the unavailable assessment.
The implementation may develop and document mathematical methods satisfying the agreed requirements. Formula freedom does not authorise inventing clinical thresholds. Equality of first and last values alone shall not establish clinical stability. Direction requires at least two observations at distinct measurement timestamps; the documented method may require more. Equal-timestamp observations shall be handled reproducibly without recording or retrieval order determining direction. Assessments shall use current context and measurements after correction or deletion.
## Acceptance criteria
```gherkin
Feature: View health trend
Scenario: Calculate a trend from observations
Given a patient has sufficient observations within the requested period
When a health trend is requested for that period
Then a trend result is returned
And the trend is derived only from observations within the requested period
Scenario: No observations exist for trend calculation
Given a patient exists
And no observations exist within the requested period
When a health trend is requested
Then the result indicates that insufficient observation data is available for trend calculation
Scenario: Reject an invalid trend period
Given a patient exists
When a health trend is requested with an end time earlier than the start time
Then the request is rejected
```
```gherkin
Feature: US-11 — Context selection, comparability, and interpretation
Scenario: Assess a comparable selection
Given sufficient valid home-resting observations with documented comparable preparation details exist
When a trend is requested for Home and At rest
Then separate systolic, diastolic, and pulse assessments are returned
And the result identifies the selection, contributing count, and recorded basis for comparability
Scenario: Different conditions remain visible
Given the selected series includes resting and after-activity observations
When an assessment is requested without activity selection
Then the result identifies the differing conditions
And explains limitations on interpreting their combined trajectory
Scenario: Unknown details limit comparability
Given observations share Home and At rest but have no recorded preparation details
When their comparability is assessed
Then the explanation identifies the known similarities and missing details
And does not certify that all measurement conditions were identical
Scenario: Missing context preserves numerical information
Given sufficient numerical observations exist with no context
When an assessment is requested
Then supported numerical direction and variation are returned
And the limitations on clinical interpretation and comparability are explained
Scenario: Conflicting descriptions
Given an observation is categorised At rest but its narrative states "during exercise"
When an assessment includes that observation
Then the conflict is identified
And an unsupported resting interpretation is not asserted
Scenario: Compare labelled selections
Given sufficient home-resting and clinic-resting series exist in the same period
When the user compares assessments for those two selections
Then each result identifies its own selection and contributing observations
And a difference between settings alone is not labelled improvement or deterioration over time
Scenario: Insufficient selected series
Given many observations exist but only one matches the selected context
When a trend is requested for that selection
Then the result reports insufficient observations for temporal direction
And does not use excluded observations to manufacture a trend
Scenario: No temporal separation
Given all selected observations have the same measurement timestamp
When a trend is requested
Then temporal direction is reported as unavailable
Scenario: No matching data
Given no observations match the selected period and context
When an assessment is requested
Then the result reports that no matching observations are available
Scenario: Updated context is used
Given an observation’s activity condition was corrected from At rest to After activity
When a resting-only assessment is requested
Then that observation no longer contributes to the result
Scenario: Reject invalid selection
When an assessment is requested with an unsupported context selection
Then the request is rejected with an explanation
```
### AC-11-A — Separate assessments
```gherkin
Given sufficient observations containing systolic pressure, diastolic pressure, and pulse
When the user requests an assessment for the patient and period
Then the result presents each measurement separately
And identifies its unit, observed level, direction, and variation
```
### AC-11-B — Patient and period selection
```gherkin
Given observations exist for multiple patients and periods
When the user requests an assessment for one patient and period
Then only observations for that patient within the selected period contribute to the result
```
### AC-11-C — Direction across the period
```gherkin
Given sufficient measurements showing a consistent upward or downward development
When the assessment is requested
Then the result identifies the corresponding direction
And bases that assessment on measurements throughout the period
```
### AC-11-D — Intermediate excursion
```gherkin
Given the beginning and ending measurements are similar
And intermediate measurements differ substantially from them
When the assessment is requested
Then the result describes the intermediate variation
And does not describe the period as clinically stable merely because its endpoints are similar
```
### AC-11-E — Reversal or mixed direction
```gherkin
Given measurements rise during one part of the period and fall during another
When the assessment is requested
Then the explanation describes the reversal or mixed development
And does not imply that all measurements follow one consistent direction
```
### AC-11-F — Limited variation outside reference values
```gherkin
Given measurements remain outside the applicable reference values
And show limited variation
When the assessment is requested
Then the explanation identifies their position relative to the reference values
And does not describe them as healthy solely because their variation is limited
```
### AC-11-G — Potentially favourable development
```gherkin
Given suitable measurements show development that applicable clinical guidance supports describing as potentially favourable
When the assessment is requested
Then the explanation describes that development and its basis
And distinguishes improvement from having reached an appropriate level
```
### AC-11-H — Potentially concerning development
```gherkin
Given suitable measurements show development that applicable clinical guidance supports describing as potentially concerning
When the assessment is requested
Then the explanation describes the concern and its basis
And does not treat a decrease as favourable solely because the values are falling
```
### AC-11-I — Conflicting measurements
```gherkin
Given systolic pressure, diastolic pressure, or pulse support different interpretations
When the assessment is requested
Then the result explains the interpretation of each affected measurement
And does not force them into a single favourable or concerning classification
```
### AC-11-J — Missing measurement context
```gherkin
Given numerical changes can be described
But measurement conditions needed for clinical interpretation are unavailable
When the assessment is requested
Then the result presents the supported numerical information
And explains that the clinical interpretation is limited by missing context
```
### AC-11-K — Insufficient observations
```gherkin
Given the observations are insufficient to determine a direction
When the assessment is requested
Then the result explicitly reports that direction cannot be determined
And does not substitute an increasing, decreasing, or unchanged conclusion
```
### AC-11-L — Applicable reference values
```gherkin
Given sufficient measurement context to select applicable reference values
When an interpretation is returned
Then the result identifies the reference values used
And does not present a general reference threshold as an individual treatment target
```
### AC-11-M — Independence from storage order
```gherkin
Given the same measurement values and timestamps
When their insertion or retrieval order changes
Then the assessment remains unchanged
```
### AC-11-N — Corrected or deleted observations
```gherkin
Given an observation has been corrected or deleted
When the user requests a new assessment
Then the result reflects the current observations
```
```gherkin
Scenario: Supported reference comparison despite incomplete preparation details
Given known measurement context meets the applicable guidance for a particular reference comparison
And optional preparation details not required for that comparison are missing
When the assessment is requested
Then the supported reference comparison is provided
And the explanation identifies the remaining limits without rejecting all clinical interpretation
```