Sync Patients

A patient record must be added to Photon before a prescription can be written.

Patients can be created manually in the Photon UI, however most partners opt to sync patients from a backend - usually after a patient onboarding flow or whenever a patient record changes.

Create or Update a Patient

A request to the createPatient mutation will create a patient in Photon. If a needed, the updatePatient mutation works in a similar fashion, and can be used to update an existing patient record.

Patient metadata, including allergies and medication history are shared with pharmacies once prescriptions and written and ordered.

Below is an example of how to create a patient from a backend. Refer to authentication guide for instructions on how to authenticate these requests.

import { GraphQLClient, gql } from "graphql-request";

const graphQLClient = new GraphQLClient("https://api.neutron.health/graphql", {
  headers: {
    authorization: "Bearer YOUR_TOKEN_HERE",
  },
});

const query = gql`
  mutation createPatient(
    $externalId: ID
    $name: NameInput!
    $dateOfBirth: AWSDate!
    $sex: SexType!
    $phone: AWSPhone!
    $allergies: [AllergenInput]
    $medicationHistory: [MedHistoryInput]
  ) {
    createPatient(
      externalId: $externalId
      name: $name
      dateOfBirth: $dateOfBirth
      sex: $sex
      phone: $phone
      allergies: $allergies
      medicationHistory: $medicationHistory
    ) {
      id
    }
  }
`;

const variables = {
  externalId: "YOUR_ID", // optional
  name: {
    first: "Jane",
    last: "Doe",
  },
  dateOfBirth: "1970-01-01",
  sex: "FEMALE",
  phone: "+12025550102",
};

const results = await graphQLClient.request(query, variables);