Data Access
The client core package provides several data services to allow you to access FHIR and custom data easily.
#
FHIR ServiceKailona has FHIR API Gateway which allows client components to access the FHIR server in a secure way using Nextcloud security mechanism.
The client components use FHIRService
class from @kailona/core
package. For example, you can read a specific
Observation resource from the FHIR service using the following source code:
The constructor of BaseResourceService
class gets resource type as a parameter. It implements the following methods as
defined in FHIR standard:
transaction
: Update, create or delete a set of resources in a single interaction with the FHIR servercreate
: Create a new resource with a server assigned id in the FHIR serverread
: Read the current state of the resource in the FHIR servervread
: Read the state of a specific version of the resource in the FHIR serverupdate
: Update an existing resource by its id in the FHIR serverpatch
: Update an existing resource by posting a set of changes to it in the FHIR serverdelete
: Delete a resource in the FHIR serverhistory
: Retrieve the change history for a particular resource in the FHIR serversearch
: Search the resource type based on some filter criteria in the FHIR server
danger
FHIR API Gateway automatically sets patient id parameter in all search queries to prevent unauthorized access in a shared FHIR server! You can setup FHIR server in a tenant infrastructure and use individual tenant for each Nextcloud user to completely isolate health data.
We would like to accept any contributions and security checks in this area.
caution
FHIR API Gateway automatically replaces URLs in the FHIR responses to allow client components call them directly.
#
Base Resource ServiceBaseResourceService
class is a base class which should be overridden before it is used. It is useful for quick data
access of a group of FHIR resources. For example, you can implement a class to manage data with custom mappers using the
following source code:
The constructor of BaseResourceService
class gets resource type as a parameter. It implements the following methods:
hasNextData
: Check whether there is more data to retrieve from the FHIR server, useful for paginationfetchData
: Retrieve data from the FHIR serverfetchNextData
: Retrieve next data from the FHIR server, useful for paginationupsertData
: Update the existing data or create if it is new in the FHIR serverremoveData
: Remove the data in the FHIR server
#
Mail ServiceMailService
class is used to send email based on some workflow such as data request. It implements the following
method:
sendRequestData
: Sends an email to request health data via Nextcloud
#
Settings ServiceSettingsService
class is used to retrieve and store application and user settings. It implements the following
methods:
retrieveAdminSettings
: Retrieve admin settings in NextcloudsaveAdminSettings
: Store admin settings in Nextcloud