Skip to content

Fix/add coordinates to csv download - #1106

Open
jona159 wants to merge 10 commits into
devfrom
fix/add-coordinates-to-csv-download
Open

jona159 wants to merge 10 commits into
devfrom
fix/add-coordinates-to-csv-download

Conversation

@jona159

@jona159 jona159 commented Sep 18, 2026 •

Copy link
Copy Markdown
Contributor

Type of Change

  • Dependency upgrade
  • Bug fix (non-breaking change)
  • Breaking change
    • e.g. a fixed bug or new feature that may break something else
  • New feature
  • Code quality improvements
    • e.g. refactoring, documentation, tests, tooling, ...

Implementation

Checklist

  • I gave this pull request a meaningful title
  • My pull request is targeting the dev branch
  • I have added documentation to my code
  • I have deleted code that I have commented out

Additional Information

@coderabbitai

coderabbitai Bot commented Sep 18, 2026 •

Copy link
Copy Markdown

Review Change StackReview Change Stack

Important

  • 🔍 Trigger review

This repository does not receive automatic reviews because it has fewer than 10 stars.

⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Advanced

Run ID: ac516164-a2a7-4003-ab5b-369ec52dfc85

📝 Summary

Summary by CodeRabbit

  • New Features

    • Added a download button to the navigation bar.
    • Added latitude and longitude as selectable export fields.
    • Coordinates are automatically selected for raw measurements and unavailable for aggregated data.
    • CSV, JSON, and TXT exports now include coordinates when selected.
  • Changes

    • Moved data downloading from the explore menu to the navigation bar.
    • Updated download interface labels and coordinate availability messaging in English and German.

Walkthrough

Changes

Coordinate download

Layer / File(s) Summary
Coordinate fields and export output
app/components/header/download.tsx, app/lib/file-exports.ts, public/locales/*/download.json
The download panel adds latitude and longitude fields for raw data. CSV, JSON, and TXT exports include selected coordinates. English and German translations add the related labels and notice.
Navigation download entry point
app/components/header/nav-bar/index.tsx, app/components/header/menu/index.tsx, app/components/map/topbar.tsx
The navigation bar opens the download panel. The menu no longer owns the download dialog or receives device data.

Priority: ➖ Normal

Estimated code review effort: 3 (Moderate) | ~20 minutes

Severity of issue fixed: Medium

Sequence Diagram(s)

sequenceDiagram
  participant User
  participant NavBar
  participant Download
  participant file_exports
  User->>NavBar: Select download button
  NavBar->>Download: Open panel with devices
  Download->>file_exports: Export selected raw coordinate fields
  file_exports-->>Download: Return CSV, JSON, or TXT output
Loading

Merge Risk: 🟡 Moderate · up to 84a5a

Raw downloads still omit the coordinates this PR is intended to add, so the server action should be corrected before merge.

🚥 Pre-merge checks | ✅ 3 | ❌ 2

❌ Failed checks (1 warning, 1 inconclusive)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 4 functions across 5 files. (2 skipped: 2 … Write docstrings for the functions missing them to satisfy the coverage threshold.
Description check ❓ Inconclusive The description includes the linked issue but does not state the change type, implementation, or limitations. The provided content is mostly an uncompleted template. Add a short summary of the implementation, select the applicable change type, and describe the raw-data-only coordinate limitation and download-location change.
✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly identifies the main change: adding coordinates to CSV downloads. It is concise and related to the changeset.
Linked Issues check ✅ Passed Issue #1095 requires latitude and longitude for each measurement download. The PR adds selectable latitude and longitude fields to the download form. app/lib/file-exports.ts writes these fields to C…
Out of Scope Changes check ✅ Passed The changed files support issue #1095. The download-menu removal and search-panel button relocate the download action described in the issue. The coordinate UI, export formatting, aggregate restrictio…
Full details: Docstring Coverage

Explanation

Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 4 functions across 5 files. (2 skipped: 2 unsupported.)

✨ Finishing Touches 💡 1
📝 Generate docstrings 💡
  • Commit to this branch
  • Create a new PR
🧪 Generate unit tests (beta)
  • Commit to this branch
  • Create a new PR

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@github-actions

github-actions Bot commented Sep 18, 2026 •

Copy link
Copy Markdown

Coverage Report

Status Category Percentage Covered / Total
🔵 Lines 66.61% 2357 / 3538
🔵 Statements 65.08% 2434 / 3740
🔵 Functions 63.57% 452 / 711
🔵 Branches 51.72% 1154 / 2231
File CoverageNo changed files found.
Generated in workflow #3066 for commit aeafbd9 by the Vitest Coverage Report Action

@scheidtdav
scheidtdav enabled auto-merge (squash) September 18, 2026 10:14

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2


ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Advanced

Run ID: 8c3964c9-a733-4d4d-923d-ed9f39cc04cf

📥 Commits

Reviewing files that changed from the base of the PR and between 4f3c707 and 84a5a55.

📒 Files selected for processing (7)
  • app/components/header/download.tsx
  • app/components/header/menu/index.tsx
  • app/components/header/nav-bar/index.tsx
  • app/components/map/topbar.tsx
  • app/lib/file-exports.ts
  • public/locales/de/download.json
  • public/locales/en/download.json

Included review availability: Your plan provides up to 1 included review per hour; 0 remain after this review.

Comment thread app/components/header/download.tsx Outdated
Comment on lines +71 to +72
latitude: boolean
longitude: boolean

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🗄️ Data Integrity & Integration | 🟠 Major | ⚡ Quick win

Forward coordinate selections to the download action.

The form submits latitude and longitude, but app/routes/explore.tsx builds includeFields with only title, unit, value, and timestamp. The exporters therefore ignore both coordinate selections, so raw downloads still omit coordinates.

Read both form fields in includeFields. Enforce the raw-data restriction in the server action as well.

Comment thread app/lib/file-exports.ts Outdated
Comment on lines +24 to +25
includeFields.latitude ? 'Latitude' : null,
includeFields.longitude ? 'Longitude' : null,

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🎯 Functional Correctness | 🟠 Major | ⚡ Quick win

Pass coordinate fields from the download action.

app/routes/explore.tsx builds includeFields with only title, unit, value, and timestamp. Therefore, both conditions here are always false for the download flow. CSV, JSON, and TXT downloads cannot include coordinates.

Add latitude and longitude to that object. Gate them with aggregate === 'raw' on the server so a crafted form request cannot enable coordinates for aggregated data.

Proposed fix in app/routes/explore.tsx
 const includeFields = {
   title: formdata.get('title') === 'on',
   unit: formdata.get('unit') === 'on',
   value: formdata.get('value') === 'on',
   timestamp: formdata.get('timestamp') === 'on',
+  latitude: aggregate === 'raw' && formdata.get('latitude') === 'on',
+  longitude: aggregate === 'raw' && formdata.get('longitude') === 'on',
 }

This branch has not been deployed

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

coordinates of measurements when downloading from mobile boxes

2 participants