Global

Methods

deleteResource(fhirBaseUrl, resource, tokenopt, basicAuth) → {Promise}

Deletes a FHIR resource from the FHIR server.
Parameters:
Name Type Attributes Description
fhirBaseUrl String the base URL of the FHIR server
resource Object resource that is supposed to be deleted
token String <optional>
the authentication token
basicAuth Boolean boolean parameter that changes the authorization header to Basic if true
Source:
Returns:
Promise object representing the response to the http call
Type
Promise

deleteResourceById(fhirBaseUrl, resourceType, id, tokenopt, basicAuth) → {Promise}

Parameters:
Name Type Attributes Description
fhirBaseUrl String the base URL of the FHIR server
resourceType Object the type of the FHIR resource
id String id of the resource to be deleted
token String <optional>
the authentication token
basicAuth Boolean boolean parameter that changes the authorization header to Basic if true
Source:
Returns:
Promise object representing the response to the http call
Type
Promise

fetchByUrl(url, paramsopt, tokenopt, basicAuth) → {Promise}

Fetches resource(s) by the given url.
Parameters:
Name Type Attributes Default Description
url String the url
params Object <optional>
{} the FHIR query params
token String <optional>
the authentication token
basicAuth Boolean boolean parameter that changes the authorization header to Basic if true
Source:
Returns:
Promise object representing the response to the http call
Type
Promise

fetchConformanceStatement(fhirBaseUrl, paramsopt, tokenopt, basicAuth) → {Promise}

Fetches the conformance statement.
Parameters:
Name Type Attributes Description
fhirBaseUrl String the base URL of the FHIR server
params Object <optional>
the FHIR query params
token String <optional>
the authentication token
basicAuth Boolean boolean parameter that changes the authorization header to Basic if true
Source:
Returns:
Promise object representing the response to the http call
Type
Promise

fetchPatient(fhirBaseUrl, id, paramsopt, tokenopt, basicAuth) → {Promise}

Fetches the Patient with the given id from a FHIR server.
Parameters:
Name Type Attributes Description
fhirBaseUrl String the base URL of the FHIR server
id String id of the Patient to be fetched
params Object <optional>
the FHIR query params
token String <optional>
the authentication token
basicAuth Boolean boolean parameter that changes the authorization header to Basic if true
Source:
Returns:
Promise object representing the response to the http call
Type
Promise

fetchPatients(fhirBaseUrl, paramsopt, tokenopt, basicAuth) → {Promise}

Fetches Patients from a FHIR server.
Parameters:
Name Type Attributes Description
fhirBaseUrl String the base URL of the FHIR server
params Object <optional>
the FHIR query params
token String <optional>
the authentication token
basicAuth Boolean boolean parameter that changes the authorization header to Basic if true
Source:
Returns:
Promise object representing the response to the http call
Type
Promise

fetchQuestionnaire(fhirBaseUrl, id, paramsopt, tokenopt, basicAuth) → {Promise}

Fetches the Questionnaire with the given id from a FHIR server.
Parameters:
Name Type Attributes Description
fhirBaseUrl String url of the FHIR-Server
id String id of the Questionnaire to be fetched
params Object <optional>
the FHIR query params
token String <optional>
the authentication token
basicAuth Boolean boolean parameter that changes the authorization header to Basic if true
Source:
Returns:
Promise object representing the response to the http call
Type
Promise

fetchQuestionnaires(fhirBaseUrl, paramsopt, tokenopt, basicAuth) → {Promise}

Fetches Questionnaires from a FHIR server.
Parameters:
Name Type Attributes Description
fhirBaseUrl String the base URL of the FHIR server
params Object <optional>
the FHIR query params
token String <optional>
the authentication token
basicAuth Boolean boolean parameter that changes the authorization header to Basic if true
Source:
Returns:
Promise object representing the response to the http call
Type
Promise

fetchResource(fhirBaseUrl, resourceType, id, paramsopt, tokenopt, basicAuth) → {Promise}

Fetches the resource from the FHIR server with the given id.
Parameters:
Name Type Attributes Default Description
fhirBaseUrl String the base URL of the FHIR server
resourceType String the type of the FHIR resource
id String id of the resource to be fetched
params Object <optional>
{} the FHIR query params
token String <optional>
the authentication token
basicAuth Boolean boolean parameter that changes the authorization header to Basic if true
Source:
Returns:
Promise object representing the response to the http call
Type
Promise

fetchResources(fhirBaseUrl, resourceType, paramsopt, tokenopt, basicAuth) → {Promise}

Fetches resources from a FHIR server using a GET request.
Parameters:
Name Type Attributes Default Description
fhirBaseUrl String the base URL of the FHIR server
resourceType String the type of the FHIR resource
params Object <optional>
{} the FHIR query params
token String <optional>
the authentication token
basicAuth Boolean boolean parameter that changes the authorization header to Basic if true
Source:
Returns:
Promise object representing the response to the http call
Type
Promise

fetchResourcesPost(fhirBaseUrl, resourceType, paramsopt, tokenopt, basicAuth) → {Promise}

