React Native Migration Guide

React Native Inform SDK Wrapper

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. You can also find all of the Inform README documentation on this site by starting here and reviewing the appropriate child pages for your use case.

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 is available in a new Artifactory mobile portal. If you are currently using the mobile portal located at https://mobileportal.validic.com/, you will need to be granted access to the new mobile portal. Please contact Validic support to be placed on our waitlist for access to the new mobile portal and Inform 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 APIs before implementing the new Inform SDK modules/frameworks.
  • You must use the Inform version of the session module if you plan to use any other Inform module. The @validic-mobile/react-native-inform-core module replaces react-native-validic-session. All references to ValidicSession must be replaced with ValidicCore. For example, ValidicSession.startSession() becomes ValidicCore.startSession().
    • For example, if you are going to update to the Inform ValidicBluetooth module, you must also update to the Inform ValidicCore modulr at the same time.
    • The Inform Session supports both v1 and Inform data models for backwards compatibility, so replace the v1 Session with the Inform Session when you start to use Inform modules in your mobile project.

Installation

The Inform React Native SDK is available via Validic's Artifactory instance. The Validic Mobile Portal will eventually be phased out and does not host the Inform SDKs. Please contact Validic Support for instructions to get set up in Artifactory.

To install into an existing React Native project using yarn:

yarn add @validic-mobile/react-native-inform-core --registry https://validic.jfrog.io/artifactory/api/npm/mobile-npm-release/

In order to use any Inform SDK, the Validic Core SDK in your project must be updated to Inform as well. The Inform Core SDK is backwards-compatible with v1 SDKs (Bluetooth, HealthKit, OCR, and LifeScan), so you can upgrade the feature SDKs one at a time if you prefer.

For example, if your project implements Core, Bluetooth, and HealthKit; you can upgrade Core and HealthKit to their Inform versions, but leave Bluetooth at v1. Or you can update Core and Bluetooth to Inform and leave HealthKit on v1. Or you can upgrade all 3 at once. You will not receive session events for v1 anymore, but you will still be able to submit records from v1 modules.



Session (react-native-inform-core)

The @validic-mobile/react-native-inform-core module replaces react-native-validic-session. All references to ValidicSession should be replaced with ValidicCore. For example, ValidicSession.startSession() becomes ValidicCore.startSession().

Method Changes

Some methods have been renamed from v1 SDK to Inform SDK.

  • The method to get the current user has been renamed: ValidicSession.getUser() in v1 is now ValidicCore.getCurrentUser().
  • The method to submit a record to the Validic backend has been renamed from ValidicSession.submitRecord() to ValidicCore.submit().
  • There is not currently an Inform replacement for the ValidicSession.submitRecords() method for submitting multiple records. To submit multiple records in Inform, loop over the array of records and call submit() for each one.
  • There is no Inform replacement for the version property at this time.

Logging

Validic debug logging has not changed in the Inform SDKs. You can find more details in Logging.

User Session

The User object properties have been changed from v1 for consistency with other properties and our other wrappers.

Old (v1 SDK):

export interface User {
  org_id: string;
  user_id: string;
  user_token: string;
}

New (Inform SDK):

export interface User {
  organizationID: string;
  userID: string;
  accessToken: string;
}

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

  • Only v2 org users are supported. If an existing session is loaded with a user from a v1 org, the session will fail its first attempted record upload and be ended.
  • Some notifications are named differently in the Inform SDKs:
    • When listening for Inform record submission success/failure notifications, use validic:core:inform:onrecord and validic:core:inform:onerror.
    • In the validic:core:inform:onsessionend notification, unsubmitted Inform records are available in the event's informRecords key.

Inform Records

Records 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 React Native 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.
  • Intraday is not supported in the React Native wrapper. If you are interested in using intraday, please reach out to Validic Support.

Summary of differences between v1 and Inform records

  • In v1 records, activity_id was used as a unique identifier for each record. That property is called log_id in the Inform SDK.
  • v1 records had lots of 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 record metric stores an individual measurement value, along with its unit and origin. Value is a number and unit is a string. 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:

  • device is for metrics that were measured by a device (such as a smart watch, glucometer, etc).
  • 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.
  • unknown is for metrics where the origin cannot be reliably determined.


Bluetooth (react-native-inform-ble)

The @validic-mobile/react-native-inform-ble package replaces react-native-validic-ble.

Model changes

The Inform version of the ValidicBluetooth framework exclusively creates objects compatible with the InformRecord interface. All callback methods and notifications that pass a Record-like interface in v1 will pass an InformMeasurement.

Method changes

The peripheralID parameter has been hoisted out of the pairPeripheral and readPeripheral options parameter, into its own dedicated parameter. Instead of calling readPeripheral({peripheralID: 1}), use readPeripheral(1, {/_ other options _/}).

Foreground and background events

The event names are the same, and the structure of the events has mostly remained the same as well. However, in the validic:ble:onbackgroundread event, instead of a records key that has an array of v1 Record objects, there is a measurement key that has an array of InformMeasurement objects.

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_MIN.



Apple Health (react-native-inform-healthkit)

The @validic-mobile/react-native-inform-healthkit package replaces react-native-validic-aggregator-ios.

Note that the list of supported HealthKit Sample Types has changed between v1 and Inform. Please review the SampleTypes enum.

Historical Fetch

The members of the HistoricalSets enum have been renamed:

  • HistoricalSetRoutine is now Summary
  • HistoricalSetFitness is now Workout

Event

The validic:healthkit:onrecords will still contain recordType and count keys, but the recordType value will be an Inform record type (string) instead of a v1 record type enum (number).

Health Connect (react-native-inform-healthconnect)

The @validic-mobile/react-native-inform-healthconnect package is new, but it effectively replaces both react-native-validic-aggregator-fit and react-native-validic-aggregator-shealth which do not have Inform equivalents.

The interface for the new package is different than the previous packages, so please review the Health Connect documentation closely for information on how to implement it.