-
Notifications
You must be signed in to change notification settings - Fork 2
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
exclude default categories from dataElements #959
Conversation
c0d94af
to
4767357
Compare
// In DHIS 2.38.5 and above the defaults parameter is not working | ||
// /api/metadata.json?fields=id&filter=id:eq:data_element_id&categoryCombo&defaults=INCLUDE/EXCLUDE; this is not working | ||
// so manually removing the default categoryCombo | ||
const elementWithoutDefaults = |
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.
A use case should not make any reference to DHIS2 (that's an implementation detail). If DHIS2 has a bug (Indeed, I've checked it: 2.36 OK, 2.38 FAIL), any extra processing should be done in the data layer, in the DHIS2 repository implementation (check any file which calls the API with that option defaults: boolean
-> apart from the metadata repo, I've found also utils/synchronization.ts; check if more)
Note: checking dhis2-core, DefaultCategoryService.java, the models that have a default object are the 4 expected: category, categoryOption, categoryCombo, categoryOptionCombo.
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.
[code-only review] All good. I'd just move the file (not a major issue)
src/utils/d2-utils.ts
Outdated
@@ -22,3 +25,47 @@ export function getD2APiFromInstance(instance: Instance) { | |||
*/ | |||
return new D2Api({ baseUrl: instance.url, auth: instance.auth, backend: "fetch" }); | |||
} | |||
|
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.
Let's move the file to data/ so it's more CleanArch compliant.
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.
Nothing more to add, it's ok by me now.
📌 References
📝 Implementation
In DHIS 2.38.6 the defaults parameter is not working in the
metadata
endpoint/api/metadata.json?fields=id&filter=id:eq:data_element_id&categoryCombo&defaults=INCLUDE/EXCLUDE;
so I'm manually removing the default
categoryCombo
fromdataElements/dataSets
📹 Screenshots/Screen capture
🔥 Is there anything the reviewer should know to test it?
📑 Others
#8694rjjmk