Skip to content

CSV / JSON export (and import) #3

Description

@cvitter

Motivation: Dives live in a local SQLite file. Users need a way
to back up, share, and migrate. CSV and JSON are the lowest common
denominator for logbook portability.

What to build:

  • File menu → Export → CSV / JSON (all dives, or filtered by current
    search)
  • File menu → Import → CSV (creates dives from a file matching
    the export schema)
  • CSV columns: dive_date, start_time, end_time, dive_time_minutes,
    max_depth_m, avg_depth_m, air_temp_c, water_temp_c, visibility_m,
    start_pressure_bar, end_pressure_bar, sites (semicolon-separated),
    buddies (semicolon-separated as name:role), notes
  • JSON: same fields, nested arrays for sites / buddies
  • Export dialog: "All dives" / "Filtered to current search" toggle
  • Import dialog: file picker, preview first 5 rows, confirm
  • Use the existing find_or_create semantics for sites and buddies
    on import (no duplicates by name+country or normalized name)

Acceptance criteria:

  • Round-trip: export → wipe DB → import produces identical rows
    (modulo ids)
  • CSV opens correctly in Excel / Numbers / Google Sheets
  • JSON validates with json.loads
  • Import shows progress for files with 100+ rows
  • 3 new tests: export-empty, export-nonempty, import-roundtrip

Related: #17 (test data generator)


Activity

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    area: dataData layer / schema / repositoriesarea: importImporters and external dataenhancementNew feature or requestpriority: highHigh priority — work on soon

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions