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

Move Arc App's brexit() method to LocoKit #13

Closed
2 tasks done
sobri909 opened this issue May 16, 2018 · 2 comments
Closed
2 tasks done

Move Arc App's brexit() method to LocoKit #13

sobri909 opened this issue May 16, 2018 · 2 comments
Assignees
Milestone

Comments

@sobri909
Copy link
Owner

sobri909 commented May 16, 2018

Splitting this task off from #11, because it's not a requirement for that task, but will be nice to eventually have in LocoKit instead of hidden away in Arc App.

Background

The brexit() method allows for extracting an ItemSegment out of a TimelineItem into a separate item (for example a brief visit to a specific mall shop within a larger mall visit) and intelligently maintaining the timeline's linked list as well as extracting path items between the new items, as appropriate.

The reason the method is called "brexit" is because if the post processing doesn't go how you want it, you can get left with an unholy mess and wish you never tried in the first place.

Todos

  • Split parent items in two if segment isn't on the edge
  • Attempt to extract paths on either side, to create a more harmonious timeline
@sobri909 sobri909 self-assigned this May 16, 2018
@sobri909 sobri909 added this to the 6.0.0 milestone May 29, 2018
@sobri909
Copy link
Owner Author

This is in the develop branch now, although with a couple of vital bits of functionality still to come.

[Aside: I mistagged the issue number on the initial commits, tagging them as #11 instead of #13. Oops.]

The new method can be found in the new PersistentProcessor, and used thus:

PersistentProcessor.extractItem(for: itemSegment, in: store) { newItem in
    // do something with the newly created TimelineItem
}

It takes an ItemSegment (ie a contiguous collection of LocomotionSample), and creates a new TimelineItem from that segment, by removing those samples from their current item, and inserting the new item into the timeline.

The new item will be a PersistentVisit if the segment's activity type is .stationary, otherwise it will be a PersistentPath.

Basically this lets you take an item segment from a timeline item's item.segments and extract it out into a separate timeline item, which will then be sensibly connected up to the timeline sequence.

The main use cases being things like extracting brief visits out of paths (for example a brief stop at the traffic lights while driving), extracting smaller visits out of larger visits (for example a brief visit to a shop inside a mall), etc.

You can see this in action in Arc App's "Recorded Activities" view on timeline items. I'll post a screenshot shortly.

@sobri909
Copy link
Owner Author

So here's an example of a Path with an ItemSegment of .walking type, which could be extracted with the new method.

The screenshot shows a view of a single Path item which is comprised or two ItemSegments, one of which is cycling and the other walking.

The TimelineProcessor merged those two segments together into a single Path item because the walking segment wasn't long enough to justify standing alone. But the new method allows you to overrule that decision, and extract the segment out into its own timeline item.

This is what Arc App does when you tap on those rows in a timeline item's "Recorded Activities" view.

ItemSegments

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

No branches or pull requests

1 participant