As we know appointments was extracted out of bahmni so that it can be used directly on an openmrs instance, As a part of the work done here we also extracted out a bahmni commons module.
In our implementation we are are also using the datafilter module.
There is a patient search API defined in bahmni commons module for which data filter is not kicking in. this is because the search query defined in
PatientDaoImpl.java is a SQL query
SQLQuery sqlQuery = new PatientSearchBuilder(sessionFactory) .withPatientName(name) .withPatientAddress(addressFieldName, addressFieldValue, addressSearchResultFields) .withPatientIdentifier(identifier, filterOnAllIdentifiers) .withPatientAttributes(customAttribute, getPersonAttributeIds(customAttributeFields), getPersonAttributeIds(patientSearchResultFields)) .withProgramAttributes(programAttributeFieldValue, programAttributeType) .withLocation(loginLocationUuid, filterPatientsByLocation) .buildSqlQuery(length, offset);
and for datafilter to kick in it needs to be a HQL query.
We have 2 approaches to migrate it to HQL query:
- Migrate the entire query to HQL. (need to rely on tests for this).
- Create a V2 for the API and incrementally build it to replace the old API.
We are in favour of a V2 as it will be easier and faster to implement it, For our use case we only need the with name criteria which can be used as a starting point for this API, and the idea is to add more criteria as and when required.
Please share your thoughts/suggestions.