-
Notifications
You must be signed in to change notification settings - Fork 360
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
Analytics API: Add support for Option in /analytics [DHIS2-18368] #19558
Conversation
This reverts commit 123bc05.
dhis-2/dhis-api/src/main/java/org/hisp/dhis/analytics/OptionSetSelectionCriteria.java
Fixed
Show fixed
Hide fixed
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good, just left a couple of minor comments.
...his-test-e2e/src/test/java/org/hisp/dhis/analytics/aggregate/AnalyticsQueryDv14AutoTest.java
Show resolved
Hide resolved
@@ -78,17 +78,18 @@ public ProgramTrackedEntityAttributeOptionDimensionItem( | |||
|
|||
@Override | |||
public String getName() { | |||
return joinWith( | |||
SPACE, program.getDisplayName(), attribute.getDisplayName(), option.getDisplayName()); | |||
return format( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does it make sense to add some null checks here (in the constructor), something like:
public ProgramTrackedEntityAttributeOptionDimensionItem(
Program program, TrackedEntityAttribute attribute, Option option) {
this.program = Objects.requireNonNull(program, "Program cannot be null");
this.attribute = Objects.requireNonNull(attribute, "Attribute cannot be null");
this.option = Objects.requireNonNull(option, "Option cannot be null");
}
|
As part of the option set and options feature, we need to change the
/analytics
API to support the following style of queries related to OptionSet and Option.The changes are only required for Program Attributes and Program Data Elements, where two new models were created to extend the existing flow and logic.
New analytics end-to-end tests are also included, so we can ensure the new feature is well covered.
The metadata was also modified to accommodate the new dimension.
Finally, very light clean-up and specific refactoring were applied where it made sense, especially to respect our Sonar rules.