How to compile changes done to Bahmni Core?

I am using Bahmni on vagrant and have set up the dev environment and am editing the files in /Projects/bahmni/bahmni-core

What I want to achieve:
I wanted to create my own query to retrieve patients from the Db.

What I Have done until now:
So I used the same logic from PatientSearchController and created my own Controller. PatientSearchController uses the url–>/rest/bahmnicore/search/patient and I used a different one for my controller.I also made the corresponding DAO,DAOImpl,Service,ServiceImpl for my search functionality.For now,I have used the same code and havent made any changes to the logic.

My Problem:
How do I compile the code so that my search functionality is available for me to use in Bahmni?

Edit:I ran mvn clean install on bahmnicore-api and bahmnicore-omod.But it only generated the omod in bahmnicore-omod and not in bahmnicore-api.Am I doing something wrong?

Just go to the root folder of Bahmni Core and run

mvn clean install -P IT

Specifying the IT profile ensures that integration tests are run.

I did that and it showed build success.But I am not able to access my service

That’s no troubleshooting information. Can you provide exact symptoms as to what you experience, logs… etc?

In bahmni when I call the api it says the requested information not not exist

You need to provide a lot more info than this for anybody else to understand where you are coming from, the exact steps you have followed and where exactly you hit the problem.

In oblivion of all this could this help?

In bahmni registration module–>create new page,I was calling the getPatients() function which is at the following url /rest/bahmnicore/search/patient .Now I have created my own getPatients() function which is at /rest/bahmnicore/search/soundex .When calling it I am getting the error which says,“The requested information does not exist” .

When I created my own getPatients() ,I compiled it using the steps you mentioned . Dont know why I am getting the error. Thanks for your reply !

Assuming that your issue lies at the REST end point, can you try to reach it with cURL and report back?

curl -u user:pass --location
  "http://your_domain/openmrs/ws/rest/bahmnicore/search/soundex"

Where you should substitute user, pass and your_domain with the appropriate values. You might also switch http to https if that’s relevant for your setup.

Note that I doubt the part that you provided /rest/bahmnicore/search/soundex to be a valid end piece of the URL. If anything the whole thing should rather look like this: /openmrs/ws/rest/v1/bahmnicore/search/soundex (note the ‘v1’).

You really must provide detailed and accurate information, otherwise it’ll be difficult to move forward.

I alerted the variable holding the path and this is what i got

user and pass refers to Bahmni user and pass right?

Try this:

curl -u krishnanspace:Ezeebee123 -k --location
  "https://192.168.33.10/openmrs/ws/rest/v1/bahmnicore/search/soundex"

I added the -k option as suggested in the message that you reported.

Also when trying this through the app (so via your web browser as in your screenshot), look for any errors in the Chrome JavaScript console that relate to the URL in question. Finally keep an eye on the OpenMRS log as well (in /opt/openmrs/openmrs.log).

It gives me a huge error saying Resource does not exist.So i tried /search/patient ,but it still showed the same :frowning:

This for example would “work”:

curl -u superman:Admin123 -k --location
  "https://demo.mybahmni.org/openmrs/ws/rest/v1/bahmnicore/search/patient"

You would get an IllegalArgumentException because more arguments need to be provided to yield an actual response. But the resource is found, functions and returns an expected error.

So try this on your side:

curl -u krishnanspace:Ezeebee123 -k --location
  "https://192.168.33.10/openmrs/ws/rest/v1/bahmnicore/search/soundex"

So I ran curl -u krishnanspace:Ezeebee123 -k --location “https://192.168.33.10/openmrs/ws/rest/v1/bahmnicore/search/patient

And I got the correct result.But When I ran /search/soundex it says resource not found.Do I have to compile it again?

Assuming that you have deployed the module in /opt/openmrs/modules/ and restarted openmrs service

Which .omod do I have to place over the mentioned path?

The one in ./bahmnicore-omod/target/

ok thanks!!