Validic Inform

Validic Inform Developer Hub

Welcome to the Validic Inform developer hub. You'll find comprehensive guides and documentation to help you start working with Validic Inform as quickly as possible, as well as support if you get stuck. Let's jump right in!

Get Started

Business Rules Getting Started Guide

Overview

The Business Rules API allows users to create rules which generate notifications when a user meets certain criteria.

BETA FEATURE

Business Rules is currently an open BETA and is open to all Inform API users. Availability of this feature may change in the future.

Creating a Rule

To create a rule you'll need to POST the following request to the Validic RESTful API. You will need to do this for each user you wish to monitor.

POST https://api.v2.validic.com/organizations/59b02bbdfSAMPLE001e13e75/users/vpt12345sp/rules?token=6f46dbSAMPLEd2b82d91698fcd0896

{
  "message": "VEvJrt5G3KD4nKvl",
  "type": "user/missing_data",
  "window": "P7D",
  "metric": {
    "type": "blood_glucose",
    "unit": "mg/dl",
    "origin": null
  },
  "threshold": {
    "value": 5,
    "comparator": "less_than"
  }
}

API Request Parameters

Field
Description
Required
Accepted Value

type

Defines the rule type.

Yes

Only adherence rules are currently supported, and require the type to be set as "user/missing_data"

window

Sets the sliding window of time over which incoming values should be evaluated as an ISO 8601 Duration value.

For adherence rules:
Yes

message

A message that will be returned when the user rule is triggered.

Yes

This field will store string values of any size.

metric > type

A valid metric type. Please review the supported metric types.

Yes

A valid metric type

metric > unit

Most metric types standardize to one value, however, some may support multiple standard units (blood glucose for instance). Use this field to further refine the metric data that should be evaluated by the rule.

No

Review list of supported metric types and their units

metric > origin

Refine the metric data that should be evaluated by the rule based upon the origin.

No

device, manual, unknown

threshold > value

Defines, in combination with the threshold comparator, when a user rule is triggered.

Yes

Integer, Float

threshold > comparator

Defines, in combination with the threshold value, when a user rule is triggered.

Yes

less_than, greather_than, equal_to

API Response

Once the rule is created, users can expect the following response. Please retain the "id" you used to create this rule. You'll use this to manage updates to your rule.

{
  "id": 123VentureMedWestTrigger1,
  "message": "VEvJrt5G3KD4nKvl",
  "type": "user/missing_data",
  "window": "P7D",
  "metric": {
    "type": "blood_glucose",
    "unit": "mg/dl",
    "origin": null
  },
  "threshold": {
    "value": 5,
    "comparator": "less_than"
  }
}

Triggered Rule Response

The rule event occurs when a specified user rule criteria are met. The rule will contain information about the user, the rule, and any associated data (when applicable). A triggered event will only be published to our Streaming API . You cannot receive triggered event in the RESTful API. Here is an example of rule event when a rule has been triggered.
The following example shows a triggered rule event:

event: rule
data: {
   "user":{
      "uid":"24174455a00c7aa60ace295bd7e06b73065578d3d6db4c90065e8ea0fd775025",
      "user_id":"598b934b8a5da50001ea87c4",
      "organization_id":"58c7fe748a5da50001a310fb"
   },
   "rule":{
      "id":118,
      "type":"user/missing_data",
      "window": "PT604800S",
      "message": "Too few Blood Glucose readings received.",
      "metric": {
        "type": "post_meal_blood_glucose",
        "sub_type": null,
        "unit": null,
        "origin": null
      },
      "threshold":{
        "value":5,
        "comparator":"less_than"
      }
   },
   "data":[
      {
         "type":"user/missing_data",
         "data":{
            "count":0
         }
      }
   ],
   "created_at":"2017-08-31T00:25:50Z"
}

Response Fields

Note

When consumed by a client, the JSON for the event data field would be on one line. It is formatted here for readability.

Field
Description

user > uid

Customer's unique user identifier.

user > user_id

Validic's unique user identifier.

user > organizaiton_id

Validic's unique organization identifier.

rule > id

Unique user rule identifier.

rule > type

Defines the rule type.

rule > window

Indicates the sliding window of time over which incoming values were evaluated. ISO 8601 Duration string format.

rule > message

A message that will be returned for the triggered rule.

rule > metric > type

The metric type.

rule > metric > sub_type

Not currently in use.

rule > metric > unit

The metric unit.

rule > metric > origin

The metric origin.

rule > threshold > value

Defines, in combination with the threshold combinator, when a user rule is triggered.

rule > threshold > comparator

Defines, in combination with the threshold value, when a user rule is triggered.

data > type

The rule type.

data > data

Information about received data that led to the user rule triggering.

created_at

The time the user rule triggered. ISO 8601 string format.

Note

All rules associated with a user are deleted if the user is suspended.

Updating Rules

You may update an existing rule by submitting a PUT request. This request must include the rule_id found in the API response when the rule was created.

PUT https://api.v2.validic.com/organizations/59b02bbdfSAMPLE001e13e75/users/vpt12345sp/rules/123VentureMedWestTrigger1?token=6f46dbSAMPLEd2b82d91698fcd0896

{
  "message": "VEvJrt5G3KD4nKvl",
  "type": "user/missing_data",
  "window": "P5D",
  "metric": {
    "type": "blood_glucose",
    "unit": "mg/dl",
    "origin": "device"
  },
  "threshold": {
    "value": 5,
    "comparator": "less_than"
  }
}
{
  "id": 123VentureMedWestTrigger1,
  "message": "VEvJrt5G3KD4nKvl",
  "type": "user/missing_data",
  "window": "P5D",
  "metric": {
    "type": "blood_glucose",
    "unit": "mg/dl",
    "origin": "device"
  },
  "threshold": {
    "value": 5,
    "comparator": "less_than"
  }
}

Delete a Rule

Deletes a user rule.

DELETE https://api.v2.validic.com/organizations/59b02bbdfSAMPLE001e13e75/users/vpt12345sp/rules/123VentureMedWestTrigger1?token=6f46dbSAMPLEd2b82d91698fcd0896

{
  "id": 123VentureMedWestTrigger1,
  "message": "VEvJrt5G3KD4nKvl",
  "type": "user/missing_data",
  "window": "P5D",
  "metric": {
    "type": "blood_glucose",
    "unit": "mg/dl",
    "origin": "device"
  },
  "threshold": {
    "value": 5,
    "comparator": "less_than"
  }
}

Business Rules Getting Started Guide