FHIRModel

.r4. FHIRModel

The implementation of the FHIRModel

Constructor

new FHIRModel(sServiceUrl, mParameters)

Constructor for a new FHIRModel. Model implementation for FHIR R4.

Version:
  • 2.3.7
Since:
  • 1.0.0
Author:
  • SAP SE
Source:
Parameters:
Name Type Description
sServiceUrl string

The root URL of the FHIR server to request data from e.g. http://example.com/fhir

mParameters object

The parameters

Name Type Attributes Default Description
baseProfileUrl string <optional>

The URL of the base profiles for all resource types. If no one is given, the model will use the FHIR default profiles located at http://hl7.org/fhir/StructureDefinition/ The base profile of a resource type is used to load the structure definition of a requested resource type, if no profile is maintained (oResource.meta.profile[0]) at the requested resource

defaultSubmitMode string <optional>

The default SubmitMode for all bindings which are associated with this model

defaultFullUrlType string <optional>
'uuid'

The default FullUrlType if the default submit mode is either batch or transaction

defaultQueryParameters object <optional>
{}

The default query parameters to be passed on resource type specific requests and not resource instance specific requests (e.g /Patient?_total:accurate&_format:json). It should be of type key:value pairs. e.g. {'_total':'accurate'} -> http://hl7.org/fhir/http.html#parameters

Prefer string <optional>
'return=minimal'

The FHIR server won't return the changed resource by an POST/PUT request -> https://www.hl7.org/fhir/http.html#2.21.0.5.2

x-csrf-token boolean <optional>
false

The model handles the csrf token between the browser and the FHIR server

filtering object <optional>
{}

The filtering options

Name Type Attributes Default Description
complex boolean <optional>
false

The default filtering type. If true, all search parameters would be modelled via _filter

search boolean <optional>
{}

The search options

Name Type Attributes Default Description
secure boolean <optional>
false

To enable RESTful search via POST

Throws:

If no service URL is given, if the given service URL does not end with a forward slash

Type
Error

Methods

bindContext(sPath, oContextopt, mParametersopt) → {sap.fhir.model.r4.FHIRContextBinding}

Creates a new context binding for the given sPath, oContext and mParameters

Since:
  • 1.0.0
Source:
See:
  • sap.ui.model.Model#bindContext
Parameters:
Name Type Attributes Description
sPath string

The binding path in the model

oContext sap.fhir.model.r4.Context <optional>

The context which is required as base for a relative path

mParameters object <optional>

Map of binding parameters Note: Currently no FHIR specific binding parameters are used

Returns:
Type:
sap.fhir.model.r4.FHIRContextBinding

The context binding

bindList(sPath, oContextopt, aSortersopt, aFiltersopt, mParametersopt) → {sap.fhir.model.r4.FHIRListBinding}

Creates a new list binding for the given sPath and optional oContext

Since:
  • 1.0.0
Source:
See:
  • sap.ui.model.Model#bindList
Parameters:
Name Type Attributes Description
sPath string

The binding path in the model

oContext sap.fhir.model.r4.Context <optional>

The context which is required as base for a relative path

aSorters Array.<sap.ui.model.Sorter> <optional>

The sorters to be used initially

aFilters Array.<sap.ui.model.Filter> <optional>

The filters to be used initially

mParameters object <optional>

Map of binding parameters which can be FHIR specific parameters or binding-specific parameters as specified below.

Name Type Attributes Description
operationMode sap.fhir.model.r4.OperationMode <optional>

The operation mode for sorting and filtering sap.fhir.model.r4.OperationMode.Server is supported. All other operation modes including undefined lead to an error if 'aSorters', 'aFilters' are given or if sap.fhir.model.r4.FHIRListBinding#sort or sap.fhir.model.r4.FHIRListBinding#filter are called.

url string <optional>

If the list binding contains a hard coded set of entities which is identified by the given URL

Throws:

if an unsupported operation mode is used

Type
Error
Returns:
Type:
sap.fhir.model.r4.FHIRListBinding

The list binding

bindProperty(sPath, oContextopt, mParametersopt) → {sap.fhir.model.r4.FHIRPropertyBinding}

Creates a new property binding for the given sPath

Since:
  • 1.0.0
Source:
See:
  • sap.ui.model.Model#bindProperty
Parameters:
Name Type Attributes Description
sPath string

The binding path in the model

oContext sap.fhir.model.r4.Context <optional>

The context which is required as base for a relative path

