Skip to content

Import a history CSV back, so a reset does not lose it permanently #102

Description

@parawanderer

Export History writes a tag's stored history as CSV. Nothing reads one back.

Why this is different from the rest of the feature list

Location history is the only data in the app that cannot be re-fetched. Apple serves a short window of reports, so anything older than that exists solely in the app's own database. Everything else survives a reinstall one way or another — tags come back from a bundle, or on their own once the app reads them from the user's Apple account — but history is gone the moment the database is.

And it goes more often than you would think: allowBackup is false, so wiping app data, moving to a new phone, or uninstalling takes it all. The user is told to keep an export; today that export is a dead end, because there is no way to put it back.

Shape

The app defined the format itself, so this is reading its own output:

  • Parse the CSV Export History writes — it already carries timestamp_utc, timestamp_local and timestamp_epoch_ms
  • Insert into Room, deduplicating on beacon plus timestamp, so importing the same file twice is harmless and importing an overlapping range merges rather than doubles
  • Report what happened in counts: rows read, rows added, rows already present

The one real design question

What to do with rows for a beacon the user has not imported. Skip them, or hold them until that beacon appears? Skipping is simpler and probably right — a history with no tag to attach to is not showing anyone anything — but it means restore order matters, and the user should be told rather than left to wonder where the rows went.

Notes

  • A schema change here means a Room migration and its tests — see rule 1 in AGENTS.md. Inserting into the existing table may not need one.
  • Related: Export History has no date range option #71, which asks for a date range on the export side. Independent of this — that one refines a working feature, this one adds the missing direction.

Written by Claude Code.

Metadata

Metadata

Assignees

No one assigned

    Labels

    @appIssues regarding the OpenTagViewer Android appenhancementNew feature or requestgood first issueGood for newcomers

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions