9. Add goals and progress reviews
What we are building
A simple flow for the member and coach to agree on a personal, non-clinical goal and revisit it over time.
What you should already have
- An authenticated patient app from step 3.
- The coach relationship and server-side access boundary from step 8.
- The FHIR Goal and CarePlan references.
The implementation
Use a Goal for one member-chosen objective. The text below is an example, not a prescribed health target:
import { useClient } from "@ovok/core";
export function useCreatePersonalGoal() {
const client = useClient();
return async (patientId: string, description: string) => {
return client.createResource({
resourceType: "Goal",
lifecycleStatus: "proposed",
description: { text: description },
subject: { reference: "Patient/" + patientId },
startDate: new Date().toISOString().slice(0, 10),
});
};
}
Keep the goal in a proposed state until the member and coach agree. Then update the existing resource to the appropriate lifecycle state:
import { useClient } from "@ovok/core";
export function useAcceptGoal() {
const client = useClient();
return async (goal: Parameters<typeof client.updateResource>[0]) =>
client.updateResource({
...goal,
lifecycleStatus: "accepted",
});
}
Load goals through an explicit Patient-scoped FHIR search in the member or coach context. The server-side policy must authorize each result. A step count, sleep entry or reflection does not automatically mean a goal was completed; the goal definition and the person's own review decide that.
A CarePlan is optional. Use it only if your workflow has a real plan with coordinated activities or participants. Do not create an empty CarePlan just to group a single Goal.
Important Ovok decisions
- FHIR Goal provides a standard lifecycle, description and Patient subject. It does not supply wellness coaching logic.
- Keep goals specific to what the member chooses. Do not prescribe exercise, diet, sleep targets or medical treatment.
- Goal completion is not inferred from nearby Observations unless the goal's actual definition and an appropriate reviewed workflow establish that relationship.
- Access to Goal and CarePlan records is governed by the project's FHIR capabilities and AccessPolicy, not by the FHIR references alone.
- A coach's interpretation remains human. The app may prompt a review but must not generate a clinical recommendation.
Expected result
The member and coach can see a proposed goal, agree on it, and review its lifecycle state alongside the separate reflections and measurements.
Common errors and troubleshooting
| Symptom | Check |
|---|---|
| Goal creation is denied | Check the Patient policy and project CapabilityStatement. Do not loosen authorization for every resource. |
| The screen marks a goal complete when a metric crosses a value | Remove the automatic inference unless the product has a reviewed and authorized rule for that goal. |
| CarePlan has no real plan content | Omit it; a single Goal can stand on its own. |
| A goal sounds like medical advice | Replace it with the member's own behavioral intention and review it with their coach. |