Developers

Search the docs

Search guides and headings.

Health profiles

Read a connected patient's health profile and replace it, with the measurement rules and the errors.

View as Markdown

You will read the health profile of a connected patient, replace it with an update, and handle the measurement rules.

What you need#

  • A signed BAA on your company. health-profile:read and health-profile:write both need it. See BAA handling.
  • A patient whose connection is active and carries care.health-profile. The patient approves it on the connect page.
  • A patient who did not approve that scope makes calls answer 403 connection_scope_not_granted. Asking for the scope on an existing connection puts it back to pending until the patient approves again.

Read a profile#

GET /care/v1/patient/{patient_id}/health-profile/get/document returns the profile with the latest measurement. patient_id is the id that creating the patient answered.

bash
curl https://api.dev.nurishd.ca/care/v1/patient/6f1c0d2e-0000-4000-8000-000000000101/health-profile/get/document \
  -H "X-Partner-API-Key: $NURISHD_API_KEY"

has_diabetes, has_heart_condition and has_other_diseases say whether the patient has the condition. diabetes_information and heart_condition_information are null when none was saved. other_diseases_notes holds the other diseases. general_health_data is the latest measurement, and is null when there is none. A patient with no profile yet answers 404 health_profile_not_found. Create it with the update route.

Update a profile#

PUT /care/v1/patient/{patient_id}/health-profile/update/document saves the profile. It creates the profile the first time and replaces it every time after. The answer is the profile, as the read route gives it.

FieldRequiredNotes
biological_sexYesMale, Female or Prefer not to say.
date_of_birthYesYYYY-MM-DD.
medications, supplementsNoAt most 10 each, each with medication_name. Send an empty list when there are none.
has_diabetes, has_heart_condition, has_other_diseasesNoWhether the patient has the condition. A flag you leave out is false.
diabetes_information, heart_condition_information, other_diseases_notesNoThe details. Required when the flag is true. See below.
additional_informationNoAt most 1000 characters.
general_health_dataNoA new measurement. Required on the first save. See below.

Each condition has a flag and a block of details. has_diabetes: true needs diabetes_information, has_heart_condition: true needs heart_condition_information, and has_other_diseases: true needs other_diseases_notes (at most 1000 characters). Otherwise the answer is 422 validation_error. A block sent with its flag false is not refused and is saved as sent. Enum values are listed for each field in the API reference.

The first save needs a measurement:

bash
curl -X PUT https://api.dev.nurishd.ca/care/v1/patient/6f1c0d2e-0000-4000-8000-000000000101/health-profile/update/document \
  -H "X-Partner-API-Key: $NURISHD_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "biological_sex": "Female",
    "date_of_birth": "1990-12-10",
    "medications": [{"medication_name": "Metformin", "dosage_amount": 500, "dosage_unit": "mg", "frequency": "Twice daily"}],
    "has_diabetes": true,
    "diabetes_information": {
      "diabetes_type": "Type 2",
      "does_user_have_family_history_of_diabetes": true,
      "does_user_have_diabetic_complications": false
    },
    "additional_information": "Prefers vegetarian meals.",
    "general_health_data": {
      "height_in_cm": 165.5,
      "weight_in_kg": 70.25,
      "activity_level": "Moderate",
      "goal": "Managed Condition",
      "managed_condition": "Diabetes [Weight Loss]"
    }
  }'

Change one field: read, modify, write#

To change the notes and keep everything else, read the profile and send it back. Drop user, created_at, updated_at and general_health_data from what you read: they are not input fields. Leaving general_health_data out keeps the measurement history as it is.

javascript
const getUrl =
	'https://api.dev.nurishd.ca/care/v1/patient/6f1c0d2e-0000-4000-8000-000000000101/health-profile/get/document';
const putUrl =
	'https://api.dev.nurishd.ca/care/v1/patient/6f1c0d2e-0000-4000-8000-000000000101/health-profile/update/document';
const headers = {
	'X-Partner-API-Key': process.env.NURISHD_API_KEY,
	'Content-Type': 'application/json',
};
const current = await (await fetch(getUrl, { headers })).json();
const { user, created_at, updated_at, general_health_data, ...profile } =
	current;

const res = await fetch(putUrl, {
	method: 'PUT',
	headers,
	body: JSON.stringify({
		...profile,
		additional_information: 'Prefers vegetarian meals, no nuts.',
	}),
});

Measurement rules#

general_health_data is a measurement. It adds one entry to the patient's history, and the read route answers the latest one, with date_of_measurement. It holds height_in_cm, weight_in_kg, activity_level, goal, managed_condition and the lifestyle fields alcohol_consumption_frequency, sleep_quality, smoking_status and stress_level.

  • The first save needs general_health_data. Without it the answer is 422 measurement_required.
  • A patient can have one measurement every 24 hours. A general_health_data sent sooner answers 409 measurement_too_recent, and nothing is saved, not even the rest of the profile.
  • To change the profile alone, leave general_health_data out.
  • managed_condition is required in general_health_data when goal is Managed Condition, and not allowed for any other goal.

Errors#

See Errors for the shape. Do not retry a 4xx unchanged.

Status and codeWhat it means for you
403 scope_not_grantedThe key lacks health-profile:read or health-profile:write.
403 connection_scope_not_grantedThe patient did not approve care.health-profile.
404 not_foundThe patient does not exist, or belongs to another company or environment.
404 health_profile_not_foundThe patient has no profile yet. Create it with an update that has a measurement.
409 connection_not_activeThe connection is pending or was revoked. Read the connection.
409 measurement_too_recentThe patient has a measurement from the last 24 hours. Send the update without general_health_data.
422 measurement_requiredA first save has no general_health_data. Add it.
422 validation_errorA field is missing or invalid. Nothing was saved.

Handling the data#

A health profile is patient data. Do not log it, do not send it to support, and do not paste it into an AI prompt. See Support.

Next#