feat: export /tracker/event using different idSchemes DHIS2-14968 #19039
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Allow users to export tracker data using the same
idSchemes
supported by the importerand the same
idScheme
related request parameters. This is guaranteed by using the same type TrackerIdSchemeParams.This PR adds support for
For example
Our mappers now need to know about the
TrackerIdSchemeParams
. All other exporters which do not yet supportidSchemes
other thanUID
are not affected as they use theTrackerIdSchemeParams.builder().build()
which defaults toUID
.Out of scope for this PR:
categoryOptionComboIdScheme
,categoryOptionIdScheme
,dataElementIdScheme
: will come in following PRs 😅Tests
Tests are important as idSchemes was a major source of bugs in the tracker importer and exporter in the past.
This feature is tested using a controller integration test with Postgresql. As the logic is in the web layer (mapping of metadata using the correct idScheme to string) and the repository (getting the different idSchemes).
The test only tests against the "single" event controller method as
#18943
made sure it uses the same path as the collection controller method.
The test only tests the metadata-specific request parameters as
#19060
made sure the logic of
idScheme
vs metadata-specific parameters is in theTrackerIdSchemeParams
type and unit tested.Example errors if we mess up our test setup and logic.
Fails if our setup misses metadata. This avoids false positives of
expected == actual
withnull == null
or"" == ""
.Fails like this if the field does not show up in the response due to for example an error in our store
Fails like this if the field does not have the expected
idScheme
(expected takes the correct field using the idSchemeParam)