mirror of
https://dev.azure.com/globalhealthx/EMR/_git/helix-engage
synced 2026-04-11 10:23:27 +00:00
95 lines
3.3 KiB
TypeScript
95 lines
3.3 KiB
TypeScript
// GraphQL queries for platform entities
|
|
// Platform remaps SDK field names — all LINKS/PHONES fields need subfield selection
|
|
|
|
export const LEADS_QUERY = `{ leads(first: 100, orderBy: [{ createdAt: DescNullsLast }]) { edges { node {
|
|
id name createdAt updatedAt
|
|
contactName { firstName lastName }
|
|
contactPhone { primaryPhoneNumber primaryPhoneCallingCode }
|
|
contactEmail { primaryEmail }
|
|
source status priority interestedService assignedAgent
|
|
utmSource utmMedium utmCampaign utmContent utmTerm landingPage { primaryLinkUrl } referrerUrl
|
|
leadScore spamScore isSpam isDuplicate
|
|
firstContacted lastContacted contactAttempts convertedAt
|
|
patientId campaignId
|
|
aiSummary aiSuggestedAction
|
|
} } } }`;
|
|
|
|
export const CAMPAIGNS_QUERY = `{ campaigns(first: 50) { edges { node {
|
|
id
|
|
name
|
|
createdAt
|
|
updatedAt
|
|
status
|
|
typeCustom
|
|
platform
|
|
startDate
|
|
endDate
|
|
budget { amountMicros currencyCode }
|
|
amountSpent { amountMicros currencyCode }
|
|
impressions
|
|
clicks
|
|
targetCount
|
|
contacted
|
|
converted
|
|
leadsGenerated
|
|
externalCampaignId
|
|
platformUrl { primaryLinkUrl }
|
|
} } } }`;
|
|
|
|
export const ADS_QUERY = `{ ads(first: 100, orderBy: [{ createdAt: DescNullsLast }]) { edges { node {
|
|
id name createdAt updatedAt
|
|
adName externalAdId status format
|
|
headline adDescription destinationUrl { primaryLinkUrl } previewUrl { primaryLinkUrl }
|
|
impressions clicks conversions
|
|
spend { amountMicros currencyCode }
|
|
campaignId
|
|
} } } }`;
|
|
|
|
export const FOLLOW_UPS_QUERY = `{ followUps(first: 50, orderBy: [{ scheduledAt: DescNullsLast }]) { edges { node {
|
|
id name createdAt
|
|
typeCustom status scheduledAt completedAt
|
|
priority assignedAgent
|
|
patientId
|
|
} } } }`;
|
|
|
|
export const LEAD_ACTIVITIES_QUERY = `{ leadActivities(first: 200, orderBy: [{ occurredAt: DescNullsLast }]) { edges { node {
|
|
id name createdAt
|
|
activityType summary occurredAt performedBy
|
|
previousValue newValue
|
|
channel durationSec outcome
|
|
leadId
|
|
} } } }`;
|
|
|
|
export const CALLS_QUERY = `{ calls(first: 100, orderBy: [{ startedAt: DescNullsLast }]) { edges { node {
|
|
id name createdAt
|
|
direction callStatus callerNumber { primaryPhoneNumber } agentName
|
|
startedAt endedAt durationSec
|
|
recording { primaryLinkUrl } disposition sla
|
|
patientId appointmentId leadId
|
|
} } } }`;
|
|
|
|
export const DOCTORS_QUERY = `{ doctors(first: 20) { edges { node {
|
|
id name fullName { firstName lastName }
|
|
department specialty qualifications yearsOfExperience
|
|
visitingHours
|
|
consultationFeeNew { amountMicros currencyCode }
|
|
consultationFeeFollowUp { amountMicros currencyCode }
|
|
active registrationNumber
|
|
clinic { id name clinicName }
|
|
} } } }`;
|
|
|
|
export const APPOINTMENTS_QUERY = `{ appointments(first: 100, orderBy: [{ scheduledAt: DescNullsLast }]) { edges { node {
|
|
id name createdAt
|
|
scheduledAt durationMin appointmentType status
|
|
doctorName department reasonForVisit
|
|
patient { id fullName { firstName lastName } phones { primaryPhoneNumber } }
|
|
doctor { id clinic { clinicName } }
|
|
} } } }`;
|
|
|
|
export const PATIENTS_QUERY = `{ patients(first: 50) { edges { node {
|
|
id name fullName { firstName lastName }
|
|
phones { primaryPhoneNumber }
|
|
emails { primaryEmail }
|
|
dateOfBirth gender patientType
|
|
} } } }`;
|