Help With Reporting Module Preview Page Query Results

We are working on the JIRA issue REPORT-823 , and my group is trying to update the results given from person queries and cohort queries.

We know “queryParameterForm” displays the results of the queries for the preview page, and we have traced the results back to a method-call

getDefinitionService(c).evaluate(definition, context);

which is found at

reporting/api/src/main/java/org/openmrs/module/reporting/definition/DefinitionContext.java

We believe that the results may also be related to

Context.getService();

Which is found at the same path listed above

We would like to know how the results are stored along with how to manipulate the results into more user friendly tables such as pageable lists.

Did you intend to ask how results are stored or how they are passed to the view for display?

Our team has a general idea of how results are displayed, but we could always use a better understanding of how exactly it works. More precisely, we could use help better understanding how results are stored and how they are passed to the view for display. Thanks ahead!

Do you mean how they are stored in the database?

We want to know how the results are displayed so we can modify it, but we believe that knowing how they are stored could help us achieve this. Any information on either of these things would help immensely. Thanks again

@mseaton @dkayiwa

When you preview a cohort query the results appear to return as a string with the number of patients in the query.

When you preview a person query the results appear to return as a list of the IDs.

I am having a difficult time tracing the results and would like to know how they are different for each type of query.

Can you share links to the query results on http://uat-refapp.openmrs.org?

Here are the results for the cohort query:
https://uat-refapp.openmrs.org/openmrs/module/reporting/definition/manageDefinitions.form?type=org.openmrs.module.reporting.cohort.definition.CohortDefinition

Here are the results for the person query:
https://uat-refapp.openmrs.org/openmrs/module/reporting/definition/manageDefinitions.form?type=org.openmrs.module.reporting.query.person.definition.PersonQuery

Pressing the green preview button will display the previews.

Let me know if this is what you were requesting.

Thanks.

I have found the file FormatTag.java located at:

/openmrs-module-reporting/omod/src/main/java/org/openmrs/module/reporting/web/taglib

I have learned this file contains the methods printCohort() and printCollection() which allow me to update how cohort queries and person queries are previewed respectively.

Now I am having the issue of correctly updating how they are displayed.

printCohort(StringBuilder sb, Cohort cohort) takes as parameters the string to build and the cohort which is being previewed. It appears cohort only has a valid size attribute; its id is NULL from what I have seen. Do you have any suggestions on getting the patients from the cohort object being passed in?

printCollection(StringBuilder sb, Collection<?> c) again takes as parameters the string to build and the collection to display. Updating the resulting table has proven to be more difficult than I expected since sb is simply filled with HTML to create a table. I have tried adding the definition-table class in an attempt to create a paginated table similar to the ones used when selecting a query to preview. This has not been successful. My current solution is making the table scrollable rather than pageable. If there is a better way to update these tables, please let me know.