Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save davidmontgom/37f63b4b6b7d4538aace5c15f355d184 to your computer and use it in GitHub Desktop.
Save davidmontgom/37f63b4b6b7d4538aace5c15f355d184 to your computer and use it in GitHub Desktop.
import sys
import json
from pprint import pprint
sys.path.append('/var/zentripprocessing')
sys.path.append('/var/zentripprocessing/createTripPDFReports')
from ProducePDF_FromServerTrip import producePDFReportFromJSON
with open('/var/test.json') as json_file:
data = json.load(json_file)
pprint(data['gps_pts'])
producePDFReportFromJSON(data)
{
"version": "1",
"library_version": "1.2",
"actvity_library": "Pathsense 2.0",
"device_os_version": "Android 4.2(iOS 9)",
"device_manufacturer": "Samsung(Apple)",
"device_model": "SM-G920W8(iPhone6)",
"time_zone": "Europe/Athens",
"driver": "dw@polarax.com",
"gps_pts": [{
"timestamp": "2016-03-11T17:37:58.000Z",
"latitude": 47.02908954,
"longitude": 47.02908954,
"gps_has_spd": "true",
"gps_speed": 45,
"gps_has_alt": "false",
"gps_altitude": 100,
"gps_has_acc": "true",
"gps_hrz_acc": 50,
"gps_vrt_acc": 50
}, {
"timestamp": "2016-03-11T17:37:58.000Z",
"latitude": 47.02908954,
"longitude": 47.02908954,
"gps_has_spd": "true",
"gps_speed": 45,
"gps_has_alt": "false",
"gps_altitude": 100,
"gps_has_acc": "true",
"gps_hrz_acc": 50,
"gps_vrt_acc": 50
}, {
"timestamp": "2016-03-11T17:37:58.000Z",
"latitude": 47.02908954,
"longitude": 47.02908954,
"gps_has_spd": "true",
"gps_speed": 45,
"gps_has_alt": "false",
"gps_altitude": 100,
"gps_has_acc": "true",
"gps_hrz_acc": 50,
"gps_vrt_acc": 50
}],
"acc_pts": [
["2016-03-11T17:37:13.737Z", -3.0517578E-4, 1.9836426E-4, 7.6293945E-5],
["2016-03-11T17:37:13.737Z", -3.0517578E-4, 1.9836426E-4, 7.6293945E-5],
["2016-03-11T17:37:13.737Z", -3.0517578E-4, 1.9836426E-4, 7.6293945E-5]
],
"gyr_pts": [
["2016-03-11T17:37:13.737Z", 3.0517578E-4, 1.9836426E-4, 7.6293945E-5],
["2016-03-11T17:37:13.737Z", 2.0517578E-4, 1.9836426E-4, 7.6293945E-5],
["2016-03-11T17:37:13.737Z", 3.0517578E-4, 1.9836426E-4, 7.6293945E-5]
],
"mag_pts": [
["2016-03-11T17:37:13.365Z", 3.0517578E-4, 3.0517578E-4, 3.0517578E-4, "High"],
["2016-03-11T17:37:14.481Z", 3.0517578E-4, 3.0517578E-4, 3.0517578E-4, "Low"],
["2016-03-11T17:37:14.481Z", 3.0517578E-4, 3.0517578E-4, 3.0517578E-4, "Medium"]
],
"act_sts": [{
"timestamp": "2016-03-11T17:37:20.113Z",
"sts_conf": {
"AUTO": 0,
"WALKING": 0,
"STILL": 0,
"ON_FOOT": 0,
"RUNNING": 0,
"CYCLING": 100,
"UNKNOWN": 0,
"DRIVING": 0,
"IN_VEHICLE_HOLDING": 0,
"HOLDING": 0,
"TILTING": 0,
"SHAKING": 0
}
}, {
"timestamp": "2016-03-11T17:37:20.113Z",
"sts_conf": {
"AUTO": 0,
"WALKING": 0,
"STILL": 0,
"ON_FOOT": 0,
"RUNNING": 0,
"CYCLING": 100,
"UNKNOWN": 0,
"DRIVING": 0,
"IN_VEHICLE_HOLDING": 0,
"HOLDING": 0,
"TILTING": 0,
"SHAKING": 0
}
}, {
"timestamp": "2016-03-11T17:37:20.113Z",
"sts_conf": {
"AUTO": 0,
"WALKING": 0,
"STILL": 0,
"ON_FOOT": 0,
"RUNNING": 0,
"CYCLING": 100,
"UNKNOWN": 0,
"DRIVING": 0,
"IN_VEHICLE_HOLDING": 0,
"HOLDING": 0,
"TILTING": 0,
"SHAKING": 0
}
}]
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment