commit 1e8a4ebe7de248ef006d4275aa00d76e6708f0a9 Author: Steffen Date: Wed Sep 30 15:05:29 2026 +0200 Initial project structure and documentation diff --git a/Docs/Architecture/01_domain_model.jpg b/Docs/Architecture/01_domain_model.jpg new file mode 100644 index 0000000..a52a26f Binary files /dev/null and b/Docs/Architecture/01_domain_model.jpg differ diff --git a/Docs/Architecture/02_microservice_architecture.jpg b/Docs/Architecture/02_microservice_architecture.jpg new file mode 100644 index 0000000..c89ff67 Binary files /dev/null and b/Docs/Architecture/02_microservice_architecture.jpg differ diff --git a/Docs/Architecture/03_class_patient_profile_service.jpg b/Docs/Architecture/03_class_patient_profile_service.jpg new file mode 100644 index 0000000..61ed42b Binary files /dev/null and b/Docs/Architecture/03_class_patient_profile_service.jpg differ diff --git a/Docs/Architecture/04_class_observation_service.jpg b/Docs/Architecture/04_class_observation_service.jpg new file mode 100644 index 0000000..d277de3 Binary files /dev/null and b/Docs/Architecture/04_class_observation_service.jpg differ diff --git a/Docs/Architecture/05_class_insights_service.jpg b/Docs/Architecture/05_class_insights_service.jpg new file mode 100644 index 0000000..142270d Binary files /dev/null and b/Docs/Architecture/05_class_insights_service.jpg differ diff --git a/Docs/Architecture/06_class_health_overview_service.jpg b/Docs/Architecture/06_class_health_overview_service.jpg new file mode 100644 index 0000000..bf0aa19 Binary files /dev/null and b/Docs/Architecture/06_class_health_overview_service.jpg differ diff --git a/Docs/Architecture/07_er_patient_profile_service.jpg b/Docs/Architecture/07_er_patient_profile_service.jpg new file mode 100644 index 0000000..043b4db Binary files /dev/null and b/Docs/Architecture/07_er_patient_profile_service.jpg differ diff --git a/Docs/Architecture/08_er_observation_service.jpg b/Docs/Architecture/08_er_observation_service.jpg new file mode 100644 index 0000000..3aea5af Binary files /dev/null and b/Docs/Architecture/08_er_observation_service.jpg differ diff --git a/Docs/Architecture/09_er_insights_service.jpg b/Docs/Architecture/09_er_insights_service.jpg new file mode 100644 index 0000000..957c3fa Binary files /dev/null and b/Docs/Architecture/09_er_insights_service.jpg differ diff --git a/Docs/Architecture/10_er_health_overview_service.jpg b/Docs/Architecture/10_er_health_overview_service.jpg new file mode 100644 index 0000000..84200f2 Binary files /dev/null and b/Docs/Architecture/10_er_health_overview_service.jpg differ diff --git a/Docs/Architecture/personal_health_measurement_all_diagrams-Domain Model.jpg b/Docs/Architecture/personal_health_measurement_all_diagrams-Domain Model.jpg new file mode 100644 index 0000000..60c001a Binary files /dev/null and b/Docs/Architecture/personal_health_measurement_all_diagrams-Domain Model.jpg differ diff --git a/Docs/Requirements/personal_health_user_stories_and_acceptance_criteria.md b/Docs/Requirements/personal_health_user_stories_and_acceptance_criteria.md new file mode 100644 index 0000000..9ea9035 --- /dev/null +++ b/Docs/Requirements/personal_health_user_stories_and_acceptance_criteria.md @@ -0,0 +1,479 @@ +# 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 | | + | diastolic | | + | 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 | | + | diastolic | | + | 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. diff --git a/src/README.md b/src/README.md new file mode 100644 index 0000000..e69de29