{"id":22201765,"url":"https://github.com/claygregory/node-moves-cleaner","last_synced_at":"2025-03-25T00:46:27.053Z","repository":{"id":57102412,"uuid":"92997269","full_name":"claygregory/node-moves-cleaner","owner":"claygregory","description":"Node module to repair common quirks of Moves app location history","archived":false,"fork":false,"pushed_at":"2018-12-31T00:34:57.000Z","size":52,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-03-17T21:30:35.571Z","etag":null,"topics":["location-history","movesapp"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/claygregory.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2017-05-31T23:26:49.000Z","updated_at":"2018-12-31T00:34:59.000Z","dependencies_parsed_at":"2022-08-20T22:10:18.476Z","dependency_job_id":null,"html_url":"https://github.com/claygregory/node-moves-cleaner","commit_stats":null,"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/claygregory%2Fnode-moves-cleaner","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/claygregory%2Fnode-moves-cleaner/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/claygregory%2Fnode-moves-cleaner/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/claygregory%2Fnode-moves-cleaner/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/claygregory","download_url":"https://codeload.github.com/claygregory/node-moves-cleaner/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245377954,"owners_count":20605375,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["location-history","movesapp"],"created_at":"2024-12-02T16:10:23.939Z","updated_at":"2025-03-25T00:46:27.013Z","avatar_url":"https://github.com/claygregory.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"\n# Moves App Segment Cleaner\n\nHaving worked with data from the [Moves App](https://www.moves-app.com) —both from the API as well as manual JSON exports — I've noticed a few\nrecurring oddities I attempt to correct with this utility. Namely:\n\n * Long stays at a single location (in excess of 24 hours) tend to get truncated, forming a time gap\n * Occasionally a single stay or single move will get chopped into multiple segments\n * Other time gaps inexplicably appear between segments, absent an 'off' segment\n * Not specifically a problem, but multple consecutive movements (e.g. walking → transport → walking) are merged as activities under a single 'move' segment. I prefer these separated into separate segments to simplify analysis.\n\n## Installation\n\n```bash\nnpm install --save @claygregory/moves-cleaner\n```\n\n## Usage\n\n For most applications, just call the single `apply` method on an array of segments. This will apply all of the normalization\n functions in one go.\n\n ```javascript\nconst MovesCleaner = require('@claygregory/moves-cleaner');\n\nconst movesCleaner = new MovesCleaner();\nconst normalizedSegments = movesCleaner.apply([\n  { type: 'move', activities: […], … },\n  { type: 'place', activities: […], … },\n  …\n]);\n ```\n\n### Additional Methods\n\nNormalization steps can also be applied individually. These include:\n\n#### Close Gaps\n\nCollapses the gap between two segments so long as no `off` segments are logged and the distance between the shoulder segments is within\na given threshold.\n\n```javascript\nmovesCleaner.close_gaps([…]);\n```\n\n#### Filter Off Segments\n\nRemoves segments with a `type` value of `off`. The gaps in time remain, only the segments are removed.\n\n```javascript\nmovesCleaner.filter_off_segments([…]);\n```\n\n#### Flatten Move Segments\n\nBubbles the individual activities of `move` segments up as standalone move segments.\n\n```javascript\nmovesCleaner.flatten_move_segments([…]);\n```\n\n#### Merge Move Segments\n\nMerges consecutive move segments of same type into a single segment. Track points are merged and start/end time, duration, and distance are corrected.\n\n```javascript\nmovesCleaner.merge_move_segments([…]);\n```\n\n#### Merge Place Segments\n\nMerges consecutive place segments with same place ID into a single segment. Start/end times are corrected.\n\n```javascript\nmovesCleaner.merge_place_segments([…]);\n```\n\n#### Sort\n\nOrders segments according to time. Many of the above methods assume time-ordered segments are provided.\n\n```javascript\nmovesCleaner.sort_segments([…]);\n```\n\n### Options\n\n Currently only one configuration option is available: `near_threshold_m` is used in gap detection to determine when the end of one segment is close enough to the beginning of next. Gaps are only closed between if endpoints are within threshold. The default is 100 meters.\n\n ```javascript\nconst MovesCleaner = require('@claygregory/moves-cleaner');\n\nconst movesCleaner = new MovesCleaner({\n  near_threshold_m: 250\n});\n ```\n\n## License\n\nSee the included [LICENSE](LICENSE.md) for rights and limitations under the terms of the MIT license.","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fclaygregory%2Fnode-moves-cleaner","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fclaygregory%2Fnode-moves-cleaner","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fclaygregory%2Fnode-moves-cleaner/lists"}