-
Notifications
You must be signed in to change notification settings - Fork 12
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
feat: cache param for expression dimension items (DHIS2-13871) #1433
feat: cache param for expression dimension items (DHIS2-13871) #1433
Conversation
src/modules/dataTypes.js
Outdated
@@ -6,6 +6,8 @@ export const DIMENSION_TYPE_DATA_ELEMENT = 'DATA_ELEMENT' | |||
export const DIMENSION_TYPE_DATA_SET = 'DATA_SET' | |||
export const DIMENSION_TYPE_EVENT_DATA_ITEM = 'EVENT_DATA_ITEM' | |||
export const DIMENSION_TYPE_PROGRAM_INDICATOR = 'PROGRAM_INDICATOR' | |||
export const DIMENSION_TYPE_EXPRESSION_DIMENSION_ITEM = |
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.
Im a bit surprised that GH doesn't pick up that this change already exists in my branch (https://github.com/dhis2/analytics/pull/1370/files?show-viewed-files=true&file-filters%5B%5D=#diff-64e11558ada84b560c86145d9ac2a5eb6c83a7f24fc40ef088b7f40aa2cbec48R21) 🤔
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.
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.
Moved it to the same line, but still not picked up.
Implements a small part of DHIS2-13871
hash
creates a deterministic fixed-length hash of the input string, it's a separate function with its own test to make it easy to replace the hash function latergetHash
accepts a string or an array of strings and returns the hash produced byhash
getExpressionHashFromVisualization
grabs the expressions (looks fordimensionItemType
andexpression
), if any EDIs in the visualization, then sorts them by id to get a cache hit as often as possible (now the order of the selected EDI items doesn't matter), and returns the result fromgetHash
In AnalyticsRequest we add the hash as a param
edi_cache
if there are EDIs in the visualization.