DoseSpot Migration Guide
1. Set Up Patient Synchronization
To ensure a smooth transition, you'll need to implement two key synchronization patterns:
a. Initial Patient Data Migration
Sync your existing patients to Photon by implementing the following:
- Create new patients using the
createPatient
mutation - Include complete patient profiles with demographics, allergies, and medication history.
- Map your existing patient IDs to Photon's system using
externalId
Here's a backend implementation example of how to create a patient with their complete allergy and medication history:
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);
b. Ongoing Patient Updates
Implement real-time synchronization in your backend:
- Update existing patient records using the
updatePatient
- Sync any changes to allergies or medication history
- Ensure new patients are automatically created in Photon
2. Embed Photon's Prescribing Interface
Install the Photon elements package:
npm i @photonhealth/elements
Then add the prescribing workflow to your application:
<photon-client
id="YOUR_CLIENT_ID"
org="YOUR_ORG_ID"
>
<photon-prescribe-workflow
patient-id="pat_9876zyxw"
enable-order="true"
/>
</photon-client>
For additional customization options, see the Elements documentation here
3. Optional Features
Webhook Integration
Set up webhooks to receive real-time updates about:
- Order status changes
- Prescription updates
To subscribe to webhooks, you can follow the instructions here
Historical Data Import
We can help import your existing DoseSpot data:
- Export your current prescription data
- Share the data export with our team
- We'll handle the migration to maintain continuity of care
Managing Patient Allergies
If you're migrating from DoseSpot, you likely already have RxCUI codes for your patient allergies. You can use these RxCUI values directly in the AllergenInput
field when creating or updating patients, without needing to search for allergens first.
If you don't have RxCUI codes for your allergens, you'll need to search for and retrieve the correct allergen information from Photon's allergen database. Here's the complete workflow:
- First, search for allergens using the allergens query:
import { GraphQLClient, gql } from "graphql-request";
const graphQLClient = new GraphQLClient("https://api.neutron.health/graphql", {
headers: {
authorization: "Bearer YOUR_TOKEN_HERE",
},
});
// Query to search for allergens
const searchAllergensQuery = gql`
query allergens($filter: AllergenFilter) {
allergens(filter: $filter) {
id
name
rxcui
}
}
`;
// Example: Search for penicillin allergens
const searchResults = await graphQLClient.request(searchAllergensQuery, {
filter: {
name: "penicillin" // Fuzzy search - will match similar names
}
});
// searchResults will contain matching allergens
- Then, use the retrieved
ID
for theAllergenInput
field in thecreatePatient
mutation.
Managing Medication History
When creating or updating patients, you can choose to include their medication history. This involves two steps:
- First, get the medication ID by searching the Photon catalog:
const searchMedicationsQuery = gql`
query medications($filter: MedicationFilter) {
medications(filter: $filter) {
id
name
genericName
strength
form
}
}
`;
// Search by name
const medResults = await graphQLClient.request(searchMedicationsQuery, {
filter: { name: "lisinopril" }
});
- Then, use the retrieved
ID
for theMedHistoryInput
field in thecreatePatient
mutation.
Managing Patient Pharmacies
You can set a patients preferred pharmacy via API. If you have patient pharmacies stored using an identifier like NCPDP or NPI, let us know and we can help you set preferred pharmacies for your existing patients.
To set a patients pharmacy:
- Search for Photon pharmacy network to find the pharmacy ID. You can search by name or location.
const searchPharmaciesQuery = gql`
query pharmacies(
$name: String,
$location: LatLongSearch,
$type: FulfillmentType,
$first: Int
) {
pharmacies(
name: $name,
location: $location,
type: $type,
first: $first
) {
id
name
name2
NPI
NCPDP
address {
street1
street2
city
state
postalCode
}
phone
fax
fulfillmentTypes
}
}
`;
// Example 1: Search by pharmacy name
const searchByName = await graphQLClient.request(searchPharmaciesQuery, {
name: "CVS Pharmacy",
first: 10
});
// Example 2: Search by location (within 5 miles)
const searchByLocation = await graphQLClient.request(searchPharmaciesQuery, {
location: {
latitude: 38.8977,
longitude: -77.0365,
radius: 5
},
type: "PICK_UP",
first: 10
});
- Once you have the pharmacy ID, attach it to the patient profile using the
updatePatient
mutation
const updatePatientMutation = gql`
mutation updatePatient(
$id: ID!
$preferredPharmacies:[ID]
) {
updatePatient(
id: $id
preferredPharmacies: $preferredPharmacies
) {
id
preferredPharmacies {
...PharmacyFragment
}
}
}
`;
// Update patient with preferred pharmacy
const variables = {
id: "PATIENT_ID",
preferredPharmacies: [pharmacyResults.data.pharmacies[0].id]
};
const result = await graphQLClient.request(updatePatientMutation, variables);
Authentication
Refer to authentication guide for instructions on how to authenticate these requests.
Need Help?
Contact us for assistance with:
- Data migration questions
- Implementation guidance
- Technical troubleshooting
Updated 10 days ago