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

(feat) Include column definition within the dataset evaluation context #245

Closed
wants to merge 1 commit into from

Conversation

icrc-psousa
Copy link

Include column definition within the dataset evaluation context

@ibacher ibacher requested a review from mseaton August 7, 2023 12:55
@@ -90,6 +90,7 @@ public DataSet evaluate(DataSetDefinition dataSetDefinition, EvaluationContext c
StopWatch sw = new StopWatch();
sw.start();

ec.addContextValue("columnDefinitions", cd);
Copy link
Member

Choose a reason for hiding this comment

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

Can you describe why this is needed? Is there a ticket for this change? What problem are you trying to solve?

Copy link
Author

Choose a reason for hiding this comment

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

This was needed within the sequence of an issue identified on patient-grid. The patient-grid uses module-reporting to retrieve data for populating the grid. An issue arises when the same concept is reused within a single form. patient-grid lacks sufficient data to correlate observations with their respective columns.

On patient-grid, module-reporting DataSetDefinitionServiceImpl is invoked here and, on the 1st arg, column data is passed. Foreach column, reporting-module invokes patient-grid's ObsForLatestEncounterPatientDataEvaluator.evaluate. However, the challenge here is that there is no provided data that allows us to identify the specific column being processed. Currently, fetching observations relies solely on encounter and concept, which can lead to multiple matching observations, differing only in their formNamespaceAndPath.

The inclusion of column data within the ObsForLatestEncounterPatientDataEvaluator.evaluate will allow us to correlate the obs formNamespaceAndPath with the right column.

Copy link
Member

@mseaton mseaton Aug 8, 2023

Choose a reason for hiding this comment

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

Thanks @icrc-psousa . Could you configure things to pass the necessary information as a configuration parameter from your data set definition down to your data definition. Can you show me where these data set and data definitions are constructed and configured?

Just looking at your commit here icrc/openmrs-module-patientgrid@173fde6 it seems that it would help if your data definition could be configured with formNamespaceAndPath in addition to concept and encounterType, and then if this is present you could just match on it directly.

Copy link
Author

Choose a reason for hiding this comment

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

Data set definition is constructed here. I missed the fact that it's populated on patient-grid side.
We can include the formNamespaceAndPath and other required data, if needed, on patient-grid side here on this data definition as you've suggested. Thanks for your input @mseaton!

This PR on module-reporting won't be needed.

@icrc-psousa icrc-psousa closed this Aug 8, 2023
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