In the following, the focus is on server-side caching applied to search operations and how a client can influence it.
Table of Contents |
---|
General Aspects of Interacting with Services
Caching of Search results
Caching in Telemedicine Solutions
Telemedicine Solutions caching of information is, as caching in general, a mechanism for achieving better performance although it must be applied with caution, especially when used with clinical content.
Note |
---|
As described in Telemedicine Solutions caching of information from the infrastructure, caching of information from services in the Clinical Domain should be used with care, with the Patient service being an exception. Use of events for cache invalidation, as described in Telemedicine Solutions caching of information from the infrastructure , might not be immediately available to a client. |
Telemedicine Solutions caching of information from the more stable Administrative Domain must be considered.
Caching in eHealth Services
It can generally be assumed that the caching is based on the principles described in https://hapifhir.io/hapi-fhir/docs/server_jpa/configuration.html#search-result-caching . When interacting with custom operations, caching is specific to the operation itself.
Patient Service
Services cache search results for 1 minute
Services use the cache when identical searches (same search parameters) are performed
This means search results can be up to 1 minute stale!
Search results for a particular bundle ID are cached in the database for 1 hour
This cache is used when paging through the result bundle of a particular search
The max value for the
max-results
header is1000
Cache-Control: nostore, max-results=1000
The default page size is 20
Maximum page size is 200
Telemedicine solutions can request a particular page size by setting the
_count
parameter
Person$match
does not employ any cachinginternally, it first searches for a Patient with the provided CRN in the local database (does not use the search result cache, for technical reasons)
If a patient exists, the information from that patient is returned
If a patient does not exist, a request is sent to the CPR registry to look for the information
The result of this request is not cached or persisted
Info |
---|
Sticky sessions are not required as the cache is stored in the database. |
Disabling Server-side Caching on Searching
Telemedicine Solutions can selectively disable caching for an individual request using the Cache-Control header:
...
In a HAPI FHIR-based client, opt-out can be achieved like this:
...
Filtering on Searching with Included Resources
Info |
---|
This functionality is available from eHealth Infrastructure Release 6.1 when including referenced ClinicalImpression in a Task search. It may later be extended to other resource types. |
...
When a search operation includes references reference resources, however, this cannot be determined up frontupfront. In that case, access is checked for each included resource just before a page of search results is returned to the client. Previously, an error would be returned to the client in case of inadvertent security violations. This behavior behaviour has now been changed to a filtering mechanism instead. Any included resources that the user is not allowed to access are removed from the search result and returned to the client.
When resources have been removed due to access control, an OperationOutcome is included in the search result, where particular elements contains contain the following:
OperationOutcome.issue.severity:
warning
OperationOutcome.issue.code:
suppressed
OperationOutcome.issue.diagnostics:
Some included resources were filtered due to access constraints for the user
Interactions with the Terminology Service
Extracting Translations from ValueSet and CodeSystem
How to determine, say, Danish translations used in ValueSet? The ValueSet as a resource is likely not to contain a proper, displayable value in Danish as the ValueSet can be defined as include of other ValueSet and/or include of entire or partial CodeSystem, and as the display values in the ValueSet are for technical help primarily. Translations, if available, reside in the CodeSystem.
To get translations for at ValueSet, use $expand
as follows:
Call
$expand
on the ValueSetGET <base-url>/fhir/ValueSet/$expand?url=<ValueSet url>&property=designation
Determine best translation:
Choose designation with “da” (for Danish) if available, otherwise
Choose display (as best alternative - this will be in whatever language the concept is defined with)
In the example below, this is the case for code assessment
Info |
---|
Example request and response on $expand on topic-type Request:
Response: { "resourceType": "ValueSet", "status": "active", … { "system": "http://hl7.org/fhir/definition-topic", "code": "assessment", "display": "Assessment" }, … { "system": "http://ehealth.sundhed.dk/cs/topic-type", "code": "self-treatment", "display": "Self-treatment", "designation": [ { "language": "da", "value": "Selvbehandling" } ] } … |
CodeSystems and designations
For supported operations on concept lookups and decomposition, please see the supported operations on CodeSystem at http://hl7.org/fhir/STU3/codesystem-operations.html. Designations targeted consumers/citizens will eg. contain the following data in the designation:
<designation>
<language value="da"></language>
<use>
<system value="http://terminology.hl7.org/CodeSystem/hl7TermMaintInfra"</system>>
<code value="consumer"></code>
</use>
<value value="Højde"></value>
</designation>
Determining the proper code, system and unit for Quantity
Given an observation code
and corresponding system
from the ValueSet ehealth-observation-codes, how does one then determine how to specify an observed quantity or reference range? The following describes how to obtain values to set inQuantity.code
, .system
and .unit
.
To get values forQuantity.code
andQuantity.system
use the ConceptMap conceptmap-obs-code-to-ucum as follows:
Call
$translate
on the givencode
andsystem
:GET <base-url>/fhir/ConceptMap/$translate?system=<system>&code=<code>
On match found, the values to use in
Quantity.code
andQuantity.system
are the matching concept’scode
andsystem
, respectively, where the source ConceptMap is “http://ehealth.sundhed.dk/ConceptMap/conceptmap-obs-code-to-ucum” (see example response below):
Info |
---|
Example request and response on $translate on conceptmap-obs-code-to-ucum Request:
Response: { "resourceType": "Parameters", "parameter": [ { "name": "result", "valueBoolean": true }, { "name": "message", "valueString": "Matches found!" }, { "name": "match", "part": [ { "name": "equivalence", "valueCode": "specializes" }, { "name": "concept", "valueCoding": { "system": "http://unitsofmeasure.org", "code": "kg", "display": "kilogram" } }, { "name": "source", "valueUri": "http://ehealth.sundhed.dk/ConceptMap/conceptmap-obs-code-to-ucum" } ] } ] } |
To get the corresponding and printable value for Quantity.unit
, use the ConceptMap conceptmap-ucum-to-printsymbol as follows:
Call
$translate
on the givensystem
andcode
determined in the response above:GET <base-url>/fhir/ConceptMap/$translate?target=http://ehealth.sundhed.dk/vs/ehealth-ucum-printsymbol-supplement&code=<code>&system=<system>
On match found, extract the matching concept (see example response below).
Call
$lookup
on the matching (CodeSystem)system
andcode
:GET <base-url>/fhir/CodeSystem/$lookup?system=http://ehealth.sundhed.dk/cs/ehealth-ucum-printsymbol-supplement&code=<code>
On match found, the value to use in
Quantity.unit
is the matching concept’sdesignation.value
where thedesignation.language=da
(see example response below). If there is no such designation, the printable value inQuantity.unit
shall be left empty.
Note |
---|
The $lookup does not return designation on eHealth Infrastructure Release 4 and other releases prior to Release 5. |
Info |
---|
Example request and response on $translate on conceptmap-ucum-to-printsymbol Request (Note that URL-encoding of percent as code is used): GET <base-url>/fhir/ConceptMap/$translate?target=http://ehealth.sundhed.dk/vs/ehealth-ucum-printsymbol-supplement&code=%25&system=http://unitsofmeasure.org Response: { "resourceType": "Parameters", "parameter": [ { "name": "result", "valueBoolean": true }, { "name": "message", "valueString": "Matches found!" }, { "name": "match", "part": [ { "name": "equivalence", "valueCode": "specializes" }, { "name": "concept", "valueCoding": { "system": "http://ehealth.sundhed.dk/cs/ehealth-ucum-printsymbol-supplement", "code": "%", "display": "percent" } }, { "name": "source", "valueUri": "http://ehealth.sundhed.dk/ConceptMap/conceptmap-ucum-to-printsymbol" } ] } ] } |
Info |
---|
Example request and response on $lookup on ehealth-ucum-printsymbol-supplement Request (Note that URL-encoding of percent as code is used): GET <base-url>/fhir/CodeSystem/$lookup?system=http://ehealth.sundhed.dk/cs/ehealth-ucum-printsymbol-supplement&code=%25 Response: { "resourceType": "Parameters", "parameter": [ { "name": "name", "valueString": "UCUMPrintSymbolSupplement" }, { "name": "version", "valueString": "0.6.0" }, { "name": "display", "valueString": "percent" }, { "name": "abstract", "valueBoolean": false }, { "name": "designation", "part": [ { "name": "language", "valueCode": "da" }, { "name": "use" }, { "name": "value", "valueString": "%" } ] } ] } |
Determining whether to provide measurement as integer or decimal
Given an observation code
and corresponding system
from the ValueSet ehealth-observation-codes, how does one determine whether an observed quantity or reference range shall be stated as an integer or decimal? While a particular device might produce a decimal with a given precision for a measure, it is up to the client/solution to convert to the form expected by the infrastructure. Whether integer or decimal, the value is set inQuantity.value
.
To determine whether to use integer or decimal, use the ConceptMap conceptmap-obs-code-to-value-type as follows:
Call
$translate
on the givencode
andsystem
:GET <base-url>/fhir/ConceptMap/$translate?system=<system>&code=<code>&target=http://hl7.org/fhir/ValueSet/data-types
On match found, indication of whether to use integer or decimal are the matching concept’s
code
andsystem
, respectively, where the source ConceptMap is “http://ehealth.sundhed.dk/ConceptMap/conceptmap-obs-code-to-value-type” (see example response below).The codes
integer
anddecimal
insystem http://hl7.org/fhir/data-types
signify that the observed value or reference range shall be given as integer and decimal, respectively.
...
Example request and response on $translate on conceptmap-obs-code-to-value-type
Request:
GET <base-url>/fhir/ConceptMap/$translate?system=urn:oid:1.2.208.176.2.1&code=NPU03804&target=http://hl7.org/fhir/ValueSet/data-types
Response:
...