FHIR

Functions to simplify working FHIR data

code(codeable)

Return the first code in the Codeable Concept.

Parameters
Name Required Type Description

codeable

Yes

CodeableConcept

CodableConcept instance

Returns

Text

Examples
fhir.code(codeable) => "25064002"

codes(codeable)

Return all codes in the Codeable Concept.

Parameters
Name Required Type Description

codeable

Yes

CodeableConcept

CodableConcept instance

Returns

Collection of Text

Examples
fhir.codes(codeable) => "[\"25064002\", \"128045006\"]"

extension(resource, url)

Function that extracts extension based on url from given FHIR resource and retrieves value found in that extension, following valueXXX pattern.

Parameters
Name Required Type Description

resource

Yes

Any

FHIR resource

url

Yes

Text

URL that identifies extension

Returns

Any

Examples
fhir.extension(fhirResource, "http://hl7.org/fhir/StructureDefinition/structuredefinition-wg") => "fhir"

questionaire answer(response, linkId)

Function that extracts answer for given questionaire response based on link id. Retrieves value following valueXXX pattern

Parameters
Name Required Type Description

response

Yes

Any

FHIR Questionaire response

linkId

Yes

Text

Link id in the response

Returns

Any

Examples
fhir.questionaire answer(response, "1.1.1") => "1234"

reference matches(id, resource)

Function that checks if given FHIR resource matches the string id e.g. Patient/12345.

Parameters
Name Required Type Description

id

Yes

Text

URL that identifies extension

resource

Yes

Any

FHIR resource

Returns

Any

Examples
fhir.reference matches("Patient/12345", fhirResource) => true

reference matches(identifier, resource)

Function that checks if given FHIR resource matches the identifier (system and value is primary match, if no system is set uses type/coding)

Parameters
Name Required Type Description

identifier

Yes

Any

FHIR resource identifier

resource

Yes

Any

FHIR resource

Returns

Any

Examples
fhir.reference matches({"system" : "urn:oid:1.2.36.146.595.217.0.1", "value":"12345"}, fhirResource) => true

resources in bundle(bundle, [type])

Function that extracts resources from given FHIR resource bundle, optionally filter by resource type.

Parameters
Name Required Type Description

bundle

Yes

Any

FHIR resource bundle

type

No

Text

Resource type to filter

Returns

collectionOfAny

Examples
fhir.resources in bundle(fhirBundle) => "[{\"resourceType\": \"Observation\"}, {\"resourceType\": \"Patient\"}]"

fhir.resources in bundle(fhirBundle, "Observation") => "[{\"resourceType\": \"Observation\"}, {\"resourceType\": \"Observation\"}]"

value(resource, [prefix])

Function that extracts values from given FHIR resource that are based on valueXXX pattern. This function will introspect all aviailable valueXXX properties and return one that has a value. It is expected that only one will have the value.In addition, prefix can also be specified to extract not value but for example 'effectiveXXX'

Parameters
Name Required Type Description

resource

Yes

Any

FHIR resource

prefix

No

Text

Prefix of the property, if not given 'value' is used

Returns

Any

Examples
fhir.value(fhirResource) => "12345"

fhir.value(fhirResource, "effective") => true

Data Types

CodeableConcept

Codable Concept

Properties

Name Type Description

coding

array

coding

text

Text

text

Coding

Coding

Properties

Name Type Description

code

Text

code

display

Text

display

system

Text

system

userSelected

Boolean

userSelected

version

Text

version

Quantity

Quantity

Properties

Name Type Description

code

Text

code

comparator

Text

comparator

system

Text

system

unit

Text

unit

value

Number

value

Ratio

Ratio

Properties

Name Type Description

denominator

Number

denominator

numerator

Number

numerator