Sorting the patient Search Grid on registration module

Hi all,

My team has implemented the sorting on the search grid of the Registration module according to a few selected headers.

This has been a requirement of a few of our clients because of the huge number of records being present and the difficulty to find for the desired record.

This sorting is implemented to view the search results in either ascending or descending order according to the header selected. The headers in blue (refer to the attached image below) have the ability to sort the results in both ways.

For this, we used an external library for sorting which is https://github.com/linagora/angularjs-naturalsort and the logic for sorting. This external library is used to perform natural sorting on the data that was returned from the search query. Then the sorting library was applied as a angularjs filter on the search grid.

Sorting of the search grid for the headers ID, Name, Middle Name, Last Name, Gender, Birth date and Age.

@angshuonline We would like to contribute this functionality to the product.

Thanks Akhil. I think this will be nice addition. Do bring up the topic in the next PAT call. My only question would be about the library

  • adding a dependency, can we use existing library and/or just write additional algorithms?
  • how much would be additional footprint?
  • how is the sort performance? have you tested with good enough dataset? (It seems to go through a fair bit of computation - like natural sorting a string … )
  • maintained library?

Hi Angshu,

  • We had some time constraints for our client so we decided to go ahead with an external library instead of writing our own.

  • Additional footprint would be modifying the UI to be sortable.

  • The sort performance was good enough for 3-4k patients. Also to note is the default OpenMRS resource limit of 50.

  • The library does not look to be well maintained. It was last updated in 2017.