Fetches resources from a FHIR server using a POST request.
Parameters:
Name Type Attributes Default Description
fhirBaseUrl String the base URL of the FHIR server
resourceType String the type of the FHIR resource
params Object <optional>
{} the FHIR query params
token String <optional>
the authentication token
basicAuth Boolean boolean parameter that changes the authorization header to Basic if true
Source:
Returns:
Promise object representing the response to the http call
Type
Promise

fetchValueSet(fhirBaseUrl, id, paramsopt, tokenopt, basicAuth) → {Promise}

Fetches ValueSet from a FHIR server.
Parameters:
Name Type Attributes Description
fhirBaseUrl String the base URL of the FHIR server
id String id of the ValueSet to be fetched
params Object <optional>
the FHIR query params
token String <optional>
the authentication token
basicAuth Boolean boolean parameter that changes the authorization header to Basic if true
Source:
Returns:
Promise object representing the response to the http call
Type
Promise

fetchValueSetConceptByUrl(fhirBaseUrl, tokenopt, url, basicAuth) → {Array}

Fetches a ValueSet by the given url and returns the concept.
Parameters:
Name Type Attributes Description
fhirBaseUrl String the base URL of the FHIR server
token String <optional>
the authentication token
url String the url of the resource
basicAuth Boolean boolean parameter that changes the authorization header to Basic if true
Source:
Returns:
- the cpncept
Type
Array

fetchValueSets(fhirBaseUrl, paramsopt, tokenopt, basicAuth) → {Promise}

Fetches ValueSets from a FHIR server.
Parameters:
Name Type Attributes Description
fhirBaseUrl String the base URL of the FHIR server
params Object <optional>
the FHIR query params
token String <optional>
the authentication token
basicAuth Boolean boolean parameter that changes the authorization header to Basic if true
Source:
Returns:
Promise object representing the response to the http call
Type
Promise

mapFhirData(data) → {Array}

Maps the response of a FHIR search query bundle to the actual FHIR resources.
Parameters:
Name Type Description
data Object a FHIR search bundle.
Source:
Returns:
the resources in an array
Type
Array
Example

Basic usage

import fhirApi from "@molit/fhir-api";

console.log(bundle);
// ->
// {
//   "resourceType": "Bundle",
//   "type": "searchset",
//   "total": 2,
//   "entry": [
//     {
//       "fullUrl": "\thttps://fhir.molit.eu/baseDstu3/Patient/6",
//       "resource": {
//         "resourceType": "Patient",
//         "id": "6"
//       }
//     },
//     {
//       "fullUrl": "\thttps://fhir.molit.eu/baseDstu3/Patient/8",
//       "resource": {
//         "resourceType": "Patient",
//         "id": "8"
//       }
//     }
//   ]
// }

let patients = fhirApi.mapFhirData(bundle);
console.log(patients)
// ->
// [
//   {
//     "resourceType": "Patient",
//     "id": "6"
//   },
//   {
//     "resourceType": "Patient",
//     "id": "8"
//   }
// ]

mapFhirResponse(res) → {Array}

Maps the response of a FHIR search query to the actual FHIR resources.
Parameters:
Name Type Description
res Object the response of a FHIR search query.
Source:
See:
Returns:
the resources in an array
Type
Array

serializeUrlParams(params)

Converts URLSearchParams in a string that a FHIR server can understand.
Parameters:
Name Type Description
params URLSearchParams the URL search params
Source:

submitResource(fhirBaseUrl, resource, tokenopt, basicAuth) → {Promise}

Submits a given resource to the server
Parameters:
Name Type Attributes Description
fhirBaseUrl String the base URL of the FHIR server
resource Object resource that is supposed to be submitted
token String <optional>
the authentication token
basicAuth Boolean boolean parameter that changes the authorization header to Basic if true
Source:
Returns:
Promise object representing the response to the http call
Type
Promise

submitResourceToUrl(baseUrl, resource, token, basicAuth)

Submits a given Resource to a Url
Parameters:
Name Type Description
baseUrl *
resource *
token *
basicAuth Boolean boolean parameter that changes the authorization header to Basic if true
Source:

updateResource(fhirBaseUrl, resource, tokenopt, basicAuth) → {Promise}

Updates an existing FHIR resource on the FHIR server.
Parameters:
Name Type Attributes Description
fhirBaseUrl String the base URL of the FHIR server
resource Object resource that is supposed to be submitted
token String <optional>
the authentication token
basicAuth Boolean boolean parameter that changes the authorization header to Basic if true
Source:
Returns:
Promise object representing the response to the http call
Type
Promise

updateResourceByUrl(fhirBaseUrl, resource, paramsopt, tokenopt, basicAuth) → {Promise}

Updates an existing FHIR resource on the FHIR server or creates a new resource if no id is in the given FHIR resource.
Parameters:
Name Type Attributes Default Description
fhirBaseUrl String the base URL of the FHIR server
resource Object resource that is supposed to be submitted
params Object <optional>
{} the FHIR query params
token String <optional>
the authentication token
basicAuth Boolean boolean parameter that changes the authorization header to Basic if true
Source:
Returns:
Promise object representing the response to the http call
Type
Promise