Diagnosis ICD-10 Rest API

We are building UI in Angular. We want to implement the same autocomplete for diagnosis fragment. Is there any API call? As there is for medication, tests, advice, etc.

When I write something in diagnosis, in the network tab it send request to “openmrs/coreapps/diagnoses/search.action?&term=<term_searched>”. And when tried in Postman, it through error. error report: https://pastebin.com/1TQjDT5a

@darius @dkayiwa

Thanks

Which version of the emrapi module are you running? Is this of help? https://issues.openmrs.org/browse/EA-125

Using EMR API 1.21 I want this autocomplete feature:

You can create a resource in the emrapi module which returns what this method does: https://github.com/openmrs/openmrs-module-coreapps/blob/master/omod/src/main/java/org/openmrs/module/coreapps/fragment/controller/DiagnosesFragmentController.java#L53-L72

BTW, what is with all the duplicates in this list? Best practice would be to have the actual diagnosis name first followed by the primary ICD-10-WHO code (if that’s what you are using). It is also important to remember that some diagnoses actually require two ICD codes.

Sorry, @dkayiwa but can you tell me How to config EMR API? Bcz I don’t see on the administration page.

What kind of configuration are you looking for?

https://demo.openmrs.org/openmrs/coreapps/diagnoses/search.action?&term={searchterm}

This url is used to fetch presumed or confirmed diagnosis. How can I use this on external UI that I have build using Angular 7? Bcz if fetched in postman it show error https://pastebin.com/hzXKpqx6

@dkayiwa any suggestion?

Hi @kundansinha, on the Ref app, you probably want to depend on coreapps to achieve this auto-completion. So you may want to copy the cURL of

from where you derived it (probably with Chrome under Network, XHR section) and use it(cURL) as an import in postman by pasting it into Paste Raw Text section of the popped up window. postman_impor_dialog

This will generate all the header info you need for the ajax request which you will use to fire up the request in postman and probably within your use case.

Thanks, @ruhanga for the suggestion I am not getting the same error not but now I am receiving this.

Could you login again into demo and import the cURL of the XHR in postman? Thank you.

Yes it i working thanks. But can you tell me how can I do a Rest API call to this

@kundansinha, you may want to include the following headers into the new rest call.

Accept: application/json, text/javascript, */*; 
Cookie: JSESSIONID={jsessionId you get after authentication or logging into the webapp} 

Here you will not depend on the user name and password credentials as is with the normal rest calls, but rather the session cookie details.

1 Like

thanks, @ruhanga.