Closed JGreenlee closed 7 months ago
This is the line that stores the bluetooth region data into the BuiltinUserCache on iOS. As we can see from the following logs...
We are at the very least successfully receiving notifications via didRangeBeacons
, which lends itself to the theory that this may be an issue with the phone-server communication.
Link to the BEMUserCache code here, specifically putSensorData
This is because the server for this deployment had not yet been updated
$ ./e-mission-py.bash
>>> edb.get_timeseries_error_db().distinct("metadata.key")
['statemachine/transition', 'background/bluetooth_ble']
So the timeseries_error DB has the transition and ble entries
>>> edb.get_timeseries_error_db().distinct("user_id")
[UUID('118bcfb4-19b1-4d92-b02e-7d5bfc1d6032'), UUID('c8e6ad49-c7a5-4650-b1ad-c61747c761fe'), UUID('170c02b7-5937-4227-9128-5da1bcdfe8c6'), UUID('97b8efad-8c28-4ffa-870b-828de7a1cb03'), UUID('29627e30-ca62-494e-af8c-b9de8e8f0f89'), UUID('e61c0e74-82db-42aa-b3ea-ba07392efcd2'), UUID('11fc1417-0776-47fc-b306-5484c34f6138'), UUID('dfa77402-da79-4e39-9c64-7bebd1f8b410'), UUID('50fcffc9-16c7-4153-a548-1ffb3f6c379a'), UUID('519df704-2f64-400d-b84e-df6e6143dae0'), UUID('629e97a4-601a-4954-80a6-ce3c0bca5579'), UUID('10fd95ea-5065-4e1d-a861-30dc80590bbf'), UUID('4acedfd2-de6a-4623-a968-9d5046a8573b')]
And after fixing them, we may need to reset the pipeline for these users
Ran the script, everything is copied over, no errors left.
>>> edb.get_timeseries_error_db().distinct("metadata.key")
[]
Now resetting the pipeline, and re-running it for at least the ones that have BLE beacons. These are the users we will re-run the pipeline for
>>> edb.get_usercache_db().find({"metadata.key": "background/bluetooth_ble"}).distinct("user_id")
[UUID('c8e6ad49-c7a5-4650-b1ad-c61747c761fe'), UUID('11fc1417-0776-47fc-b306-5484c34f6138'), UUID('629e97a4-601a-4954-80a6-ce3c0bca5579'), UUID('dfa77402-da79-4e39-9c64-7bebd1f8b410'), UUID('10fd95ea-5065-4e1d-a861-30dc80590bbf'), UUID('4acedfd2-de6a-4623-a968-9d5046a8573b')]
Reset pipelines for 13 users. Some of them were only the None
transition errors.
6 users had BLE beacon information, manually ran the pipeline for them
One of them had obsolete transitions which we are not going to fix
Got error 'T_ENTERED_BLE_RANGE' while saving entry AttrDict({'_id': ObjectId('661b29806109164d65102979'), 'user_id': UUID('dfa77402-da79-4e39-9c64-7bebd1f8b410'), 'metadata': {'time_zone': 'America/Los_Angeles', 'plugin': 'none', 'write_ts': 1713041202.864598, 'platform': 'ios', 'read_ts': 0, 'key': 'statemachine/transition', 'type': 'message'}, 'data': {'currState': 'STATE_ONGOING_TRIP', 'transition': 'T_ENTERED_BLE_RANGE', 'ts': 1713041202.86425}}) -> None
Got error 'T_ENTERED_BLE_RANGE' while saving entry AttrDict({'_id': ObjectId('661b29806109164d6510297b'), 'user_id': UUID('dfa77402-da79-4e39-9c64-7bebd1f8b410'), 'metadata': {'time_zone': 'America/Los_Angeles', 'plugin': 'none', 'write_ts': 1713041203.863857, 'platform': 'ios', 'read_ts': 0, 'key': 'statemachine/transition', 'type': 'message'}, 'data': {'currState': 'STATE_ONGOING_TRIP', 'transition': 'T_ENTERED_BLE_RANGE', 'ts': 1713041203.863525}}) -> None
Got error 'T_ENTERED_BLE_RANGE' while saving entry AttrDict({'_id': ObjectId('661b29806109164d6510297d'), 'user_id': UUID('dfa77402-da79-4e39-9c64-7bebd1f8b410'), 'metadata': {'time_zone': 'America/Los_Angeles', 'plugin': 'none', 'write_ts': 1713041204.864588, 'platform': 'ios', 'read_ts': 0, 'key': 'statemachine/transition', 'type': 'message'}, 'data': {'currState': 'STATE_ONGOING_TRIP', 'transition': 'T_ENTERED_BLE_RANGE', 'ts': 1713041204.864253}}) -> None
A second user had ill-formatted entries, which we are also not going to fix
Got error 'AttrDict' instance has no attribute 'currState' while saving entry AttrDict({'_id': ObjectId('661d4ae161091667901a055e'), 'user_id': UUID('4acedfd2-de6a-4623-a968-9d5046a8573b'), 'metadata': {'time_zone': 'America/New_York', 'plugin': 'none', 'write_ts': 1713195745.456911, 'platform': 'ios', 'read_ts': 0, 'key': 'statemachine/transition', 'type': 'message'}, 'data': {'curr_state': 'STATE_ONGOING_TRIP', 'transition': 'T_TRIP_ENDED', 'ts': 1713195745.455}}) -> None
Got error 'AttrDict' instance has no attribute 'currState' while saving entry AttrDict({'_id': ObjectId('661d5fca61091667901a1fe4'), 'user_id': UUID('4acedfd2-de6a-4623-a968-9d5046a8573b'), 'metadata': {'time_zone': 'America/New_York', 'plugin': 'none', 'write_ts': 1713201068.700629, 'platform': 'ios', 'read_ts': 0, 'key': 'statemachine/transition', 'type': 'message'}, 'data': {'curr_state': 'STATE_ONGOING_TRIP', 'transition': 'T_EXITED_GEOFENCE', 'ts': 1713201068.698}}) -> None
No vehicle identity found for major:minor pair 0000:0000
I am pretty sure this is from old simulated entries, before https://github.com/e-mission/e-mission-data-collection/pull/223, where major and minor were not filled in correctly
After dismissing that popup (for me, there were 5 of them), it looks to be working!
Recent trips I've taken, when the beacon was with me, are recognized as "Jack's Mazda 3" and prompt for "Gas Car Survey"
Older trips, where the beacon not with me, just show "Detected" modes and don't prompt for any survey
I can delete those (this is all test data, so I have no qualms about mucking around with it). Let me do that now.
There are 127 of these spurious entries. Deleting them...
>>> edb.get_timeseries_db().count_documents({"metadata.key": "background/bluetooth_ble", "data.major": 0, "data.minor": 0})
127
>>> edb.get_timeseries_db().delete_many({"metadata.key": "background/bluetooth_ble", "data.major": 0, "data.minor": 0})
<pymongo.results.DeleteResult object at 0x7f38ea0dabb0>
>>> edb.get_timeseries_db().count_documents({"metadata.key": "background/bluetooth_ble", "data.major": 0, "data.minor": 0})
0
Done.
Resolved by server upgrade and manually deleting the bad entries
May be due to: