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

refactor: Option dimension in Visualization [DHIS2-18370] #19725

Open
wants to merge 6 commits into
base: master
Choose a base branch
from

Conversation

maikelarabori
Copy link
Contributor

@maikelarabori maikelarabori commented Jan 20, 2025

Making the option set / item adherent to the existing model objects.
Before this change, the JSON request/response would look like:

            "items": [
                {
                    "id": "IpHINAT79UW.CklPZdOd6H1",
                    "dimensionItemType": "PROGRAM_DATA_ELEMENT",
                    "optionSetItem": {
                        "aggregation": "DISAGGREGATED",
                        "options": [
                            {
                                "id": "AZK4rjJCss5"
                            },
                            {
                                "id": "UrUdMteQzlT"
                            }
                        ]
                    }
                }
            ]
            "items": [
                {
                    "id": "IpHINAT79UW.UuL3eX8KJHY.koZkOwyJbSQ",
                    "dimensionItemType": "PROGRAM_DATA_ELEMENT_OPTION"
                },
                                {
                    "id": "IpHINAT79UW.UuL3eX8KJHY.uODmvdTEeMr.AGGREGATED",
                    "dimensionItemType": "PROGRAM_DATA_ELEMENT_OPTION"
                },
                {
                    "id": "IpHINAT79UW.CklPZdOd6H1.AZK4rjJCss5.DISAGGREGATED",
                    "dimensionItemType": "PROGRAM_ATTRIBUTE_OPTION"
                },
                                {
                    "id": "IpHINAT79UW.CklPZdOd6H1.UrUdMteQzlT.DISAGGREGATED",
                    "dimensionItemType": "PROGRAM_ATTRIBUTE_OPTION"
                }
            ]

Even though, it looks less concise (from the representation point of view) it follows the same standard of existing dimensions. After a conversation with @larshelge , this the preferred way.

isNotBlank(aggregationId) ? Aggregation.valueOf(aggregationId) : AGGREGATED;

if (program == null || attribute == null || option == null) {
return null;
Copy link
Contributor

Choose a reason for hiding this comment

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

Not sure what is the convention, but wouldn't be better to return Option< ProgramTrackedEntityAttributeOptionDimensionItem>?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

We could, but I applied the same convention from all other existing methods. It can be refactored all together later if this is the case.

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.

2 participants