Migrating from the v1.x.x SDK to the Inform SDK (v2.x.x)

Overview

The Inform version (2.0.0 and newer) of the Validic Mobile Library is designed to improve interoperability with the rest of the Validic ecosystem. It includes improved Record models that closely match the models used in the rest of the Validic Inform system, but offers a clear production upgrade path by maintaining backward-compatibility with the v1 models.

Each module contains a README with usage information for v1 and Inform.

Important Notes

  • "Inform SDK" refers to the Validic Mobile SDK release versions that are 2.0.0 and newer. "v1 SDK" refers to all 1.x.x versions of the Validic Mobile SDK.
  • The Inform SDK only supports Inform organizations. If you are still using Validic's v1 (legacy API) system, please contact support to migrate to Inform before implementing the new Inform SDK modules/frameworks.

Shared

Inform Records

The Record class and its subclasses have received a big overhaul in the Inform SDK. We've addressed a lot of the weaknesses in the v1 model, as well as brought the models into alignment with what the rest of the Validic Inform system uses. This will make interacting with the native record models much simpler, as they will look almost exactly like the models you receive from the Inform APIs.

The main Validic Record class in the Inform SDK is InformRecord - all record classes inherit from this class. The subclasses are:

  • InformMeasurement: provides point in time measurements, like height, weight, blood pressure, glucose, etc. It replaces v1's Diabetes, Biometrics, and Weight.
  • InformNutrition: provides a summary of your daily nutritional intake. It replaces v1's Nutrition.
  • InformSleep: provides a record of your sweet, sweet dreams. It replaces v1's Sleep.
  • InformSummary: provides a summary of your daily activity, like steps, calories and heart rate. It replaces v1's Routine.
  • InformWorkout: provides a list of all workout events. It replaces v1's Fitness.
  • InformIntraday: provides a list of time series data for a given user. It replaces v1's Intraday.

Summary of differences between v1 and Inform records

  • In v1 records, activityID was used as a unique identifier for each record. That property is called logID in the Inform SDK.
  • v1 Record subclasses had properties to hold individual measurements, e.g. Biometrics had dozens of fields including systolic, diastolic, temperature, and spo2. In the Inform records, each individual measurement is represented as a Metric, which has its own value, unit, and origin. See the Metrics section below for more info.
  • The v1 record field validated is now represented in each metric's origin.
  • The data in the v1 field sourcePeripheral is now available in source.device.model.
  • The data in the v1 field originalSource is now available in source.device.manufacturer.
  • The data in the v1 field intermediarySource is not directly available anywhere, but source.type contains something analogous.

Metrics

Each InformRecord stores a list of Metrics along that contain its value, its unit, and origin. Value is a BigDecimal, and unit is specific to the type and is represented as an enum constant. Note that not all units supported in the Validic Inform system are available in the Inform SDK at this time - we will be working to add more as time goes on.

Origin represents the source of the value, and replaces the v1 record field validated:

  • Origin.device is for metrics that were measured by a device (such as a smart watch, glucometer, etc).
  • Origin.manual is for metrics that were manually entered by the end user. These might be less trustworthy, as the user could have entered a value incorrectly.
  • Origin.unknown is for metrics where the origin cannot be reliably determined. This is the default

Here's how to get a metric of a specific type from a record:

val bodyWeightMetric = record.metrics.firstOrNull(it.type == BodyWeight.Type.value);

User session

User session behavior remains almost identical to the behavior in v1, with a few notable exceptions:

  • There is no "Default user" provided in the Inform SDK
  • Submitting records is now done in the SessionV2 object with a kotlin suspend function.
  • Listening for a session ending event is handled by registering a listener on SessionV2. Any unsubmitted Inform records are available as as argument by overriding fun onUserSessionEnded(user: User, records: List<InformRecord>?)

validicmobile-ble

Model changes

The Inform version of the ValidicBluetooth exclusively creates InformRecord-based records. All callback methods and listeners that previously were called with a v1 Record subclass will be called with a InformRecord subclass. See Inform Records for the list of subclasses

Removal of deprecated methods

A new set of callback methods was recently introduced in BluetoothPeripheralControllerListener that contain return a List<Measurement> in v2 for the success method.

// v1
public void onSuccess(BluetoothPeripheralController peripheralController, BluetoothPeripheral peripheral, BluetoothDevice bluetoothDevice, List<Record> records);
// Inform
public void onSuccess(BluetoothPeripheralController peripheralController, BluetoothPeripheral peripheral, BluetoothDevice bluetoothDevice, List<Measurement> records);

Out-of-bounds glucose readings

In v1, readings that indicated a high or low glucose value were transformed into +FLT_MAX and -FLT_MAX, respectively. In Inform, high and low glucose readings are transformed into +INT_MAX and -INT_MAX.

validicmobile-ocr

Model changes

The Inform version of the ValidicOCR framework exclusively creates InformRecord-based records. All callback methods and notifications that previously were called with a v1 Record subclass will be called with a Measurement. See Inform Records for more information about the Measurement type.

Units

In v1 when initializing the ValidicOCRController the enum for each unit type is defined in the Diabetes.Unit.Glucose enum. For inform these units are enums and constants defined in the validicmobile-ocr module.

Initializer changes

The OCRViewController initializer methods take a peripheralID: Int argument in v1; in Inform, the initializers take a peripheral:OCRPeripheral argument.

validicmobile-lifescan

In v1, the helper method is an initializer on Diabetes; in v2, the helper method is an initializer on Measurement.

val response = BloodGlucoseResponse() // response from one touch

val measurements = response.asInformMeasurements()