Principles
Data belongs to the user. Export must be complete, portable, and not require the app to read it back. See the Product Contract for the user data ownership commitment.- Export produces a self-contained file - no external dependencies to restore it
- Import is additive by default - it does not silently overwrite existing data
- No proprietary encoding or binary formats - everything is readable in a text editor
- Schema version is embedded in every export so future versions can handle old files
Formats
JSON (full fidelity)
Includes the complete event log, all tasks, and all check-ins. Use this for:- Transferring to a new device
- Backup before a wipe
- Debugging and support
CSV (human-readable summary)
Two sheets: tasks and check-ins. Does not include the event log. Use this for:- Sharing with a doctor or care coordinator
- Personal analysis in a spreadsheet
- Printing a history
Export schema (JSON)
Import rules
ID handling
Original IDs are preserved on import. If an event or task with the same ID already exists in the database:- Events: skip the duplicate (events are immutable; same ID = same event)
- Tasks: prompt the user to choose: keep existing, replace with imported, or keep both (new ID assigned)
Conflict resolution
For event log merges (importing into a non-empty database): events are ordered byoccurredAt. No deduplication beyond ID matching. The combined log is replayed in chronological order to recompute mana state.
Validation
Before importing, validate:- Schema version -
versionfield must be present and an integer the app knows how to handle - Required fields -
events,tasks, andcheckInsarrays must be present (can be empty) - Date format - all timestamp strings must parse as valid ISO 8601
- Event types - unknown
typevalues are rejected with a clear message (not silently dropped)
Handling unknown event types
If an event’stype is not in the known set, surface an error and stop:
“This export contains event types this version of the app doesn’t recognise. Update the app and try again.”Do not silently drop unknown events - they may be load-bearing for EWMA history.
User-safe error messages
All import errors use neutral, non-judgemental language. No blame, no urgency.Not a valid export file
Not a valid export file
“This file doesn’t look like a Canthus export. Make sure you’re selecting the right file.”
Export from a newer app version
Export from a newer app version
“This export is from a newer version of the app. Update Canthus and try importing again.”
Corrupted or incomplete file
Corrupted or incomplete file
“This file couldn’t be read - it may be incomplete or corrupted. Try exporting again from your other device.”
Unknown event types
Unknown event types
“This export contains data this version of the app doesn’t recognise. Update Canthus and try importing again.”