Skip to content

Embeddable workflows to augment your patient app experience.

License

Notifications You must be signed in to change notification settings

canvas-medical/embed

Repository files navigation

Canvas Embed

This repository provides a quick add on to allow patients to manage their scheduling and appointments.

It is comprised of the following two main sections:

🚧 The proxy is a temporary measure to be used until a patient-scoped OAuth token is implemented on the Canvas Medical FHIR API. 🚧

Its primary purpose is to handle the OAuth authentication for the JS embedded widgets (aka the embeds) when communicating with the FHIR API. This authentication process should contain a patient_key in its response. This patient_key is required to interact with the embeds.

The following is an example of how to fetch a patient_key by making a GET request to the Auth endpoint of your proxy API.

Javascript Example

fetch(`${apiURL}/Auth?key=${apiKey}&patient=${patientId}`)
  .then((response) => response.json())
  .then((data) => {
    if (data.patient_key) {
      // Pass the patient_key into some state variable or directly into the initializer
    } else {
      console.error("Patient not found")
    }
  })

This fetch example is found in both the example-apps/react and the example-apps/static

Getting Started

Fork this repo and then clone the fork

Start by navigating to /example-apps/, installing the selected app dependencies, and running the app. Running an example app will give you a better understanding of how the embeds can run in your custom application. The React app has helpful documentation on how to make use of embeds.

Make sure to read through the Proxy documentation to deploy your own proxy app.

If you would like to contribute, make sure to read our Contributing Guidelines and Code of Conduct. Then head over to the Getting Started documentation for more instructions