react-native-veyetals-online
v0.3.3
Published
Aws Kinesis WebRTC based video chat solution that integrates Veyetals scanning to calculate a patients vitals using rPPG technology
Downloads
113
Readme
iOS Integration Guide
Add awsconfiguration file to your XCode project
Initialize SDK with the following Code
import { NativeModules } from "react-native"
const { VitalsOnlineManager } = NativeModules
try{
const result = await VitalsOnlineManager.initializeWithUserName("userName", "userId", "password", "applicationName")
console.log(result)
}catch(err){
console.log(err)
}
Incoming VOIP Calls
Use react-native-voip-push-notification
to setup VOIP notifications in iOS app. After integrating react-native-voip-push-notification
use following functions to register VOIP token and receive incoming call.
import { NativeModules } from "react-native"
const { VitalsOnlineManager } = NativeModules
//Register VOIP push notification token with veyetals-online
try{
const result = await VitalsOnlineManager.registerForVoipNotificationsWithToken(token)
console.log(result)
}catch(err){
console.log(err)
}
//Report incoming push notification to veyetals-online
try{
const result = VitalsOnlineManager.reportIncomingCallWithPayload(payload)
console.log(result)
}catch(err){
console.log(err)
}
Initiate iOS outgoing call
Initiating outgoing call is pretty simple. It only requires remote user's callerId which is the same ID user uses to login into VitalsOnline. Calling user must be logged into the VitalsOnline SDK using VitalsOnlineManager.initializeWithUserName
function before he could initiate outgoing call.
import { NativeModules } from "react-native"
const { VitalsOnlineManager } = NativeModules
VitalsOnlineManager.startVideoCallWithUserId("<userId>")
Deregister device for VOIP push notifications
Upon user logout deregister device for VOIP push notifications using following function.
import { NativeModules } from "react-native"
const { VitalsOnlineManager } = NativeModules
//Register VOIP push notification token with veyetals-online
try{
const result = await VitalsOnlineManager.deregisterFromVoipNotifications()
console.log(result)
}catch(err){
console.log(err)
}
iOS - VeyetalsOnlineViewIOS
VeyetalsOnlineViewIOS
is iOS only ReactNative view to scan user vitals using iPhone Camera.
NPM Package instructions are the same as for Android. Following are the system requirements for integration of VeyetalsOnlineViewIOS in React Native iOS application.
iOS Version: 13.0 and above.
Swift Version: 5.0
Camera Usage Permission: Add camera usage string in application's info.plist file
How to use VeyetalsOnlineViewIOS
component in iOS app
import { VeyetalsOnlineViewIOS } from 'react-native-veyetals-online';
async function onCompleted(vitals) {
console.log('Veyetals scanning is complete');
//process vitals - sample output
/*
{
"Heart-rate": "64",
"HRV": "100",
"02-saturation": "97",
"Respiration-rate": "12",
"Systolic": "112",
"Diastolic": "70",
"Stress-levels": "-1",
"snr": "3",
"glucose": "104",
"isValidHeartRate": "true",
"isValidBloodPressure": "true"
}
*/
}
async function onCancelled() {
console.log('Veyetals scanning cancelled');
//update view
}
const customLabels = {
multiCameraAlertTitle: "Multi Camera Alert Title",
multiCameraAlertMessage: "Multi Camera Alert Message",
userMovementErrorMessage: "User Movement Error Message",
faceAlignmentMessage: "Face Alignment Message",
//Custom label for invalid vital alert view title
INVALID_VITAL_ALERT_TITLE: "Invalid vital value",
//Custom labels for invalid vitals captured via face scan
INVALID_RPPG_HR_ALERT_MSG: "Invalid heart rate value",
INVALID_RPPG_HRV_ALERT_MSG: "Invalid heart rate variability value",
INVALID_RPPG_STRESS_ALERT_MSG: "Invalid stress level value",
INVALID_RPPG_RL_ALERT_MSG: "Invalid respiratory rate value",
INVALID_RPPG_BP_ALERT_MSG: "Invalid blood pressure value",
INVALID_RPPG_O2_ALERT_MSG: "Invalid oxygen saturation value",
//Custom labels for invalid vitals captured via finger scan
INVALID_PPG_HR_ALERT_MSG: "Invalid heart rate value"
INVALID_PPG_HRV_ALERT_MSG: "Invalid heart rate variability value",
INVALID_PPG_STRESS_ALERT_MSG: "Invalid stress level value",
INVALID_PPG_RL_ALERT_MSG: "Invalid respiratory rate value",
INVALID_PPG_BP_ALERT_MSG: "Invalid blood pressure value",
INVALID_PPG_O2_ALERT_MSG: "Invalid oxygen saturation value"
}
<VeyetalsOnlineViewIOS
style={{
flex: 1,
}}
config={{
userId: <USER_ID>,
channelId: <CHANNEL_ID>,
mode: [face|finger],
isLightWeight: false,
customLabels: customLabels,
}}
onComplete={onCompleted}
onCancel={onCancelled}
/>
User Management
VeyetalsOnlineViewIOS
internally manages users to keep track of service usage. For this purpose it requires following 3 pieces of information from the client app:
CHANNEL_ID: Uniquely identifies an organisation. SDK clients must request CHANNEL_ID from Veyetals team before integrating the component in their application.
APP_ID: Uniquely identifies an app. A channel may have multiple apps using the VeyetalsOnlineViewIOS
view. APP_ID is programatically obtained from the client application.
USER_ID: Uniquely identifies an app user for a specific APP_ID and for a specific CHANNEL_ID. Used to track users per app per channel.
These three pieces of information help Veyetals to aggregate the number of users using Veyetals service per app per channel and help generate billing. Before integrating SDK it’s essential for client to contact Veyetals team and activate CHANNEL_ID and APP_ID.
Data Privacy
RNVeyetalsNative component doesn’t store users' video or vitals data; neither on the device nor in the cloud. Therefore, it’s responsibility of the client application to protect user data.
Android Integration Guide
In App level build.gradle
add following into dependencies
:
def aws_version = '2.73.0'
implementation("com.amazonaws:aws-android-sdk-kinesisvideo:$aws_version@aar") { transitive = true }
implementation("com.amazonaws:aws-android-sdk-kinesisvideo-signaling:$aws_version@aar") { transitive = true }
implementation("com.amazonaws:aws-android-sdk-kinesisvideo-webrtcstorage:$aws_version@aar") { transitive = true }
implementation("com.amazonaws:aws-android-sdk-mobile-client:$aws_version@aar") { transitive = true }
implementation("com.amazonaws:aws-android-sdk-auth-userpools:$aws_version@aar") { transitive = true }
implementation("com.amazonaws:aws-android-sdk-auth-ui:$aws_version@aar") { transitive = true }
implementation 'org.webrtc:google-webrtc:1.0.+'
implementation 'org.awaitility:awaitility:4.2.0'
implementation 'org.json:json:20190722'
implementation 'com.google.guava:guava:28.1-android'
implementation 'com.google.code.gson:gson:2.8.9'
implementation 'org.apache.commons:commons-lang3:3.9'
implementation('org.glassfish.tyrus.bundles:tyrus-standalone-client:1.20') { exclude module: 'javax.inject' }
//Coroutines
implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-core:1.3.7'
implementation 'androidx.lifecycle:lifecycle-livedata-ktx:2.2.0'
//Retrofit
implementation "com.squareup.okhttp3:okhttp:4.7.2"
implementation "com.squareup.okhttp3:logging-interceptor:4.9.0"
implementation "com.squareup.retrofit2:retrofit:2.9.0"
implementation "com.squareup.retrofit2:converter-gson:2.9.0"
Usage
import { NativeModules } from "react-native"
const {RNVitalsOnline} = NativeModules;
try {
RNVitalsOnline.startCall(
callerId,
callerName,
password,
calleeId,
calleeName,
veyetalsMode,
application,
isOutgoingCall,
)
} catch (error) {
console.log(error);
}
Properties
| Property | Description | Type | Required |
| -------- | ----------- | ---- | -------- |
| callerId
| id of the user | String | Yes |
| callerName
| name of user | String | Yes |
| password
| password to access vitals online | String | Yes |
| calleeId
| id of user to be called | String | Yes |
| calleeName
| name of user to be called | String | Yes |
| veyetalsMode
| master / viewer | String | Yes |
| application
| name of app | String | Yes |
| isOutgoingCall
| true/ false | boolean | Yes |
Stress Mappings
-1 --> Relaxed
0 --> Normal
1 --> Low Stress
2 --> Medium Stress
3 --> High Stress
4 --> Very High Stress