Skip to content

Allow trackers to provide an authoritative transportation mode #3668

Description

@Edo78

Feature request

Please add a way for location trackers to send an authoritative, pre-classified transportation mode that Dawarich will preserve instead of treating it only as a hint for its own classifier.

Why this is needed

I use Android activity recognition through AutoLocation/Tasker. The phone already knows when I am:

  • walking
  • running
  • in a vehicle
  • stationary

I then use GPSLogger to send my location data to Dawarich.

GPSLogger is currently adding support for forwarding the detected motion/activity to Dawarich:

mendhak/gpslogger#1333

However, after checking Dawarich's current transportation-mode pipeline, "motion" / "activity" are deliberately treated as hints, not authoritative values.

For example:

{
"motion": ["driving"]
}

boosts the driving score, but Dawarich may still classify the segment as "stationary", "walking", "cycling", etc. if the kinematic classifier prefers another mode.

This creates a real problem for activity recognition.

If Android reports IN_VEHICLE, I may still be physically stationary for a long time because of:

  • heavy traffic
  • a railway crossing
  • a long red light
  • waiting in the car
  • a queue

A speed of 0 km/h does not mean that the transportation mode changed from driving to stationary/walking. It only means that the vehicle is temporarily stopped.

Likewise, Dawarich sometimes classifies slow city driving as cycling. In my case this is especially misleading because I do not even use a bicycle.

Existing behavior

From the current code:

  • tracker "motion" / "activity" values are stored in "motion_data"
  • "TransportationModes::HintScorer" converts them into score boosts
  • the comment in the code explicitly says:

«"Hints are fused into emission scores — never a hard gate."»

That behavior makes sense for uncertain tracker hints, but there is currently no way for a tracker to say:

«"This mode was already determined by the device; do not infer it again."»

Dawarich already has the concept of a true override at the segment level. Manual corrections set values such as:

transportation_mode: mode,
corrected_at: Time.current,
confidence: :high,
confidence_score: 1.0,
source: "user"

and those manually corrected segments are preserved during subsequent reclassification.

What seems to be missing is an equivalent concept for trusted tracker-provided transportation modes.

Proposed API / payload semantics

For example, something like:

{
"transportation_mode": "driving",
"transportation_mode_source": "tracker"
}

or:

{
"motion": ["driving"],
"motion_authoritative": true
}

The exact field names are not important.

The important semantic difference would be:

  • normal "motion" / "activity" → hint, current behavior
  • authoritative tracker mode → use this value directly for that point/time range and do not override it through inference

When the tracker sends "unknown" / null, Dawarich could fall back to automatic inference again.

Example flow

Android Activity Recognition
↓
AutoLocation
↓
Tasker
↓
GPSLogger
↓
Dawarich

with mappings such as:

STILL -> stationary
WALKING -> walking
RUNNING -> running
IN_VEHICLE -> driving

If "IN_VEHICLE" remains active while the car is stopped for 20 minutes, Dawarich should keep the transportation mode as "driving" rather than deciding from speed alone that I became stationary or started walking.

Related issues / discussions

This appears related to earlier requests about transportation-mode correction and false detections, especially:

The existing manual override solves the problem after classification. This request is about allowing a trusted tracker to provide the correct mode before classification, so Dawarich does not need to guess when the source already knows the answer.

Thanks for considering it.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions