eRx
Patient Sync
🚧

The eRx Service is currently in beta.

Patient Sync

Patient information is automatically sent to Photon (opens in a new tab) as you make changes in the FHIR Service. This makes the patient information available to the prescriber automatically when they are prescribing medications.

Data that is Synced

The following patient information is sent to Photon:

  • name (first and last)
  • date of birth
  • gender
  • email
  • phone number
  • address
  • allergies
  • medication history

Basic Patient Information

When you create a patient in the FHIR service, this information is collected and sent to Photon. The required fields for patient creation are:

  • name (first and last)
  • date of birth
  • gender
  • phone number

Here is an example of a patient creation that will be sent to Photon:

create-patient.ts
import zapehr from '@zapehr/sdk';
import { Patient } from 'fhir/r4b';
 
const patient: Patient = {
  resourceType: 'Patient',
  name: [
    {
      family: 'Shaw',
      given: ['Amy', 'V.'],
    },
  ],
  telecom: [
    {
      system: 'phone',
      value: '+14231112222',
      use: 'home',
    },
    {
      system: 'email',
      value: '[email protected]',
    },
  ],
  gender: 'female',
  birthDate: '1987-02-20',
  address: [
    {
      line: ['49 Meadow St', 'Apt 2'],
      city: 'Mounds',
      state: 'OK',
      postalCode: '74047',
      country: 'US',
    },
  ],
};
 
const createdResource = await zapehr.fhir.create<Patient>(patient);

Additionally, when you update a patient in the FHIR service, the new information is sent to Photon.

Photon Patient ID

When a patient is created in the FHIR service, a unique patient ID is generated by Photon and sent back to the FHIR service. This ID is then stored in the FHIR Patient on an identifier and used to identify the patient in future requests. Here is an example:

{
  "identifier": [
    {
      "use":"official",
      "value":"pat_01HR3FBJFIWLGBP22JWQFK8WX9",
      "system":"http://api.zapehr.com/photon-patient-id"
    }
  ]
}

Patient Allergies

When you create an allergy (opens in a new tab) in the FHIR service that is associated with a patient, this information is sent to Photon. Here is an example of an allergy creation that will be sent to Photon:

create-allergy.ts
import zapehr from '@zapehr/sdk';
import { AllergyIntolerance } from 'fhir/r4b';
 
const allergy: AllergyIntolerance = {
  resourceType: 'AllergyIntolerance',
  patient: {
    reference: `Patient/${your-fhir-patient-id}`,
  },
  code: {
    coding: [
      {
        system: 'http://api.zapehr.com/photon-allergy-id',
        code: 'alg_01GBAPSGG6X7NJ8DV6VF1SFGTQ',
        display: 'peanut allergenic extract',
      }
    ],
  },
  onsetDateTime: '2021-08-01',
  note: [
    {
      text: 'Patient has had allergy since 10 yo.',
    },
  ],
};
 
const createdResource = await zapehr.fhir.create<AllergyIntolerance>(allergy);

Updates for allergies are also sent to Photon. The following information is sent to Photon when an allergy is created or updated in the FHIR service:

  • allergen id
  • onset date
  • comment

Of these, only the allergen id is required. The other fields are optional.

Photon Allergen ID

Each allergen within Photon's system has a unique identifier used to track it, and this is the identifier than needs to be sent to Photon. Here is an example of an allergen identifier:

{
  "code": {
    "coding": [
      {
        "system": "http://api.zapehr.com/photon-allergy-id",
        "code": "alg_01GBAPSGG6X7NJ8DV6VF1SFGTQ",
        "display": "peanut allergenic extract"
      }
    ]
  }
}

The code system http://api.zapehr.com/photon-allergy-id is used to identify the allergy codings that should be synced to Photon. If a coding has a system other than this, it will be excluded from what is sent to Photon.

Medication History

When you create a medication statement (opens in a new tab) in the FHIR service that is associated with a patient, this information is sent to Photon. Here is an example of a medication creation that will be sent to Photon:

create-medication.ts
import zapehr from '@zapehr/sdk';
import { MedicationStatement } from 'fhir/r4b';
 
const medication: MedicationStatement = {
  resourceType: 'MedicationStatement',
  status: 'active',
  subject: {
    reference: `Patient/${your-fhir-patient-id}`,
  },
  medicationCodeableConcept: {
    coding: [
      {
        system: 'http://api.zapehr.com/photon-medication-id',
        code: 'med_01HNXFYCM6YP675JGEQX19VD17',
        display: 'Amoxil (Amoxicillin 400 mg /5mL) Oral powder, for suspension',
      }
    ],
  },
  note: [
    {
      text: 'Patient has been taking this medication since 10 yo.',
    },
  ],
};
 
const createdResource = await zapehr.fhir.create<MedicationStatement>(medication);

Updates for medications are also sent to Photon. The following information is sent to Photon when a medication is created or updated in the FHIR service:

  • medication id
  • active status
  • comment

Of these, medication id and active status are required.

Photon Medication ID

Each medication within Photon's system has a unique identifier used to track it, and this is the identifier than needs to be sent to Photon. Here is an example of a medication identifier:

{
  "medicationCodeableConcept": {
    "coding": [
      {
        "system": "http://api.zapehr.com/photon-medication-id",
        "code": "med_01HNXFYCM6YP675JGEQX19VD17",
        "display": "Amoxil (Amoxicillin 400 mg /5mL) Oral powder, for suspension"
      }
    ]
  }
}

The code system http://api.zapehr.com/photon-medication-id is used to identify the medication codings that should be synced to Photon. If a coding has a system other than this, it will be excluded from what is sent to Photon.