mParameters object <optional>

Map of binding parameters Note: Currently no FHIR specific binding parameters are used

Returns:
Type:
sap.fhir.model.r4.FHIRPropertyBinding

The property binding

bindTree(sPath, oContextopt, aFiltersopt, mParametersopt, aSortersopt) → {sap.fhir.model.r4.FHIRTreeBinding}

Creates a new tree binding for the given sPath and optional oContext

Since:
  • 1.0.0
Source:
See:
  • sap.ui.model.Model#bindTree
Parameters:
Name Type Attributes Description
sPath string

The binding path in the model

oContext sap.fhir.model.r4.Context <optional>

The context which is required as base for a relative path

aFilters Array.<sap.ui.model.Filter> <optional>

The filters to be used initially

mParameters object <optional>

Map of binding parameters which can be FHIR specific parameters

aSorters Array.<sap.ui.model.Sorter> <optional>

The sorters to be used initially

Throws:

if an unsupported operation mode is used

Type
Error
Returns:
Type:
sap.fhir.model.r4.FHIRTreeBinding

The tree binding

create(sResourceType, oDataopt, sGroupIdopt) → {string}

Creates a new resource based on the given sResourceType with given oData. Note: The resource will be created only on the client side, to push the created resource to the server sap.fhir.model.r4.FHIRModel#submitChanges has to be called afterwards

Since:
  • 1.0.0
Source:
Parameters:
Name Type Attributes Description
sResourceType string

The resource type

oData object <optional>

The data of the resource

sGroupId string <optional>

The group where the resource should belongs to

Returns:
Type:
string

The uuidv4 of the created resource

destroy()

Destroys this model

Since:
  • 1.0.0
Source:
See:
  • sap.ui.model.Model#destroy

getBaseProfileUrl() → {string}

Determines the URL of the base profiles for all resource types

Since:
  • 1.0.0
Source:
Returns:
Type:
string

The base profile URL

Determines the next link url should be used

This method might be overridden by the application to provide a customized next link processing because FHIR did not offer a standardized link structure.

Since:
  • 2.3.2
Source:
Parameters:
Name Type Description
sNextLinkUrl string

The next link url

sPath string

The FHIR resource path

mParameters sap.fhir.model.r4.FHIRListBinding.Parameter | sap.fhir.model.r4.FHIRTreeBinding.Parameter

Existing parameters

Returns:
Type:
sap.fhir.model.r4.NextLink

Next link object containing the url and parameters

getProperty(sPathopt, oContextopt, oDataExtopt) → {object}

Determines the value for the property in the model based on the given sPath and oContext and oDataExt

Since:
  • 1.0.0
Source:
Parameters:
Name Type Attributes Description
sPath string <optional>

The path to the desired property

oContext sap.fhir.model.r4.Context <optional>

The binding context

oDataExt object <optional>

The data object containing the desired property

Returns:
Type:
object

the value behind the path

getServiceUrl() → {string}

Determines the root URL of the FHIR server

Since:
  • 1.0.0
Source:
Returns:
Type:
string

The service URL

hasResourceTypePendingChanges(sResourceType) → {boolean}

Determines if there are any pending changes for the given sResourceType

Since:
  • 1.0.0
Source:
Parameters:
Name Type Description
sResourceType string

The FHIR resource type

Returns:
Type:
boolean

true there are changes for the given resource type.

readLatestVersionOfResource(sPath, fnSuccessopt)

Triggers a HEAD request to the FHIR server that was specified in the model constructor. If HEAD isn't available it sends a GET request and updates the resource data in the model implicitly

Since:
  • 1.0.0
Source:
Parameters:
Name Type Attributes Description
sPath string

A string containing the path to the resource which should be requested.

fnSuccess function <optional>

The callback function which is executed after the version read was successfully

refresh()

Refreshes the model and all associated bindings

Since:
  • 1.0.0
Source:
See:

remove(aResources, fnPreProcessopt, sGroupIdopt)

Mark resources for the DELETE request which have to be submitted to the server with the submitChanges() method or delete client changes

Since:
  • 1.0.0
Source:
Parameters:
Name Type Attributes Description
aResources Array.<string>

the resources which shall be deleted, e.g. ["/Patient/123", "/Organization/XYZ"]

fnPreProcess function <optional>

to preprocess the objects of the given aResources

sGroupId string <optional>

The group where the resource should belongs to

resetChanges(sGroupIdopt, bAvoidUpdateopt)

