Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Timeline feature #48

Open
Outlet2048 opened this issue Jan 20, 2021 · 16 comments
Open

Timeline feature #48

Outlet2048 opened this issue Jan 20, 2021 · 16 comments
Labels
Status: Needs investigation Needs further investigation Type: Feature New feature

Comments

@Outlet2048
Copy link

Would it be possible to add something similar to a timeline similar to what Googles location history offers?

Id be totally fine with manually confirming where I was and don't expect the data to be accurate enough for all of this to work without any user input.
For me this would be an amazing feature to have but i have no idea how hard an implementation would be.

Cheers!

@Outlet2048 Outlet2048 changed the title Timeline feauture Timeline feature Jan 20, 2021
@linusg
Copy link
Member

linusg commented Jan 20, 2021

Googles location history

I'm not familiar with that, my Google account has location history saving turned off - can you provide a screenshot or additional explanation?

@linusg linusg added Status: Needs investigation Needs further investigation Type: Feature New feature labels Jan 20, 2021
@Outlet2048
Copy link
Author

I have disabled that feature as well but I can describe what I remember
At the bottom of the page there's a bar that lists all the places you've been that day. I assume staying somewhere for an extended period of time causes Google to add an entry
Ive noticed that owntracks also sets a lot of points when you stay somewhere for a longer period of time so this might be the best way to identify whether or not the user has stopped somewhere for an extended period of time.

The screenshot i've attached is somewhat outdated but its enough to get the idea of it. Basically a list of all stops organized in a timeline. Admittedly i have no idea how difficult it would be to get the data from openstreetmap to see what place the user has stopped at.

image201507292128379766527f2b5d3e95d4a733fcfb77bd7e

@linusg
Copy link
Member

linusg commented Jan 20, 2021

Oh, that would be pretty awesome! I'll think about how we could approach this - basically there are three options:

  • Do it all client side (detection of individual locations from raw data points, look up their name)
  • Add this functionality to the recorder itself
  • Add a secondary service that reads data from the recorder and adds metadata like this, the frontend would then need to communicate with both, or it proxies the recorder and serves as an enhanced replacement

Great idea though, would love to have this :)

@Outlet2048
Copy link
Author

I'm really happy to hear that you like the idea!

Sadly i have no programming experience and have no idea what approach would be best.
But let me know if you have any questions regarding the user experience :P

@growse
Copy link
Contributor

growse commented Jan 20, 2021

Oh, that would be pretty awesome! I'll think about how we could approach this - basically there are three options:

* Do it all client side (detection of individual locations from raw data points, look up their name)

* Add this functionality to the recorder itself

* Add a secondary service that reads data from the recorder and adds metadata like this, the frontend would then need to communicate with both, or it proxies the recorder and serves as an enhanced replacement

Great idea though, would love to have this :)

One challenge with (2) and (3) would be in persisting metadata. It's been a while since I looked at it, but I believe that some Geocoding services (e.g. Google) specifically prohibit storage of the reverse geocode result - it's for point in time display only.

Seems like an ideal thing to do client-side, as it's fundamentally a display/UI problem, rather than something tha should leak upstairs to data storage?

@jpmens
Copy link
Member

jpmens commented Jan 20, 2021

Google specifically prohibit storage of the reverse geocode result

That's one of the reasons we're fond of OpenCage who specifically permit it: Cache results as long as you like is prominently displayed on their landing page. :-)

@Outlet2048
Copy link
Author

Hello again!

Another idea that came to mind is the ability to "create" places.
Example: I visit a friend. This wont show up with any name since its just an address and not a shop etc. So it would be great if the user could geofence an area and give it a name. Entering it will display the given name on the timeline

Cheers!

@Outlet2048
Copy link
Author

I heard you can add a "bounty" to issues via the issuehunt website. Assuming that you'd have to enable this for your repo first, would you be interested in doing so?

@gitc23
Copy link

gitc23 commented May 23, 2023

Any progress or new ideas on this? Was just coming here to also suggest a timeline feature when I saw that it was already a suggestion!

@linusg
Copy link
Member

linusg commented May 23, 2023

