Options for OpenMRS drug management

i am also trying to do same, wanted to create prescription and share with patient and get it printed., can you share omod file of orderenteryui module i need that,

Thanks for your resonse, unfortunately i dont have setup, so cant complie that. can you please share omod file with me so i can test, i understand disclaimer.

https://modules.openmrs.org/#/show/266/

Thanks @mksd i really appreciate it.

i believe it snapshot module, can you please share complete one so i can test it out, meanwhile i have also installed it and getting no drug into it.

please suggest.

Did you read this thread: ‘Drug dispense and administration in OrderEntryUi’? And in particular from here regarding your issue.

If you check the console, there is client side error. here the screen shot,

Syntax Error: Token ‘.’ is an unexpected token at column 15 of the expression [setting | omrs.display] starting at [.display].

Solution for above error:

Here is the file you should edit


Just replace the {{ setting | omrs.display }} with {{ setting.display }}

@hpardess are you doing a pull request with your suggested changes?

During testing I found the suggested solution and it worked for me somehow. Therefore, i suggested this and @mksd can decide whether it is write or not. because he know the purpose of that statement. so i am not doing pull request with suggested changes right now. I left it to the main developer to decide.

The reason of not listing drugs is a client side error as posted previously

As i traced the request, the serverside sends request with list of matched drugs as array but getDrugs() function ( openmrs-module-uicommons/blob/master/omod/src/main/webapp/resources/scripts/services/drugService.js ) does not parse the the received data correctly which cause following error,

Expected array but received: {“$$state”:{“status”:0}}

Can anyone please fix following function:

getDrugs: function(params) {
    return Drug.query(params).$promise.then(function(res) {
        return res.results;
    });
}

cc: @darius

This is because in the meantime Angular was upgraded. See ‘Upgrade angular version in UICommons’ here.

So basically this code works up to a certain version of UI Commons. I guess there would be no harm at making the change you suggested. OEUI’s POM should also stop depending on the distro. I mean all these things are the consequence of OEUI not being actively developed, as warned.

Translation: you should make a PR :wink: Altogether you should take the lead on OEUI and others will help you, rather than leaving “the main developer to decide”. This is a piece of work started by @darius that we took over briefly and discontinued, there is no main developer anymore behind it. And we have no plans to do anything with it in the foreseeable future.

@hpardess this will get you started with making pull requests: https://wiki.openmrs.org/display/docs/Pull+Request+Tips

Thanks @mksd for guidance.

Follwoing link really help me to understand how to deal with that bug and fix it. I will make a pull request.

Also regarding OEUI not listing the drugs. I fixed it locally that issue was also because of angularjs version change that could not handle asynchronous data in drop-down.

If anyone else want to fix it locally. here is the codes line to be fixed

{{ setting | omrs.display }}

replace it with

{{ setting | omrsDisplay }}

$scope.search = function(term) {
    return DrugService.getDrugs({ q: term });
}

replace it with

$scope.search = function(term) {
    return DrugService.getDrugs({ q: term }).then(function(result){
        return result;
    });
}

also

'typeahead="drug as drug.display for drug in search($viewValue) | filter:$viewValue" ' +

replace it with

'typeahead="drug as drug.display for drug in search($viewValue)" ' +

@hpardess do you mind opening a pull request? At least for the sake of those who are not coders. By the way, creating a pull request is a practical way of expressing your gratitude for all that you are using previously done by others. :slight_smile:

Sure I will. I am really interested to join the community not only as implementer but as developer too. I read the wiki page regarding Pull Request but i felt it will take longer to do that so i posted by founded solution to help other and also not forget till it do pull request.

I can not save and sign the drug order. here is the screen shot,

