Skip to content

Add new datapoint export options, including new CSV formats - #2020

Merged
Ekhorn merged 44 commits into
openremote:masterfrom
Hackerberg43:enhancement/dataExportPage
Feb 25, 2026
Merged

Ekhorn merged 44 commits into
openremote:masterfrom
Hackerberg43:enhancement/dataExportPage

Conversation

@Hackerberg43

@Hackerberg43 Hackerberg43 commented Jul 24, 2025 •

Copy link
Copy Markdown
Contributor

Description

Data export page:

  • Added loading indicators that are activated while retrieving table data and while the export request is running.
    Before, it was not visible whether the app was loading, becoming unresponsive or simply not doing anything. (closes Data export: improve performance and feedback of data export page #1396)
  • Added a list input to select alternative export formats.
afbeelding

asset/datapoint/export resource :

397464018-f3a13eee-4f2c-4d05-bbbb-738bb93ca2c6
  • Added 1 minute average aggregation option, potentially saves even more time post-processing the csv.

  • Fix resource leak using try-with-resources on FileInputStream (a leak was observed while we tried multiple times extracting data that resulted in database timeouts, not sure if this is the direct cause though)

  • Added migration script to add tablefunc extension to postgres, required for the new csv formatting.

Checklist

  • 1. I've made "format" an optional query parameter in asset/datapoint/export to avoid an API breaking change. However, I'm not fully confident if this is the correct way. I did not find any usage of @DefaultValue in any of the existing api resources, while it seems a straightforward solution. I'm trying to create something similar to the optional parameters used in the datapoint query (gapfill, formula,..), but not sure if that is the best way either, because those did not get picked up by the automated API documentation.

  • 2. Tested on a local deployment only with a 2 million datapoint database.

  • 3. The format names are little lengthy, not sure how to improve.

@wborn
wborn requested a review from Copilot July 25, 2025 15:22

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull Request Overview

This PR enhances the data export functionality by adding loading indicators to improve user experience and introducing multiple CSV export formats with database optimization. The changes address user feedback about unclear loading states and provide more flexible data export options.

  • Added loading indicators to show export progress and prevent user confusion
  • Introduced three CSV export formats: default, column-per-attribute, and column-per-attribute with 1-minute averages
  • Fixed resource leak using try-with-resources pattern and added database migration for PostgreSQL tablefunc extension

Reviewed Changes

Copilot reviewed 7 out of 7 changed files in this pull request and generated 6 comments.

Show a summary per file
File Description
ui/app/shared/locales/nl/or.json Added Dutch translation for "Export format" label
ui/app/shared/locales/en/or.json Added English translation for "Export format" label
ui/app/manager/src/pages/page-export.ts Enhanced UI with loading indicators and export format selection dropdown
model/src/main/java/org/openremote/model/datapoint/AssetDatapointResource.java Added optional format parameter to export API endpoint
manager/src/main/resources/org/openremote/manager/setup/database/V20250724_01__addTableFunc.sql Database migration to enable PostgreSQL tablefunc extension
manager/src/main/java/org/openremote/manager/datapoint/AssetDatapointService.java Implemented multiple CSV export formats with SQL crosstab functionality
manager/src/main/java/org/openremote/manager/datapoint/AssetDatapointResourceImpl.java Updated export endpoint to handle format parameter and fixed resource leak

Comment thread ui/app/manager/src/pages/page-export.ts Resolved
Comment thread ui/app/manager/src/pages/page-export.ts Resolved
Hackerberg43 and others added 3 commits July 25, 2025 22:04
…tapointService.java

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
…tapointService.java

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
…tapointResourceImpl.java

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
@Hackerberg43

Copy link
Copy Markdown
Contributor Author

@richturner
richturner requested a review from a team September 3, 2025 09:47
@richturner richturner added the Discuss Needs discussion within the planning team label Sep 9, 2025
@Hackerberg43

Copy link
Copy Markdown
Contributor Author

Intial comments/insights have been addressed, this should be ready for proper review.

@richturner

Copy link
Copy Markdown
Member

As discussed @Hackerberg43 a frontend test would be great to get this finished @MartinaeyNL can you review the frontend code changes please.

@Ekhorn

Ekhorn commented Jan 16, 2026

Copy link
Copy Markdown
Contributor

I have this commit running on our testrig right now with 200m datapoints. It is unable to export data, only gives timeouts. I'm currently narrowing down if this is caused by the DB bloat and not the export itself. Will keep you updated.

@Hackerberg43 Just checking that you're aware of the fact that @openremote/core sets the request timeout to 20 seconds (on the frontend). Increasing rest.setTimeout(20000); avoids these timeouts and it might make sense to increase this timeout limit (for datapoint exports), because downloading hundreds of megabytes or gigabytes of data at this scale starts to get throttled by connection speeds.

@Hackerberg43

Copy link
Copy Markdown
Contributor Author

Ah good to know! I'm trying some of the queries directly into the testrig database right now, which take a couple of minutes to complete. I am currently trying to optimize/clean the database a bit to see if it can be brought down to a reasonable time. Otherwise it might need to be considered to move back to disk storage and decouple the exporting/downloading process.

@Hackerberg43

Copy link
Copy Markdown
Contributor Author

So after some DB tuning our testrig is just able to export 2m datapoints before the timeout. While still not sufficient for our use case, I think for most projects this is completely fine? We might diverge to a separate solution in our custom project that performs export jobs in the background and exposes files in an export folder as downloadable.

So this is ready to test @Ekhorn.

@Ekhorn

Ekhorn commented Jan 20, 2026

Copy link
Copy Markdown
Contributor

There seems to be an issue with the GitHub actions runner timing out on certain PRs. I'll check if I can get this resolved on my own first.

@ebariaux
ebariaux requested a review from Ekhorn January 26, 2026 09:31

@Ekhorn Ekhorn left a comment •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Nice work @Hackerberg43!

I will approve this when the threads are resolved.

See #2020 (comment) and #2020 (comment)

@Ekhorn Ekhorn mentioned this pull request Feb 12, 2026
@Hackerberg43

Copy link
Copy Markdown
Contributor Author

@Ekhorn Done.
The sql injection fix required some code updating but done now. db migration file updated for today.

@Ekhorn Ekhorn left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

With these changes the normal CSV export runs a little faster again (after the recent SQL injection defensive measure) and prevents filesystem issues, also the crosstab formats are a nice addition.

Thanks @Hackerberg43!

@Ekhorn
Ekhorn requested a review from richturner February 25, 2026 09:30
@Ekhorn
Ekhorn merged commit 5e04a4c into openremote:master Feb 25, 2026
1 check passed
@MartinaeyNL MartinaeyNL added Enhancement Improvement of an existing feature and removed Discuss Needs discussion within the planning team labels Mar 9, 2026
@Ekhorn Ekhorn added Feature Development of new feature and removed Enhancement Improvement of an existing feature labels Mar 9, 2026
@MartinaeyNL MartinaeyNL changed the title Enhancement: Improve data export Add new datapoint export options, including new CSV formats Mar 9, 2026
@Hackerberg43
Hackerberg43 deleted the enhancement/dataExportPage branch April 21, 2026 12:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Feature Development of new feature

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Enhancement/alternative data export format ( postgres update req. ) Data export: improve performance and feedback of data export page

6 participants