Repository navigation
feat(core): export GeoJSON, CSV ed E7 (formato del blog) - #38
Conversation
- exportToGeoJson: point/visit come Point, activity come LineString
(path o start/end), coordinate [lng, lat]
- exportToCsv: una riga per punto, visita e punto di path (RFC 4180)
- exportToE7: { locations: [{ latitudeE7, longitudeE7, timestamp }] }
da punti grezzi e path delle activity, ordinato per tempo; sostituisce
la conversione manuale del blog
- exportDataset / exportFormatFromPath: dispatcher comune a CLI e app
(.kml, .geojson, .csv, .e7.json, altrimenti JSON)
- CLI: nuovi formati e --export-format; app: filtri nel dialog di export
- README e AGENTS.md aggiornati
Closes #16
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01CecUKcJiSVnehcZEiXLgtk
There was a problem hiding this comment.
🔵 Needs a closer look
It changes the public export API and the shared CLI/app export path, includes an author-flagged untested cross-platform .e7.json save-dialog behavior, and a CSV completeness gap that warrant human verification.
1 open finding
What changed in this PR
This PR extends mappit-core's export capabilities beyond JSON/KML by adding three new exporters — GeoJSON (RFC 7946), CSV (RFC 4180 quoting), and E7 (latitudeE7/longitudeE7, the format expected by the downstream travel blog). It introduces a shared format dispatcher (exportDataset + exportFormatFromPath) that both the CLI and the Electron app now use, replacing the previous inline ext === '.kml' branching. This closes issue #16 and the data epic #23, and makes the blog's manual E7 conversion step unnecessary.
Changes:
- New exporters in
packages/core/src/exporters/(GeoJSON, CSV, E7) plus aexportDataset/exportFormatFromPathdispatcher re-exported from the barrel andindex.ts. - CLI gains
--export-formatand infers the format from the file extension; the app's main process and save dialog use the shared dispatcher and offer the new formats. - New tests (exporter unit tests + CLI integration tests) and documentation updates in
README.md/AGENTS.md.
| File | Description |
|---|---|
| packages/core/src/exporters/geojson-exporter.ts | New GeoJSON exporter: points/visits→Point, activities→LineString with [lng,lat]. |
| packages/core/src/exporters/csv-exporter.ts | New CSV exporter with RFC 4180 quoting; one row per point/visit/path point. |
| packages/core/src/exporters/e7-exporter.ts | New E7 exporter producing { locations: [...] } sorted by instant for the blog. |
| packages/core/src/exporters/index.ts | Adds ExportFormat, EXPORT_FORMATS, exportFormatFromPath, and exportDataset dispatcher. |
| packages/core/src/index.ts | Re-exports the new exporters and types from the package entry point. |
| packages/core/src/cli.ts | Uses the dispatcher; adds --export-format; infers format from extension. |
| packages/app/src/main/index.ts | Export IPC handler now delegates to the shared dispatcher. |
| packages/app/src/renderer/main.ts | Save dialog adds GeoJSON/CSV/E7 filters. |
| packages/core/tests/exporters/formats.test.ts | New unit tests for the three exporters and the dispatcher. |
| packages/core/tests/cli.test.ts | New CLI integration tests for the export formats. |
| README.md / AGENTS.md | Documentation updated for the new formats and CLI options. |
🧠 Review effort: Balanced
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
| } else { | ||
| for (const p of e.path) { | ||
| rows.push({ | ||
| kind: 'path', | ||
| timestamp: p.timestamp ?? e.startTime, | ||
| lat: p.lat, | ||
| lng: p.lng, | ||
| activity_type: e.activityType, | ||
| }); | ||
| } | ||
| } |
Dalla review di Copilot sulla PR #38: prima sparivano dal CSV. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01CecUKcJiSVnehcZEiXLgtk

Closes #16. Chiude anche l'epic dati #23 (#22, #17, #16).
Nuovi exporter (
packages/core/src/exporters/)exportToGeoJson/toGeoJson): punti e visite diventanoPoint, le activity diventanoLineString(dal path oppure, senza path, da start/end). Coordinate[lng, lat], proprietàkind,startTime,activityType… OpzioniincludePoints/includeTimeline.exportToCsv): una riga per punto, visita e punto di path. Colonnekind,timestamp,end_time,lat,lng,activity_type,accuracy,name,place_id, quoting RFC 4180, delimitatore configurabile.exportToE7/toE7Locations):{ locations: [{ latitudeE7, longitudeE7, timestamp }] }, cioè il formato che si aspetta il blog (maps.jsdivide per 1e7). Usa i punti grezzi e i punti dei path delle activity (un punto senza timestamp prende l'inizio dell'activity), ordinati per istante. È la stessa logica dello script manuale diblog/PLAN.md§1.3, che non serve più. Le visite si possono aggiungere conincludeVisits(default no, come nel blog).exportDataset(ds, format)eexportFormatFromPath(path), condivisi da CLI e app:.kml,.geojson,.csv,.e7.json→ E7, altrimenti JSON.CLI e app
--export-format json|kml|geojson|csv|e7..e7.json).Test
Da verificare
e7.jsonnon l'ho provato su Windows/macOS. In ogni caso basta chiamare il filenome.e7.json.--filter-date A B --export content/<ID>.e7.json(poi rinominare in<ID>.json). Va provato su un export reale prima di aggiornarePLAN.mdnel blog.README e AGENTS.md aggiornati.
🤖 Generated with Claude Code
https://claude.ai/code/session_01CecUKcJiSVnehcZEiXLgtk