Installing and Configuring a FHIR Server
The Management Portal provides a Server Configuration page that allows you to install a new FHIR server and then configure it. Alternatively, you can install and configure a server programmatically.
The FHIR server must be installed in a Foundation namespace; multiple FHIR servers can be installed in the same Foundation namespace.
Before installing a FHIR server, you must consider whether you want to customize it now or in the future. If you install a FHIR server without creating new Interactions and InteractionsStrategy subclasses, you will not be able to perform certain customizations such as adding FHIR operations or modifying how bundles are processed. For information about preparing for these customizations before installing the FHIR server, see Developing Custom Functionality. To view the options that can be configured without creating Interactions and InteractionsStrategy subclasses, see Configuring a FHIR Server.
To install a new FHIR server from the Management Portal:
Open the Management Portal and switch to the Foundation namespace where you want the FHIR server installed. If you do not have a Foundation namespace, go to Health, and select Installer Wizard from the top menu bar. The Configure Foundation button allows you to create a new Foundation namespace. Be sure to activate the namespace after creating it.
Navigate to Health > FHIR Configuration > Server Configuration. If you do not see the FHIR Configuration menu, make sure you are using a Foundation namespace.
Select the + button in the Endpoints section.
Select the FHIR server’s metadata set, which is based on a FHIR version. For example, if the server is working with FHIR R4 data, select HL7v4.Important:
If you plan to add custom search parameters for your endpoint now or in the future, you must create a custom metadata set first, then select it as the server’s metadata set. For more information, see Custom Metadata Sets.
Select the InteractionsStrategy for the endpoint. For InterSystems IRIS for Health, the default interactions strategy is the Resource Repository (HS.FHIRServer.Storage.Json.InteractionsStrategy), which stores FHIR data as JSON in dynamic objects.
Enter the base URL of the FHIR server’s endpoint. The name of the URL must begin with a slash (/).
Configuring a FHIR Server
Once you have installed a FHIR Server, you can configure its settings using the Server Configuration page of the Management Portal. These configuration settings can also be modified programmatically by setting the properties of the server’s ConfigData object.
To configure the FHIR server:
In the Management Portal, navigate to Health > FHIR Configuration > Server Configuration. Make sure you are in the FHIR server’s namespace.
Choose the endpoint of the FHIR server that you are configuring.
When the page expands, scroll down and select the Edit button.
Configure the settings, using the following descriptions as a guide.
|Enabled||Specify whether the endpoint is enabled. A disabled endpoint rejects requests from FHIR clients.|
|Default Search Page Size||Search result page size to use when a search does not contain a _count parameter.|
|Max Search Page Size||Maximum search result page size to prevent an excessive user-specified page size.|
|Max Search Results||Maximum number of resources that can be selected by a search before the server responds to the query with an error. This number only includes resources selected by the actual search; it does not include resources included via an _include search parameter. This value does not affect the size of pages returned by a search. Overly broad searches that select large numbers of resources take a lot of system resources to fulfill, and are probably more broad than the client actually needs.|
|Max Conditional Delete Results||Maximum allowable number of resources to delete via conditional delete. If the conditional delete search finds more than this number of resources, then the conditional delete as a whole is rejected with an HTTP 412 Precondition Failed error.|
|FHIR Session Timeout||Maximum number of seconds between requests to the service before any session data is considered stale.|
|Default Prefer Handling||Specifies what happens by default when a search request contains an unknown parameter. Specify lenient to ignore the unknown parameter and return a bundle in which the OperationOutcome resource identifies the issue. Specify strict to reject the search request and return an error. A FHIR search request that includes the prefer header overrides this default.|
|OAuth Client Name||Specifies the application name that the FHIR server, as an OAuth resource server, uses to contact the OAuth 2.0 authorization server when needed. For more information about OAuth 2.0 support, see OAuth 2.0 Authorization.|
|Required Resource||If you specify an InterSystems security resource, FHIR clients must have privileges to the resource to perform interactions on the server. For more information, see Adding Authorization Requirements.|
|Service Config Name||To route FHIR requests through an interoperability production before reaching the FHIR server, enter the package and name of the business service that will receive the requests. Unless the business service has a custom name, this entry is HS.FHIRServer.Interop.Service. For more details, see FHIR Productions.|
|Allow Unauthenticated Access||Allows all FHIR requests to reach the server, ignoring authentication and authorization strategies.|
|New Service Instance||Instantiates a new Service object for every FHIR request.|
|Include Tracebacks||The FHIR server responds to a FHIR request by sending a stack trace in an OperationOutcome resource.|
Installing and Configuring Programmatically
For applications that need to install a FHIR server programmatically rather than using the Management Portal, the server must be installed first, then configured.
The FHIR server must run in a foundation namespace, therefore creating a foundation namespace is a prerequisite to installing the FHIR server. Once you have a foundation namespace, the following methods of HS.FHIRServer.Installer must be called in order:
|InstallNamespace()||Prepares an existing foundation namespace for the FHIR Server; it does not create a new foundation namespace. If called without an argument, the installer assumes the active namespace is a foundation namespace and prepares it for the FHIR server.|
|InstallInstance()||Installs an instance of a FHIR Service into the current namespace. This method requires the following arguments:
For example, the following ObjectScript code installs a FHIR server using the default R4 metadata set and the default JSON storage strategy for InterSystems IRIS for Health (Resource Repository).
Set appKey = "/MyFHIRApp/fhir/r4" Set strategyClass = "HS.FHIRServer.Storage.Json.InteractionsStrategy" Set metadataConfigKey = "HL7v40" //Install a Foundation namespace and change to it Do ##class(HS.HC.Util.Installer).InstallFoundation("FHIRNamespace") Set $namespace = "FHIRNamespace" // Install elements that are required for a FHIR-enabled namespace Do ##class(HS.FHIRServer.Installer).InstallNamespace() // Install an instance of a FHIR Service into the current namespace Do ##class(HS.FHIRServer.Installer).InstallInstance(appKey, strategyClass, metadataConfigKey)
Configuring the FHIR Server Programmatically
The InstallInstance() method creates a HS.FHIRServer.API.ConfigData object when it creates the FHIR server endpoint. You can control the behavior of the FHIR server by modifying the properties of this object. Refer to the class reference or the configuration utility’s settings for a description of these properties.
For example, the code to change the debug mode of the FHIR server would retrieve the FHIR server’s configData object, modify the DebugMode property, and then save the ConfigData object. The ObjectScript code might look like:
Set appKey = "/MyFHIRApp/fhir/r4" Set strategy = ##class(HS.FHIRServer.API.InteractionsStrategy).GetStrategyForEndpoint(appKey) Set configData = strategy.GetServiceConfigData() Set configData.DebugMode = 4 Do strategy.SaveServiceConfigData(configData)