Technical Overview

Project structure

Chart Search module consists of 3 projects:

  • server
  • api
  • omod

The server project doesn't have any OpenMRS dependencies. It contains custom Data Import Handler.

The api project contains classes interacts with Solr via SolrJ library: ChartSearchSearcher and ChartSearchIndexer. The first one makes requests to select handler, the second one - to ChartSearchDataImportHandler.

Omod project has chart search portlet, settings and commands pages.

Quick Overview

EmbeddedSolr was choosed instead of Lucene because SolrJ has common interface for EmbeddedSolr and separated Solr server. It makes easier to migrate from EmbeddedSolr to dedicated Solr.

DIH doesn't cover all requirements. It cannot import data asynchronously. Custom handler uses requests queue and daemons, that takes requests from queue and handles them. 

ChartSearchDataImportHandler locates in org.apache.solr.handler.dataimport package. This is due to the fact that Solr DataImporter class has package-level access modifier. 

There are two scheduler daemons started by handler: scheduler that periodically cleans index and scheduler that writes PatientInfoCache to file. 

Index clear scheduler uses IndexClearStrategy to change how to prune patients. 

PatientInfoCache contains patients last index time. This time is used to import only delta data. In future that class should contain patient index state.

Cache writes to file using PatientInfoProviderCSVImpl. This implementation uses the supercsv library. We should remove this dependency in future.

Solr stores in singleton and loads lazy. It caused by Spring dependency issues.