Resets the model to the state when the model was synchronized with the server for the last time. Resetting means newly created resources are removed and changed resources are rolled backed to the earlier state.

Since:
  • 1.0.0
Source:
Parameters:
Name Type Attributes Description
sGroupId string <optional>

The groupId which identifies the changes of a specific group

bAvoidUpdate boolean <optional>

If true then checkupdate() won't be called, because it will anyway get called in furthers steps

sendGetRequest(sPath, mParametersopt) → {sap.fhir.model.r4.lib.RequestHandle}

Triggers a GET request to the FHIR server that was specified in the model constructor. The data will be stored in the model

Since:
  • 1.0.0
Source:
Parameters:
Name Type Attributes Description
sPath string

A string containing the path to the data which should be retrieved. The path is concatenated to the service URL which was specified in the model constructor.

mParameters sap.fhir.model.r4.RequestParameters <optional>

The additional request parameters

Returns:
Type:
sap.fhir.model.r4.lib.RequestHandle

A request handle.

sendPostRequest(sPath, oPayloadopt, mParametersopt) → {sap.fhir.model.r4.lib.RequestHandle}

Triggers a POST request to the FHIR server that was specified in the model constructor. The data will be stored in the model

Since:
  • 1.0.0
Source:
Parameters:
Name Type Attributes Description
sPath string

A string containing the path to the data which should be retrieved. The path is concatenated to the service URL which was specified in the model constructor.

oPayload object <optional>

The request body

mParameters sap.fhir.model.r4.RequestParameters <optional>

The additional request parameters

Returns:
Type:
sap.fhir.model.r4.lib.RequestHandle

A request handle.

setProperty(sPath, vValue, oContextopt, oBinding)

Sets a new value for the property on the the given sPath in the model

Since:
  • 1.0.0
Source:
Parameters:
Name Type Attributes Description
sPath string

The path of the property to set

vValue any

The value to set the property to

oContext sap.fhir.model.r4.Context <optional>

The context which will be used to set the property

oBinding sap.fhir.model.r4.PropertyBinding

That the checkupdate method doesn't run in not associated bindings less round trips

submitChanges(sGroupIdopt, fnSuccessCallbackopt, fnErrorCallbackopt) → {object}

Submits the client changes of the model to the FHIR service

Since:
  • 1.0.0
Source:
Parameters:
Name Type Attributes Description
sGroupId string <optional>

The group id to submit only a specific group, leave empty when all changes should be submitted

fnSuccessCallback function <optional>

The callback function which is executed with specific parameters after the changes are send successfully to the server
Batch/Transaction Submit Mode fnSuccessCallback(aFHIRResources)
Direct Mode fnSuccessCallback(oFHIRResource)

fnErrorCallback function <optional>

The callback function which is executed with specific parameters when the transport to the server failed
Batch/Transaction Submit Mode fnErrorCallback(oMessage, aSuccessResource, aOperationOutcome)
Direct Mode fnErrorCallback(oMessage)

Returns:
Type:
object

mRequestHandles contains all request groups and direct requests which where submitted, e.g. {"patientDetails": oFHIRBundle1, "direct": [oRequestHandle1, oRequestHandle2], "patientList": oFHIRBundle2}, if there are no changes undefined is returned

Events

requestCompleted

Fired, when a request is completed

Since:
  • 1.0.0
Source:
Parameters:
Name Type Description
oEvent sap.ui.base.Event
Name Type Description
getSource sap.ui.base.EventProvider
getParameters object
Name Type Description
requestHandle sap.fhir.model.r4.lib.RequestHandle

Wrapper for the jqXHR request object, binding which potentially triggered the request and the request URL

requestFailed

Fired, when a request failed

Since:
  • 1.0.0
Source:
Parameters:
Name Type Description
oEvent sap.ui.base.Event
Name Type Description
getSource sap.ui.base.EventProvider
getParameters object
Name Type Description
requestHandle sap.fhir.model.r4.lib.RequestHandle

Wrapper for the jqXHR request object, binding which potentially triggered the request and the request URL

requestSent

Fired, when a request was sent to the FHIR Server

Since:
  • 1.0.0
Source:
Parameters:
Name Type Description
oEvent sap.ui.base.Event
Name Type Description
getSource sap.ui.base.EventProvider
getParameters object
Name Type Description
requestHandle sap.fhir.model.r4.lib.RequestHandle

Wrapper for the jqXHR request object, binding which potentially triggered the request and the request URL