simra-project / simra-ios

Apache License 2.0
4 stars 6 forks source link

AI Incident Detection #36

Closed ckrey closed 2 years ago

selphiron commented 3 years ago

We now have a better incident detection approach using a trained artificial neuronal network. To switch to the new approach, the user must enable it in the settings. Our old approach is the default incident detection approach. When the AI-supported incident detection is enabled, a POST request is sent to the backend if incidents need to be calculated (e.g., after the user stops the recording of his/her ride): <URL-to-backend>/12/classify-ride?clientHash=<client-hash>&bikeType=<int>&phoneLocation=<int> Note that the backend version changed from 11 to 12. clientHash is calculated like in the uploads. bikeType is the integer representing the bike type chosen by the user in "Profile" phoneLocation is the integer representing the phone location chosen by the user in "Profile"

The POST body contains the ride to be analyzed. Only the ride, not the incidents (So only the part after the ====== line).

A succesful response (200) returns a JSONArray with at least one long element and contains only elements of the data type long. The first element is the version/ID of the used artificial neuronal network. The following elements (if they exist) are timestamps where the backend detected incidents. At the GPS locations where these timestamps occur, an incident marker has to be set.

In case a succesful response (200) is not received (e.g., because of connection timeout), the default offline incident detection is started.

The returned version/ID of the used artifical neuronal network is appended at the header of the incident. The header looks now like this: <app version>#<how often this file was changed>#<artifical neuronal network version> Example: i15#1#1

ckrey commented 3 years ago

AI may return accelerometer or GPS timestamp (see #39)