# Build the five-domain wellness model

Canonical page: https://docs.ovok.com/guides/whole-person-wellness/build-the-five-domain-wellness-model

## What we are building [#what-we-are-building]

A dashboard model that keeps five areas visible while preserving where every value came from. A reflection remains a reflection; an imported sample remains a measurement.

## What you should already have [#what-you-should-already-have]

- An authenticated member and optional health import from [steps 3](./build-onboarding-authentication-and-profile) and [4](./connect-apple-health-and-health-connect).
- The FHIR [Observation](/api/fhir/r4/observation), [Questionnaire](/api/fhir/r4/questionnaire) and [QuestionnaireResponse](/api/fhir/r4/questionnaire-response) references.

## The implementation [#the-implementation]

Use a small presentation model to drive the five cards. It describes source and meaning; it does not create a second persistence format.

~~~ts
export type WellnessDomain =
  | "sleep"
  | "movement"
  | "nutrition"
  | "stress"
  | "recovery";

type DomainCard = {
  id: WellnessDomain;
  titleKey: string;
  sources: Array<"questionnaire-response" | "observation">;
  sourceLabelKey: string;
  summaryKey: string;
};

export const wellnessDomains: DomainCard[] = [
  {
    id: "sleep",
    titleKey: "domains.sleep.title",
    sources: ["questionnaire-response", "observation"],
    sourceLabelKey: "sources.selfReported",
    summaryKey: "domains.sleep.reflection",
  },
  {
    id: "movement",
    titleKey: "domains.movement.title",
    sources: ["questionnaire-response", "observation"],
    sourceLabelKey: "sources.selfReported",
    summaryKey: "domains.movement.reflection",
  },
  {
    id: "nutrition",
    titleKey: "domains.nutrition.title",
    sources: ["questionnaire-response"],
    sourceLabelKey: "sources.selfReported",
    summaryKey: "domains.nutrition.reflection",
  },
  {
    id: "stress",
    titleKey: "domains.stress.title",
    sources: ["questionnaire-response"],
    sourceLabelKey: "sources.selfReported",
    summaryKey: "domains.stress.reflection",
  },
  {
    id: "recovery",
    titleKey: "domains.recovery.title",
    sources: ["questionnaire-response"],
    sourceLabelKey: "sources.selfReported",
    summaryKey: "domains.recovery.reflection",
  },
];
~~~

Keep measured context in its own view model. Sleep sessions and step totals are imported in [step 4](./connect-apple-health-and-health-connect); resting heart rate is another optional measurement. They complement the five domains but do not become additional reflections or a recovery score.

In each card, show the source label near the value:

- `Self-reported` for a member's QuestionnaireResponse.
- `Imported from Apple Health` or `Imported from Health Connect` for a supported Observation.
- `No data yet` when there is no value. Do not fill the gap with a fabricated zero.

## Important Ovok decisions [#important-ovok-decisions]

- Nutrition, stress, perceived sleep quality, movement intentions and perceived recovery are captured in FHIR QuestionnaireResponses, not as passively measured Observations.
- Imported sleep-session intervals, local-day step totals and resting heart rate are separate FHIR Observations with their source coding and time semantics intact.
- The SDK uses source coding systems for sleep and step records; do not describe them as LOINC-coded or treat an elapsed sleep interval as time asleep.
- A QuestionnaireResponse is the historical answer record; changing a reflection creates a later response rather than rewriting how the person previously felt.
- The model does not calculate a composite or clinical score.
- Keep app-owned labels in Ovok CMS translation groups. The stable keys above are examples of app keys, not server FHIR fields.

## Expected result [#expected-result]

Your dashboard has five consistent cards and a separate measured-data area. Each visible value makes clear whether it was reported by the member or imported.

## Common errors and troubleshooting [#common-errors-and-troubleshooting]

| Symptom | Check |
| --- | --- |
| A reflection is stored as an Observation | Keep subjective answers in QuestionnaireResponse resources. |
| A missing metric displays as zero | Use an explicit empty state; absence is not a measured zero. |
| The UI says resting heart rate indicates recovery | Remove the inference. Display the measurement without a readiness label. |
| The cards repeat raw FHIR JSON | Map the response to a presentation model while retaining the original resource for audit and navigation. |

## Previous / next [#previous--next]

- Previous: [Step 4: Connect Apple Health and Health Connect](./connect-apple-health-and-health-connect)
- Next: [Step 6: Build the weekly wellness reflection](./build-weekly-wellness-reflection)
