Cortex returns empty data for sociability features (calls & sms)

I tried using Cortex to fetch some data for the raw features calls and sms. Even after querying Cortex for the calls feature for as long as 50 days, and for multiple patients, I’m getting empty data. I’ve added the code for this below for one such patient.

import cortex
import os
import datetime

# Credentials
os.environ['LAMP_ACCESS_KEY'] = 'MY_LAMP_ACCESS_KEY'
os.environ['LAMP_SECRET_KEY'] = 'MY_LAMP_SECRET_KEY'
os.environ['LAMP_SERVER_ADDRESS'] = 'api.lamp.digital'

PARTICIPANT_ID = 'U1606505063'
RELAPSE_DATE = '11/11/2021'
relapse_timestamp = int(datetime.datetime.strptime(RELAPSE_DATE,'%m/%d/%Y').strftime('%s'))

day = 86400
END_TIME = relapse_timestamp
# Fetching calls data from a period of 50 days till relapse  
START_TIME = END_TIME - day * 50

calls = cortex.calls(id=PARTICIPANT_ID, start=START_TIME*1000, end=END_TIME*1000)
print(calls)

and I get the following output

{'timestamp': 1632249000000, 'duration': 4320000000, 'data': [], 'fs_mean': 0, 'fs_var': 0}

I’ve also tried fetching secondary features such as call_degree and sms_number with resolution=5, but processing these features seems to be taking a very long time. Any help here would be greatly appreciated.

Thank you!

Hello,

Can you confirm that you have call / sms data?

You can use this code to pull the first 10 datapoints to check that you have data:

LAMP.SensorEvent.all_by_participant('your_participant_id', origin="lamp.calls", _limit=10)

cortex.raw.calls.calls() is just a wrapper for the above API call, so I suspect that you do not have any call / sms data. Unfortunately, many phones will not allow collection of SMS / call features anymore.

As for why the secondary feature would take a long time, resolution is in milliseconds. So a resolution of 5ms would result in an extremely large number of function calls and would take a long time to run. For other features I would suggest trying a higher resolution (ex: 86400000 for a day).

I hope this helps!

1 Like