Fhir Users Guide
Fhir Users Guide
Release 8.2
F91806-01
March 2024
Oracle Healthcare Data Repository FHIR User's Guide, Release 8.2
F91806-01
This software and related documentation are provided under a license agreement containing restrictions on
use and disclosure and are protected by intellectual property laws. Except as expressly permitted in your
license agreement or allowed by law, you may not use, copy, reproduce, translate, broadcast, modify, license,
transmit, distribute, exhibit, perform, publish, or display any part, in any form, or by any means. Reverse
engineering, disassembly, or decompilation of this software, unless required by law for interoperability, is
prohibited.
The information contained herein is subject to change without notice and is not warranted to be error-free. If
you find any errors, please report them to us in writing.
If this is software, software documentation, data (as defined in the Federal Acquisition Regulation), or related
documentation that is delivered to the U.S. Government or anyone licensing it on behalf of the U.S.
Government, then the following notice is applicable:
U.S. GOVERNMENT END USERS: Oracle programs (including any operating system, integrated software,
any programs embedded, installed, or activated on delivered hardware, and modifications of such programs)
and Oracle computer documentation or other Oracle data delivered to or accessed by U.S. Government end
users are "commercial computer software," "commercial computer software documentation," or "limited rights
data" pursuant to the applicable Federal Acquisition Regulation and agency-specific supplemental
regulations. As such, the use, reproduction, duplication, release, display, disclosure, modification, preparation
of derivative works, and/or adaptation of i) Oracle programs (including any operating system, integrated
software, any programs embedded, installed, or activated on delivered hardware, and modifications of such
programs), ii) Oracle computer documentation and/or iii) other Oracle data, is subject to the rights and
limitations specified in the license contained in the applicable contract. The terms governing the U.S.
Government's use of Oracle cloud services are defined by the applicable contract for such services. No other
rights are granted to the U.S. Government.
This software or hardware is developed for general use in a variety of information management applications.
It is not developed or intended for use in any inherently dangerous applications, including applications that
may create a risk of personal injury. If you use this software or hardware in dangerous applications, then you
shall be responsible to take all appropriate fail-safe, backup, redundancy, and other measures to ensure its
safe use. Oracle Corporation and its affiliates disclaim any liability for any damages caused by use of this
software or hardware in dangerous applications.
Oracle®, Java, MySQL, and NetSuite are registered trademarks of Oracle and/or its affiliates. Other names
may be trademarks of their respective owners.
Intel and Intel Inside are trademarks or registered trademarks of Intel Corporation. All SPARC trademarks are
used under license and are trademarks or registered trademarks of SPARC International, Inc. AMD, Epyc,
and the AMD logo are trademarks or registered trademarks of Advanced Micro Devices. UNIX is a registered
trademark of The Open Group.
This software or hardware and documentation may provide access to or information about content, products,
and services from third parties. Oracle Corporation and its affiliates are not responsible for and expressly
disclaim all warranties of any kind with respect to third-party content, products, and services unless otherwise
set forth in an applicable agreement between you and Oracle. Oracle Corporation and its affiliates will not be
responsible for any loss, costs, or damages incurred due to your access to or use of third-party content,
products, or services, except as set forth in an applicable agreement between you and Oracle.
For information about Oracle's commitment to accessibility, visit the Oracle Accessibility Program website at
http://www.oracle.com/pls/topic/lookup?ctx=acc&id=docacc.
Contents
Preface
Documentation accessibility viii
Diversity and Inclusion viii
1 Getting Started
Introduction 1-1
Platform Requirements 1-1
2 Installation
4 Deployment Details
Install files 4-1
FHIR Server Base URL and REST Endpoints 4-1
Configuration Files 4-1
Properties File 4-1
Log Configurations 4-6
iii
6 Auditing
Audit Interceptor Execution Flow 6-1
Audit Record Format 6-2
Settings 6-2
11 FHIR Operations
FHIR CRUD (Create/Read/Update/Delete) operations 11-1
Create 11-2
Update 11-4
Delete 11-6
Patch 11-7
Read 11-13
vRead 11-14
FHIR Search operations 11-16
Basic searching: Finding patients 11-16
References: Finding encounters 11-18
Quantities: Finding laboratory values 11-18
Dates and times: Narrowing your search 11-19
Paging search results 11-20
Sorting search results 11-21
iv
Full text searching 11-22
Patient search $everything 11-22
FHIR Bundle transactions and batches 11-23
Basic bundle transaction 11-24
Bundle multiple related resources 11-25
Placeholder IDs and references 11-26
Conditional Create 11-28
Conditional Update 11-29
Delete 11-30
Patch 11-31
Search parameters 11-32
Default search parameters 11-32
Managing search parameters 11-33
Manual indexing 11-33
Reindex operation 11-34
Reindex response 11-35
Modify Search Results 11-36
Include and RevInclude Parameters 11-37
Summary Parameter 11-37
Limit Size Parameter 11-40
Elements Parameter 11-43
Sort Parameter 11-45
Contained Resources 11-45
Search parameter features 11-46
Index missing search parameter (: missing) 11-47
Index contained resources 11-47
Searching for data 11-49
FHIR Search extensions 11-49
Creating data 11-50
Validating references and referential integrity 11-50
Transactions and submitting bundles 11-51
Auto-creating reference targets 11-51
FHIR Transaction with conditional create 11-52
Auto-create placeholders for reference targets 11-54
Auto-create placeholder reference targets with identifier 11-55
Reading data 11-56
Diff operation 11-56
Diff at Instance Level 11-56
Diff at Type Level 11-57
$everything operation 11-58
Updating data 11-59
v
Patching data 11-59
Tag retention 11-63
Deleting data 11-64
Deletes and referential integrity 11-65
Transactional delete 11-66
Referential integrity 11-66
Cascading deletes 11-67
The $expunge operation 11-68
Binary Access Operations 11-71
Binary Access Write Operation ($binary-access-write) 11-71
Binary Access Read Operation ($binary-access-read) 11-73
12 Other Features
Repository Validation Support 12-1
Configuration 12-2
Remote Terminology Service Validation Support 12-4
Configuration 12-4
Patient :identifier Search Parameter Support 12-5
Lucene/Elasticsearch Indexing 12-6
Configuration 12-7
String search 12-7
13 Partitioning
Partitioning Outcomes 13-1
Partition Operations 13-2
Creating a Partition 13-2
Updating a Partition 13-3
Deleting a Partition 13-3
Reading a Partition 13-4
Listing all Partitions 13-4
Enabling Partitioning 13-5
14 Terminology
Uploading CodeSystems 14-1
Applying Deltas to CodeSystems 14-3
ValueSet 14-5
Expanding Hierarchical CodeSystems and ValueSets 14-6
Requesting A ValueSet Expansion 14-9
vi
Requesting a ValueSet Hierarchical Expansion 14-10
vii
Preface
Preface
This preface contains the following sections:
• Documentation accessibility
• Diversity and Inclusion
Documentation accessibility
For information about Oracle's commitment to accessibility, visit the Oracle
Accessibility Program website at http://www.oracle.com/pls/topic/lookup?
ctx=acc&id=docacc.
viii
1
Getting Started
This section provides information about the platform requirements for setting up an Oracle
Healthcare Data Repository HL7 FHIR server.
• Introduction
• Platform Requirements
Introduction
Fast Healthcare Interoperability Resources (FHIR) is a standard for healthcare data
exchange that is published by HL7 (www.hl7.org/fhir/).
Oracle Healthcare Data Repository (HDR) Release 8.2 supports the HL7 FHIR specification
versions R4 (4.0.1), R4B (4.3.0) and R5. The FHIR server module is distributed as a web
application, which can be deployed to standard web containers such as WebLogic. FHIR
resources are exposed as a set of REST APIs that can be accessed by REST-based
applications.
Platform Requirements
The following software is required for Oracle Healthcare Data Repository and the FHIR
server module:
• Operating System: Oracle Enterprise Linux 8.x or 9.x (64 bit)
• Oracle Database 19c Release 1 (12.1.0.2.0) or Release 2 (12.2.1.2.0) or Release 19c.
Download from the Oracle Software Delivery Cloud at https://edelivery.oracle.com.
• WebLogic Server 14.1.1.0 with the Coherence option. Download from the Oracle
Software Delivery Cloud at https://edelivery.oracle.com.
• JDK (Java Development Kit) 11u17 and later. Download from My Oracle Support.
Download the Oracle Healthcare Data Repository 8.2 patch set from My Oracle Support at
https://support.oracle.com. Refer to the Oracle Healthcare Data Repository 8.2 Release
Notes (https://support.oracle.com/epmos/faces/DocumentDisplay?id=2997697.1).
1-1
2
Installation
Refer to the Oracle Healthcare Data Repository 8.2 Release Notes (https://
support.oracle.com/epmos/faces/DocumentDisplay?id=2997697.1) for information on
prerequisites and steps to install the HDR-FHIR module.
2-1
3
HDR FHIR Server Architecture
Healthcare functional domains (administrative, clinical, and financial) and core services are
exposed as RESTful endpoints.
The client application that uses the HDR FHIR RESTful APIs must properly configure the
system in a secure environment to avoid unauthorized access of those APIs. To access
protected FHIR APIs, the client application must provide a valid access token. For more
information on this, see the HDR 8.1 Secure Configuration Guide and Secure Development
Guide.
The FHIR Server can be deployed in a single or multi-node cluster as illustrated below:
3-1
Chapter 3
3-2
Chapter 3
3-3
4
Deployment Details
This section describes the details of the HDR FHIR Server deployment.
• Install files
• FHIR Server Base URL and REST Endpoints
• Configuration Files
Install files
The HDR FHIR Server module is packaged as a deployable web application (.war) file. The
war file is distributed along with the HDR 8.2 patch set. Once installed, FHIR resources are
exposed as a set of REST endpoints.
The other component, the FHIR command line tool, is available in the HDR 8.2 patch and
copy them under HDR HOME directory on the middle tier. Refer to FHIR Command-Line
Utility section for more details.
Configuration Files
Runtime behavior and logging are controlled using configuration files.
• Properties File
• Log Configurations
Properties File
The runtime behavior of the FHIR JPA server can be managed using the hdr_fhir.yaml file:
<HDR_DOMAIN>/config/fhir/hdr_fhir.yaml
4-1
Chapter 4
Configuration Files
4-2
Chapter 4
Configuration Files
enable_index_missing_fields: false
# enable_index_of_type: true
# enable_index_contained_resource: false
### !!Extended Lucene/Elasticsearch Indexing is still a experimental feature,
4-3
Chapter 4
Configuration Files
logger:
error_format: 'ERROR - ${requestVerb} ${requestUrl}'
format: >-
Path[${servletPath}] Source[${requestHeader.x-forwarded-for}]
Operation[${operationType} ${operationName} ${idOrResourceName}]
UA[${requestHeader.user-agent}] Params[${requestParameters}]
ResponseEncoding[${responseEncodingNoDefault}]
log_exceptions: true
4-4
Chapter 4
Configuration Files
name: fhirtest.access
max_binary_size: 104857600
max_page_size: 200
retain_cached_searches_mins: 60
reuse_cached_search_results_millis: -1
#############
#Resource validation configuration
#############
validation:
requests_enabled: false
responses_enabled: false
# if remote terminology validation is set to true, make sure that request validation
is also enabled(requests_enabled property).
remote_terminology_service_enabled: false
remote_terminology_server_base_url: https://lforms-fhir.nlm.nih.gov/baseR4
#############
binary_storage_enabled: true
############
#below property decides whether to store the resource as plain text in RES_TEXT_VC
column.
#if the resource size is below the size as set in the below property, it goes
RES_TEXT_VC column,
#if its larger than the property set value, it goes to RES_TEXT as compressed blob.
# summary - the resource is stored in either RES_TEXT_VC or RES_TEXT dependeing on
the size set below.
inline_resource_storage_below_size: 0
# bulk_export_enabled: true
subscription:
resthook_enabled: false
websocket_enabled: false
# email:
# from: [email protected]
# host: localhost
# port: 22
# username:
# password:
# auth:
# startTlsEnable:
# startTlsRequired:
# quitWait:
# lastn_enabled: true
# store_resource_in_lucene_index_enabled: true
### This is configuration for normalized quantity search level default is 0
### 0: NORMALIZED_QUANTITY_SEARCH_NOT_SUPPORTED - default
### 1: NORMALIZED_QUANTITY_STORAGE_SUPPORTED
### 2: NORMALIZED_QUANTITY_SEARCH_SUPPORTED
normalized_quantity_search_level: 0
metadata:
implementation_description: Oracle FHIR Server
software_name: Oracle FHIR Server
publisher: Oracle Corporation
software_version: 8.1.4
resource_count_enabled: false
resource_compression_enabled: true
response_highlighter_enabled: true
allow_placeholder_references: true
response_timing_log_enabled: false
############
# for extracting unique request id from the incoming REST HTTP request and log the id
4-5
Chapter 4
Configuration Files
############
# for controlling scheduled job - resourcecountcache
enable_resource_count_scheduling_job: false
resource_count_cache_expiry_time_in_minutes: 240
resource_count_job_scheduling_time_in_minutes: 10
############
audit:
enabled: true
datastore_type: DB
savemessagepayload_enabled: false
standard: CUSTOM
elasticsearch:
debug:
pretty_print_json_log: false
refresh_after_write: false
enabled: false
required_index_status: YELLOW
rest_url: 'localhost:9200'
protocol: 'http'
schema_management_strategy: CREATE
username: SomeUsername
password: SomePassword
oauth:
enabled: false
token_issuer: "https://dev-t9brtcqa.auth0.com/"
token_audience: "https://fhir-hdr.auth.com/api/v2/"
token_alg: HS256
scopes: "fhir.admin,fhir.users,fhir.users.restricted"
fhir.admin: read,create,update,delete
fhir.users: read,create
fhir.users.restricted: read
#note: add more if needed
#scopes and allowed fhir resources
fhir.admin.allowedapis: ALL
fhir.users.allowedapis: ALL
#ResearchStudy
fhir.users.restricted.allowedapis: Patient, Observation, AllergyIntolerance,
Medication, Condition, Procedure, Immunization
Log Configurations
HDR FHIR has several logging mechanisms that each serve a distinct purpose. These
mechanisms are described in the table below. Oracle HDR FHIR uses the log4j2
logging framework to emit these logs. These logs are generated at runtime by all
components of the FHIR. The location of the log4j2.properties is: <HDR_DOMAIN>/
config/fhir/ log4j2.properties.
4-6
Chapter 4
Configuration Files
4-7
5
Using the OAuth 2.0 protected API
HDR FHIR offers a suite of REST APIs implemented per HL7 FHIR specification and secured
using the OAuth 2.0 security framework. This article outlines the steps needed for clients/
admin users to obtain a secure access token from HDR's OAuth Server and use the access
token to invoke the HDR FHIR REST APIs.
• Prerequisites
• How It Works
• Obtaining the Access Token from the OAuth Server
• Calling the HDR FHIR API with an Access Token
• Error Messages
Prerequisites
Prerequisites for using the OAuth protected API are as follows:
• HDR FHIR is successfully registered with an OAuth Server as a Resource Server (that is
protecting its endpoints).
• A client representing the HDR FHIR API admin user has been registered with OAuth
Server as an OAuth Client and is authorized to invoke HDR FHIR APIs.
How It Works
Figure 5-1 Access Token Process
5-1
Chapter 5
Obtaining the Access Token from the OAuth Server
1. Client application or user authenticates with the OAuth Server (at say, the /
ms_oauth/oauth2/endpoints/tokens endpoint) using the client ID and secret. The
client ID and secret would have been obtained at the time of registering the OAuth
client with OAuth Server.
2. OAuth Server validates the client ID and secret.
3. OAuth Server responds with an Access Token.
4. Client application or user uses the Access Token to call an HDR FHIR API.
5. HDR FHIR server intercepts the request and validates the Access Token.
6. HDR FHIR API responds with requested data.
You can now extract the access_token property value from the response to make
authorized requests to your API.
Error Messages
Here is a list of a few common OAuth-related error messages that can be thrown by
HDR FHIR APIs and the associated remediation steps.
5-2
Chapter 5
Error Messages
5-3
6
Auditing
This module is responsible for collecting and storing audit data from incoming REST request
and response. Key details such as user id, IP address, resource name, HTTP request type
and request URL etc. are collected from the incoming request and stored in a secure
location. Audit records can be stored either in a database table or in a file.
• Audit Interceptor Execution Flow
• Audit Record Format
• Settings
The audit module (rendered in green) design follows an interceptor pattern as shown in the
above flow diagram. Here, incoming and outgoing REST API transactions are intercepted for
extracting audit data elements.
Once the data is extracted, audit information goes to either a database table or a file
(depending on storage settings defined in the FHIR server configuration file).
6-1
Chapter 6
Audit Record Format
Settings
Audit service functionality can be controlled using a configuration file. The file is
located at <HDR_DOMAIN>/config/fhir/hdr_fhir.yaml.
For example, if there is a requirement to store message payload as part of an audit
record, change “savemessagepayload_enabled" property to true. Other important
entries in the properties file is as shown below.
#audit enabled - true or false
audit:
enabled: true
If ‘FILE' is selected as the storage type, audit data goes to a file named audit-hdr-
fhir.log.
If ‘DB' is selected as the storage type, audit data goes to a table called
OHF_HDR_FHIR_AUDIT. Refer to the FHIR eTRM document for more information
about the Audit table.
#collect request/response payload message – true or false
savemessagepayload_enabled=false
6-2
7
FHIR Command-Line Utility
The HDR FHIR command-line interface (CLI) tool is a standalone command-line tool
distributed with HDR 8.2 that contains a number of commands to ingest terminology data
provided by the LOINC and SNOMED organizations.
The current version of the HDR FHIR command-line interface tool supports LOINC and
SNOMED terminology data to be loaded into the HDR FHIR repository.
The tool is distributed in the form of zip file (hdr-fhir-cli-app-8.1.0-SNAPSHOT.zip) and is
located in the HDR 8.2 patch.
Extract it into a directory where you will keep it, and add this directory to your path.
The zip file hdr-fhir-cli-app-8.1.0-SNAPSHOT.zip contains the following files:
File Description
lib All runtime executable jar file.
hdr-fhir-cli.sh Linux script to manage the command line tool.
• Prerequisites
• Commands
Prerequisites
The following prerequisites are required to use the command-line utility:
• Install the JDK 11
• Set the environment variable JAVA_HOME
• Extract the hdr-fhir-cli-app-8.1.0-SNAPSHOT.zip file into the middle tier
• Set the environment variable CLI_HOME to the location where hdr-fhir-cli-app-8.1.0-
SNAPSHOT.zip file is extracted
Commands
The HDR FHIR command line tool has a number of supported functions, called commands.
Each command has a name and a set of supported arguments.
You can see a list of supported commands by simply executing the below command. For
example:
$>{$CLI_HOME}/hdr-fhir-cli.sh
Usage:
hdr-fhir-cli {command} [options]
Commands:
export-conceptmap-to-csv - Exports a specific ConceptMap resource to a CSV file.
7-1
Chapter 7
Commands
You can also see the list of supported arguments for a given command by issuing
command help [commandname]. For example:
$>{$CLI_HOME}/hdr-fhir-cli.sh help upload-terminology
Usage:
hdr-fhir-cli upload-terminology [options]
Uploads a terminology package (e.g. a SNOMED CT ZIP file) to a server, using the
$upload-external-code-system operation.
Options:
• export-conceptmap-to-csv
• import-csv-to-conceptmap
• upload-definitions and upload-examples
• upload-terminology
export-conceptmap-to-csv
The export-conceptmap-to-csv command can be used to export a ConceptMap
resource as a CSV file of terminology mappings.
The first row of the CSV file will include the following headers:
SOURCE_CODE_SYSTEM – ConceptMap.group.source
SOURCE_CODE_SYSTEM_VERSION – ConceptMap.group.sourceVersion
TARGET_CODE_SYSTEM – ConceptMap.group.target
TARGET_CODE_SYSTEM_VERSION – ConceptMap.group.targetVersion
SOURCE_CODE – ConceptMap.group.element.code
SOURCE_DISPLAY – ConceptMap.group.element.display
TARGET_CODE – ConceptMap.group.element.target.code
TARGET_DISPLAY – ConceptMap.group.element.target.display
EQUIVALENCE – ConceptMap.group.element.target.equivalence
7-2
Chapter 7
Commands
ConceptMapEquivalence)
COMMENT – ConceptMap.group.element.target.comment
Usage:
hdr-fhir-cli export-conceptmap-to-csv [options]
-f,--filename <filename> The path and filename of the CSV file to be exported (./output.csv).
-l,--logging If specified, verbose logging will be used.
-t,--target <target> Base URL for the target server (e.g. “http://localhost:7001/oracle-fhir-
server/fhir").
u,--url <url> The URL of the ConceptMap resource to be exported (i.e.
ConceptMap.url).
-v,--fhir-version <version> The FHIR version being used. Valid values: r4.
These terminology mappings could then be exported with the following command:
./hdr-fhir-cli.sh export-conceptmap-to-csv --fhir-version R4 -t http://localhost:8080//
oracle-fhir-server/fhir -u http://hl7.org/fhir/ConceptMap/cm-administrative-gender-v2 -
f /u01/output.csv
import-csv-to-conceptmap
The import-csv-to-conceptmap command can be used to import a CSV file of terminology
mappings and store it as a ConceptMap resource.
The first row of the CSV file is expected to include the following headers:
SOURCE_CODE_SYSTEM – ConceptMap.group.source
SOURCE_CODE_SYSTEM_VERSION – ConceptMap.group.sourceVersion
TARGET_CODE_SYSTEM – ConceptMap.group.target
TARGET_CODE_SYSTEM_VERSION – ConceptMap.group.targetVersion
SOURCE_CODE – ConceptMap.group.element.code
SOURCE_DISPLAY – ConceptMap.group.element.display
TARGET_CODE – ConceptMap.group.element.target.code
TARGET_DISPLAY – ConceptMap.group.element.target.display
EQUIVALENCE – ConceptMap.group.element.target.equivalence (ConceptMapEquivalence)
COMMENT – ConceptMap.group.element.target.comment
An example CSV file that describes the mapping of FHIR to HL7v2 for Administrative Gender
would appear as follows:
"SOURCE_CODE_SYSTEM","SOURCE_CODE_SYSTEM_VERSION","TARGET_CODE_SYSTEM","TARGET_CODE_SYS
TEM_VERSION","SOURCE_CODE","SOURCE_DISPLAY","TARGET_CODE","TARGET_DISPLAY","EQUIVALENCE
","COMMENT"
"http://hl7.org/fhir/administrative-gender","","http://hl7.org/
fhir/v2/0001","","male","Male","M","Male","equal",""
Usage:
hdr-fhir-cli import-csv-to-conceptmap [options]
7-3
Chapter 7
Commands
Options:
-f,--filename <filename> The path and filename of the CSV file to be imported (for
example, ./input.csv).
-i,--input <input> The source value set of the ConceptMap to be imported (i.e.
ConceptMap.sourceUri).
-l,--logging If specified, verbose logging will be used.
-o,--output <output> The target value set of the ConceptMap to be imported (i.e.
ConceptMap.targetUri).
-t,--target <target> Base URL for the target server (e.g. "http://localhost:7001/oracle-
fhir-server/fhir").
-u,--url <url> The URL of the ConceptMap resource to be imported/exported
(i.e. ConceptMap.url).
-v,--fhir-version <version> The FHIR version being used. Valid values: r4.
These terminology mappings could then be imported with the following command:
./hdr-fhir-cli.sh import-csv-to-conceptmap --fhir-version R4 -t http://
localhost:8080//oracle-fhir-server/fhir -u http://hl7.org/fhir/ConceptMap/cm-
administrative-gender-v2 -i http://hl7.org/fhir/ValueSet/administrative-gender -
o http://hl7.org/fhir/ValueSet/v2-0001 -f /u01/sampleInputFile.csv
-e,--exclude <arg> Exclude uploading the given resources, such as "-e dicom-
dcim,foo".
-t,--target <arg> Base URL for the target server (such as "http://localhost:7001/
oracle-fhir-server/fhir ").
-v,--fhir-version <version> The FHIR version being used. Valid values: r4.
Command usage:
./hdr-fhir-cli.sh upload-definitions --fhir-version R4 -t http://localhost:8181/
baseR4 "-e dicom-dcim,foo"
7-4
Chapter 7
Commands
upload-terminology
The HDR FHIR server provides a terminology server, which supports ingestion of terminology
data provided by LOINC and SNOMED. For more information on obtaining the above
terminology data refer to the respective websites.
The HDR FHIR server provides a repository for terminology content used across the HDR
platform, and an API suite to access the content.
The server provides a mechanism for ingestion of the terminology data via the upload-
terminology command of the CLI tool. This command supports only LOINC and SNOMED
terminologies in the current release.
Note:
The path and exact filename of the terminology files will likely need to be adjusted
for your local disk structure.
Usage:
hdr-fhir-cli upload-terminology [options]
-d,--data <arg> Local file to use to upload (can be a raw file or a ZIP containing the
raw file).
-l,--logging If specified, verbose logging will be used.
-t,--target <target> Base URL for the target server (such as "http://localhost:7001/oracle-
fhir-server/fhir").
-u,--url <arg> The code system URL associated with this upload (such as http://
snomed.info/sct).
-v,--fhir-version <version> The FHIR version being used. Valid values: r4.
Command usage:
$>{$CLI_HOME}$./hdr-fhir-cli.sh upload-terminology -d /scratch/fhir/Loinc_2.65.zip -d /
scratch/fhir/loincupload.properties --fhir-version R4 –t http://localhost:8080//oracle-
fhir-server/fhir -u http://loinc.org
7-5
8
Working with FHIR REST APIs
Oracle Healthcare Data Repository 8.2-FHIR offers a suite of REST APIs implemented as per
the HL7 FHIR specification and is secured using the OAuth 2.0 security framework. For more
information, refer to the HDR FHIR REST API documentation.
https://support.oracle.com/epmos/faces/DocumentDisplay?id=2913016.1
8-1
9
HDR FHIR Data Model
For information on the Oracle Healthcare Data Repository 8.2-FHIR data model, see the
FHIR Technical Reference Manual, available from Oracle Support:
https://support.oracle.com/epmos/faces/DocumentDisplay?id=2913016.1
9-1
10
Data Store in Repository
This section describes about how the FHIR resource data gets stored in the HDR FHIR
repository.
The HDR FHIR JPA schema relies on the concept of internal persistent IDs on tables, using a
Java type of Long.
Many tables use an internal persistent ID as their primary key, allowing flexibility for other
more complex business identifiers to be changed and minimizing the amount of data
consumed by foreign key relationships. Persistent ID columns are generally assigned using
the database sequences. The persistent ID column is generally called PID in the HDR FHIR
schema.
• Resources
Various resources are used in storing data in the HDR FHIR repository.
• Search Indexes
Search Parameter Index are used to index resources for searching.
Resources
Various resources are used in storing data in the HDR FHIR repository.
Resource Master Table
The table called HFJ_RESOURCE indicates a single resource of any type in the database.
For example, the resource Patient/1 will have exactly one row in this table, representing all
versions of the resource.
Resource Versions and Contents
The table called HFJ_RES_VER contains individual versions of a resource. If the resource
Patient/1 has 3 versions, there will be 3 rows in this table.
The complete raw contents of the resource is stored in either the RES_TEXT or the
RES_TEXT_VC column of the resource specific extended table OHF_FHIR_xxx, using the
encoding specified in the RES_ENCODING column of the HFJ_RES_VER.
Example: Resource Extended Table OHF_FHIR_PATIENT
The following property decides whether to store the resource as plain text in RES_TEXT_VC
column or not.
If the resource size is below the size as set in the following property, it goes to
RES_TEXT_VC column and RES_ENCODING columns value is JSON.
If the resource size is larger than the property set value, it goes to RES_TEXT as a
compressed blob.
inline_resource_storage_below_size: 0
Encoding
10-1
Chapter 10
Search Indexes
The resource is serialized using FHIR JSON encoding, and then compressed into a
byte stream using GZIP compression. This will be controlled using the following
property:
resource_compression_enabled: true
If the above property is set to true, the resource is serialized and then compressed
into byte stream using GZIP compression. Then the compressed resource is stored
into RES_TEXT column as a blob value with RES_ENCODING set to JSONC.
If the above property is set to false, the resource is not compressed and the plain text
resource is stored into RES_TEXT column as a blob with RES_ENCODING set to
JSON.
Client Assigned Resource IDs
By default, the HFJ_RESOURCE.RES_ID column is used as the resource ID for all
server-assigned IDs. For example, if a Patient resource is created in a completely
empty database, it will be assigned the ID Patient/1 by the server and RES_ID will
have a value of 1.
However, when client-assigned IDs are used, these may contain text values to allow a
client to create an ID such as Patient/ABC. When a client-assigned ID is given to a
resource, a row is created in the HFJ_RESOURCE table. When an HFJ_FORCED_ID
row exists corresponding to the equivalent HFJ_RESOURCE row, the RES_ID value is
no longer visible or usable by FHIR clients and it becomes purely an internal ID to the
JPA server.
If the server has been configured with a Resource Client ID Strategy of ANY, the
server use the Resource Server ID Strategy of UUID and will create a Forced ID for all
resources (not only resources having textual IDs).
Propety:
client_id_strategy: ANY
Resource Links
Resource links will be established between the two resources. When a resource is
created or updated, it is indexed for searching. Any search parameters of type
Reference are resolved, and one or more rows may be created in the HFJ_RES_LINK
table between source Resource Id and Target Resource ID.
Search Indexes
Search Parameter Index are used to index resources for searching.
The table starts with HFJ_SPIDX (Search Parameter Index) used to index resources
for searching. When a resource is created or updated, a set of rows will be added in
the tables. These are used for finding appropriate rows to return when performing
FHIR searches. There are dedicated tables for supporting each of the non-reference
FHIR Search Datatypes: Date, Number, Quantity, String, Token, and URI:
• HFJ_SPIDX_DATE
• HFJ_SPIDX_NUMBER
10-2
Chapter 10
Search Indexes
• HFJ_SPIDX_QUANTITY
• HFJ_SPIDX_QUANTITY_NRML
• HFJ_SPIDX_STRING
• HFJ_SPIDX_TOKEN
• HFJ_SPIDX_URI
Note:
Reference search parameters are implemented using the HFJ_RES_LINK table
above.
The SPIDX tables leverage "hash columns", which contain a hash of multiple columns in
order to reduce index size and improve search performance. Hashes currently use the
MurmurHash3_x64_128 hash algorithm, keeping only the first 64 bits in order to produce a
LongInt value. For example, all search index tables have columns for storing the search
parameter name (SP_NAME) and resource type (RES_TYPE). An additional column which
hashes these two values is provided:
HASH_IDENTITY
10-3
11
FHIR Operations
This section gives an overview of some of the features of HDR FHIR, and it shows you how
to manage and configure it for a few basic functionalities.
• FHIR CRUD (Create/Read/Update/Delete) operations
This section describes how to use the HDR FHIR Endpoint to perform basic CRUD
(Create/Read/Update/Delete) operations.
• FHIR Search operations
This section describes the FHIR Search operations.
• FHIR Bundle transactions and batches
Oracle FHIR includes a mechanism that can be used by a client to send multiple
interactions to a server for processing. This mechanism uses the FHIR bundle resource
as the transport, with a collection of one or more interactions grouped inside the bundle.
• Search parameters
Search parameters are named paths within resources that are indexed by the system so
that they can be used to find resources that match a given criteria.
• Search parameter features
This section describes optional features that you can enable or disable for optimizing how
searching works on Oracle HDR-FHIR server.
• Searching for data
This section contains information about methods for searching for data in Oracle HDR
FHIR.
• Creating data
This section describes creating data in Oracle HDR FHIR repository.
• Reading data
This section describes methods for reading data from the Oracle HDR FHIR Repository.
• Updating data
This section describes information about methods for updating data in the HDR FHIR
Repository.
• Deleting data
The FHIR delete operation performs a "logical" delete. This means that data is not
physically removed from the database.
• Binary Access Operations
In many cases, resources such as DocumentReference are used to store large files
such as scanned PDFs and images. These resources use the Attachment datatype,
which ultimately stores a content type and a base 64 encoded representation of the
binary content.
11-1
Chapter 11
FHIR CRUD (Create/Read/Update/Delete) operations
• Create
A client may create a new resource on an HDR FHIR server by performing a
Create operation. The Create uses an HTTP POST against the URL [baseUrl]/
[resourceName]. This POST should have a Content-Type header which specifies
the MIME type of the payload.
• Update
You can update an existing resource on an FHIR server by performing an Update
operation. The Update uses an HTTP PUT against the URL [baseUrl]/
[resourceName]/[id]. This PUT should have a Content-Type header that specifies
the MIME type of the payload.
• Delete
You can delete a resource on an FHIR server by performing a Delete operation.
The Delete uses an HTTP DELETE against the URL [baseUrl]/[resourceType]/[id].
• Patch
You can patch a resource on an FHIR server by performing a Patch operation.
This operation support allows you to modify a resource in place by supplying a
delta. The Patch uses an HTTP PATCH against the URL [baseUrl]/[resourceType]/
[id]. This operation requires a Content-Type header that specifies the MIME type of
the payload.
• Read
If you know the ID of a resource on an FHIR server, you can read back the most
recent version of that resource by performing a Read operation. The Read uses an
HTTP GET against the URL [baseUrl]/[resourceType]/[id].
• vRead
You can also include a version string in the URL in order to request a specific
version of the resource by performing a vRead operation. The vRead uses an
HTTP GET against the URL [baseUrl]/[resourceType]/[id]/_history/[versionId].
Create
A client may create a new resource on an HDR FHIR server by performing a Create
operation. The Create uses an HTTP POST against the URL [baseUrl]/
[resourceName]. This POST should have a Content-Type header which specifies the
MIME type of the payload.
The following example shows a simple Patient resource create using a JSON Payload.
Request: FHIR CRUD Create operation
11-2
Chapter 11
FHIR CRUD (Create/Read/Update/Delete) operations
11-3
Chapter 11
FHIR CRUD (Create/Read/Update/Delete) operations
Update
You can update an existing resource on an FHIR server by performing an Update
operation. The Update uses an HTTP PUT against the URL [baseUrl]/[resourceName]/
[id]. This PUT should have a Content-Type header that specifies the MIME type of the
payload.
The following example shows a simple Patient resource update using a JSON
Payload. This example uses the previously created Patient resource (see Create) and
updates it by adding an address.
Request: FHIR CRUD Update operation
11-4
Chapter 11
FHIR CRUD (Create/Read/Update/Delete) operations
11-5
Chapter 11
FHIR CRUD (Create/Read/Update/Delete) operations
Delete
You can delete a resource on an FHIR server by performing a Delete operation. The
Delete uses an HTTP DELETE against the URL [baseUrl]/[resourceType]/[id].
This operation performs a logical delete, which has a specific set of semantics:
• The resource is marked as deleted, and it no longer appears in search results.
• The version number of the resource is incremented (that is, a new deleted version
is created).
• Previous versions of the resource are not physically deleted.
• The resource may be un-deleted by updating it again.
The following example shows a simple delete of the resource created and updated in
the examples in Create and Update.
11-6
Chapter 11
FHIR CRUD (Create/Read/Update/Delete) operations
Patch
You can patch a resource on an FHIR server by performing a Patch operation. This operation
support allows you to modify a resource in place by supplying a delta. The Patch uses an
HTTP PATCH against the URL [baseUrl]/[resourceType]/[id]. This operation requires a
Content-Type header that specifies the MIME type of the payload.
For example, for a JSON patch payload the header value is: application/json-patch+json.
Updating a resource using patch operation: PATCH works by creating a patch document
that specifies the changes that the client wishes to make to a resource, and submits that to
the server. The server then applies those changes to the indicated resource and optionally
returns the updated resource.
Each change in the patch document (and there can be multiple) specifies:
• The operation that is to be performed (for example, add, remove, or replace).
• The location in the resource to apply the operation.
• The new value (if an add or change).
The following example shows how to perform a patch using a FHIR Patch.
11-7
Chapter 11
FHIR CRUD (Create/Read/Update/Delete) operations
"resourceType": "Patient",
"id" : "149954",
"birthDate": "1974-02-13"
URL http://<HOST>:<PORT>/oracle-
fhir-server/fhir/Patient/149954
Note:
The Patch document is in an array as there can be any number of
operations in a single PATCH call.
Response: The FHIR endpoint will respond with a response similar to the
following:
{
"resourceType": "Patient",
"id": "149954",
"meta": {
"versionId": "2",
"lastUpdated": "2022-04-24T19:05:13.111+05:30",
"source": "#sieqifF8d5n5c2dU"
},
11-8
Chapter 11
FHIR CRUD (Create/Read/Update/Delete) operations
"text": {
"status": "generated",
"div": "<div xmlns=\"http://www.w3.org/1999/xhtml\"><table
class=\"hapiPropertyTable\"><tbody/></table></div>"
},
"gender": "female"
}
• Adding an address. This element can repeat. It is represented in the resource instance
as an array. It is possible to adjust an array, but unlike an object, the array will not be
automatically created if it does not exist. So, the contents of the patch document will be
different if there is no address already. It needs to be created first.
URL http://<HOST>:<PORT>/oracle-fhir-
server/fhir/Patient/149954
Request Body [
{ "op": "add", "path": "/address",
"value":[]},
{ "op": "add", "path": "/
address/0", "value":
{
"use" : "home",
"line" : ["<Sample Street
Name>","avon"],
"city" : "<City_Name>",
"district": "<Sample Street Name>",
"state": "Vic",
"postalCode": "3999",
"text":"<Sample Street Name>"
}
}
]
Response: The FHIR endpoint will respond with a response similar to the following:
{
"resourceType": "Patient",
"id": "149954",
"meta": {
"versionId": "3",
"lastUpdated": "2022-04-24T19:17:02.229+05:30",
11-9
Chapter 11
FHIR CRUD (Create/Read/Update/Delete) operations
"source": "#2dK6qlDOD2W4vQbh"
},
"text": {
"status": "generated",
"div": "<div xmlns=\"http://www.w3.org/1999/xhtml\"><table
class=\"hapiPropertyTable\"><tbody/></table></div>"
},
"gender": "female",
"address": [ {
"use": "home",
"text": "<Sample Street Name>",
"line": [ "<Sample Street Name>", "avon" ],
"city": "<City_Name>",
"district": "<Sample Street Name>",
"state": "Vic",
"postalCode": "3999"
} ]
}
Headers
Content-Type: application/json-
patch+json
Request Body
[
{
"op": "replace",
"path": "/address/0/postalCode",
"value": "4000"
},
{
"op": "replace",
"path": "/birthDate",
"value": "1974-02-20"
}
]
11-10
Chapter 11
FHIR CRUD (Create/Read/Update/Delete) operations
Response: The FHIR endpoint will respond with a response similar to the following:
{
"resourceType": "Patient",
"id": "149954",
"meta": {
"versionId": "4",
"lastUpdated": "2022-04-24T19:37:51.559+05:30",
"source": "#fZYCuXUNmAoZYbDH"
},
"text": {
"status": "generated",
"div": "<div xmlns=\"http://www.w3.org/1999/xhtml\"><table
class=\"hapiPropertyTable\"><tbody/></table></div>"
},
"gender": "female",
"birthDate": "1974-02-20",
"address": [ {
"use": "home",
"text": "<Sample Street Name>t",
"line": [ "<Sample Street Name>", "avon" ],
"city": "<City_Name>",
"district": "<Sample Street Name>",
"state": "Vic",
"postalCode": "4000"
} ]
}
[
{"op": "remove", "path": "/address/0"}
]
For adjusting the array, you need to know the position of the element in the array to remove.
If you want to be sure, then you can require that the client submit the actual address that they
are removing so the server can check. This can be done using the test operation. The
document below will remove the address only if its value matches.
[
{"op": "test", "path": "/address/0","value": { "use" : "home", "line" :
["<Sample Street Name>","avon"], "city" : "<City_Name>", "district":
"<Sample Street Name>", "state": "Vic", "postalCode": "4000",
"text":"<Sample Street Name>"}},
{"op": "remove", "path": "/address/0"}
]
11-11
Chapter 11
FHIR CRUD (Create/Read/Update/Delete) operations
Headers
Content-Type: application/json-
patch+json
Request Body
[
{"op": "test", "path": "/address/
0","value": { "use" : "home",
"line" : ["<Sample Street
Name>","avon"],
"city" : "<City_Name>",
"district": "<Sample Street
Name>",
"state": "Vic",
"postalCode": "4000",
"text":"<Sample Street Name>"}},
{"op": "remove", "path": "/
address/0"}
]
Response: The FHIR endpoint will respond with a response similar to the following:
{
"resourceType": "Patient",
"id": "149954",
"meta": {
"versionId": "5",
"lastUpdated": "2022-04-24T19:54:03.769+05:30",
"source": "#Bu5gN7pTIzZgLrM9"
},
"text": {
"status": "generated",
"div": "<div xmlns=\"http://www.w3.org/1999/xhtml\"><table
class=\"hapiPropertyTable\"><tbody/></table></div>"
},
"gender": "female",
"birthDate": "1974-02-20"
}
11-12
Chapter 11
FHIR CRUD (Create/Read/Update/Delete) operations
Read
If you know the ID of a resource on an FHIR server, you can read back the most recent
version of that resource by performing a Read operation. The Read uses an HTTP GET
against the URL [baseUrl]/[resourceType]/[id].
The following example shows a simple read of the resource created and updated in the
examples in Create, Update, Delete, and Patch.
Request: FHIR CRUD Read operation
11-13
Chapter 11
FHIR CRUD (Create/Read/Update/Delete) operations
vRead
You can also include a version string in the URL in order to request a specific version
of the resource by performing a vRead operation. The vRead uses an HTTP GET
against the URL [baseUrl]/[resourceType]/[id]/_history/[versionId].
The following example shows a simple vRead of the original resource created in
Create.
Request: FHIR vRead operation
11-14
Chapter 11
FHIR CRUD (Create/Read/Update/Delete) operations
11-15
Chapter 11
FHIR Search operations
11-16
Chapter 11
FHIR Search operations
11-17
Chapter 11
FHIR Search operations
11-18
Chapter 11
FHIR Search operations
11-19
Chapter 11
FHIR Search operations
11-20
Chapter 11
FHIR Search operations
11-21
Chapter 11
FHIR Search operations
You can also sort by multiple search parameters by combining them with a comma.
Note:
FHIR also provides a second full text parameter, _text that you can use to
search across the resource.
11-22
Chapter 11
FHIR Bundle transactions and batches
11-23
Chapter 11
FHIR Bundle transactions and batches
resource and then placed into Bundle.entry.resource. In all cases, the HTTP verb/
method is PATCH.
{
"resourceType": "Bundle",
"type": "transaction",
"entry": [
{
"fullUrl": "urn:uuid:850bc2ca-d9ab-467b-9924-0e08d0a6e586",
"resource": {
"resourceType": "Patient",
"identifier": [
{
"system": "https://github.com/synthetichealth/synthea",
"value": "8ffd03ee-fb56-441d-a3ef-01cdc9f94d89"
} ],
"name": [
{
"use": "official",
"family": "Trantow673",
"given": [
"Matthew562"
],
"prefix": [
"Mr."
]
}
],
"request": {
"method": "POST",
"url": "Patient"
}
} }
}
11-24
Chapter 11
FHIR Bundle transactions and batches
{
"resourceType": "Bundle",
"type": "transaction",
"entry": [ {
"fullUrl": "Patient/PTA",
"resource": {
"resourceType": "Patient",
"id": "PTA",
"identifier": [ {
"system": "http://acme.org/mrns",
"value": "013872"
} ],
"name": [ {
"family": "Simpson",
"given": [ "Homer" ]
} ]
},
"request": {
"method": "PUT",
"url": "Patient/PTA"
}
}, {
"fullUrl": "Observation/OB1",
"resource": {
"resourceType": "Observation",
"id": "OB1",
"status": "final",
"code": {
"coding": [ {
"system": "http://loinc",
"code": "29463-7",
"display": "Body Weight"
} ]
},
"subject": {
"reference": "Patient/PTA"
},
"effectiveDateTime": "2022-02-23",
"valueQuantity": {
11-25
Chapter 11
FHIR Bundle transactions and batches
"value": 67.1,
"unit": "kg",
"system": "http://unitsofmeasure.org",
"code": "kg"
}
},
"request": {
"method": "PUT",
"url": "Observation/OB1"
}
}, {
"fullUrl": "Observation/OB2",
"resource": {
"resourceType": "Observation",
"id": "OB2",
"status": "final",
"code": {
"coding": [ {
"system": "http://loinc",
"code": "29463-7",
"display": "Body Weight"
} ]
},
"subject": {
"reference": "Patient/PTA"
},
"effectiveDateTime": "2019-12-29",
"valueQuantity": {
"value": 72.4,
"unit": "kg",
"system": "http://unitsofmeasure.org",
"code": "kg"
}
},
"request": {
"method": "PUT",
"url": "Observation/OB2"
}
} ]
}
11-26
Chapter 11
FHIR Bundle transactions and batches
and should be randomly generated. They serve only to link resources in the Bundle together,
and are thrown away by the server once it has determined the actual resource IDs.
The following example shows a transaction that creates two resources: a Patient and an
Observation referring to this patient.
{
"resourceType": "Bundle",
"type": "transaction",
"entry": [ {
"fullUrl": "urn:uuid:e16eac01-a5ee-4904-b1c8-f4bd56e338d5", >
Placeholder ID for Patient resource
"resource": {
"resourceType": "Patient",
"identifier": [ {
"system": "http://acme.org/mrns",
"value": "013872"
} ],
"name": [ {
"family": "Simpson",
"given": [ "Homer" ]
} ]
},
"request": {
"method": "POST",
"url": "Patient"
}
}, {
"fullUrl": "urn:uuid:499733fe-7ced-4d15-81ce-8a433a1fb71e",
"resource": {
"resourceType": "Observation",
"status": "final",
"code": {
"coding": [ {
"system": "http://loinc",
"code": "29463-7",
"display": "Body Weight"
} ]
},
"subject": {
"reference": "urn:uuid:e16eac01-a5ee-4904-b1c8-f4bd56e338d5" >
Reference to Patient placeholder ID. This will be automatically replaced
with the real resource ID by the server.
},
"effectiveDateTime": "2022-02-23",
"valueQuantity": {
"value": 67.1,
"unit": "kg",
"system": "http://unitsofmeasure.org",
"code": "kg"
}
},
"request": {
"method": "POST",
"url": "Observation"
11-27
Chapter 11
FHIR Bundle transactions and batches
}
} ]
}
Conditional Create
The FHIR Conditional Create mechanism allows the client to specify a FHIR search
URL alongside a resource to create. When processing the create, the server will first
check if any resource already exists matching the given search. If no resources match,
the create proceeds. If a resource does match, no resource is created.
In a standard REST mechanism, conditional creates place the search URL in the In-
None-Exist request header. In a FHIR bundle transaction, this URL goes in
Bundle.entry.request.ifNoneExist. Like a normal create, we use the HTTP method/verb
of POST.
For example:
{
"resourceType": "Bundle",
"type": "transaction",
"entry": [ {
"fullUrl": "urn:uuid:95dbbf93-5829-46ba-9021-2545a1da3aa5", >
Placeholder ID for Patient
"resource": {
"resourceType": "Patient",
"identifier": [ {
"system": "http://acme.org/mrns",
"value": "013872"
} ],
"name": [ {
"family": "Simpson",
"given": [ "Homer" ]
} ]
},
"request": {
"method": "POST",
"url": "Patient",
"ifNoneExist": "Patient?identifier=http://acme.org/mrns|
013872" > Search URL for Conditional Create
}
}, {
"fullUrl": "urn:uuid:124ff3c8-f251-4bd9-8c44-cc6568180eae",
"resource": {
"resourceType": "Observation",
"identifier": [ {
"system": "http://acme.org/obs",
"value": "46252"
} ],
"status": "final",
"code": {
"coding": [ {
"system": "http://loinc",
"code": "29463-7",
"display": "Body Weight"
11-28
Chapter 11
FHIR Bundle transactions and batches
} ]
},
"subject": {
"reference": "urn:uuid:95dbbf93-5829-46ba-9021-2545a1da3aa5" >
Reference to Patient Placeholder ID
},
"effectiveDateTime": "2022-02-23",
"valueQuantity": {
"value": 67.1,
"unit": "kg",
"system": "http://unitsofmeasure.org",
"code": "kg"
}
},
"request": {
"method": "POST",
"url": "Observation",
"ifNoneExist": "Observation?identifier=http://acme.org/obs|46252"
> Search URL for Conditional Create
}
} ]
}
Conditional Update
The FHIR Conditional Update mechanism allows a resource to be transmitted to the server
for updating, but instead of supplying an ID to update, the client supplies a search URL
similar to the URL used for the Conditional Create example.
For more information, see Conditional Create.
Before performing the update, the server first performs the search. If no resources match the
search, a new resource is created. If a resource already matches the search, it is updated
using the contents in Bundle.entry.resource. In this case, the method/verb will be PUT and
the search URL is specified in Bundle.request.url.
For example:
{
"resourceType": "Bundle",
"type": "transaction",
"entry": [ {
"fullUrl": "urn:uuid:95dbbf93-5829-46ba-9021-2545a1da3aa5", >
Placeholder ID for Patient
"resource": {
"resourceType": "Patient",
"identifier": [ {
"system": "http://acme.org/mrns",
"value": "013872"
} ],
"name": [ {
"family": "Simpson",
"given": [ "Homer" ]
} ]
},
11-29
Chapter 11
FHIR Bundle transactions and batches
"request": {
"method": "PUT",
"url": "Patient?identifier=http://acme.org/mrns|013872" >
Search URL for Conditional Update
}
}, {
"fullUrl": "urn:uuid:124ff3c8-f251-4bd9-8c44-cc6568180eae",
"resource": {
"resourceType": "Observation",
"identifier": [ {
"system": "http://acme.org/obs",
"value": "46252"
} ],
"status": "final",
"code": {
"coding": [ {
"system": "http://loinc",
"code": "29463-7",
"display": "Body Weight"
} ]
},
"subject": {
"reference":
"urn:uuid:95dbbf93-5829-46ba-9021-2545a1da3aa5" > Reference to
Patient Placeholder ID
},
"effectiveDateTime": "2022-02-23",
"valueQuantity": {
"value": 67.1,
"unit": "kg",
"system": "http://unitsofmeasure.org",
"code": "kg"
}
},
"request": {
"method": "PUT",
"url": "Observation?identifier=http://acme.org/obs|46252" >
Search URL for Conditional Update
}
} ]
}
Delete
FHIR logical deletes can be performed as a part of a transaction, as well. In a
transaction bundle, deletes will be applied as a group, meaning that if one fails, all will
be rolled back.
The following example shows deletes in a FHIR transaction.
{
"resourceType": "Bundle",
"type": "transaction",
"entry": [ {
11-30
Chapter 11
FHIR Bundle transactions and batches
"request": {
"method": "DELETE",
"url": "Patient/A0"
}
}, {
"request": {
"method": "DELETE",
"url": "Patient/A1"
}
} ]
}
Patch
The FHIR Patch operation can also be performed in a transaction bundle. When using the
FHIR Patch mechanism for patching, the FHIR Patch document is placed in
Bundle.entry.resource. In the case of JSON Patch the contents are placed in a Binary
resource and then placed into Bundle.entry.resource. In all cases, the HTTP verb/method is
PATCH.
The following example shows a simple FHIR Patch in a transaction.
{
"resourceType": "Bundle",
"type": "transaction",
"entry": [ {
"resource": {
"resourceType": "Parameters”, > The FHIR Patch document
"parameter": [ {
"name": "operation",
"part": [ {
"name": "type",
"valueCode": "replace"
}, {
"name": "path",
"valueString": "Patient.identifier"
}, {
"name": "value",
"valueIdentifier": {
"system": "http://new-system",
"value": "0001"
}
} ]
} ]
},
"request": {
"method": "PATCH",
"url": "Patient/123" > The identity of the resource to patch
}
} ]
}
11-31
Chapter 11
Search parameters
Search parameters
Search parameters are named paths within resources that are indexed by the system
so that they can be used to find resources that match a given criteria.
For example, the FHIR specifications define the gender search parameter on the
Patient resource, giving it a path of Patient.gender. This means that every time a new
Patient resource is created—or an existing one is updated—the value found at path
Patient.gender will be indexed. Clients may then use a URL search parameter named
gender to find a resource with the given gender.
Request: Search parameters
11-32
Chapter 11
Search parameters
However, it is often useful to customize the supported search parameters. For example, you
may want to:
• Add additional search parameters that will index fields that do not have a standard search
parameter defined.
• Add additional search parameters that will index extensions used by your clients.
• Disable search parameters that are not used in order to improve performance and
conserve space (disabling unnecessary search parameters can have a dramatic impact
on write performance in some cases).
Manual indexing
It is possible to trigger a manual reindexing of data in the Oracle HDR-FHIR repository.
To perform a manual reindex, invoke the following operation at the server (root) level of the
FHIR Endpoint (that is, the base URL of the FHIR endpoint). To specify parameters, a
resource of type Parameters must be included as the body of a POST request.
• Operation:
$mark-all-resources-for-reindexing
• Parameter:
type: Optional. If supplied, specifies the specific resource type to reindex. If not specified,
all resource types are reindexed.
See the following examples for more details.
11-33
Chapter 11
Search parameters
Content-Type: application/fhir+json
{
"resourceType": "Parameters",
"parameter": [ {
"name": "type",
"valueString": "Patient"
} ]
}
Content-Type: application/fhir+json
{
"resourceType": "Parameters",
"parameter": []
}
Reindex operation
The $reindex operation requests that all data on the server, or a selected subset of
the data on the server, be reindexed.
The $reindex operation can be called in one of two ways, either with a list of urls to
be reindexed or with everything=true. If everything=true then the urls parameter is
ignored and all resources will be reindexed. Otherwise, only the resources matching
the urls are reindexed. The reindex operation uses search URLs to identify resources
that should be reindexed. A search URL takes the form:
{resourceType}?[optional search parameters]
For example, the following URL indicates that all resources of type Patient should be
reindexed:
Patient?
The following URL indicates that all Observations whose subject is in active should be
reindexed:
Observation?subject.active=true
If no URLs are included, then all resources of all types will be reindexed.
Example 1: Reindex a specific set of URLs
POST <baseURL>/$reindex
Content-Type: application/fhir+json
11-34
Chapter 11
Search parameters
"resourceType": "Parameters",
"parameter": [ {
"name": "url",
"valueString": "Patient?active=true"
}, {
"name": "url",
"valueString": "Observation?subject.active=true"
} ]
}
POST baseURL/$reindex
Content-Type: application/fhir+json
{
"resourceType": "Parameters",
"parameter": [ {
"name": "url",
"valueString": "Practitioner?"
}, {
"name": "url",
"valueString": "Patient?"
} ]
}
OR
POST baseURL/$reindex
{
"resourceType": "Parameters",
"parameter": [ {
"name": "everything",
"valueBoolean": "true"
}]
}
• Reindex response
The $reindex operation creates a batch job that can be executed asynchronously.
Reindex response
The $reindex operation creates a batch job that can be executed asynchronously.
When you invoke a reindex operation, the system responds with a jobId and that can be used
to know the status of the reindex operation.
11-35
Chapter 11
Search parameters
Example Response:
{
"resourceType": "Parameters",
"parameter": [ {
"name": "jobId",
"valueString": "18256337-5a0d-4b9d-a2af-0927d08201c6"
} ]
}
You can use the $export-poll-status operation to know the status of the job using the
following call:
GET baseURL/$export-poll-status?_jobId=18256337-5a0d-4b9d-
a2af-0927d08201c6
11-36
Chapter 11
Search parameters
The parameter _include is used to follow links forward. For example, to include relevant
Patient resources for requested Observation matches, based on the Observation.subject
element, using either the subject or patient search parameters.
GET [base]/Observation?_include=Observation:subject
The parameter _revinclude is used to follow reverse links. For example, to include relevant
Observation resources for requested Patient matches, based on the Observation.subject
element, using either the subject or patient search parameters.
GET [base]/Patient?_revinclude=Observation:subject
Summary Parameter
The client can request the server to return only a portion of the resources by using the
parameter _summary.
GET [base]/Patient?_summary=true
The _summary parameter requests the server to return a subset of the resource. It can contain
one of the following values:
Value Description
true Return a limited subset of elements from the
resource.
text Return only the text, id, meta, and top-level
mandatory elements.
data Remove the text element.
count Search only: just return a count of the matching
resources, without returning the actual matches.
false Return all parts of the resource(s).
GET [base]/Patient?_summary=true
{
"resourceType": "Bundle",
"id": "71702ee9-4046-49c0-9840-0fe139a2afd1",
"meta": {
11-37
Chapter 11
Search parameters
"lastUpdated": "2024-02-26T08:34:47.477+00:00",
"tag": [ {
"system": "http://terminology.hl7.org/CodeSystem/v3-
ObservationValue",
"code": "SUBSETTED",
"display": "Resource encoded in summary mode"
} ]
},
"type": "searchset",
"total": 1,
"link": [ {
"relation": "self",
"url": "http://hsgbu-
lon-166.snlhrprshared1.gbucdsint02lhr.oraclevcn.com:3003/oracle-fhir-
server/fhir/Patient?_summary=true"
} ],
"entry": [ {
"fullUrl": "http://hsgbu-
lon-166.snlhrprshared1.gbucdsint02lhr.oraclevcn.com:3003/oracle-fhir-
server/fhir/Patient/1",
"resource": {
"resourceType": "Patient",
"id": "1",
"meta": {
"versionId": "1",
"lastUpdated": "2024-02-26T06:59:39.364+00:00",
"source": "#rIx8lDj54KOhTZF0",
"tag": [ {
"system": "http://terminology.hl7.org/CodeSystem/v3-
ObservationValue",
"code": "SUBSETTED",
"display": "Resource encoded in summary mode"
} ]
},
"identifier": [ {
"use": "usual",
"type": {
"coding": [ {
"system": "http://terminology.hl7.org/CodeSystem/v2-0203",
"code": "MR"
} ]
},
"system": "urn:oid:1.2.36.146.595.217.0.1",
"value": "12345",
"period": {
"start": "2001-05-06"
},
"assigner": {
"display": "Acme Healthcare"
}
} ],
"active": true,
"name": [ {
"use": "official",
"family": "Chalmers",
11-38
Chapter 11
Search parameters
11-39
Chapter 11
Search parameters
{
"resourceType": "Bundle",
"id": "9c027c3b-3911-47cd-bda5-0ed99fb5d92a",
"meta": {
"lastUpdated": "2024-02-26T09:08:36.093+00:00"
},
"type": "searchset",
"total": 2,
"link": [ {
"relation": "self",
"url": "http://hsgbu-
lon-166.snlhrprshared1.gbucdsint02lhr.oraclevcn.com:3003/oracle-fhir-
server/fhir/Patient?_count=1"
}, {
"relation": "next",
"url": "http://hsgbu-
lon-166.snlhrprshared1.gbucdsint02lhr.oraclevcn.com:3003/oracle-fhir-
server/fhir?_getpages=9c027c3b-3911-47cd-
bda5-0ed99fb5d92a&_getpagesoffset=1&_count=1&_pretty=true&_bundletype=s
earchset"
} ],
"entry": [ {
"fullUrl": "http://hsgbu-
lon-166.snlhrprshared1.gbucdsint02lhr.oraclevcn.com:3003/oracle-fhir-
server/fhir/Patient/1",
"resource": {
"resourceType": "Patient",
"id": "1",
"meta": {
"versionId": "1",
"lastUpdated": "2024-02-26T06:59:39.364+00:00",
"source": "#rIx8lDj54KOhTZF0"
},
"text": {
"status": "generated",
"div": "<div xmlns=\"http://www.w3.org/1999/
xhtml\">\n\t\t\t<table>\n\t\t\t\t<tbody>\n\t\t\t\t\t<tr>\n\t\t\t\t\t\t<
td>Name</td>\n\t\t\t\t\t\t<td>Peter James \n
<b>Chalmers</b> ("Jim")\n </td>\n\t\t\t\t\t</
tr>\n\t\t\t\t\t<tr>\n\t\t\t\t\t\t<td>Address</td>\n\t\t\t\t\t\t<td>534
Erewhon, Pleasantville, Vic, 3999</td>\n\t\t\t\t\t</
tr>\n\t\t\t\t\t<tr>\n\t\t\t\t\t\t<td>Contacts</
td>\n\t\t\t\t\t\t<td>Home: unknown. Work: (03) 5555 6473</
11-40
Chapter 11
Search parameters
td>\n\t\t\t\t\t</tr>\n\t\t\t\t\t<tr>\n\t\t\t\t\t\t<td>Id</
td>\n\t\t\t\t\t\t<td>MRN: 12345 (Acme Healthcare)</td>\n\t\t\t\t\t</
tr>\n\t\t\t\t</tbody>\n\t\t\t</table>\n\t\t</div>"
},
"identifier": [ {
"use": "usual",
"type": {
"coding": [ {
"system": "http://terminology.hl7.org/CodeSystem/v2-0203",
"code": "MR"
} ]
},
"system": "urn:oid:1.2.36.146.595.217.0.1",
"value": "12345",
"period": {
"start": "2001-05-06"
},
"assigner": {
"display": "Acme Healthcare"
}
} ],
"active": true,
"name": [ {
"use": "official",
"family": "Chalmers",
"given": [ "Peter", "James" ]
}, {
"use": "usual",
"given": [ "Jim" ]
}, {
"use": "maiden",
"family": "Windsor",
"given": [ "Peter", "James" ],
"period": {
"end": "2002"
}
} ],
"telecom": [ {
"use": "home"
}, {
"system": "phone",
"value": "(03) 5555 6473",
"use": "work",
"rank": 1
}, {
"system": "phone",
"value": "(03) 3410 5613",
"use": "mobile",
"rank": 2
}, {
"system": "phone",
"value": "(03) 5555 8834",
"use": "old",
"period": {
"end": "2014"
11-41
Chapter 11
Search parameters
}
} ],
"gender": "male",
"birthDate": "1974-12-25",
"_birthDate": {
"extension": [ {
"url": "http://hl7.org/fhir/StructureDefinition/patient-
birthTime",
"valueDateTime": "1974-12-25T14:35:45-05:00"
} ]
},
"deceasedBoolean": false,
"address": [ {
"use": "home",
"type": "both",
"text": "534 Erewhon St PeasantVille, Rainbow, Vic 3999",
"line": [ "534 Erewhon St" ],
"city": "PleasantVille",
"district": "Rainbow",
"state": "Vic",
"postalCode": "3999",
"period": {
"start": "1974-12-25"
}
} ],
"contact": [ {
"relationship": [ {
"coding": [ {
"system": "http://terminology.hl7.org/CodeSystem/v2-0131",
"code": "N"
} ]
} ],
"name": {
"family": "du Marché",
"_family": {
"extension": [ {
"url": "http://hl7.org/fhir/StructureDefinition/
humanname-own-prefix",
"valueString": "VV"
} ]
},
"given": [ "Bénédicte" ]
},
"telecom": [ {
"system": "phone",
"value": "+33 (237) 998327"
} ],
"address": {
"use": "home",
"type": "both",
"line": [ "534 Erewhon St" ],
"city": "PleasantVille",
"district": "Rainbow",
"state": "Vic",
"postalCode": "3999",
11-42
Chapter 11
Search parameters
"period": {
"start": "1974-12-25"
}
},
"gender": "female",
"period": {
"start": "2012"
}
} ]
},
"search": {
"mode": "match"
}
} ]
}
If _count has the value 0, the server returns a bundle that reports the total number of
resources that match in Bundle.total, but with 0 entry.
GET [base]/Patient?_count=0
{
"resourceType": "Bundle",
"id": "1fda0ebb-2ec2-4590-89c9-568b2dfd4780",
"meta": {
"lastUpdated": "2024-02-26T09:09:47.005+00:00",
"tag": [ {
"system": "http://terminology.hl7.org/CodeSystem/v3-ObservationValue",
"code": "SUBSETTED",
"display": "Resource encoded in summary mode"
} ]
},
"type": "searchset",
"total": 2
}
Note:
The _count parameter has no impact on the value of Bundle.total as the latter
represents the total number of matches, not how many are returned in a single
Bundle response.
Elements Parameter
A client can request a specific set of elements be returned as part of a resource in the search
results using the _elements parameter.
GET [base]/Patient?_elements=identifier,active
11-43
Chapter 11
Search parameters
Example Response
{
"resourceType": "Bundle",
"id": "d9dcca52-b714-47df-a9e7-f6e3edd031d5",
"meta": {
"lastUpdated": "2024-02-26T09:27:20.680+00:00"
},
"type": "searchset",
"total": 1,
"link": [ {
"relation": "self",
"url": "http://localhost:3003/oracle-fhir-server/fhir/Patient?
_elements=identifier%2Cactive"
}, {
"relation": "next",
"url": "http://localhost:3003/oracle-fhir-server/fhir?
_getpages=d9dcca52-b714-47df-a9e7-
f6e3edd031d5&_getpagesoffset=1&_count=1&_pretty=true&_bundletype=search
set&_elements=active,identifier"
} ],
"entry": [ {
"fullUrl": "http://localhost:3003/oracle-fhir-server/fhir/
Patient/1",
"resource": {
"resourceType": "Patient",
"id": "1",
"meta": {
"versionId": "1",
"lastUpdated": "2024-02-26T06:59:39.364+00:00",
"source": "#rIx8lDj54KOhTZF0",
"tag": [ {
"system": "http://terminology.hl7.org/CodeSystem/v3-
ObservationValue",
"code": "SUBSETTED",
"display": "Resource encoded in summary mode"
} ]
},
"identifier": [ {
"use": "usual",
"type": {
"coding": [ {
"system": "http://terminology.hl7.org/CodeSystem/v2-0203",
"code": "MR"
} ]
},
"system": "urn:oid:1.2.36.146.595.217.0.1",
"value": "12345",
"period": {
"start": "2001-05-06"
},
"assigner": {
"display": "Acme Healthcare"
}
} ],
11-44
Chapter 11
Search parameters
"active": true
},
"search": {
"mode": "match"
}
} ]
}
Sort Parameter
The client can indicate which order to return the results by using the parameter _sort, which
can contain a comma-separated list of sort rules in priority order.
GET [base]/Patient?_sort=name,-id, active, address
Each item in the comma-separated list is a search parameter, optionally with a '-' prefix. The
prefix indicates decreasing order. In its absence, the parameter is applied in increasing order.
Contained Resources
By default, search results only include resources that are not contained in other resources.
However, chained parameters will be evaluated inside contained resources. The client can
use the _contained parameter to include contained resources in the search result.
To illustrate this, consider an Observation resource that has a contained patient resource.
{
"resourceType": "Observation",
"id": "test-observation",
"contained": [
{
"resourceType": "Patient",
"id": "contained-patient-test",
"name": [{
"family": "Taylor"
}]
}
],
"subject": { "reference": "#contained-patient-test" }
}
{
"resourceType": "Bundle",
"id": "fac7f392-6678-4f7a-b497-097e9eebf3db",
11-45
Chapter 11
Search parameter features
"meta": {
"lastUpdated": "2024-02-26T10:08:03.246+00:00"
},
"type": "searchset",
"total": 1,
"link": [ {
"relation": "self",
"url": "http://localhost:3003/oracle-fhir-server/fhir/Observation?
_contained=true&subject.name=Taylor"
} ],
"entry": [ {
"fullUrl": "http://localhost:3003/oracle-fhir-server/fhir/
Observation/152",
"resource": {
"resourceType": "Observation",
"id": "152",
"meta": {
"versionId": "1",
"lastUpdated": "2024-02-26T10:07:46.522+00:00",
"source": "#bDxRJtAqeE5Avf9s"
},
"contained": [ {
"resourceType": "Patient",
"id": "contained-patient-test",
"name": [ {
"family": "Taylor"
} ]
} ],
"subject": {
"reference": "#contained-patient-test"
}
},
"search": {
"mode": "match"
}
} ]
}
To enable the _contained parameter on Oracle HDR FHIR server, set the below
property to true in the hdr_fhir.yaml file. By default this property is set to false. If this is
set to true all the contained resources will be indexed while persisting the resources.
enable_index_contained_resource: true
11-46
Chapter 11
Search parameter features
Indexing for missing search parameters can add a great deal of extra index space, and slow
down write operations on servers with many enabled search parameters. This feature is
therefore disabled by default and must be specifically enabled if it is needed.
11-47
Chapter 11
Search parameter features
This works because of the chain, which is the dot notation followed by a second
search parameter. This syntax means "find me any Observation resources where the
subject reference links to a target resource where a search for name=Smith would
match."
By default, chained searches only consider top-level resources. Consider the following
Observation resource with a reference to a contained Patient.
The search given above will not return this Observation, because the contained
resource has not been included in the search indexes. If the Index Contained
Resources feature is enabled, indexes will be generated for the contained resources,
and Observation/3 would be included in the search results.
11-48
Chapter 11
Searching for data
%now—Date searches can be performed relative to "now" using the %now parameter value.
For example, to search for Procedures with a date later than now, you can search for /
Observation?date=le%now.
Note:
The "%" needs to be URL escaped so the actual URL will be /Observation?
date=le%25now.
%today—Similarly date searches can be performed relative to "today" using the "%today"
parameter value. "%today" works the same as "%now" except that it searches as a "date"
type as opposed to a "dateTime" type.
11-49
Chapter 11
Creating data
Creating data
This section describes creating data in Oracle HDR FHIR repository.
• Validating references and referential integrity
When a resource is written to the repository (create/update/etc), local resource
references that are indexed by at least one SearchParameter can be checked to
ensure that the target of the reference is valid.
• Transactions and submitting bundles
If you POST a bundle message to [baseUrl]/Bundle you are submitting the
bundle for storage as-is.
• Auto-creating reference targets
Often when batch processing data from multiple sources, you have data from one
source that has references to data from other sources.
• FHIR Transaction with conditional create
The conditional create is roughly described as “use an existing resource that
matches specific criteria if one exists (and do not modify that resource), or create a
new one if not.”
• Auto-create placeholders for reference targets
If the Auto-Create Placeholder Reference Targets setting
(auto_create_placeholder_reference_targets) is enabled in the Oracle HDR FHIR
server, it is possible to have the server automatically create an empty
"placeholder" resource with a pre-assigned ID.
• Auto-create placeholder reference targets with identifier
If the Auto-Create Placeholder Reference Targets setting is enabled in the FHIR
Storage module configuration (as shown above), and the Allow Inline Match URL
References Enabled setting is also enabled, you can refine the behavior shown
above further.
11-50
Chapter 11
Creating data
not exist at the time that the source resource is created will not be indexed, even if the
target resource is created later. Disable with caution.
Referential integrity
If the config Enforce Referential Integrity on Delete (enforce_referential_integrity_on_delete)
is enabled on HDR FHIR Server, resources can only be deleted if there are no other
resources with indexed references to the candidate resource for deletion.
11-51
Chapter 11
Creating data
The following topics describe helpful strategies for solving this issue:
• FHIR Transaction with conditional create
• Auto-create placeholders for reference targets
• Auto-create placeholder reference targets with identifier
"resourceType": "Bundle",
"meta": {
"lastUpdated": "2014-08-18T01:43:30Z"
},
"type": "transaction",
"entry": [
{
11-52
Chapter 11
Creating data
"fullUrl": "urn:uuid:61ebe359-bfdc-4613-8bf2-c5e300945f0a",
"resource": {
"resourceType": "Patient",
"text": {
"status": "generated",
"div": "<div xmlns=\"http://www.w3.org/1999/xhtml\">Some
narrative</div>"
},
"active": true,
"name": [
{
"use": "official",
"family": "Chalmers",
"given": [
"Peter",
"James"
]
}
],
"gender": "male",
"birthDate": "1974-12-25"
},
"request": {
"method": "POST",
"url": "Patient"
}
},
{
"fullUrl": "http://example.org/fhir/Patient/100058",
"resource": {
"resourceType": "Patient",
"id": "123",
"text": {
"status": "generated",
"div": "<div xmlns=\"http://www.w3.org/1999/xhtml\">Some
narrative</div>"
},
"active": true,
"name": [
{
"use": "official",
"family": "Chalmers",
"given": [
"Peter",
"James"
]
}
],
"gender": "male",
"birthDate": "1974-12-25"
},
"request": {
"method": "PUT",
"url": "Patient/100058"
}
11-53
Chapter 11
Creating data
},
{
"request": {
"method": "GET",
"url": "Patient?name=Peter"
}
},
{
"request": {
"method": "GET",
"url": "Patient/1",
"ifNoneMatch": "W/\"4\"",
"ifModifiedSince": "2015-08-31T08:14:33+10:00"
}
}
]
}
{
"resourceType": "Observation",
"status": "final",
"code": {
"coding": [ {
"system": "http://loinc.org",
"code": "789-8"
} ]
},
"subject": {
"reference": "Patient/ABC"
},
"valueQuantity": {
"value": 4.12,
"system": "http://unitsofmeasure.org",
"code": "10*12/L"
}
}
11-54
Chapter 11
Creating data
In this case, the reference is treated as a local search (in this case for a Patient with the
identifier included in the inline match URL) and executed as such.
If the search finds zero results, a new Patient resource is created. If the inline match URL
uses an identifier as it does here, Patient.identifier is populated with the inline match URL's
identifier system and value. The reference is then automatically replaced with a reference to
this new Patient.
If the search finds one result, the reference is automatically replaced with a reference to the
found Patient and no placeholder reference target is created.
11-55
Chapter 11
Reading data
Note:
We use Patient as an example; this applies to any reference targets that
include an Identifier element.
Reading data
This section describes methods for reading data from the Oracle HDR FHIR
Repository.
• Diff operation
Use the $diff operation to generate a differential between two versions of a
resource, or between two different resources of the same type.
• Diff at Instance Level
When you invoke the $diff operation at the instance level (meaning it is invoked on
a specific resource ID), it compares two versions of the given resource.
• Diff at Type Level
When the $diff operation is invoked at the type level (meaning it is invoked on a
specific resource type), it will compare two different resources of the same type.
• $everything operation
The Oracle HDR-FHIR jpa server supports the Patient/$everything operation and
accepts all the IN parameters defined in the documentation. Additionally, Oracle
HDR allows you to provide an _id parameter, in order to filter the set of patients
you wish to get everything for.
Diff operation
Use the $diff operation to generate a differential between two versions of a resource,
or between two different resources of the same type.
Differentials generated by this operation are in FHIR Patch format.
In generated differentials, where a value has changed (that is, a replace operation), an
additional part value is present on the given operation called previousValue. This part
shows the value as it was in the from version of the resource.
11-56
Chapter 11
Reading data
11-57
Chapter 11
Reading data
{
"resourceType": "Parameters",
"parameter": [ {
"name": "operation",
"part": [ {
"name": "type",
"valueCode": "replace"
}, {
"name": "path",
"valueString": "Patient.id"
}, {
"name": "previousValue",
"valueId": "100065"
}, {
"name": "value",
"valueId": "100004"
} ]
} ]
}
$everything operation
The Oracle HDR-FHIR jpa server supports the Patient/$everything operation and
accepts all the IN parameters defined in the documentation. Additionally, Oracle HDR
allows you to provide an _id parameter, in order to filter the set of patients you wish to
get everything for.
The following requests are all equivalent, and these example queries fetch everything
for Patient/1, Patient/2, and Patient/3.
Request: $everything operation using GET
11-58
Chapter 11
Updating data
Updating data
This section describes information about methods for updating data in the HDR FHIR
Repository.
• Patching data
You can patch data to make a small change to a resource without needing to re-upload
the entire content. For example, a resource status field might be changed by an
application with no other changes needed.
• Tag retention
According to the FHIR rules on updating resources, by default when a resource is
updated, any tags and security labels are carried forward even if they are not explicitly
listed in the new version.
Patching data
You can patch data to make a small change to a resource without needing to re-upload the
entire content. For example, a resource status field might be changed by an application with
no other changes needed.
11-59
Chapter 11
Updating data
Category Description
HTTP Method PATCH
Content-Type application/fhir+json
URL http(s)://HOSTNAME:PORT/oracle-fhir-server/
fhir/Patient/123/
Request Body
{
"resourceType": "Parameters",
"parameter": [ {
"name": "operation",
"part": [ {
"name": "type",
"valueCode": "replace"
}, {
"name": "path",
"valueString":
"Patient.birthDate"
}, {
"name": "value",
"valueDate": "1975-09-09"
} ]
} ]
}
Category Description
HTTP Method POST
Content-Type application/fhir+json
11-60
Chapter 11
Updating data
Category Description
URL http(s)://HOSTNAME:PORT/oracle-fhir-server/
fhir/
Request Body
{
"resourceType": "Bundle",
"type": "transaction",
"entry": [ {
"fullUrl": "Patient/123",
"resource": {
"resourceType":
"Parameters",
"parameter": [ {
"name": "operation",
"part": [ {
"name": "type",
"valueCode": "replace"
}, {
"name": "path",
"valueString":
"Patient.birthDate"
}, {
"name": "value",
"valueDate":
"1930-01-01"
} ]
} ]
},
"request": {
"method": "PATCH",
"url": "Patient/123"
}
} ]
}
Category Description
HTTP Method PATCH
Content-Type application/json-patch+json
URL http(s)://HOSTNAME:PORT/oracle-fhir-server/fhir/
Observation/123
11-61
Chapter 11
Updating data
Category Description
Request Body
[
{
"op": "replace",
"path": "/status",
"value": "in-progress"
}
]
Note:
If you are using "op": "add", you need to suffix the path with /- (e.g. "path": "/
identifier/-").
Category Description
HTTP Method POST
Content-Type application/fhir+json
URL http(s)://HOSTNAME:PORT/oracle-fhir-server/
fhir/
11-62
Chapter 11
Updating data
Category Description
Request Body
{
"resourceType": "Bundle",
"type": "transaction",
"entry": [
{
"fullUrl": "Patient/1",
"resource": {
"resourceType": "Binary",
"contentType":
"application/json-patch+json",
"data":
"WyB7ICJvcCI6InJlcGxhY2UiLCAicGF0a
CI6Ii9hY3RpdmUiLCAidmFsdWUiOmZhbHN
lIH0gXQ=="
},
"request": {
"method": "PATCH",
"url": "Patient/1"
}
}
]
}
Tag retention
According to the FHIR rules on updating resources, by default when a resource is updated,
any tags and security labels are carried forward even if they are not explicitly listed in the new
version.
For example, suppose a resource is created by a client, and in that resource a tag "foo" is
listed in Resource.meta.tag. Then, an update is performed by a client but this update does
not contain a value in Resource.meta.
According to the FHIR rules, in this case the tag is copied to the new version of the resource
even though it was not explicitly requested.
If a client wishes to override this behavior, they may do so using the X-Meta-Snapshot-Mode
header. This header indicates that Tags and/or Security Labels and/or Profile Declarations
should be treated as snapshots, meaning that any values not already present should be
removed.
The value is a comma-separated list containing the metadata components that should be
treated in snapshot mode:
• TAG—Resource tags
11-63
Chapter 11
Deleting data
Deleting data
The FHIR delete operation performs a "logical" delete. This means that data is not
physically removed from the database.
For example, Patient resource with ID 123 is created (via an HTTP POST /Patient)
and subsequently deleted (via an HTTP DELETE Patient/123). This causes a second
version of the Patient/123 resource to be created with version Patient/123/_history/2
that is marked as deleted.
This patient no longer appears in search results and attempts to read the resource
(using an HTTP GET Patient/123) fails with an "HTTP 410 Gone" response.
The original content of the resource is not destroyed, however. It can still be found
using two FHIR operations:
• Using a FHIR version-specific read: GET Patient/123/_history/1
• Using a FHIR instance-history: GET Patient/123/_history
Note that HTTP 410 Gone responses include a Location header containing the fully
qualified resource ID as well as the version ID.
Example: DELETE 410 Gone response with a Location Header
11-64
Chapter 11
Deleting data
11-65
Chapter 11
Deleting data
• You can disable referential integrity checking in the HDR-FHIR server by changing
enforce referential integrity check in delete setting on the FHIR Server. This means
that any delete on resource is allowed, even if other resources still have
references left.
• You can use a transactional delete.
• You can use cascading deletes.
Transactional delete
Use the FHIR Transaction operation to delete multiple resources at the same time.
This is useful if you have chains or collections of resources to delete at once, but also
can be used to delete circular references.
To delete multiple resources in a transaction, POST a Bundle such as the following to
the root of your FHIR endpoint.
Example: Transactional delete
Referential integrity
By default, Oracle HDR-FHIR server blocks the deletion of a resource if any other
resources have indexed references to the resource being deleted.
For example:
• The resource Patient/102 has been saved in the repository, and a second
resource Observation/558 is then saved as well, where the Observation.subject
reference is a reference to the Patient.
• In this situation, attempts to delete Patient/102 are blocked unless resources with
references to this resource are deleted first (or are deleted as a part of the same
transaction in the case of a transactional delete).
11-66
Chapter 11
Deleting data
If it is enabled, resources can only be deleted if there are no other resources with indexed
references to the candidate resource for deletion.
Cascading deletes
By enabling the cascading delete, a user can perform the delete on parent resource, then all
the corresponding child resources will be deleted as well.
In order to perform a cascading delete:
• First, the allow_cascading_deletes property must be enabled on the HDR-FHIR Server.
• And then, to perform a cascaded delete, the client HTTP request must include either a
special URL parameter (_cascade) or a special header to indicate that a cascading
delete is desired.
The following example shows how to delete using a URL parameter.
11-67
Chapter 11
Deleting data
11-68
Chapter 11
Deleting data
11-69
Chapter 11
Deleting data
Delete expunge
If you need to quickly delete all data associated with a set of resources, you can
combine the DELETE and $expunge operations into a single step. Oracle HDR FHIR
supports this combination.
You can call the usual DELETE with a special parameter _expunge=true. This results
in starting a Delete Expunge Batch Job that deletes and expunges the requested
details in the background.
In order to perform a Delete Expunge, three settings need to be enabled on the Oracle
HDR FHIR server:
11-70
Chapter 11
Binary Access Operations
When the _expunge parameter is provided to the DELETE operation, the matched resources
and all of their history will be both deleted and expunged from the database. This will perform
considerably faster than doing the delete and expunge separately.
DELETE with _expunge=true
The following example shows how to perform a delete expunge using the DELETE method:
Request: DELETE with _expunge=true
11-71
Chapter 11
Binary Access Operations
POST http://<HOST_NAME>:<PORT>/oracle-fhir-server/fhir/
DocumentReference/DocumentReference
Content-Type: application/fhir+json
{
"resourceType": "DocumentReference",
"subject": {
"reference": "Patient/P123"
},
"content": [
{
"attachment": {
"contentType": "image/jpeg"
}
}
]
}
The server will reply with a content-location header containing the ID of the newly
created resource.
content-location: http://localhost:7001/oracle-fhir-server/fhir/
DocumentReference/499952/_history/1
This ID is then used in the Binary Access Write Operation to set the binary content.
Second, the Binary Access Write Operation is invoked to directly store the content.
The path parameter, that specifies a FHIRPath expression to the attachment element
within the DocumentReference resource. It is important to provide the appropriate
content type via the Content-Type header in the operation HTTP request.
POST : http://localhost:7001/oracle-fhir-server/fhir/DocumentReference/
499952/$binary-access-write?path=DocumentReference.content.attachment
Content-Type: image/png
HTTP Body - (... binary content ...)
Note:
The below property decides whether to store the resource as plain text in the
RES_TEXT_VC column of resource extended tables.
inline_resource_storage_below_size: 0
If the resource size is below the size as set in the above property, it goes
RES_TEXT_VC column, otherwise it goes to RES_TEXT as compressed blob.
11-72
Chapter 11
Binary Access Operations
GET http://localhost:7001/oracle-fhir-server/fhir/DocumentReference/
499952/$binary-access-read?path=DocumentReference.content.attachment
Note:
The $binary-access-read operation works on any resource that contains base64
data.
Example:
/DocumentReference/[id]/$binary-access-read?
path=DocumentReference.content.attachment
GET /Binary/[id]/$binary-access-read?path=Binary.data
GET /Media/[id]/$binary-access-read?path=Media.content
Note:
If the data is stored as blob, it is required to switch your response type to "blob" in
the client call.
11-73
12
Other Features
Oracle Healthcare Data Repository includes other features such as Repository Validation
support, Remote Terminology Service Validation support, Patient :identifier Search Parameter
support, and Lucene/Elasticsearch indexing.
• Configuration
The required configuration properties are added to the hdr_fhir.yaml file.
12-1
Chapter 12
Repository Validation Support
Configuration
The required configuration properties are added to the hdr_fhir.yaml file.
load_ig_on_server_startup: false
If this property is set to true, the HDR-FHIR server dynamically loads configured IG
packages during FHIR server startup. By default this property is set to false.
implementationguides:
us_core:
name: hl7.fhir.us.core
version: 6.0.0
url: http://hl7.org/fhir/us/core/STU6/package.tgz
To load a different IG, change the url, name, and version to point to the specific IG
package location, add one more section like above that includes name, version and
url.
install_transitive_ig_dependencies: false
This property allows loading of dependencies required by the IG. Usually, this value is
set to false as most of the IGs depends on hl7 fhir core which is implied and doesn’t
require loading. Set this value to false.
validation_repository_enabled: false
If this property set to true, the incoming FHIR resource is validated against a
configured profile. Set this value to false to disable repository validation.
Note:
Make sure that the incoming message contains meta tag with profile
information to be validated.
Sample Message:
{
"resourceType" : "Patient",
"id" : "patient-example-female",
"meta": {
"profile": [
"http://hl7.org/fhir/us/core/StructureDefinition/us-core-
patient"
]
},
"text" : {
"status" : "generated",
"div" : "<div xmlns=\"http://www.w3.org/1999/xhtml\"><p><b>Martha
DeLarosa </b> female, DoB: 1992-05-01 ( id: 574687583)</p></div>"
},
12-2
Chapter 12
Repository Validation Support
"identifier" : [
{
"system" : "urn:oid:2.16.840.1.113883.2.4.6.3",
"value" : "574687583"
}
],
"active" : true,
"name" : [
{
"family" : "DeLarosa",
"given" : [
"Martha"
]
}
],
"telecom" : [
{
"system" : "phone",
"value" : "+31788700800",
"use" : "home"
}
],
"gender" : "female",
"birthDate" : "1992-05-01",
"address" : [
{
"line" : [
"Laan Van Europa 1600"
],
"city" : "Dordrecht",
"postalCode" : "3317 DB",
"country" : "NL"
}
],
"contact" : [
{
"relationship" : [
{
"coding": [
{
"system": "http://terminology.hl7.org/CodeSystem/v2-0131",
"code": "N"
}
]
}
],
"name" : {
"family" : "Mum",
"given" : [
"Martha"
]
},
"telecom" : [
{
"system" : "phone",
12-3
Chapter 12
Remote Terminology Service Validation Support
"value" : "+33-555-20036",
"use" : "home"
}
],
"address" : {
"line" : [
"Promenade des Anglais 111"
],
"city" : "Lyon",
"postalCode" : "69001",
"country" : "FR"
}
}
]
}
• Configuration
The required configuration properties are added to the hdr_fhir.yaml file.
Configuration
The required configuration properties are added to the hdr_fhir.yaml file.
remote_terminology_service_enabled: false
Set this property to true to enable validate codes using the configured FHIR-based
remote terminology server. By default it is false.
remote_terminology_server_base_url=http://hapi.fhir.org/baseR4
Specify FHIR-based remote terminology server url to validate codes against this
server.
Note:
If remote terminology validation is set to true, make sure that request
validation is also enabled (requests_enabled property).
12-4
Chapter 12
Patient :identifier Search Parameter Support
GET [base]/Consent?patient:identifier=http://
ns.electronichealth.net.au/id/hi/ihi/1.0|8003608833630130
The example is a search for all Consent resources that reference a patient by a particular
patient identifier. When the :identifier modifier is used, the search value works as a token
search.
In this case, patient resource will not be created before, and it will be attached while
persisting the resource.
Sample Message:
{
"resourceType": "Consent",
"id": "consent-example-basic1255",
"text": {
"status": "generated",
"div": "<div xmlns=\"http://www.w3.org/1999/
xhtml\">\n\t\t\t<p>\n\tAuthorize Normal access for Treatment\n\t\t\t</
p>\n\t\t\t<p>\n Patient "P. van de Heuvel" wishes to have all
of the PHI collected at the Good Health Psychiatric Hospital \n available
for normal treatment use.\n\t\t\t</p>\n\t\t</div>"
},
"status": "active",
"scope": {
"coding": [
{
"system": "http://terminology.hl7.org/CodeSystem/consentscope",
"code": "patient-privacy"
}
]
},
"category": [
{
"coding": [
{
"system": "http://loinc.org",
"code": "59284-0"
}
]
}
],
"patient": [{
"identifier": {
12-5
Chapter 12
Lucene/Elasticsearch Indexing
"system": "http://test.com",
"value": "12345"
}
}],
"dateTime": "2016-05-11",
"organization": [
{
"reference": "Organization/rrrrf001"
}
],
"sourceAttachment": {
"title": "The terms of the consent in lawyer speak."
},
"policyRule": {
"coding": [
{
"system": "http://terminology.hl7.org/CodeSystem/v3-ActCode",
"code": "OPTIN"
}
]
},
"provision": {
"period": {
"start": "1964-01-01",
"end": "2016-01-01"
}
}
}
When the above message is persisted, indexed patient references will generate an
index in the HFJ_SPIDX_TOKEN table for the patient identifier.
Now you can search Consent resources that reference a patient by a patient identifier
using the GET operation like below.
GET [base]/Consent?patient:identifier=http://test.com|12345
Lucene/Elasticsearch Indexing
The HDR-FHIR JPA Server supports optional indexing via Hibernate Search when
configured to use Lucene or Elasticsearch to support the _content, or _text search
parameters and also the extended Lucene string search indexing supports the default
search, as well as :contains, :exact, and :text modifiers.
• Configuration
The settings below will be enabled to support lucene or elastic search in the
hdr_fhir.yaml file.
• String search
The Extended Lucene string search indexing supports the default search, as well
as :contains, :exact, and :text modifiers.
12-6
Chapter 12
Lucene/Elasticsearch Indexing
Configuration
The settings below will be enabled to support lucene or elastic search in the hdr_fhir.yaml file.
hibernate.search.enabled: true
For Lucene:
hibernate.search.backend.type: elasticsearch
hibernate.search.backend.analysis.configurer:
ca.uhn.fhir.jpa.search.HapiHSearchAnalysisConfigurers$HapiElasticAnalysisConf
igurer
elasticsearch:
debug:
pretty_print_json_log: false
refresh_after_write: false
enabled: false
required_index_status: YELLOW
rest_url: 'localhost:9200'
protocol: 'http'
schema_management_strategy: CREATE
username: SomeUsername
password: SomePassword
Note:
To work with elastic search, the required elastic search client jar files need to be
placed under the WebLogic domain classpath (Example: <FHIR_DOMAIN>/lib) or
add those jar files to HDR FHIR application war file under
<HDR_FHIR_WAR>\WEB-INF\lib folder directly. These jar files are not bundled
with the HDR FHIR application due to Oracle's commercial license procedure/
restrictions.
String search
The Extended Lucene string search indexing supports the default search, as well
as :contains, :exact, and :text modifiers.
12-7
Chapter 12
Lucene/Elasticsearch Indexing
Configuration
12-8
13
Partitioning
Oracle Healthcare Data Repository FHIR 8.1.4 introduced a new feature called Partitioning.
Partitioning allows each resource on the server to be placed in a partition grouping a set of
resources together.
• Partitioning Outcomes
Partitioning is designed so that it can be used to achieve different outcomes.
• Partition Operations
Several operations can be used to manage partitions.
• Enabling Partitioning
To enable partitioning on the HDR FHIR server, uncomment and enable the properties in
the hdr_fhir.yaml file as shown below.
Partitioning Outcomes
Partitioning is designed so that it can be used to achieve different outcomes.
Multitenancy
Partitioning could be used to achieve multitenancy, where there are multiple logically
separate resources on the server. Traditionally this kind of setup is called tenant wise, and
each of these tenants should not be able to access or modify data belonging to another
tenant.
Separate Data
Partitioning could also be used to logically separate data coming from distinct sources
within an organization. For example, patient records might be placed in one partition, lab data
sourced from a lab system might be placed in a second partition and patient surveys from a
survey app might be placed in another. In this situation, data does not need to be completely
segregated (Lab Observation records may have references to Patient records in the patient
partition) but these partitions might be used to support security groups, retention policies, etc.
Partitioning in HDR FHIR JPA means that every resource has a partition identity. This identity
consists of the following attributes:
• Partition Name: This is a short textual identifier for the partition that the resource
belongs to. This might be a customer ID, a description of the type of data in the partition,
or something else.
• Partition ID: This is an integer ID that corresponds 1:1 with the partition Name. It is used
in the database as the partition identifier.
• Partition Date: This is an additional partition discriminator that can be used to implement
partitioning strategies using a date axis.
At the database level, partitioning involves the use of two dedicated columns to many tables
within the HDR_FHIR Schema
13-1
Chapter 13
Partition Operations
Partition Operations
Several operations can be used to manage partitions.
Before a partition can be used, it must be registered.
• Creating a Partition
The $partition-management-create-partition operation can be used to create a new
partition.
• Updating a Partition
The $partition-management-update-partition operation can be used to update an
existing partition.
• Deleting a Partition
The $partition-management-delete-partition operation can be used to delete an
existing partition.
• Reading a Partition
The $partition-management-read-partition operation can be used to read an
existing partition.
• Listing all Partitions
The $partition-management-list-partitions operation can be used to list all existing
partitions.
Creating a Partition
The $partition-management-create-partition operation can be used to create a new
partition.
An HTTP POST to the following URL can be used to invoke this operation. Notice that
we use the DEFAULT partition, as it always exists by default.
Example:
http://localhost:9001/oracle-fhir-server/fhir/DEFAULT/$partition-
management-create-partition
13-2
Chapter 13
Partition Operations
{
"resourceType": "Parameters",
"parameter": [ {
"name": "id",
"valueInteger": 123
}, {
"name": "name",
"valueCode": "PARTITION-123"
}, {
"name": "description",
"valueString": "a description"
} ]
}
Updating a Partition
The $partition-management-update-partition operation can be used to update an existing
partition.
An HTTP POST to the following URL can be used to invoke this operation.
Example:
http://localhost:9001/oracle-fhir-server/fhir/DEFAULT/$partition-management-
update-partition
{
"resourceType": "Parameters",
"parameter": [ {
"name": "id",
"valueInteger": 123
}, {
"name": "name",
"valueCode": "PARTITION-123"
}, {
"name": "description",
"valueString": "a description"
} ]
}
Deleting a Partition
The $partition-management-delete-partition operation can be used to delete an existing
partition.
An HTTP POST to the following URL can be used to invoke this operation.
13-3
Chapter 13
Partition Operations
Example:
http://localhost:9001/oracle-fhir-server/fhir/DEFAULT/$partition-
management-delete-partition
{
"resourceType": "Parameters",
"parameter": [ {
"name": "id",
"valueInteger": 123
} ]
}
Reading a Partition
The $partition-management-read-partition operation can be used to read an existing
partition.
An HTTP POST to the following URL can be used to invoke this operation.
http://localhost:9001/oracle-fhir-server/fhir/DEFAULT/$partition-
management-read-partition
{
"resourceType": "Parameters",
"parameter": [ {
"name": "id",
"valueInteger": 123
} ]
}
http://localhost:9001/oracle-fhir-server/fhir/DEFAULT/$partition-
management-list-partitions
13-4
Chapter 13
Enabling Partitioning
This operation returns a Parameters resource that looks like the following:
{
"resourceType": "Parameters",
"parameter": [ {
"name": "partition",
"part": [ {
"name": "id",
"valueInteger": 1
}, {
"name": "name",
"valueCode": "PARTITION-1"
}, {
"name": "description",
"valueString": "a description1"
} ]
}, {
"name": "partition",
"part": [ {
"name": "id",
"valueInteger": 2
}, {
"name": "name",
"valueCode": "PARTITION-2"
}, {
"name": "description",
"valueString": "a description2"
} ]
} ]
}
Enabling Partitioning
To enable partitioning on the HDR FHIR server, uncomment and enable the properties in the
hdr_fhir.yaml file as shown below.
partitioning:
allow_references_across_partitions: true
When this flag is not set (as is the default), when a search requests a specific partition, an
additional SQL WHERE predicate is added to the query to explicitly request the given
partition ID. When this flag is set, this additional WHERE predicate is not necessary since the
partition is factored into the hash value being searched on. Setting this flag avoids the need
to manually adjust indexes against the HFJ_SPIDX tables.
partitioning_include_in_search_hashes: true
This setting controls whether resources in one partition should be allowed to create
references to resources in other partitions.
13-5
14
Terminology
HDR FHIR supports a terminology feature to use and manage code.
The general pattern for representing coded values in resources uses the following four
elements:
• system - A URI that identifies the system
• version - A string value representing a version of the original code system
• code - A string value that identifies a concept as defined by the code system
• display - A description of the concept as defined by the code system
Example:
{
"system" : "http://loinc.org",
"version" : "2.62",
"code" : "55423-8",
"display" : "Number of steps in unspecified time Pedometer"
}
• Uploading CodeSystems
In most cases, it is useful to upload your own CodeSystems for use in HDR FHIR
Repository. This might mean uploading external Terminologies such as LOINC/SNOMED
or loading custom terminologies such as local CodeSystems defined for organizational
specific use.
• Applying Deltas to CodeSystems
A pair of FHIR operations can be used to add or remove codes from the CodeSystems.
These operations directly add or remove the codes from the specified CodeSystem.
• ValueSet
The FHIR Specification defines two resource types that are used as a part of defining and
using codes.
Uploading CodeSystems
In most cases, it is useful to upload your own CodeSystems for use in HDR FHIR Repository.
This might mean uploading external Terminologies such as LOINC/SNOMED or loading
custom terminologies such as local CodeSystems defined for organizational specific use.
Uploading External Terminologies
HDR FHIR has the ability to upload several standard terminology code systems like LOINC/
SNOMED using their native distribution formats. This is done using the $upload-external-
code-system operation on the CodeSystem Resource and can be invoked using the HDR
FHIR command line utility. Refer to the FHIR Command-Line Utility chapter in this guide.
14-1
Chapter 14
Uploading CodeSystems
http://<HOST_NAME>:<PORT>/oracle-fhir-server/fhir/CodeSystem/$upload-
external-code-system
The request body for this operation is a Parameters resource with the following parts:
Parameter Description
system This parameter should have a uri value
containing the CodeSystem URI.
file This parameter should have an attachment
value containing the value of the file (encoded
in Base64) in Attachment.data and the
filename in Attachment.url.
contentType Specifies the payload type (should be text/csv,
application/zip etc.).
data Contains the raw Base64 encoded payload.
url Used by the upload processor to determine
the type of file being uploaded (e.g.
concepts.csv vs hierarchy.csv). See the CSV
input Files below for descriptions of the files to
upload.
CODE,DISPLAY
CHEM,Chemistry
HB,Hemoglobin
NEUT,Neutrophils
MICRO,Microbiology
C&S,Culture and Sensitivity
14-2
Chapter 14
Applying Deltas to CodeSystems
{
"resourceType": "Parameters",
"parameter": [
{
"name": "system",
"valueUri": "http://example.com/csv"
},
{
"name": "file",
"valueAttachment": {
"contentType": "text/csv",
"data":
"Q09ERSxESVNQTEFZCgpDSEVNLENoZW1pc3RyeQpIQixIZW1vZ2xvYmluCk5FVVQsTmV1dHJvcGhp
bHMKCk1JQ1JPLE1pY3JvYmlvbG9neQpDJlMsQ3VsdHVyZSBhbmQgU2Vuc2l0aXZpdHkK",
"url": "file:/concepts.csv"
}
},
{
"name": "file",
"valueAttachment": {
"contentType": "text/csv",
"data":
"UEFSRU5ULENISUxECgpDSEVNLEhCCkNIRU0sTkVVVAoKTUlDUk8sQyZTCg==",
"url": "file:/hierarchy.csv"
}
}
]
}
http://<HOST_NAME>:<PORT>/oracle-fhir-server/fhir/CodeSystem/$apply-
codesystem-delta-add
{
"resourceType": "Parameters",
14-3
Chapter 14
Applying Deltas to CodeSystems
"parameter": [
{
"name": "system",
"valueUri": "http://example.com/csv"
},
{
"name": "file",
"valueAttachment": {
"contentType": "text/csv",
"data":
"Q09ERSxESVNQTEFZCgpDSEVNVFJZLENoZW1pc3RyeQpIQjEsSGVtb2dsb2Jpbg==",
"url": "file:/concepts.csv"
}
}
]
}
http://<HOST_NAME>:<PORT>/oracle-fhir-server/fhir/CodeSystem/$apply-
codesystem-delta-remove
{
"resourceType": "Parameters",
"parameter": [
{
"name": "system",
"valueUri": "http://example.com/csv"
},
{
"name": "file",
"valueAttachment": {
"contentType": "text/csv",
"data":
"Q09ERSxESVNQTEFZCgpDSEVNVFJZLENoZW1pc3RyeQpIQjEsSGVtb2dsb2Jpbg==",
"url": "file:/concepts.csv"
}
}
]
}
14-4
Chapter 14
ValueSet
ValueSet
The FHIR Specification defines two resource types that are used as a part of defining and
using codes.
• The CodeSystem resource defines a collection of codes.
• The ValueSet resource creates a collection of codes drawn from one or more
CodeSystems.
ValueSets are defined by a collection of rules, it means the composition. These rules can be
simple rules (e.g. include codes P, Q, and R) or much more complex rules (ex: include any
codes that are a child of code P, etc).
Pre-Calculation for ValueSet Expansion
When a ValueSet is uploaded into HDR FHIR Repository, a scheduler job will be triggered in
the background to calculate the expansion of the valueset and store it in a dedicated set of
database tables. When you perform a ValueSet expansion, an extension will be added to the
ValueSet.meta element. This extension shows the status of the pre-calculation.
Pre-Calculation Status
To test whether a ValueSet has been pre-calculated, simply request the expansion using
the $expand operation. For example, the following request can be used to request the
expansion of the my_custom_value_set ValueSet:
GET ValueSet/$expand?url= http://example.com/my_custom_value_set
If this ValueSet has not been precalculated, the system will send a response similar to the
following:
{
"resourceType": "ValueSet",
"id": "200007",
"meta": {
"extension": [ {
"url": "http://hapifhir.io/fhir/StructureDefinition/valueset-expansion-
message",
"valueString": "ValueSet \"ValueSet.url[http://example.com/
t_custom_value_set]\" has not yet been pre-expanded. Performing in-memory
expansion without parameters. Current status: NOT_EXPANDED | The ValueSet is
waiting to be picked up and pre-expanded by a scheduled task."
} ],
"versionId": "1"
},
"url": "http://example.com/my_custom_value_set",
"status": "active",
[ ... Remaining Fields Not Shown ... ]
}
After the pre-calculation has completed, you will see a response similar to the following:
{
"resourceType": "ValueSet",
"id": "200007",
14-5
Chapter 14
ValueSet
"meta": {
"extension": [ {
"url": "http://hapifhir.io/fhir/StructureDefinition/valueset-
expansion-message",
"valueString": "ValueSet was expanded using an expansion that
was pre-calculated at 2023-08-16T20:14:35.055+05:30 (00:24:06 ago)"
} ],
"versionId": "1"
},
"url": "http://example.com/t_custom_value_set",
"status": "active",
[ ... Remaining Fields Not Shown ... ]
}
{
"resourceType": "Parameters",
"parameter": [ {
"name": "message",
"valueString": "ValueSet with URL \"http://example.com/
my_custom_value_set\" precaluclated expansion with 4 concept(s) has
been invalidated"
} ]
}
14-6
Chapter 14
ValueSet
The hierarchy in a CodeSystem often indicates an "is-a" relationship between the parent
code and the child codes. This is not always the case; the hierarchy can imply different kinds
of relationships depending on the specific system.
ValueSets can be used to retrieve all of the codes that are a child of a specific code in a
CodeSystem.
For example, suppose you have the following CodeSystem and there are 3 codes at the root
level (P , Q and R) and each of these codes have children, some of which have further
children.
{
"resourceType": "CodeSystem",
"url": "http://example.com/my_custom_codeSystem",
"content": "complete",
"concept": [ {
"code": "P",
"display": "Code P",
"concept": [ {
"code": "PP",
"display": "Code PP",
"concept": [ {
"code": "PPP",
"display": "Code PPP"
} ]
}, {
"code": "PQ",
"display": "Code PQ"
} ]
}, {
"code": "Q",
"display": "Code Q",
"concept": [ {
"code": "QP",
"display": "Code QP"
}, {
"code": "QQ",
"display": "Code QQ"
} ]
} , {
"code": "R",
"display": "Code R",
"concept": [ {
"code": "RP",
"display": "Code RP"
}, {
"code": "RQ",
"display": "Code RQ"
} , {
"code": "RR",
"display": "Code RR"
}]
} ]
}
14-7
Chapter 14
ValueSet
|-- P
| |-- PP
| | \-- PPP
| \-- PQ
\-- Q
| |-- QP
| \-- QQ
\-- R
|-- RP
\-- RQ
\-- RR
{
"resourceType": "ValueSet",
"url": "http://example.com/my_custom_value_set",
"status": "active",
"compose": {
"include": [ {
"system": "http://example.com/my_custom_codeSystem",
"filter": [ {
"property": "concept",
"op": "is-a",
"value": "P"
} ]
} ]
}
}
Note:
Note that the "is-a" filter will exclude the concept itself.
The following example combines an "is-a" filter with a simple explicit code inclusion in
order to include the code "P" as well as all of its descendants.
{
"resourceType": "ValueSet",
"url": "http://example.com/my_custom_value_set",
"status": "active",
"compose": {
"include": [ {
"system": "http://example.com/my_custom_codeSystem",
"filter": [ {
"property": "concept",
"op": "is-a",
"value": "P"
} ]
14-8
Chapter 14
ValueSet
}, {
"system": "http://example.com/my_custom_codeSystem",
"concept": [ {
"code": "P"
} ]
} ]
}
}
http://<HOST_NAME>:<PORT>/oracle-fhir-server/fhir/ValueSet/$expand?
url=my_custom_value_set
This will return the following response. Note that the hierarchy is not included in the
response.
{
"resourceType": "ValueSet",
"id": "200007",
"meta": {
"extension": [ {
"url": "http://hapifhir.io/fhir/StructureDefinition/valueset-expansion-
message",
"valueString": "ValueSet was expanded using an expansion that was pre-
calculated at 2023-08-16T20:14:35.055+05:30 (00:28:24 ago)"
} ],
"versionId": "1"
},
"url": "http://example.com/my_custom_value_set",
"status": "active",
"compose": {
"include": [ {
"system": "http://example.com/my_custom_codeSystem",
"filter": [ {
"property": "concept",
"op": "is-a",
"value": "P"
} ]
}, {
"system": "http://example.com/my_custom_codeSystem",
"concept": [ {
"code": "P"
} ]
} ]
},
"expansion": {
"identifier": "d802bee9-5447-4ecd-92f9-062b704ca566",
"timestamp": "2023-08-16T20:42:59+05:30",
14-9
Chapter 14
ValueSet
"total": 4,
"offset": 0,
"parameter": [ {
"name": "offset",
"valueInteger": 0
}, {
"name": "count",
"valueInteger": 1000
} ],
"contains": [ {
"system": "http://example.com/my_custom_codeSystem",
"code": "PP",
"display": "Code PP"
}, {
"system": "http://example.com/my_custom_codeSystem",
"code": "PPP",
"display": "Code PPP"
}, {
"system": "http://example.com/my_custom_codeSystem",
"code": "PQ",
"display": "Code PQ"
}, {
"system": "http://example.com/my_custom_codeSystem",
"code": "P",
"display": "Code P"
} ]
}
}
http://<HOST_NAME>:<PORT>/oracle-fhir-server/fhir/ValueSet/$expand?
url=my_custom_value_set &includeHierarchy=true
{
"resourceType": "ValueSet",
"id": "200007",
"meta": {
"extension": [ {
"url": "http://hapifhir.io/fhir/StructureDefinition/valueset-
expansion-message",
"valueString": "ValueSet was expanded using an expansion that
was pre-calculated at 2023-08-16T20:14:35.055+05:30 (00:29:44 ago)"
} ],
"versionId": "1"
14-10
Chapter 14
ValueSet
},
"url": "http://example.com/my_custom_value_set",
"status": "active",
"compose": {
"include": [ {
"system": "http://example.com/my_custom_codeSystem",
"filter": [ {
"property": "concept",
"op": "is-a",
"value": "P"
} ]
}, {
"system": "http://example.com/my_custom_codeSystem",
"concept": [ {
"code": "P"
} ]
} ]
},
"expansion": {
"identifier": "415a2a3c-02d5-463d-a810-e9d907146234",
"timestamp": "2023-08-16T20:44:18+05:30",
"total": 4,
"offset": 0,
"parameter": [ {
"name": "offset",
"valueInteger": 0
}, {
"name": "count",
"valueInteger": 1000
} ],
"contains": [ {
"system": "http://example.com/my_custom_codeSystem",
"code": "P",
"display": "Code P",
"contains": [ {
"system": "http://example.com/my_custom_codeSystem",
"code": "PP",
"display": "Code PP",
"contains": [ {
"system": "http://example.com/my_custom_codeSystem",
"code": "PPP",
"display": "Code PPP"
} ]
}, {
"system": "http://example.com/my_custom_codeSystem",
"code": "PQ",
"display": "Code PQ"
} ]
} ]
}
}
14-11