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,80 @@
# Common requirements
## Authority and scope
This directory contains one current definition for each user story US-01 through US-15. These files consolidate the supplied requirements and addenda. The replacement mapping is in `../requirements-reconciliation-changelog.md`; retired filenames are not additional active requirements.
Requirements describe observable behaviour. Baseline service decomposition, gateway routing, persistence, and token mechanism decisions belong in Architecture and Design. All compared architectural variants must satisfy the same functional requirements under equivalent data and conditions.
## Access and profile lifecycle
US-13 governs authenticated patient access and US-14 governs assigned, read-only healthcare-professional access. These rules apply to every patient-specific operation, including context, filtered statistics, trends, and overview results. Professionals may read assigned-patient information but cannot create, update, or delete it. Assignment lists remain protected. General US-15 guidance is public and discloses no patient-specific information.
A patient account has zero profiles before initial creation and exactly one afterwards. US-01 defines creation and retry outcomes. Accounts without profiles may authenticate and create their own initial profile; other own-data requests report that the requested information is unavailable and do not expose other patients.
Unless a scenario explicitly tests access rejection, it assumes an authenticated caller authorised for the operation. Missing-resource scenarios apply after access checks, without disclosing another patient's existence or information. Authentication and ownership are not established by caller-supplied patient identifiers alone.
## Periods and ordering
US-07, US-10, US-11, and the selected-period insight in US-12 use inclusive boundaries: start <= measurement timestamp <= end. An end before the start is rejected. Equal bounds are valid and include observations exactly at that instant; valid periods do not guarantee sufficient data for an assessment.
Times denote measurement instants. Equivalent instants expressed with different offsets are treated equally. A timestamp without an offset must have a documented interpretation; it must not change with the machine running the service. No particular wire format is prescribed.
Observation history is ordered by ascending measurement timestamp. US-06 separately defines latest-observation ties. Recording order never determines US-11 direction.
## Measurement context and selection
US-04 defines the recordable setting, activity condition, and optional details. Missing or ambiguous context stays unknown; original text and notes are preserved. Similar values do not prove comparable conditions.
US-07, US-10, US-11, and US-12 insight support setting and activity selections. When both are selected, both must match. Unknown is a selectable category distinct from known values. Without selections, context alone excludes nothing. Each result identifies applied selections. Individual stories define empty-result and sufficiency behaviour.
## Acceptance-test conventions
Each scenario can establish its own state directly. It need not run another user story for setup. Create, update, and delete success does not require returning a complete object or a particular HTTP status. Persistence and subsequent-read assertions may be verified using independent read scenarios with the required state established in Given.
Documented numerical methods and their concrete test fixtures must satisfy the functional criteria. No specific trend formula is prescribed. Clinical claims require applicable Danish/European guidance; mathematical-method freedom does not authorise invented clinical cutoffs.
## Shared period acceptance criteria
```gherkin
Feature: Inclusive periods
Scenario Outline: Include both boundaries
Given an authorised patient has eligible observations exactly at the start and end and outside the period
When <operation> is requested for that period
Then both boundary observations contribute
And observations outside the period do not contribute
Examples:
| operation |
| history |
| numerical insight |
| trend assessment |
| overview insight |
Scenario Outline: Equal bounds are valid
Given eligible observations exist exactly at the selected instant and elsewhere
When <operation> is requested with start and end equal to that instant
Then the period is accepted
And only observations at that instant are selected
And the operation applies its own data-sufficiency rules
Examples:
| operation |
| history |
| numerical insight |
| trend assessment |
| overview insight |
Scenario Outline: Reject reversed bounds
Given the caller is authorised
When <operation> is requested with end before start
Then the request is rejected
Examples:
| operation |
| history |
| numerical insight |
| trend assessment |
| overview insight |
```
-3
View File
@@ -1,3 +0,0 @@
For US-10, the Insights Service calculates summaries on demand from observations retrieved over HTTP through the API Gateway. It does not persist generated summaries and has no database or repository.
The HealthSummary table in Docs/Architecture/09_er_insights_service.jpg is an architectural inconsistency to be corrected, not a deferred implementation requirement. A health summary may exist as a calculated response object, without a persistence identity.
Record this decision and reconcile the affected architecture documentation. Keep trend calculation under US-11.
@@ -1,479 +0,0 @@
# Personal Health Measurement System — User Stories and Acceptance Criteria
## Purpose
This document defines the externally observable behaviour of the Personal Health Measurement System.
The user stories and acceptance criteria are intentionally architecture-neutral. They do not prescribe microservices, databases, controllers, repositories, communication mechanisms, or deployment choices.
For the thesis experiment, these requirements should remain stable across architectural variants so that functional behaviour is held constant while architecture changes.
---
## US-01 — Create a patient profile
**User story**
> As a patient, I want to create a patient profile so that my health measurements can be associated with me.
### Acceptance criteria
```gherkin
Feature: Create patient profile
Scenario: Create a patient with valid information
Given no patient exists with the generated patient identifier
When a patient profile is created with
| name | Steffen Example |
| dateOfBirth | 1980-01-01 |
| contactInfo | steffen@example.test |
Then the patient profile is created successfully
And a patient identifier is assigned
And the patient profile can be retrieved using that identifier
Scenario: A patient name is required
When a patient profile is created without a name
Then the patient profile is rejected
Scenario: A date of birth is required
When a patient profile is created without a date of birth
Then the patient profile is rejected
```
---
## US-02 — View a patient profile
**User story**
> As a patient, I want to view my patient profile so that I can verify the information associated with my measurements.
### Acceptance criteria
```gherkin
Feature: View patient profile
Scenario: Retrieve an existing patient
Given a patient exists
When the patient profile is requested using the patient identifier
Then the patient profile is returned
And the returned patient identifier matches the requested patient
And the patient's name is included
And the patient's date of birth is included
And the patient's contact information is included
Scenario: Request a patient that does not exist
Given no patient exists with the requested patient identifier
When the patient profile is requested
Then the request reports that the patient does not exist
```
---
## US-03 — Update a patient profile
**User story**
> As a patient, I want to update my profile information so that the system contains my current information.
### Acceptance criteria
```gherkin
Feature: Update patient profile
Scenario: Update an existing patient
Given a patient exists with
| name | Steffen Example |
| contactInfo | old@example.test |
When the patient profile is updated with
| name | Steffen Example |
| contactInfo | new@example.test |
Then the update succeeds
And the patient identifier is unchanged
And the patient profile contains contact information "new@example.test"
Scenario: Update a patient that does not exist
Given no patient exists with the requested patient identifier
When an update is requested for that patient
Then the update is rejected
And no new patient is created
```
---
## US-04 — Record a blood-pressure observation
**User story**
> As a patient, I want to record a blood-pressure observation so that I can maintain a history of my measurements.
### Acceptance criteria
```gherkin
Feature: Record blood-pressure observation
Scenario: Record a valid observation
Given a patient exists
When the patient records a blood-pressure observation with
| measuredAt | 2026-09-12T08:00:00 |
| systolic | 128 |
| diastolic | 82 |
| pulse | 68 |
| context | Resting |
| note | Before breakfast |
Then the observation is accepted
And an observation identifier is assigned
And the observation is associated with the patient
And the observation can be retrieved later
Scenario: Record an observation without optional fields
Given a patient exists
When the patient records a blood-pressure observation with
| measuredAt | 2026-09-12T08:00:00 |
| systolic | 128 |
| diastolic | 82 |
| pulse | 68 |
Then the observation is accepted
Scenario Outline: Reject an observation containing a non-positive measured value
Given a patient exists
When the patient records a blood-pressure observation with
| measuredAt | 2026-09-12T08:00:00 |
| systolic | <systolic> |
| diastolic | <diastolic> |
| pulse | <pulse> |
Then the observation is rejected
Examples:
| systolic | diastolic | pulse |
| 0 | 82 | 68 |
| -1 | 82 | 68 |
| 128 | 0 | 68 |
| 128 | -1 | 68 |
| 128 | 82 | 0 |
| 128 | 82 | -1 |
Scenario: Reject an observation without a measurement timestamp
Given a patient exists
When the patient records a blood-pressure observation without a measurement timestamp
Then the observation is rejected
Scenario: Record an observation for a patient that does not exist
Given no patient exists with the requested patient identifier
When a blood-pressure observation is recorded for that patient
Then the observation is rejected
```
---
## US-05 — View a specific blood-pressure observation
**User story**
> As a patient, I want to retrieve a specific blood-pressure observation so that I can review a previously recorded measurement.
### Acceptance criteria
```gherkin
Feature: View specific blood-pressure observation
Scenario: Retrieve an existing observation
Given a patient has recorded a blood-pressure observation with
| systolic | 128 |
| diastolic | 82 |
| pulse | 68 |
When that observation is requested using its observation identifier
Then the observation is returned
And the systolic value is 128
And the diastolic value is 82
And the pulse value is 68
Scenario: Retrieve an observation that does not exist
Given no observation exists with the requested observation identifier
When the observation is requested
Then the request reports that the observation does not exist
```
---
## US-06 — View the latest blood-pressure observation
**User story**
> As a patient, I want to see my latest blood-pressure observation so that I can quickly review my most recent measurement.
### 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
```
---
## US-07 — View blood-pressure observation history
**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.
### 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
```
---
## US-08 — Update a blood-pressure observation
**User story**
> As a patient, I want to correct a previously recorded observation so that accidental entry errors can be fixed.
### Acceptance criteria
```gherkin
Feature: Update blood-pressure observation
Scenario: Correct an existing observation
Given a patient has an observation with
| systolic | 182 |
| diastolic | 82 |
| pulse | 68 |
When the systolic value is corrected to 128
Then the update succeeds
And the observation identifier is unchanged
And the observation contains systolic value 128
Scenario Outline: Reject an update containing a non-positive measured value
Given a patient has an existing observation
When the observation is updated with
| systolic | <systolic> |
| diastolic | <diastolic> |
| pulse | <pulse> |
Then the update is rejected
Examples:
| systolic | diastolic | pulse |
| 0 | 82 | 68 |
| 128 | 0 | 68 |
| 128 | 82 | 0 |
Scenario: Update an observation that does not exist
Given no observation exists with the requested observation identifier
When an update is requested
Then the update is rejected
```
---
## US-09 — Delete a blood-pressure observation
**User story**
> As a patient, I want to delete an incorrectly recorded observation so that it is no longer part of my measurement history.
### Acceptance criteria
```gherkin
Feature: Delete blood-pressure observation
Scenario: Delete an existing observation
Given a patient has a recorded observation
When that observation is deleted
Then the deletion succeeds
And the observation can no longer be retrieved
And the observation no longer appears in the patient's observation history
Scenario: Delete an observation that does not exist
Given no observation exists with the requested observation identifier
When deletion is requested
Then the request reports that the observation does not exist
```
---
## US-10 — View calculated health insight for a period
**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.
### 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
```
---
## US-11 — View a health trend
**User story**
> As a patient, I want to see how my recorded measurements change over time so that I can identify the direction of my measured values.
### 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
```
> **Note:** The exact mathematical definition of a trend should be specified before implementation if this story is retained. The acceptance criteria deliberately avoid prescribing an algorithm at this stage.
---
## US-12 — View a consolidated health overview
**User story**
> As a patient, I want a consolidated overview of my profile, latest observation, and calculated insight so that I can review the most important information in one place.
### Acceptance criteria
```gherkin
Feature: View consolidated health overview
Scenario: View an overview for a patient with observations
Given a patient exists
And the patient has recorded blood-pressure observations
And health insight can be calculated for the requested period
When the health overview is requested for that period
Then the patient's profile is included
And the latest blood-pressure observation is included
And the calculated health insight is included
Scenario: View an overview for a patient without observations
Given a patient exists
And the patient has no recorded observations
When the health overview is requested
Then the patient's profile is included
And no latest blood-pressure observation is returned
And the overview indicates that no calculated health insight is available
Scenario: Request an overview for a patient that does not exist
Given no patient exists with the requested patient identifier
When the health overview is requested
Then the request reports that the patient does not exist
Scenario: Reject an invalid overview period
Given a patient exists
When the health overview is requested with an end time earlier than the start time
Then the request is rejected
```
---
# Functional invariance requirement for the experiment
All architecture variants evaluated in the thesis should satisfy the same user stories and acceptance criteria.
A modified architecture should not be considered functionally equivalent to the baseline unless the same acceptance-test suite passes against both systems under equivalent test data and conditions.
The acceptance criteria define required observable behaviour. They intentionally do not require any particular:
- service decomposition,
- internal class structure,
- database technology,
- persistence implementation,
- communication mechanism,
- deployment model,
- caching strategy,
- concurrency mechanism,
- or other architectural implementation choice.
@@ -0,0 +1,89 @@
# US-01 — Create a patient profile
The [common requirements](00-common-requirements.md) apply to this story.
**User story**
> As a patient, I want to create a patient profile so that my health measurements can be associated with me.
## Functional requirements
A patient must be authenticated to create their own initial profile. A patient account has no associated profile before successful initial creation and exactly one afterwards. The association derives from the authenticated account, never an account or patient identity selected by the caller.
Creation assigns a patient identifier and persistently associates it with the account. The association survives process restart. A later create request shall report that a profile already exists and shall neither create a second profile nor replace the association.
Concurrent requests and retries after a lost response or an interrupted creation shall not produce duplicate or inaccessible profiles. After recovery, at most one profile exists for the account and a successful outcome leaves that profile accessible to it. The implementation may choose the recovery and concurrency mechanisms. It shall not report successful creation before both profile creation and association are complete.
Healthcare professionals cannot create patient profiles. Unauthenticated requests are rejected. Account registration remains outside scope.
## Acceptance criteria
```gherkin
Feature: Create patient profile
Scenario: Create a patient with valid information
Given an authenticated patient account has no associated profile
When a patient profile is created with
| name | Steffen Example |
| dateOfBirth | 1980-01-01 |
| contactInfo | steffen@example.test |
Then the patient profile is created successfully
And a patient identifier is assigned
And the identifier is associated with the authenticated account
Scenario: A patient name is required
When a patient profile is created without a name
Then the patient profile is rejected
Scenario: A date of birth is required
When a patient profile is created without a date of birth
Then the patient profile is rejected
```
```gherkin
Scenario: Reject a second profile
Given an authenticated patient account already has a profile
When another profile creation is requested
Then the request reports that a profile already exists
And no second profile is created and the association is unchanged
```
```gherkin
Scenario: Persistent account association
Given a profile and its account association were successfully created
And the application processes have restarted
When the authenticated account requests its profile
Then the same associated profile is returned
```
```gherkin
Scenario: Retry after a successful creation response was lost
Given profile creation and account association succeeded but the response was lost
When the authenticated account retries creation
Then the result indicates that the profile already exists
And no duplicate profile or replacement association is created
```
```gherkin
Scenario: Concurrent initial creation
Given an authenticated patient account has no profile
When two valid initial-creation requests are made concurrently
Then at most one profile is created and associated with the account
And no request reports a second profile as created
```
```gherkin
Scenario: Recovery after interrupted creation
Given initial profile creation was interrupted before profile creation and association both completed
And the system is able to process requests again
When the authenticated account retries creation
Then the operation recovers to one accessible associated profile or reports that creation remains incomplete
And it neither produces duplicate profiles nor reports an inaccessible profile as successfully created
```
```gherkin
Scenario: Unauthenticated initial creation
Given the caller is not authenticated
When initial profile creation is requested
Then the request is rejected and no profile is created
```
@@ -0,0 +1,27 @@
# US-02 — View a patient profile
The [common requirements](00-common-requirements.md) apply to this story.
**User story**
> As a patient, I want to view my patient profile so that I can verify the information associated with my measurements.
## Acceptance criteria
```gherkin
Feature: View patient profile
Scenario: Retrieve an existing patient
Given a patient exists
When the patient profile is requested using the patient identifier
Then the patient profile is returned
And the returned patient identifier matches the requested patient
And the patient's name is included
And the patient's date of birth is included
And the patient's contact information is included
Scenario: Request a patient that does not exist
Given no patient exists with the requested patient identifier
When the patient profile is requested
Then the request reports that the patient does not exist
```
@@ -0,0 +1,30 @@
# US-03 — Update a patient profile
The [common requirements](00-common-requirements.md) apply to this story.
**User story**
> As a patient, I want to update my profile information so that the system contains my current information.
## Acceptance criteria
```gherkin
Feature: Update patient profile
Scenario: Update an existing patient
Given a patient exists with
| name | Steffen Example |
| contactInfo | old@example.test |
When the patient profile is updated with
| name | Steffen Example |
| contactInfo | new@example.test |
Then the update succeeds
And the patient identifier is unchanged
And the patient profile contains contact information "new@example.test"
Scenario: Update a patient that does not exist
Given no patient exists with the requested patient identifier
When an update is requested for that patient
Then the update is rejected
And no new patient is created
```
@@ -0,0 +1,124 @@
# US-04 — Record a blood-pressure observation
The [common requirements](00-common-requirements.md) apply to this story.
**User story**
> As a patient, I want to record a blood-pressure observation so that I can maintain a history of my measurements.
## Functional requirements
The patient shall be able to record and save the following information with an observation:
| Information | Required supported distinctions |
| --- | --- |
| Setting | Home, clinic, other, unknown/not recorded |
| Activity condition | At rest, during activity, after activity, unknown/not recorded |
| Preparation and technique | Optional details about rest duration, body position, measured arm, and device/cuff used |
| Additional circumstances | Optional descriptions such as recent activity, stress, pain, or a departure from the usual measurement routine |
Setting and activity condition shall be independently recordable and usable for subsequent selection and comparison; users shall not have to encode both solely in an undifferentiated note. The representation and storage design are implementation choices.
Partial context shall be accepted. Missing information shall remain unknown, without defaulting to home, resting, or correct technique. Existing observations and valid submissions without context shall remain supported.
The existing optional context text and note shall be preserved. Ambiguous historical text shall not be converted into definite categories. Where recorded categories and narrative descriptions conflict, the system shall retain the supplied information and make the conflict apparent when relevant to interpretation.
Users shall record the actual circumstances, including departures from guidance. A measurement taken after activity is valid to record; it is not a validation error merely because it is unsuitable for a resting comparison.
Context shall remain associated with its observation and be available on subsequent authorised reads. No separate patient-level context record or manually entered consistency score is required. Comparability is assessed across observations under US-11.
## Acceptance criteria
```gherkin
Feature: Record blood-pressure observation
Scenario: Record a valid observation
Given a patient exists
When the patient records a blood-pressure observation with
| measuredAt | 2026-09-12T08:00:00 |
| systolic | 128 |
| diastolic | 82 |
| pulse | 68 |
| context | Resting |
| note | Before breakfast |
Then the observation is accepted
And an observation identifier is assigned
And the observation is associated with the patient
And the observation can be retrieved later
Scenario: Record an observation without optional fields
Given a patient exists
When the patient records a blood-pressure observation with
| measuredAt | 2026-09-12T08:00:00 |
| systolic | 128 |
| diastolic | 82 |
| pulse | 68 |
Then the observation is accepted
Scenario Outline: Reject an observation containing a non-positive measured value
Given a patient exists
When the patient records a blood-pressure observation with
| measuredAt | 2026-09-12T08:00:00 |
| systolic | <systolic> |
| diastolic | <diastolic> |
| pulse | <pulse> |
Then the observation is rejected
Examples:
| systolic | diastolic | pulse |
| 0 | 82 | 68 |
| -1 | 82 | 68 |
| 128 | 0 | 68 |
| 128 | -1 | 68 |
| 128 | 82 | 0 |
| 128 | 82 | -1 |
Scenario: Reject an observation without a measurement timestamp
Given a patient exists
When the patient records a blood-pressure observation without a measurement timestamp
Then the observation is rejected
Scenario: Record an observation for a patient that does not exist
Given no patient exists with the requested patient identifier
When a blood-pressure observation is recorded for that patient
Then the observation is rejected
```
```gherkin
Feature: US-04 — Record measurement setting and conditions
Scenario: Record setting and condition independently
Given a patient exists and the submitting patient is authorised
When a valid observation is submitted with setting Home and activity condition At rest
Then observation creation succeeds
Scenario: Record partial context
Given a patient exists
When a valid observation is submitted with setting Clinic and no activity condition
Then observation creation succeeds
Scenario: Retain support for absent context
Given a patient exists
When an otherwise valid observation is submitted without context
Then observation creation succeeds
Scenario: Record departure from routine
Given a patient exists
When a valid observation is submitted as After activity with a description of the activity
Then observation creation succeeds
Scenario: Reject unsupported category
Given a patient exists
When an observation is submitted with a setting category outside the supported distinctions
Then the operation is rejected with an explanation of the invalid category
Scenario: Retrieve previously saved context
Given an observation exists with saved setting, activity condition, preparation details, and a note
When an authorised user requests that observation
Then the returned observation contains those saved details associated with that observation
Scenario: Reject another patient’s context submission
Given the submitting patient is not authorised to record observations for another patient
When an observation with measurement context is submitted for that other patient
Then the operation is rejected
```
@@ -0,0 +1,62 @@
# US-05 — View a specific blood-pressure observation
The [common requirements](00-common-requirements.md) apply to this story.
**User story**
> As a patient, I want to retrieve a specific blood-pressure observation so that I can review a previously recorded measurement.
## Functional requirements
The returned observation shall include its recorded setting, activity condition, optional preparation details, and existing context text and note. Unknown information shall be distinguishable from explicitly recorded values. Context shall remain attached to the correct numerical measurements and timestamp.
These details are patient observation data and receive the same access protection as the observation itself.
## Acceptance criteria
```gherkin
Feature: View specific blood-pressure observation
Scenario: Retrieve an existing observation
Given a patient has recorded a blood-pressure observation with
| systolic | 128 |
| diastolic | 82 |
| pulse | 68 |
When that observation is requested using its observation identifier
Then the observation is returned
And the systolic value is 128
And the diastolic value is 82
And the pulse value is 68
Scenario: Retrieve an observation that does not exist
Given no observation exists with the requested observation identifier
When the observation is requested
Then the request reports that the observation does not exist
```
```gherkin
Feature: US-05 — View the context of a specific observation
Scenario: Return complete saved context
Given an observation exists with Home, At rest, and preparation details
When an authorised user requests the observation
Then its saved context is returned with its numerical measurements and timestamp
Scenario: Return partial context
Given an observation exists with Clinic and an unknown activity condition
When the observation is requested by an authorised user
Then Clinic is returned as the setting
And activity condition is represented as unknown
Scenario: Preserve historical free text
Given an observation exists with only the context text "Morning reading"
When the observation is requested by an authorised user
Then the original text is returned
And no definite setting or activity condition is invented
Scenario: Protect context
Given a user is not authorised to access an observation
When that user requests the observation
Then access is rejected
And its context is not disclosed
```
@@ -0,0 +1,66 @@
# 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
```
@@ -0,0 +1,87 @@
# 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
```
@@ -0,0 +1,90 @@
# US-08 — Update a blood-pressure observation
The [common requirements](00-common-requirements.md) apply to this story.
**User story**
> As a patient, I want to correct a previously recorded observation so that accidental entry errors can be fixed.
## Functional requirements
The patient shall be able to add, correct, or clear individual setting, activity-condition, and optional preparation/circumstance details defined in US-04, including on historical observations. Clearing a value makes it unknown; it does not assign a default.
An update to context alone shall preserve numerical measurements, measurement timestamp, patient association, and all context or note values not explicitly changed. Partial updates shall not erase unrelated information. Unsupported categories shall be rejected without partially applying the requested update.
Subsequent reads, context selections, and assessments shall use the current recorded context. They shall not retain classifications derived from context that was corrected or cleared.
## Acceptance criteria
```gherkin
Feature: Update blood-pressure observation
Scenario: Correct an existing observation
Given a patient has an observation with
| systolic | 182 |
| diastolic | 82 |
| pulse | 68 |
When the systolic value is corrected to 128
Then the update succeeds
And the observation identifier is unchanged
And the observation contains systolic value 128
Scenario Outline: Reject an update containing a non-positive measured value
Given a patient has an existing observation
When the observation is updated with
| systolic | <systolic> |
| diastolic | <diastolic> |
| pulse | <pulse> |
Then the update is rejected
Examples:
| systolic | diastolic | pulse |
| 0 | 82 | 68 |
| 128 | 0 | 68 |
| 128 | 82 | 0 |
Scenario: Update an observation that does not exist
Given no observation exists with the requested observation identifier
When an update is requested
Then the update is rejected
```
```gherkin
Feature: US-08 — Correct or remove recorded measurement context
Scenario: Add context to historical observation
Given an authorised patient has an observation without context
When Home and At rest are added
Then the update succeeds
Scenario: Correct one context value
Given an authorised patient has an observation recorded as Home and At rest
When the setting alone is corrected to Clinic
Then the update succeeds
Scenario: Clear optional context
Given an authorised patient has an observation with a known activity condition
When that activity condition is cleared
Then the update succeeds
Scenario: Retrieve partially corrected observation
Given an observation’s setting was corrected to Clinic without changing its other values
When an authorised user requests that observation
Then Clinic is returned
And the original numerical values, timestamp, activity condition, and note are returned unchanged
Scenario: Reject invalid context correction
Given an observation exists
When an update contains an unsupported setting category
Then the update is rejected
Scenario: Nonexistent observation
Given the observation does not exist
When a context correction is submitted
Then the update is rejected
Scenario: Unauthorised correction
Given a user is not authorised to modify an observation
When the user submits a context correction
Then the operation is rejected
```
@@ -0,0 +1,56 @@
# US-09 — Delete a blood-pressure observation
The [common requirements](00-common-requirements.md) apply to this story.
**User story**
> As a patient, I want to delete an incorrectly recorded observation so that it is no longer part of my measurement history.
## Functional requirements
Deleting an observation shall also remove its context from ordinary observation retrieval, history, numerical summaries, and assessments. Context belonging to other observations shall remain unaffected. Context has no separate user-visible lifecycle after its observation is deleted.
## Acceptance criteria
```gherkin
Feature: Delete blood-pressure observation
Scenario: Delete an existing observation
Given a patient has a recorded observation
When that observation is deleted
Then the deletion succeeds
And the observation can no longer be retrieved
And the observation no longer appears in the patient's observation history
Scenario: Delete an observation that does not exist
Given no observation exists with the requested observation identifier
When deletion is requested
Then the request reports that the observation does not exist
```
```gherkin
Feature: US-09 — Remove context with a deleted observation
Scenario: Delete contextualised observation
Given an authorised patient has an observation with setting and conditions
When that observation is deleted
Then deletion succeeds
Scenario: History excludes previously deleted observation
Given an observation with Home and At rest was deleted
And other home-resting observations remain in the selected period
When history is requested for Home and At rest
Then the deleted observation and its context are absent
And the remaining matching observations are returned
Scenario: Assessment excludes deleted data
Given a contextualised observation was deleted
And sufficient remaining observations exist for an assessment
When the assessment is requested
Then the deleted values and context do not contribute to the result
Scenario: Reject unauthorised deletion
Given a user is not authorised to delete an observation
When the user requests its deletion
Then the operation is rejected
```
@@ -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
```
+315
View File
@@ -0,0 +1,315 @@
# 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
```
+78
View File
@@ -0,0 +1,78 @@
# US-12 — View a consolidated health overview
The [common requirements](00-common-requirements.md) apply to this story.
**User story**
> As a patient, I want a consolidated overview of my profile, latest observation, and calculated insight so that I can review the most important information in one place.
## Functional requirements
The latest observation in the overview shall include its recorded context and retain the existing latest-observation selection rules. Its context shall not be presented as applying to every observation contributing to the insight.
Users shall be able to apply the US-10 setting and activity selections to the overview’s calculated insight. Those selections affect the insight only; the latest observation remains the latest overall observation for the patient. The overview shall identify this distinction, the insight selection, and its contributing count.
Without selections, the existing overview behaviour remains. Mixed or unknown context explanations accompanying the insight shall remain visible. When a selection has no contributing observations, the profile and available latest observation shall still be returned, with an explanation that no insight is available for that selection. This story does not add a trend component to the overview.
## Acceptance criteria
```gherkin
Feature: View consolidated health overview
Scenario: View an overview for a patient with observations
Given a patient exists
And the patient has recorded blood-pressure observations
And health insight can be calculated for the requested period
When the health overview is requested for that period
Then the patient's profile is included
And the latest blood-pressure observation is included
And the calculated health insight is included
Scenario: View an overview for a patient without observations
Given a patient exists
And the patient has no recorded observations
When the health overview is requested
Then the patient's profile is included
And no latest blood-pressure observation is returned
And the overview indicates that no calculated health insight is available
Scenario: Request an overview for a patient that does not exist
Given no patient exists with the requested patient identifier
When the health overview is requested
Then the request reports that the patient does not exist
Scenario: Reject an invalid overview period
Given a patient exists
When the health overview is requested with an end time earlier than the start time
Then the request is rejected
```
```gherkin
Feature: US-12 — Preserve measurement context in the health overview
Scenario: Latest context and insight selection differ
Given a patient has a latest after-activity observation and earlier home-resting observations in the period
When an overview is requested with Home and At rest selected for insight
Then the latest after-activity observation and its context are returned
And the insight uses only matching home-resting observations
And the result distinguishes their different bases
Scenario: No matching insight observations
Given a patient has a profile and a latest observation
And no observations match the selected insight context
When the overview is requested for that selection
Then the profile and latest observation remain available
And the absence of insight for the selection is explained
Scenario: Unknown context remains unknown
Given the latest observation has no context
When the overview is requested
Then its context is represented as unknown
And no context is copied from other observations
Scenario: Default overview preserves context limitations
Given insight spans differing measurement conditions
When an overview is requested without context selections
Then the original pooled insight is returned
And its mixed-context explanation is included
```
@@ -0,0 +1,95 @@
# US-13 — Authenticate and access own health information
The [common requirements](00-common-requirements.md) apply to this story.
**As a patient,**
I want to authenticate using my credentials and access only my own health information,
so that I can use the system while access to my information is restricted to me and healthcare professionals assigned to me.
## Functional requirements
The thesis prototype uses pre-created test accounts and synthetic patient data. A patient account has zero profiles before initial creation and exactly one afterwards, as defined in US-01. Healthcare professional accounts use predefined patient assignments under US-14.
Authentication is required for all patient profile, observation, insight, trend and health overview operations. General US-15 guidance is available without authentication. Patients may perform the operations defined by the existing user stories only on their own information.
## Acceptance criteria
```gherkin
Scenario: Successful authentication
Given I have a pre-created account
When I authenticate using valid credentials
Then the system recognises my account and Patient role
And recognises its associated patient profile if one has been created
```
```gherkin
Scenario: Access to my own information
Given I am authenticated
When I request an available operation on my own health information
Then access is permitted
And the operation follows its existing acceptance criteria
```
```gherkin
Scenario: Invalid credentials
Given I am not authenticated
When I attempt to authenticate using an incorrect account identifier or incorrect secret
Then authentication is rejected
And the response does not reveal which part of the credentials was incorrect
```
```gherkin
Scenario: Missing authentication
Given I have not authenticated
When I request an operation involving patient information
Then the request is rejected
And no patient information is returned or changed
```
```gherkin
Scenario: Invalid authentication information
Given my request contains authentication information that the system cannot validate
When I request an operation involving patient information
Then the request is rejected
And no patient information is returned or changed
```
```gherkin
Scenario: Access to another patient’s information
Given I am authenticated as one patient
When I attempt to view or change another patient’s information
Then access is rejected
And none of that patient’s information is returned or changed
```
```gherkin
Scenario: Own information does not yet exist
Given I am authenticated
And the requested information does not yet exist for my patient account
When I request that information
Then the system follows the existing behaviour for missing information
And does not return another patient’s information
```
```gherkin
Scenario: Login before profile creation
Given I have a pre-created patient account with no associated profile
When I authenticate using valid credentials
Then authentication succeeds and recognises my account and Patient role
And I may create my initial profile under US-01
And I gain no access to another patient’s information
```
```gherkin
Scenario: Expired authentication
Given my authentication information has expired
When I request protected patient information
Then the request is rejected
And no patient information is returned or changed
```
## Prototype limitations
Account registration, password recovery, multifactor authentication, account administration, access by unassigned third parties, and writes by healthcare professionals are outside scope. Assigned healthcare professionals have the read-only access defined in US-14.
These criteria apply to every applicable API operation. The authentication mechanism and internal implementation are separate design decisions. The prototype does not claim production readiness.
@@ -0,0 +1,100 @@
# US-14 — Read assigned patients’ information
The [common requirements](00-common-requirements.md) apply to this story.
**As a healthcare professional,**
I want to authenticate using my credentials and view health information for patients assigned to me,
so that I can review their measurements and health insights.
## Functional requirements
The thesis prototype uses pre-created healthcare professional accounts and predefined patient assignments. A healthcare professional may be assigned to multiple patients, and a patient may be assigned to multiple healthcare professionals.
Access is read-only and covers the assigned patients’ profiles, observations and their context, numerical insights, trend assessments and health overviews.
## Acceptance criteria
```gherkin
Scenario: Successful authentication
Given I have a pre-created healthcare professional account
When I authenticate using valid credentials
Then the system recognises my identity and healthcare professional role
```
```gherkin
Scenario: View assigned patients
Given I am authenticated as a healthcare professional
When I request my assigned patients
Then the system returns only patients assigned to me
```
```gherkin
Scenario: View an assigned patient’s information
Given I am authenticated as a healthcare professional
And a patient is assigned to me
When I request their profile, observations and context, numerical insights, trend assessment or health overview
Then access is permitted
And the requested information is returned according to the existing retrieval requirements
```
```gherkin
Scenario: No assigned patients
Given I am authenticated as a healthcare professional
And no patients are assigned to me
When I request my assigned patients
Then the system indicates that no patients are assigned
And does not return other patients
```
```gherkin
Scenario: Patient information does not yet exist
Given I am authenticated as a healthcare professional
And a patient is assigned to me
And the requested information does not yet exist
When I request that information
Then the system follows the existing behaviour for missing information
```
```gherkin
Scenario: Access to an unassigned patient
Given I am authenticated as a healthcare professional
When I request information about a patient who is not assigned to me
Then access is rejected
And no information about that patient is returned
```
```gherkin
Scenario: Attempt to change patient information
Given I am authenticated as a healthcare professional
When I attempt to create, modify or delete patient information
Then the operation is rejected
And the patient information remains unchanged
```
```gherkin
Scenario: Invalid credentials
Given I am not authenticated
When I attempt to authenticate using an incorrect account identifier or incorrect secret
Then authentication is rejected
And the response does not reveal which part of the credentials was incorrect
```
```gherkin
Scenario: Missing or invalid authentication
Given my request has missing or invalid authentication information
When I request assigned patients or patient information
Then the request is rejected
And no patient information is returned
```
```gherkin
Scenario: Patient account attempts professional access
Given I am authenticated only as a patient
When I attempt to use access reserved for healthcare professionals
Then access is rejected
And my existing access to my own information is unaffected
```
## Prototype limitations
Patient assignments are predefined. Assignment management, professional credential verification, consent workflows, emergency access and editing by healthcare professionals are outside scope.
@@ -0,0 +1,85 @@
# US-15 — Follow measurement instructions
The [common requirements](00-common-requirements.md) apply to this story.
## User story
As a patient, I want clear instructions for taking and recording blood-pressure and pulse measurements, so that my observations are as accurate and comparable as practicable.
## Scope
Measurement guidance is separate from saving context under US-04. Guidance shall be available before any observation exists and while preparing to record an observation. Existing access rules continue to protect patient data; general guidance is available without authentication and shall neither require nor disclose patient information or assignment lists. Patient-specific records and assessments remain protected under US-13 and US-14.
## Functional requirements
The system shall provide clear, ordered instructions for obtaining accurate and repeatable blood-pressure and accompanying pulse measurements, based on applicable Danish or European clinical guidance. The instructions shall identify their source and review date, and distinguish home self-measurement from clinical measurement.
Home guidance shall cover preparation and rest, a suitable validated device and cuff, posture and arm positioning, remaining still during measurement, repeated readings and timing, and recording actual values and conditions. It shall explain how maintaining comparable conditions helps later comparison. Where numeric waiting times or repeat schedules are given, they shall follow the identified guidance rather than invented values.
The Danish home protocol described in [Sundhed.dk — Højt blodtryk](https://www.sundhed.dk/sundhedsfaglig/laegehaandbogen/hjerte-kar/symptomer-og-tegn/hoejt-blodtryk/) includes five minutes of seated rest and repeated morning/evening readings over three days. Instructions shall distinguish such a planned monitoring protocol from recording an individual observation. Device and cuff guidance shall be consistent with [Sundhed.dk — Blodtryksmåling](https://www.sundhed.dk/sundhedsfaglig/laegehaandbogen/undersoegelser-og-proever/kliniske-procedurer/hjertekar/blodtryksmaaling/).
Guidance for accompanying pulse shall explain recording the device-reported pulse and the relevance of rest/activity context; it shall not assume that a single pulse value measures rhythm regularity. The guidance shall not claim to guarantee accuracy or replace the device instructions or individually supplied clinical instructions.
If the setting is unknown, guidance shall clearly label its applicability rather than assuming home measurement. Departures from recommended conditions shall be recordable; guidance shall advise recording the actual circumstances instead of changing, discarding, or inventing readings.
Reading or declining guidance shall not create, change, or delete an observation, mark a procedure as followed, or block an otherwise valid observation submission. If guidance cannot be provided, the system shall communicate this without presenting unverified instructions as authoritative. Guidance shall not recommend changes to prescribed medication.
## Acceptance criteria
```gherkin
Feature: US-15 — Follow measurement instructions
Scenario: Access guidance before first observation
Given a patient has no observations
When measurement guidance is requested
Then preparation, measurement, and recording instructions are available
And the source, applicability, and review date are identified
Scenario: Home measurement guidance
When home measurement guidance is requested
Then the instructions cover rest, equipment and cuff, positioning, repeated readings, and recording conditions
And any numeric instructions follow the identified Danish or European guidance
Scenario: Unknown setting
Given no measurement setting has been supplied
When guidance is requested
Then its supported setting is identified
And no measurement setting is saved or assumed on the user’s behalf
Scenario: Different measurement conditions
Given the user is preparing to record an after-activity measurement
When guidance is requested
Then the guidance distinguishes it from a resting measurement
And explains recording the actual conditions without relabelling the result as resting
Scenario: Pulse context
When guidance for accompanying pulse is requested
Then it explains recording the pulse value and relevant activity condition
And does not describe the single pulse value as a rhythm assessment
Scenario: Guidance does not certify compliance
Given an observation entry is being prepared
When measurement guidance is viewed
Then no observation is saved or altered
And following the procedure is not recorded automatically
Scenario: Guidance is optional
Given otherwise valid observation data is supplied
And the patient has not viewed guidance
When the observation is submitted
Then creation succeeds
Scenario: Guidance unavailable
Given no verified guidance is available for the requested setting
When guidance for that setting is requested
Then its unavailability is explained
And unsupported instructions are not presented as verified guidance
```
```gherkin
Scenario: General guidance without login
Given I am not authenticated
When I request general measurement guidance
Then the general guidance is available
And no patient-specific information or assignment list is returned
```