How do I log health data?
In Web chatbot, as a logged-in user, when the user tries to login his data using utterances such as "my blood pressure is 120 by 90" or "my height is 6 feet", the data can be saved using the Log Health Data Manager node and Log Health Data node in the Experience Designer flow.
- 1 Log Health Data Manager node
- 2 Inputs
- 2.1 Slots
- 2.1.1 Measurement Type
- 2.2 Intents
- 2.2.1 LogHealthData
- 2.2.2 YesIntent
- 2.2.3 NoIntent
- 2.2.4 NumberIntent
- 2.2.5 Measurement Position
- 2.2.6 None Intent
- 2.2.7 RecordMeasurement (Optional)
- 2.2.8 TypeOfMeasurement (Optional)
- 2.1 Slots
- 3 Log Health Data Flow in Experience Designer
- 4 Working of the flow
Log Health Data Manager node
Log Health Data Manager node, when used along with Log Health Data node, saves health data of the user to the Orbita database.
Inputs
A Log Health Data Manager node will accept inputs in a predefined format that are outlined in the examples below.
Slots
Measurement Type
You can use the following measurement types in the input for the node.
blood glucose
blood pressure
body fat
body mass index
body temperature
calories
calories burned
calories intake
drugs
glucose
heart rate
height
house temperature
medication
medicine
outside temperature
oximetry
oxygen
oxygen level
pills
prescription
pulse
resting heart rate
rr Interval
skin temperature
sleep duration
spirometry
spo2
step count
steps
sugar
sugar level
temperature
walked
weigh
weight
You can place these measurement types in a slot and use them in the utterances within an intent.
The following image shows the slot that contains the measurement types.
Intents
The following intents are used in the sample flow that is shared at the end of the document.
LogHealthData
YesIntent
NoIntent
NumberIntent
RecordMeasurement (optional)
TypeOfMeasurement (optional)
LogHealthData
Create an intent and name it LogHealthData.
Set the State to No State. This lets the intent trigger the flow.
The utterances must include the Measurement Type and the corresponding number, to be given as an input to the Log Health Data Manager Node.
Example utterances
i drank my {measurementType}
i have taken my {measurementType}
lets record my {measurementType} is {integerPart}
my {measurementType} is {integerPart} hours and {fractionPart}
report my {measurementType} is {integerPart} point {fractionPart} pounds
You can configure your intent as shown in the following image. The slots should be appropriately named and used in the utterances.
YesIntent
When a Yes/No question is triggered by Pin1, the YesIntent confirms the inputs.
For example
User says: let's record my weight is hundred pounds
Node (Pin1): you said your weight is 100 pounds, is that correct?
User says: Yes
The node sends the output to Pin2. The LogHealthData node should be connected to Pin2 to save the output.
NoIntent
When a Yes/No question is triggered by Pin1, the NoIntent will be used to discard the input value. The node will prompt a question to get the value for the measurement type that is already saved in the session.
For example
User says: lets record my weight is hundred pounds
Node (Pin1): you said your weight is 100 pounds is that correct?
User says: No
Node (Pin1): what is your weight
NumberIntent
The NumberIntent lets the user provide input as a number. This will be used in specific scenarios where the node throws a reconfirmation message (from Pin1) asking for a value of the measurement type.
From the above example,
User says: lets record my weight is hundred pounds
Node (Pin1): you said your weight is 100 pounds is that correct?
User says: No
Node (Pin1): what is your weight
User says: ninety
Node (Pin1): you said your weight is 90 pounds is that correct?
Measurement Position
The toggle option for the measurement position is mandatory or not mandatory.
Consider the Position checkbox is checked in the node. The Measurement position word is a mandatory field only for Blood Pressure. The node will prompt a question through Pin1.
For example, when the Position is checked:
User says: report my blood pressure is ninety over hundred
Node (Pin1): you said your blood pressure is 100 over 90 is that correct?
User says: Yes
Node (Pin1): were you sitting, standing, or lying down
User says: sitting
The bot autocorrects and takes the bigger number first and the smaller number second.
Any of the measurement position words given below can be used as an input to the node.
Place the following measurement positions in a slot and use the slot in an utterance.
laying
laying down
lying
lying down
Position
semirecumbent
sitting
standing
None Intent
None Intent is triggered if any other utterances other than the stored utterances are used.
If the None Intent is triggered before invoking the flow, the bot will respond with a fall-back message “Sorry, I didn't understand you. Could you repeat that?”.
RecordMeasurement (Optional)
Create an intent with the name RecordMeasurement and set the state as No State.
This intent contains utterances such as Record a Measurement or Record a vital measurement to trigger the flow without stating any measurement or values.
User says: record a measurement
Bot says: What Measurement would you like to record?
TypeOfMeasurement (Optional)
Create an intent and name it TypeOfMeasurement. Set the state as RecordMeasurement.
This intent contains the utterances such that the measurement type is fed as input.
From the above example,
User says: record a measurement
Bot says: What measurement would you like to record?
User says: height
Bot says: Ok, what is your height measurement?
User says: six feet
Node (Pin1): you said your height is 6 feet 0 inches tall, is that correct?
Log Health Data Flow in Experience Designer
The following image shows the flow with which you can log health data.
Working of the flow
User not logged in
If the user is not logged in, he/she will get the error below when they try to invoke the flow.
“Access is denied due to invalid credentials”
User logged in
If a user is logged in, the data will be stored for that user.
With Measurement type
If the utterances contain the measurement type and corresponding values, the LogHealthData intent will invoke the flow.
The first time a user’s health data is input to the node, the node checks the following:
measurementType
integerPart and fractionPart
Position
If measurementType and Number are present, then the output is set to Pin1, to get a confirmation on whether to save the input parameters.
The next input the node expects is Yes or No to save or discard the input parameters.
If the input is No, a default message will be sent to Pin1.
If the input is Yes, the input parameters will be sent to Pin2.
Example output (Pin2):
msg.payload=
{ "unitOfMeasurement" : "MMHG",
"measurementValue" : {
"diastolic" : 80, "systolic": 120
},
"source" : {},
"_id" : "586c81caf43a1099dcfcb1af",
"user" : "58685b4822c81018cc06e06c",
"recordedTime" : "2017-01-04T05:02:02.818Z",
"createdAt" : "2017-01-04T05:02:02.000Z",
"modifiedAt" : "2017-01-04T05:02:02.000Z",
"__v" : 0
}
Without Measurement type (Optional)
When the utterance is given without any measurement type, the bot will ask for a measurement type.
Once the measurement type is given, the bot will ask for a value.
This value along with the measurement type will be fed to the node.
The node sends a confirmation message to Pin1.
If YesIntent is triggered, the output will be sent to Pin2.
Log Health Data node
To save the input data, the log health data node should be connected to Pin2 of the log health data manager node.