FHIR for Developers: Part 4

Jaideep Pahwa
Nerd For Tech
Published in
4 min readMay 21, 2022

Data Types in FHIR

As in any other language or specification, FHIR has a set of data types used to define the resource elements. Most of the data types are very similar to any other programming language but along with these fundamental data types defined in FHIR, they will serve some special and exciting use-cases in the world of healthcare.

This article will take a deeper dive into different data types in FHIR and their use case behind it.

In FHIR there are basically four categories of data types:

Primitive Types: Simple/primitive types, which are single elements with a primitive value. These include common data types that are used in many other programming languages. Following are examples of a few of the available primitive data types.

string: “The patient is doing good”

boolean: true/false

date: 2019–02–09

decimal: 1234.00001

integer: 1234

uri: https:/medi.info/set (Yes! FHIR has a separate Data Type for a URI/URLs due to extensive use of URI/URLs in the FHIR data set)

base64Binary: bhg6868kc989..(storing images and documents in binary)

dateTime: 2013–06–08T10:57:34+01:00

instant: 2013–06–08T10:57:34.099+01:00

Difference between dateTime and instant is of precision. dateTime is generally used for human times and has lesser precision as compared to instant which is used for machine times. Also precision of dateTime is variable eg. doctor will give you priscription in dateTime format.

Primitive DataTypes

General-purpose Types: General-purpose complex types, are re-usable clusters of elements. These are the mini structures that are reused in different parts and places in the specification. A good example of the general-purpose data type would be HumanNames.

General-purpose Data Types

HumanNames is used at multiple places in the FHIR specification for defining the name of different actors like a patient, practitioners, etc.

HumanName DataType

CodeableConcept is used whenever we need to store the values that follow some specific terminology. eg: storing the disease or medication of the patient. We may use a terminology server that may supply us with these values.

CodeableConcept

You might have noticed 0..1, 1..1, 0..* in the above picture. This represents the cardinality. Cardinality in simple words tells you how many values a particular field can hold. 0..1 represents 0 or 1 similarly 0..* represents 0 or more.

Metadata Types: A set of types for use with metadata resources.

Metadata Data Types

ContactDetail: This is used for storing the contact details of anyone.

ContactDetail’

DataRequirement: The DataRequirement structure defines a general data requirement for a knowledge asset such as a decision support rule or quality measure.

DataRequirement

Special Purpose Types: These types are defined for some specific purpose within the specification.

Special Purpose Data Types

References: Many of the defined elements in a resource are references to other resources. References are always defined and represented in one direction — from one resource (source) to another (target). The corresponding reverse relationship from the target to the source exists in a logical sense but is not typically represented explicitly in the target resource.

References

Meta: It is used for representing information about any resource . It includes information about resources like profiles, version, identifies etc. Don't confuse this with the Metadata Data Types, both serve different purposes in FHIR.

Meta

This article includes a few of the important data types. There are many other data types are available in FHIR documentation. You can check out the documentation for more details.

On lighter note:

If you loved my work please like and share this article( it’s free :)). Also, do follow me for more articles like these.

Also, check out my other articles:

5 Minutes Tech

3 stories

FHIR for Developers

9 stories

Self Help

2 stories

General Tech

2 stories

--

--

Jaideep Pahwa
Nerd For Tech

Software Engineer at Walmart | Tech Enthusiast | Avid Learner