-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathparseOldData.py
63 lines (55 loc) · 1.43 KB
/
parseOldData.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
import pandas as pd
import dataManager
import s3fs
import boto3
import tqdm
import csv
import tqdm
fs = s3fs.S3FileSystem(anon=False)
totalList = []
file = [[]]
#Grab the files from aws
with fs.open('s3://flaskbucketcd/data/raw_history.csv', 'r') as history:
file = list(csv.reader(history))
i = -1
for row in tqdm.tqdm(file):
i+= 1
if i == 0:
continue
try:
horizAcc = row[8].split(',')[0]
vertAcc = row[8].split(',')[1]
except:
horizAcc = ''
vertAcc = ''
tempList = {"type": "Feature",
"geometry": {
"type": "Point",
"coordinates": [
row[1].split(',')[0],
row[1].split(',')[1]
]
},
"properties": {
"timestamp": row[0],
"altitude": row[2],
"speed": row[4],
"horizontal_accuracy": horizAcc,
"vertical_accuracy": vertAcc,
"motion": [row[5]],
"pauses": False,
"activity": "other_navigation",
"desired_accuracy": 100,
"deferred": 1000,
"significant_change": "disabled",
"locations_in_payload": len(file) - 1,
"battery_state": row[7],
"battery_level": row[6],
"device_id": "",
"wifi": row[9]
}
}
totalList.append(tempList)
#Once all data has been populated into a list, feed it into the filter to fill out the history fill
dataManager.storeCSV(totalList)
#dataManager.createKMLFiles()