Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

task: Support the zip/gzip format in tracker exporter endpoints [ DHIS2-16165 ] #15994

Merged
merged 9 commits into from
Jan 8, 2024

Conversation

lucaCambi77
Copy link
Contributor

@lucaCambi77 lucaCambi77 commented Dec 19, 2023

https://dhis2.atlassian.net/browse/DHIS2-16165

Apply the same logic as in the old tracker events endpoint we can find in AbstractRootNodeMessageConverter.

Two new GET mapping are created in tracker/events applying to:

  • application/json+gzip (.../events.json.gz)
  • application/json+zip (.../events.json.zip)

Also, we harmonize the CSV compression for EventsExportController and TrackedEntititesExportController with the same logic.
Using the same logic as the old tracker, the Rest invocation will accept the attachment parameter, defaulting to event.json.zip or event.json.gzip if missing.

This also introduces the EventExportTestConfiguration, which can be used to mock configuration beans. This way, we don't need to invoke the service, also because the event query uses Postgres functions and doesn't work with the h2 database. Overall, the MVC tests should test only the web layer and not the services. We can still invoke the real method when applicable or fake a response if we want to.

Copy link

codecov bot commented Dec 19, 2023

Codecov Report

Attention: 6 lines in your changes are missing coverage. Please review.

Comparison is base (f20000d) 66.40% compared to head (e5911b9) 66.45%.
Report is 54 commits behind head on master.

Additional details and impacted files
@@             Coverage Diff              @@
##             master   #15994      +/-   ##
============================================
+ Coverage     66.40%   66.45%   +0.04%     
- Complexity    31551    31567      +16     
============================================
  Files          3506     3508       +2     
  Lines        130529   130664     +135     
  Branches      15227    15243      +16     
============================================
+ Hits          86678    86830     +152     
+ Misses        36778    36764      -14     
+ Partials       7073     7070       -3     
Flag Coverage Δ
integration 50.27% <1.63%> (-0.08%) ⬇️
integration-h2 32.48% <95.08%> (+0.18%) ⬆️
unit 30.38% <27.04%> (+<0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files Coverage Δ
...ntroller/tracker/export/event/CsvEventService.java 91.11% <100.00%> (+10.79%) ⬆️
.../export/trackedentity/CsvTrackedEntityService.java 95.00% <100.00%> (+0.76%) ⬆️
.../java/org/hisp/dhis/webapi/utils/ContextUtils.java 62.76% <ø> (ø)
...api/controller/tracker/export/CompressionUtil.java 81.81% <81.81%> (ø)
...r/tracker/export/event/EventsExportController.java 69.38% <96.15%> (+42.97%) ⬆️
...trackedentity/TrackedEntitiesExportController.java 83.16% <94.59%> (+10.54%) ⬆️

... and 100 files with indirect coverage changes


Continue to review full report in Codecov by Sentry.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update f20000d...e5911b9. Read the comment docs.

@lucaCambi77 lucaCambi77 requested review from vietnguyen and a team December 19, 2023 15:43
Copy link
Contributor

@enricocolasante enricocolasante left a comment

Choose a reason for hiding this comment

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

It looks good to me!
But I think we also need to support the same compression for csv format.
You can see in the old tracker that this is possible and in the Import/Export app it is supported to export compressed events in csv format

@lucaCambi77
Copy link
Contributor Author

lucaCambi77 commented Dec 20, 2023

It looks good to me! But I think we also need to support the same compression for csv format. You can see in the old tracker that this is possible and in the Import/Export app it is supported to export compressed events in csv format

Ok @enricocolasante, I've missed that. Actually, there is already the gzip support for csv. We can start from that and complete the job then

Copy link

sonarcloud bot commented Jan 5, 2024

@lucaCambi77 lucaCambi77 merged commit 132a00e into master Jan 8, 2024
17 checks passed
@lucaCambi77 lucaCambi77 deleted the DHIS2-16165 branch January 8, 2024 15:14
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.

3 participants