Need review on Data Integrity Module API design

Thanks @darius and @dkayiwa
I didn’t realised that we can write tests instead of hot-reloading every time. Thanks a lot. It will definitely save lot of time.

I have written major API endpoints but I’m not able to trigger them. I’m also not able to see them in REST documentation page. I have used this command curl -u admin:password http://localhost:8080/openmrs/ws/rest/v1/dataintegrity/results to trigger but getting Resource does not exist error. @ssmusoke, could you please help me?

Thanks

@shivtej Can you provide a link to a repo where your changes can be reviewed for support

Made the PR here: https://github.com/openmrs/openmrs-module-dataintegrity/pull/21

@dkayiwa @wyclif Please can you help review the REST API I am very green here.

@suthagar23 your experience will be useful here too

@ssmusoke, @dkayiwa, thanks for your help. I fetched the latest code from all the dependent modules and rebuilt the module using mvn clean install and it worked.

@ssmusoke, I’m not able to run the tests I wrote for REST APIs. I’m not able to get application context. Full log here: https://pastebin.com/r3K0CJfx

I’ve also updated the PR: https://github.com/openmrs/openmrs-module-dataintegrity/pull/21

@shivtej does your pull request have the tests that fail?

@dkayiwa, yes. See this file: https://github.com/openmrs/openmrs-module-dataintegrity/pull/21/files#diff-284563762b288f66c5f9e3291fe0f907

Do you mean this pull request? https://github.com/openmrs/openmrs-module-dataintegrity/pull/21

@dkayiwa, yes.

@shivtej change this dependency https://github.com/openmrs/openmrs-module-dataintegrity/blob/master/pom.xml#L128 to 1.10.5

@ssmusoke, @dkayiwa Thanks for the help. Now the tests are running but there is a scope of improvement.

So, I’m using executeDataSet to store some data in-memory and then use it for tests. The problem is that the file I’m using is exactly same to another file located elsewhere. Basically, this folder and this folder have same content. Is there any way that omod and api sub-module can share same resources?

I’ve also updated the PR.

If you need them in both the api and omod, then just put them in the api. The omod will simply reference the api

@dkayiwa, so I deleted the resources directory from omod-test but now I’m getting FileNotFoundException error. Can you let me know what I’ve missed? I’ve also updated the PR.

Add this to your root pom: https://github.com/METS-Programme/openmrs-module-aijar/blob/master/pom.xml#L495-L515

Then add this to your omod pom: https://github.com/METS-Programme/openmrs-module-aijar/blob/master/omod/pom.xml#L30-L36

@dkayiwa, @ssmusoke, I want to fetch rules belong to a particular class. I wrote some code for that which you can see here . Basically, I sending ruleCategory in doGetAll method and then processing it accordingly.

So, the method is working passed the unit test I’m not able to see this REST APIs end-point in Rest API doc and I’m not able to get execute it using curl. I’m getting this error .

Is there any documentation for webservices because it’s getting very difficult for me to develop APIs by just referring other’s code? Thanks

@raff @wyclif @darius any assistance especially with regard to documentation and a flow to follow would be welcome

Stephen, could you be more specific what you’re asking for? (Busy…)

@darius @shivtej is implementing an API for the Data Integrity module so we are looking for examples/documentation to build on rather than copying and pasting code from all over the place