There is a large fleet, slightly more than a million vehicles, which is constantly growing. Each vehicle sends GPS coordinates to the server, as well as events (ignition is on, door is open, parking brake is tightened, etc.). GPS Coordinates are sent either once every 30 seconds, or in batches of 15 GPS coordinates (if the connection with the server is temporarily lost, the vehicle accumulates points in itself until the connection is restored). Now the database stores GPS coordinates for several years.
The entire stream of GPS coordinates for applications comes in a continuous stream from 4 RMQ queues. Each RMQ message is a package with 300 coordinates mixed together, from different vehicles.
Each GPS coordinate contains: the unique device_id of the vehicle from which the GPS coordinate was received, latitude, longitude, timestamp, speed.
Accordingly, after the GPS coordinates are stored in the database, there is a special method that builds tracks using the saved GPS coordinates. There is a special filter that removes "stars" (unnecessary coordinates that create interference on the map, for example, if the vehicle has been standing still for a long time and the GPS fails), and also splits the track into sections of movement and parking. The length of the time period from which the car is considered to be parked (and not at a traffic light, for example) is set by the settings, also lies in the database.
For example, a car has generated 2000 coordinates in a day, and the method will return only 1700 coordinates in a day, removing the stars.
Actually, it would be great to learn how to determine in real time the beginning of the car movement and the end of the movement by coordinates so that the results roughly coincide with the way the points are processed by the method. Once the start or end of the path is detected - the application records the corresponding event in the database.
Perhaps recurrent neural networks could be applied?