Getting Started
Stress measurement

Start measuring stress and provide insight to you and your users.

After completing SDK setup, there's a few methods that you can use to get measure your user's stress.

At the top of each file that you'd like to use any of the methods described below, import the Limbic module.

  1. import Limbic

Get stress for current user

The main method that is important is getting the stress levels of the current user. We're mining the data from HealthKit, feed it into our AI and return stress levels to you.

  1. override func viewDidLoad() {
  2. super.viewDidLoad()
  3. let limbic = Limbic()
  4. // Do any additional setup after loading the view, typically from a nib.
  5. limbic.getStressforCurrentUser(startDate: Date(), endDate: Date(), data: nil) { stress in
  6. // for return values, see below
  7. }
  8. }

Return values

The SDK will return a dictionary with an unix timestamp of the measurement (resolution will be daily) as a key.

  1. {
  2. "1515174614" : {
  3. "stressIndex" : 0.49430439430,
  4. "confidence" : 0.02003929329
  5. }
  6. }

stressIndex the stress level score for an individual user. The score is relative to the average baseline calculated on historic data for the user. Here, a score of '0' denotes baseline stress levels. A score above this baseline denotes higher-than-average stress; below denotes lower-than-average stress. (We are currently working on a stressIndex value that is calculated relative to the overall population baseline - this will indicate a particular user's stress level compared to others).

confidence the statistical confidence interval (CI) of our prediction. A low CI value denotes a high certainty; a large CI value denotes low certainty.

Helper functions

To make your life even easier, we've made it even easier to call certain timeframes with some helper functions.

  1. limbic.getLastDayStressForCurrentUser { stress in
  2. print(stress)
  3. }
  1. limbic.getLastWeekStressForCurrentUser { stress in
  2. print(stress)
  3. }
  1. limbic.getLastMonthStressForCurrentUser { stress in
  2. print(stress)
  3. }
  1. limbic.getLastYearStressForCurrentUser { stress in
  2. print(stress)
  3. }