How does patient search work in Platform?

I had this little query on the implementation of various search based functions like patient search, concept search, person search, active visits, etc.

With platform 1.11.4, I was able to track down the actual methods handling search related requests but little confused on how and from where things are taken care of after integrating platform with reference application modules.

For starters say where can I find the method called when find patient function is used through the reference application. So far I’ve learned that coreapps module provides the find patient functionality from patient search widget. I’ve tracked down to patientSearchWidget.js and found that search URL make REST invocation. I scanned through web services module but got lost and have failed to understand the workflow to its root.

I’m currently working on multi-tenant architecture and need to fine tune the service method for the above mentioned search functions.

Are you looking for this? https://github.com/openmrs/openmrs-module-webservices.rest/blob/master/omod-1.8/src/main/java/org/openmrs/module/webservices/rest/web/v1_0/resource/openmrs1_8/PatientResource1_8.java#L251

2 Likes

The webservices.rest module has a thin layer in general, in most cases it simply delegates to the methods in the core API. If you peek at the code in core there’s methods like ConceptService.getConcepts and PatientService.getPatients which also delegate to underlying DAO methods like ConceptDAO.getConcepts and PatientDAO.getPatients that issue queries to the DB

1 Like

Thanks @dkayiwa and @wyclif. Tracked down the methods and I’m off the blockers now.:grinning:

I’ve added few variables under person class and want to access them in patientSearchWidget results.

Currently, the patientSearchWidget uses REST call to …/ws/rest/v1/patient with custom version parameter as: var customRep = 'custom:(uuid,' + 'patientIdentifier:(uuid,identifier),' + 'person:(gender,age,birthdate,birthdateEstimated,personName))';

I tried adding variable name like: ...person:(gender,age,birthdate,birthdateEstimated,personName,<my-variable>)); but I always get a null for <my-variable>.

Is there any change I need to make in webservice module??

Yes, you would need to have made them accessible properties.

See:

@darius I expected a similar change and have already tried adding properties in getRepresentationDescription() of PersonResource1_8. I get a null value for <my-variable> in JSON response of the REST call and in XML response I get a tag with no value (<my-varaible/>). Do I need to define a @PropertyGetter for the property I’m trying to add??

Note: The variable I’m trying to access is of a custom data-type (class)

Hello,

Am working on adding a search for a patient using fingerprint technology. It will be great to get pointers here. Here is my work-plan:

  1. -Have an end-to-end understanding of the design+code for the Find Patient App.

  2. -Add an icon to the find -patient widget

  3. -Work with ReST+Angular on how to search for a patient record

  4. -Embed the applet that does finger-print search.

  5. -Redirect urls to the patient dash board app. Please share comments here. @darius @wyclif

Hi Simon,

The folks at ampath with @judy did some work on a biometrics module I think last summer, it would be good to reach out to them and see if you can share ideas or even see if you can use that module.