{"error":
{"message":"[provider on class org.openmrs.Encounter]",
"code":"org.openmrs.module.webservices.rest.web.resource.impl.BaseDelegatingResource:705",
"detail":"org.openmrs.module.webservices.rest.web.response.ConversionException: provider on class org.openmrs.Encounter\r\n\tat org.openmrs.module.webservices.rest.web.resource.impl.BaseDelegatingResource.getProperty(BaseDelegatingResource.java:705)\r\n\tat org.openmrs.module.webservices.rest.web.resource.impl.BaseDelegatingResource.setConvertedProperties(BaseDelegatingResource.java:608)\r\n\tat org.openmrs.module.webservices.rest.web.resource.impl.DelegatingCrudResource.create(DelegatingCrudResource.java:93)\r\n\tat org.openmrs.module.webservices.rest.web.v1_0.controller.MainResourceController.create(MainResourceController.java:91)\r\n\tat sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)\r\n\tat sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)\r\n\tat sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)\r\n\tat java.lang.reflect.Method.invoke(Method.java:498)\r\n\tat org.springframework.web.bind.annotation.support.HandlerMethodInvoker.invokeHandlerMethod(HandlerMethodInvoker.java:177)\r\n\tat org.springframework.web.servlet.mvc.annotation.AnnotationMethodHandlerAdapter.invokeHandlerMethod(AnnotationMethodHandlerAdapter.java:446)\r\n\tat org.springframework.web.servlet.mvc.annotation.AnnotationMethodHandlerAdapter.handle(AnnotationMethodHandlerAdapter.java:434)\r\n\tat org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:943)\r\n\tat org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:877)\r\n\tat org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:966)\r\n\tat org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:868)\r\n\tat javax.servlet.http.HttpServlet.service(HttpServlet.java:707)\r\n\tat org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:842)\r\n\tat javax.servlet.http.HttpServlet.service(HttpServlet.java:790)\r\n\tat org.eclipse.jetty.servlet.ServletHolder.handle(ServletHolder.java:816)\r\n\tat org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1686)\r\n\tat org.openmrs.module.web.filter.ForcePasswordChangeFilter.doFilter(ForcePasswordChangeFilter.java:60)\r\n\tat org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1669)\r\n\tat org.openmrs.module.web.filter.ModuleFilterChain.doFilter(ModuleFilterChain.java:72)\r\n\tat org.openmrs.web.filter.GZIPFilter.doFilterInternal(GZIPFilter.java:64)\r\n\tat org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)\r\n\tat org.openmrs.module.web.filter.ModuleFilterChain.doFilter(ModuleFilterChain.java:70)\r\n\tat org.openmrs.module.webservices.rest.web.filter.AuthorizationFilter.doFilter(AuthorizationFilter.java:108)\r\n\tat org.openmrs.module.web.filter.ModuleFilterChain.doFilter(ModuleFilterChain.java:70)\r\n\tat org.springframework.web.filter.ShallowEtagHeaderFilter.doFilterInternal(ShallowEtagHeaderFilter.java:82)\r\n\tat org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)\r\n\tat org.openmrs.module.web.filter.ModuleFilterChain.doFilter(ModuleFilterChain.java:70)\r\n\tat org.openmrs.module.owa.filter.OwaFilter.doFilter(OwaFilter.java:57)\r\n\tat org.openmrs.module.web.filter.ModuleFilterChain.doFilter(ModuleFilterChain.java:70)\r\n\tat org.openmrs.module.xforms.web.XformsFilter.doFilter(XformsFilter.java:69)\r\n\tat org.openmrs.module.web.filter.ModuleFilterChain.doFilter(ModuleFilterChain.java:70)\r\n\tat org.openmrs.module.web.filter.ModuleFilter.doFilter(ModuleFilter.java:54)\r\n\tat org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1669)\r\n\tat org.openmrs.web.filter.OpenmrsFilter.doFilterInternal(OpenmrsFilter.java:108)\r\n\tat org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)\r\n\tat org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1669)\r\n\tat org.springframework.orm.hibernate4.support.OpenSessionInViewFilter.doFilterInternal(OpenSessionInViewFilter.java:150)\r\n\tat org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)\r\n\tat org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1669)\r\n\tat org.openmrs.web.filter.StartupFilter.doFilter(StartupFilter.java:105)\r\n\tat org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1669)\r\n\tat org.openmrs.web.filter.StartupFilter.doFilter(StartupFilter.java:105)\r\n\tat org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1669)\r\n\tat org.openmrs.web.filter.StartupFilter.doFilter(StartupFilter.java:105)\r\n\tat org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1669)\r\n\tat org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:88)\r\n\tat org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)\r\n\tat org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1669)\r\n\tat org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:581)\r\n\tat org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:143)\r\n\tat org.eclipse.jetty.security.SecurityHandler.handle(SecurityHandler.java:548)\r\n\tat org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:226)\r\n\tat org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1156)\r\n\tat org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:511)\r\n\tat org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:185)\r\n\tat org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1088)\r\n\tat org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:141)\r\n\tat org.eclipse.jetty.server.handler.ContextHandlerCollection.handle(ContextHandlerCollection.java:213)\r\n\tat org.eclipse.jetty.server.handler.HandlerCollection.handle(HandlerCollection.java:109)\r\n\tat org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:119)\r\n\tat org.eclipse.jetty.server.Server.handle(Server.java:517)\r\n\tat org.eclipse.jetty.server.HttpChannel.handle(HttpChannel.java:306)\r\n\tat org.eclipse.jetty.server.HttpConnection.onFillable(HttpConnection.java:242)\r\n\tat org.eclipse.jetty.io.AbstractConnection$ReadCallback.succeeded(AbstractConnection.java:245)\r\n\tat org.eclipse.jetty.io.FillInterest.fillable(FillInterest.java:95)\r\n\tat org.eclipse.jetty.io.SelectChannelEndPoint$2.run(SelectChannelEndPoint.java:75)\r\n\tat org.eclipse.jetty.util.thread.strategy.ExecuteProduceConsume.produceAndRun(ExecuteProduceConsume.java:213)\r\n\tat org.eclipse.jetty.util.thread.strategy.ExecuteProduceConsume.run(ExecuteProduceConsume.java:147)\r\n\tat org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:654)\r\n\tat org.eclipse.jetty.util.thread.QueuedThreadPool$3.run(QueuedThreadPool.java:572)\r\n\tat java.lang.Thread.run(Thread.java:745)\r\n
Caused by: java.lang.NoSuchMethodException: Property 'provider' has no getter method\r\n\tat org.apache.commons.beanutils.PropertyUtilsBean.getSimpleProperty(PropertyUtilsBean.java:1127)\r\n\tat org.apache.commons.beanutils.PropertyUtilsBean.getNestedProperty(PropertyUtilsBean.java:686)\r\n\tat org.apache.commons.beanutils.PropertyUtilsBean.getProperty(PropertyUtilsBean.java:715)\r\n\tat org.apache.commons.beanutils.PropertyUtils.getProperty(PropertyUtils.java:290)\r\n\tat org.openmrs.module.webservices.rest.web.resource.impl.BaseDelegatingResource.getProperty(BaseDelegatingResource.java:699)\r\n\t... 74 more\r\n"}}

Any suggestion on how to solve it?

Your issue vaguely reminds me of something that we faced in the very early days of peaking at OEUI: ‘orderentryui - provider is undefined in order-entry.js’. Perhaps will it help, at least by giving you ways to troubleshoot further your actual issue.

Here is the issue created: https://issues.openmrs.org/browse/ORDER-25

I could not fix the this error yet. @wyclif, could you please look for this error and suggest the solution? Options for OpenMRS drug management

I observed the same error message in another post (Can't create Obs through REST with many levels of groupMembers) but it is fixed. I have the webservices.rest-2.19.0 module in my local machine.

Have you looked at the encounter resource for details on how to create an encounter based on the OpenMRS version you are running? From the error message, it appears like you’re setting the provider fields on the encounter as of 1.9, encounter has no provider fields, it should be encounterProviders, each encounter provider is a provider and an encounter role.