Provider Service
The Provider Service module adds methods for working with provider data.
The Provider Service module is dependent on Orbita Blaze being available and configured.
- 1 Dependencies
- 2 Methods
- 2.1 renderDetails
- 2.2 search
- 2.3 filter
- 2.4 format
- 2.4.1 fromOrbita
- 2.4.2 fromElastic
- 2.5 getByOrbitaId
- 3 Intermediary Model
Dependencies
The Provider Service module is dependent on the following modules:
Methods
renderDetails
Renders markup for the details overlay for a provider card based on the provided provider data.
It will optionally attempt to retrieve and render reviews from one of the available review providers (Ratings MD and NRC) based on the value of the providerId field, which is assumed to be an NPI for this functionality.
The review provider is configured in the following section of the settings content:
"providerService": {
"reviews": {
"provider": "NRC",
"organizationSlug": "valley-health"
}
}
When configured, the provider’s rating field will also be overridden with the rating returned from the review provider (if available).
Parameters:
rawProvider (object): The raw provider record
tabs (array, optional): The tabs to show in the details view. Valid options are “locations”, “specialties”, “languages”, “insurance”, and “reviews”. If tabs is not specified, all tabs are shown.
overrides (object, optional): An object where the key is a tab name (valid options are “locations”, “specialties”, “languages”, “insurance”, and “reviews”) and the value is custom HTML to display for that tab instead of the normal mark-up.
Returns: A promise that will resolve with the rendered details markup for the provided provider.
search
Searches for providers using Blaze based on a query
Parameters:
query (string): The search query
maximumResults (number, default = 10000): The maximum number of results to return.
sort (array, default = []): An array of sort properties, where each item in the array is an object where the key is the property to sort on, and the value is a sort order with “asc” for ascending or “desc” for descending, for example:
[ { "lastName": "desc" } ]
includeFilters (array, default = []): An array of filters to be included, where each item in the array is an object where the key is the property to filter on, and the value is an array of values to match for. For example:
[ { "lastName.keyword": ["Smith", "Jones"] } ]
Root level provider record string properties in includeFilters should have “.keyword” appended to the property name as shown above.
disableFallbackQueries (boolean, default = true): Whether or not to disable any silent fallback queries that Blaze might use.
Returns: A promise that will resolve with an object containing the following properties:
providers (array): The results of the search, in raw Elastic format
aggregations (object): Aggregation information that can be used with some Orbita components (card list filters for example).
facetEntityState (object): Active filtering facet information
The promise will reject in the case of a Blaze lookup failure.
filter
Retrieves filtered provider results from Blaze using the provided filters
Parameters:
filters (object): A filter object formatted in the expected Blaze filter format, for example:
maximumResults (number, default = 10000): The maximum number of results to return.
sort (array, default = []): An array of sort properties, where each item in the array is an object where the key is the property to sort on, and the value is a sort order with “asc” for ascending or “desc” for descending, for example:
disableFallbackQueries (boolean, default = true): Whether or not to disable any silent fallback queries that Blaze might use.
Returns: A promise that will resolve with an object containing the following properties:
providers (array): The results of the search, in raw Elastic format.
aggregations (object): Aggregation information that can be used with some Orbita components (card list filters for example).
facetEntityState (object): Active filtering facet information
The promise will reject in the case of a Blaze lookup failure.
format
format is a container for the following methods:
fromOrbita
Formats a raw Orbita record into the intermediary model.
Parameters:
raw (object): The raw Orbita record
Returns: The formatted provider.
fromElastic
Formats a raw Elastic result into the intermediary model.
Parameters:
raw (object): The raw Elastic result
Returns: The formatted provider.
getByOrbitaId
Retrieves a provider record by its Orbita ID
Parameters:
id (string): The Orbita ID of the provider
formatted (boolean, default = true): Whether or not to return the data in the intermediary model. If false, the raw data will be returned.
Returns: A promise that will resolve with the provider record.
Intermediary Model
Certain methods provide an option of returning data raw from Orbita or in the format of the intermediary model that serves as an interface for other modules using the Provider Service module. The intermediary provider model is:
id (string): The Orbita ID of the provider record
providerId (string): providerId from the Orbita record
firstName (string): firstName from the Orbita record
lastName (string): lastName from the Orbita record
fullName (string): name from the Orbita record
gender (string): doctorSex from the Orbita record
acceptingNewPatients (boolean): true if acceptingNewPatient from the Orbita record is “Yes”, false otherwise
image (string): doctorImage from the Orbita record, or a default avatar based on gender if none is specified
specialties (array): specialities from the Orbita record
languages (array): languages from the Orbita record
insurance (array): insurance from the Orbita record
locations (array): hospitalAffiliations from the Orbita record, formatted into the following format:
id (string): id from the hospital affiliation entry
name (string): name from the hospital affiliation entry
address (string): address from the hospital affiliation entry
phone (string): phone from the hospital affiliation entry
customData (object): customData from the hospital affiliation entry
ratingStars (array): An array of either “full” or “half” used for star rating display based on the value entered for rating in the Orbita record