Files
HealthAppRepository/suggestions/us11-trend-definition.md
T

2.4 KiB

US-11 — Proposed trend definition

Required clarification

US-11 explicitly requires a mathematical definition before implementation. No definition was found in the requirements or design documents. The Insights class diagram defines a single direction and description, but does not identify the measured value, algorithm, or minimum sufficient data.

Proposed definition (pending approval)

  • Calculate on demand in the existing Insights Service using observations retrieved through the gateway for the requested patient and inclusive period. Do not store trend results.
  • The single direction describes systolic blood pressure. State this explicitly in the response description; do not imply a combined trend across systolic, diastolic, and pulse.
  • Require observations at two or more distinct measurement timestamps. Empty data, a single observation, or observations all measured at the same timestamp indicate insufficient data.
  • Compare mean systolic values at the earliest and latest measurement timestamps. If multiple observations share either endpoint timestamp, use their decimal arithmetic mean, so identifier ordering does not determine direction.
  • Return Increasing when the latest mean exceeds the earliest mean, Decreasing when it is lower, and Stable when equal. No tolerance threshold, regression, smoothing, or clinical interpretation is introduced. Intermediate observations do not affect this endpoint comparison.
  • Return the documented patient identifier, period start/end, direction, and a description explaining the comparison.
  • Use existing period validation and missing-data conventions: 400 for invalid bounds, 404 problem details for insufficient data, and 502/504 for upstream failures.

This simple definition identifies net change between the endpoints, not the shape of change during the period. Choosing a different measured value or a regression-based trend would produce different product behaviour and requires an explicit decision.

Verification after approval

Cover increasing/decreasing/stable results, endpoint timestamp ties, sufficient/insufficient data, exclusion of other patients and out-of-period measurements, independence from insertion order, invalid periods, and fresh results following observation corrections/deletions. Retain existing Insights architecture and independent process boundaries.

This suggestion does not authorize implementation or modify authoritative requirements.