Defining data types

When creating rules, you will jump back-and-forth between defining data types (i.e. the 'things' we are talking about) and the rules that operate on those data points.

The ontology defines the data that users will provide

It can be difficult to understand the purpose of the ontology at first sight. If you think about it as describing the data that a user provides to check compliance, it starts to make more sense.

The fundamental data types

When talking about user data, we use different data types to describe different classes of data. The most common data types we use are:

  • True/false values
  • Text
  • Numbers
  • Dates
  • One-of-several options

Data types are primarily used to define the operations that can be performed on them. For example, it makes sense to perform mathematical operations on numbers, such as in this example: total_hours + 2. However, it usually nonsensical to talk about doing maths on text values. What would it mean to divide a person's name by 2?

With that in mind, let's investigate the various data types in detail

Boolean values (true/false)

Named after mathematician George Boole, boolean values are simple true/false values.

For the most part, boolean values are pretty straight forward, and work as you would expect. The only tricky part is knowing when a boolean value is not the right choice. For example, it is usually better to ask for a person's date of birth, rather than asking if they are over 18 years of age.

We will examine situations like this, and others, in a later section.

Text values

Surprisingly, text values are not used very often. For the most part, they are used either to identify (or name) something, or to provide a description of it.

Number values

Depending upon the regulation, number values can be used extensively. In topics such as accounting, payroll and tax, numbers and mathematical expressions form a majority of rules.

Date and time values

Depending upon when you read this guide, there is either one or four date and time data types. We will discuss all four types to prepare you.