This is not exactly straightforward to implement, and as far as I know no one has even begun making a more detailed plan - so no progress as of yet :)

@gitc23
Copy link

gitc23 commented May 23, 2023

Thank you for your quick reply, @linusg! I am not a programmer, but a few conceptual thoughts:

  • Cut .rec files at 12 AM of the selected date. The first location becomes the starting point and the last one before midnight the end point.
  • Use a combination of distance and dwell time for the system to recognize a place (e.g., if user stays within a 50m radius for at least 10min, this is considered a stay).
  • Enhance this with user-defined geofences: all points within a defined area are considered a stay after 10min
  • Make UI interactive like in the screenshot: let users name places and store them (maybe also add and remove) -> this could be integrated into a monthly/yearly overview of visits, time spent etc.
  • Use some sort of clustering algorithm like DBSCAN or OPTICS to find points at one single location

I can imagine a Timeline button in the from date picker. This could automatically set the start time to 12am and then select the end time of the same day at midnight and trigger an overlay on the side which shows a similar view to that from Google.

These are just some initial thoughts and I'd need to dig into the code to find out more. What would your thoughts on a high-level implementation be?

@gitc23
Copy link

gitc23 commented Jun 6, 2023

Hey guys, so I've just tried my hand on this in the last few days and created a basic view that fetches the stay points of the given timeframe, takes the start and end times and calculates the duration. Mind you that I am not a programmer and just read my way around the relevant Vue concepts. Right now, the TimelineView just overlays the Map view as I wasn't able to find a way to have the Map view react dynamically to the width of the TimelineView.

I have implemented this in a fork here as I wasn't sure whether this already warrants a pull request.

The stay point calculation is based on this implementation of an algorithm from Mining user similarity based on location history (Li et al., 2008). The selected thresholds for distance and time are 15min and 100m, meaning whenever the user stayed at a point >100m away from the previous stay point and did not move more than 100m from this point for >15min, then it gets selected as a stay point and the average coordinates of the location get displayed on the map via a marker.

Screenshot 2023-06-07 at 12 25 23 AM

Just a few ideas off the top of my head for further polishing and fleshing out the concept:

  • add mobile view
  • add reactivity to Map view
  • visually enhance everything (font, alignment, icons...)
  • add cards with metadata to the location markers, re-use LDeviceLocationPopup? Also visually alter markers when selected in the timeline and vice versa
  • add Google-like date picker in the TimelineView (at the very least the left/right arrows for jumping between days, could re-use the existing range picker)
  • simplify the date selection, e.g. just select the start date and click "Timeline" -> should select the given day until midnight (unless another range is specified)
  • re-calculate stay points on date change
  • automatically fit view on calculation
  • calculate statistics for the given range (number of places, time at places, time on the move, time stationary...)
  • make stay points editable with an autocomplete dropdown that shows possible matches from the same area
  • store user-edited locations in a data file and parse this according to the closest location; suggest this location as the name in the dropdown
  • evaluate different stay point algorithms, a lot of them are quite similar (1, 2, 3, but I also found this paper on two-step clustering from 2023 which describes a much more sophisticated algorithm)
  • add algorithm defaults to config file (distance and time thresholds)

Please check out the fork and tell me what you think. Would love to work on this together!

Thanks!

@jp-bennett
Copy link

@gitc23 Your work on this looks great so far. Any updates since June?

@gitc23
Copy link

gitc23 commented Aug 14, 2023

@jp-bennett Thank you very much! Unfortunately, I didn't really have time to work more on this.

I'd be down to collaborate and pick up some work again, though. Do you have experience in working with Vue and its concepts? The algorithm may also need some improvements.

@jp-bennett
Copy link

@gitc23 I know enough JS to be dangerous, but haven't worked with Vue yet. This will go on the long list of projects to work through.

@ippocratis
Copy link

@gitc23 it would make sense for stay points to display the place name if available. Owntracks is reverse geocoding coordinates to names already if opencage is selected.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Status: Needs investigation Needs further investigation Type: Feature New feature
Projects
None yet
Development

No branches or pull requests

7 participants