Skip to main content

FHIRServerUtils

The FHIRServerUtils module contains utility methods for discovering information about a FHIR server.

getAuthorizeURL

Returns the authorize URL for a given FHIR server.

const authorizeURL = FHIRServerUtils.getAuthorizeURL(baseURL);

getTokenURL

Returns the token URL for a given FHIR server.

const tokenUrl = FHIRServerUtils.getTokenURL(baseURL);

getConformanceStatementURL

Returns the URL of the "metadata" endpoint for a given FHIR server.

const url = FHIRServerUtils.getConformanceStatementURL(baseURL);

getSmartConfiguration

Returns the full "SMART Configuration" as a string

const smartConfiguration = await FHIRServerUtils.getSmartConfiguration(baseURL);

getConformanceStatement

Returns the full "Conformance Statement" as a JSON object

const conformance = await FHIRServerUtils.getConformanceStatement(baseURL);

getConformanceStatementPatientSearchParam

For a given FHIR resource, returns the search param that should be used to identify the patient, or null if one could not be found. You can also cache the "Conformance Statement" if you need to call this multiple times.

This is used by the PlasmaFHIRClient whenever you call readPatientResource.

const confStatement = {};
const searchParam = await FHIRServerUtils.getConformanceStatementPatientSearchParam(
baseURL, "Immunization", confStatement);

getResourcesData

For a given FHIR server, returns data about the FHIR resources that are supported.

const conStatement = {};
const data = await FHIRServerUtils.getResourcesData(baseURL, confStatement);

getSearchParamsForResource

Gets data about all search parameters for a given resource from the metadata (for a given FHIR server)

const conStatement = {};
const data = await FHIRServerUtils.getSearchParamsForResource(baseURL, "Patient", confStatement);

getExtensionsForResource

Gets data about all extensions for a given resource from the metadata (for a given FHIR server)

const conStatement = {};
const data = await FHIRServerUtils.getExtensionsForResource(baseURL, "Patient", confStatement);

getFHIRVersion

Returns the FHIR version of the given server

const fhirVersion = FHIRServerUtils.getFHIRVersion(baseURL, confStatement);