improved eval_records
This commit is contained in:
+10
-2
@@ -111,16 +111,24 @@ for day in day_list:
|
|||||||
|
|
||||||
for filename in file_list:
|
for filename in file_list:
|
||||||
file_path = os.path.join(day_path, filename)
|
file_path = os.path.join(day_path, filename)
|
||||||
|
print(f"Open file: {filename}")
|
||||||
with open(file_path, "r") as fp:
|
with open(file_path, "r") as fp:
|
||||||
records = json.load(fp)
|
records = json.load(fp)
|
||||||
|
print(f"Found {len(records)} records")
|
||||||
for record in records:
|
for record in records:
|
||||||
try:
|
try:
|
||||||
|
vehicle_data = record['data']
|
||||||
if record['info']['is_delta']:
|
if record['info']['is_delta']:
|
||||||
record = deep_merge(last, record['data'])
|
print(f"Found delta record {record['info']['record_id']}")
|
||||||
|
vehicle_data = deep_merge(last, record['data'])
|
||||||
|
record['data'] = vehicle_data
|
||||||
|
else:
|
||||||
|
print(f"Found full record {record['info']['record_id']}")
|
||||||
|
|
||||||
except KeyError:
|
except KeyError:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
last = record
|
last = vehicle_data
|
||||||
try:
|
try:
|
||||||
for end_point in end_points:
|
for end_point in end_points:
|
||||||
end_point.assign(record)
|
end_point.assign(record)
|
||||||
|
|||||||
Reference in New Issue
Block a user