Server log format
The server log data is stored in files named
trial-i-server.log for trial
i. There are only server logs for the rendezvous conndition, as the server is not used in the "free walking" condition.
These files contain regular logs of the current status of the server. This includes information about all connected client devices (position, reported signal strength, battery life remaining, GPS quality, heading, current activity level) and the current location of the rendezvous target (the centroid).
The data is stored in ASCII format, in a format suitable for parsing with Python (just the string representation of a dictionary). Each line is one entry, and the data is recorded at roughly 1Hz.
The format is a Python-style dictionary in the form
{"field" : value, "field2" : value, ...} (see below for how to parse it), and each entry has the following fields:
- study_started (boolean) True, if the study is already underway (at least one client is active).
- time (float) Time, in seconds since the server was started. Note that the server will have been running for some time before the first device connects and the log starts; this is why the values do not start at 0.
- centroid (float, float) Location, as (longitude, latitude) pair, of the rendezvous target centroid.
- device_info (list) A list of all connected clients. Each entry in this list is a dictionary, and has the following fields:
- device_id (integer) The unique IMEI code for the device.
- study_started (integer) 1 if the device has started the rendezvous process, 0 otherwise.
- timestamp (integer) The devices time, in seconds since the epoch.
- lat (float) Device latitude, as reported by the GPS unit.
- lon (float) Device longitude, as reported by the GPS unit.
- battery_life (integer) Percentage of battery life remaining on the device (0--100)
- ready_message_sent (integer) 1 if the phone sent a message to indicate that the participant was at the starting location and ready to go.
- signal_strength (integer) Signal strength of the cellular connection, 0--7, 7 is strongest.
- gps_sat_lock (integer) Number of GPS satellites the device is using to get a fix.
- acc_activity (float) Average energy of the accelerometer over last 2 seconds. Arbitrary scale, but normally in range 0--2000, with 0 being absolutely still.
- heading (float) Current heading of the sensor in degrees. (compensated and filtered)
- heading_activity (float) Average energy of heading signal over last 2 seconds. Arbitrary scale, but normally in range 0--2.
Example
{'study_started': True, 'device_info': [{'study_started': '0', 'timestamp': '1247663679', 'lon': '-3.975549167773',
'battery_life': '100', 'ready_message_sent': '1', 'signal_strength': '7', 'gps_sat_lock': '5', 'lat': '51.612834027632',
'acc_activity': '0', 'heading': '12.242169592282', 'heading_activity': '2.5439356693455E-07', 'device_id':
'356962010467828'}, {'study_started': '0', 'timestamp': '1247663704', 'lon': '-3.982692055315', 'battery_life': '100',
'ready_message_sent': '1', 'signal_strength': '7', 'gps_sat_lock': '4', 'lat': '51.612067921972', 'acc_activity':
'891.27061720672', 'heading': '-78.860344708373', 'heading_activity': '0.20414750780859', 'device_id': '352255010375339'},
{'study_started': '0', 'timestamp': '1247663627', 'lon': '-3.975645308166', 'battery_life': '100', 'ready_message_sent':
'1', 'signal_strength': '6', 'gps_sat_lock': '5', 'lat': '51.608882045601', 'acc_activity': '468.71211845863', 'heading':
'11.095872935231', 'heading_activity': '0.73063362929467', 'device_id': '352255017948849'}, {'study_started': '0',
'timestamp': '1247663697', 'lon': '-3.978666312564', 'battery_life': '100', 'ready_message_sent': '0', 'signal_strength':
'7', 'gps_sat_lock': '3', 'lat': '51.614521387921', 'acc_activity': '3468.2349350457', 'heading': '-13.59896255152',
'heading_activity': '0.48977079717097', 'device_id': '356996016341140'}, {'study_started': '0', 'timestamp': '1247663705',
'lon': '-3.982420481755', 'battery_life': '100', 'ready_message_sent': '1', 'signal_strength': '6', 'gps_sat_lock': '7',
'lat': '51.607710088343', 'acc_activity': '817.76538840597', 'heading': '5.4958042989687', 'heading_activity':
'0.079197662888855', 'device_id': '352255010850372'}], 'centroid': [51.611203094293799, -3.9789946651146004], 'time':
1297.3589999675751}
Parsing
In Python, parsing is trivial:
f = open("trial-1-server.log")
for line in f:
data = eval(line)
# print out the time
print data["time"]
# print out the number of connected devices
print len(data["device_info"))
# print out the battery life of all connected devices
print [device["battery_life"] for device in data["device_info"]]