# Simple types

## String

This type is used to store a sequence of characters.

## Boolean

This type  has only two possible values:  `true` and  `false`. It is used as a simple flag that tracks true/false conditions.

## Numeric types

In DI numeric values can be Integer or Decimal values.

• An Integer value is a 64-bit two's complement integer.
• the minimum representable value (called Integer MIN_VALUE) is -263 = -9223372036854775808
• the maximum representable value (called Integer MAX_VALUE) is 263-1 = 9223372036854775807.
• A Decimal value is a floating point type associated to double precision 64-bit format IEEE 754 value.
• The minimum representable value (called Decimal MIN_VALUE) 2 -1074 ~4.9 E-324
• The maximum representable value (called Decimal MAX_VALUE) is  (2-2 -52)·21023 ~ 1.7976931348623157 E308.
• The Decimal data type define three special values:
• Negative infinity.
• Positive infinity.
• NaN. Stands for "Not A Number". It is used to represent a value that does not represent a real number. For example 0/0 is undefined as a real number, and so represented by NaN.

A Decimal value can hold Integer values. So a function defined as  `Decimal Compute`(Decimal input1, Decimal input2) can be used with two Decimal inputs but also with 1 Decimal input and 1 Integer input or two Integer inputs.

## Time related types

• Duration: allows to define an amount of time. Internally an Integer amount of milliseconds. So min value is -263 millis and max values is 263-1 millis.
• CalendarDuration: allows to define an amount of time using a custom unit. The custom unit can be one of "millisecond", "second", "minute", "day", "week", "month", "year". Using this type of duration allows to address issues linked to :
• minutes lasting more than 60 seconds (leap seconds).
• days lasting 23 or 25 hours (daylight time changes).
• months lasting from 28 to 31 days.
• years lasting from 365 to 366 days.
• Instant: allows to define an instant in the datetime continuum.
• Interval: allows to define an interval of time between two instants start and end. By default an Interval is inclusive of the start instant and exclusive of the end instant.

# Complex types

## Classifier

This type is used to represent a classification. It contains an ordered list of instances that are the different states of that classification.

Its value is composed by the following properties:

Property Description
Value the selected instance UUID
Label the selected instance name
Rank the selected instance rank (0-based index)
Example of value
```{
"Value": "00000002-0001-0000-130b-29020cc02800",
"Label": "NORMAL",
"Rank": 0
}```

## Baseline

This type is used to create a data profile.

Its value is composed by the following properties:

 average the mean of the data values standardDeviation the dispersion of the data values

The properties can be Decimal or Duration.

Example of value
```{
"average":"13",
"standardDeviation":"1.2"
}```

## Thresholds

This type defines a mapping between ranges of values and a classifier instance.

Its value is a List of rules

Each rule is a greater than comparison from a threshold value with an associated classifier instance.
A rule is composed by the following properties:

 classifier the associated classifier instance label (mandatory) threshold the value to compare with (not set for default value) included either the threshold is included or not (not set for default value)if true, we use a greater than or equals comparison, if false, we use a greater than comparison.

The threshold property can be Decimal, Duration, Integer, Instant or String.

Examples
Evaluation type Value

```{
"rules": [
{
"classifier": "CRITICAL",
"threshold": 2,
"included": false
},
{
"classifier": "WARNING",
"threshold": 1,
"included": false
},
{
"classifier": "NORMAL",
"threshold": -1,
"included": true
},
{
"classifier": "WARNING",
"threshold": -2,
"included": true
},
{
"classifier": "CRITICAL"
}
]
}```
```{
"rules": [
{
"classifier": "CRITICAL",
"threshold": 10,
"included": false
},
{
"classifier": "WARNING",
"threshold": 5,
"included": true
},
{
"classifier": "NORMAL"
}
]
}```
```{
"rules": [
{
"classifier": "NORMAL",
"threshold": 5,
"included": true
},
{
"classifier": "WARNING",
"threshold": 0,
"included": false
},
{
"classifier": "CRITICAL"
}
]
}```

## Dispersion multipliers

This type defines a mapping between multiplication factors and classifier. It can be used to evaluate new thresholds from a baseline by multiplying its standard deviation by the corresponding multiplication factor and adding the average .

Its value has exactly the same structure as Thresholds.

The threshold property can be only Decimal.

## Forecast

This type contains a list of forecasts at a specific time.

Each forecast value has the following properties:

 value integer, decimal or duration validTime the forecast instant when the value is valid

The value property can be Decimal, Duration or Integer.

Example of value
```{
"forecasts": [
{
"validTime": "2016-01-27T19:00:00",
"value": 1
},
{
"validTime": "2016-01-27T20:00:00",
"value": 2
},
{
"validTime": "2016-01-27T21:00:00",
"value": 3
}
]
}```

## Calendar configuration

This type is used to configure time frame fo calendar period types.

Its value is composed of the following properties:

Property Description
timeZone The time zone that applies to ICS event (if not already specified)
rules An ordered list of period type configuration

Each period type configuration has the following properties:

Property Description
period The period type name
Example of value
```"calendarConfiguration": {
"timeZone": "Europe/Paris",
"rules": [
{
"period": "High",
"ics": "BEGIN:VCALENDAR
BEGIN:VEVENT
DTSTART:20170101T120000
DTEND:20170101T000000
RRULE:FREQ=DAILY
SEQUENCE:0
END:VEVENT
END:VCALENDAR"
},
{
"period": "Low",
"ics": "BEGIN:VCALENDAR
BEGIN:VEVENT
DTSTART:20170101T080000
DTEND:20170101T160000
RRULE:FREQ=DAILY
SEQUENCE:0
END:VEVENT
END:VCALENDAR"
}
]
}```