Uploaded image for project: 'Webservices REST Module'
  1. Webservices REST Module
  2. RESTWS-632

Cannot specify precised numeric values in obs

    XMLWordPrintable

Details

    • Bug
    • Status: Closed
    • TBD
    • Resolution: Fixed
    • None
    • None
    • None
    • None
    • Undetermined

    Description

      Its impossible to create obs with precised numeric values (eg. 2.5) in obs.

      Thats how HTTP Requests logs looks like:
      PS. You can just directly execute these POST requests via some HTTP Client (without creating patients, visits etc.), because I've created these on int02, so its available for everyone

      When creating obs with value without precision:

      POST
      D/OkHttp: --> POST http://int02.openmrs.org:8080/openmrs/ws/rest/v1/encounter http/1.1
      D/OkHttp: Content-Type: application/json; charset=UTF-8
      D/OkHttp: Content-Length: 314
      D/OkHttp: Authorization: Basic QWRtaW46QWRtaW4xMjM=
      D/OkHttp: Accept: application/json
      D/OkHttp: {"encounterType":"67a71486-1a54-468f-ac3e-7091a9a79584","obs":[{"concept":"5085AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA","obsDatetime":"2016-12-23T02:24:08.957","person":"87747124-429a-4c85-922f-30ae62bee7d1","value":"50.0"}],"patient":"87747124-429a-4c85-922f-30ae62bee7d1","visit":"fb1aed4a-2f50-4e43-a587-fca84042d35d"}
      D/OkHttp: --> END POST (314-byte body)
      
      POST Response
      D/OkHttp: <-- 201 Created http://int02.openmrs.org:8080/openmrs/ws/rest/v1/encounter (825ms)
      D/OkHttp: Server: Apache-Coyote/1.1
      D/OkHttp: Set-Cookie: JSESSIONID=48867C6D228023BC0CD12F065512FC5A; Path=/openmrs/
      D/OkHttp: Content-Type: application/json;charset=UTF-8
      D/OkHttp: Content-Length: 1353
      D/OkHttp: Date: Fri, 23 Dec 2016 07:24:09 GMT
      D/OkHttp: OkHttp-Sent-Millis: 1482477849139
      D/OkHttp: OkHttp-Received-Millis: 1482477849809
      D/OkHttp: {"uuid":"ee2576a2-5b2b-49ea-acb2-ef58b6835cd5","display":"Vitals 23/12/2016","encounterDatetime":"2016-12-23T02:24:09.000-0500","patient":{"uuid":"87747124-429a-4c85-922f-30ae62bee7d1","display":"10H56 - AC-262 TEST USER","links":[{"rel":"self","uri":"http://int02.openmrs.org/openmrs/ws/rest/v1/patient/87747124-429a-4c85-922f-30ae62bee7d1"}]},"location":null,"form":null,"encounterType":{"uuid":"67a71486-1a54-468f-ac3e-7091a9a79584","display":"Vitals","links":[{"rel":"self","uri":"http://int02.openmrs.org/openmrs/ws/rest/v1/encountertype/67a71486-1a54-468f-ac3e-7091a9a79584"}]},"obs":[{"uuid":"7b030f10-1d7c-4afd-873c-f7be4b6a1265","display":"Systolic blood pressure: 50","links":[{"rel":"self","uri":"http://int02.openmrs.org/openmrs/ws/rest/v1/obs/7b030f10-1d7c-4afd-873c-f7be4b6a1265"}]}],"orders":[],"voided":false,"visit":{"uuid":"fb1aed4a-2f50-4e43-a587-fca84042d35d","display":"Facility Visit @ Laboratory - 23/12/2016 02:14","links":[{"rel":"self","uri":"http://int02.openmrs.org/openmrs/ws/rest/v1/visit/fb1aed4a-2f50-4e43-a587-fca84042d35d"}]},"encounterProviders":[],"links":[{"rel":"self","uri":"http://int02.openmrs.org/openmrs/ws/rest/v1/encounter/ee2576a2-5b2b-49ea-acb2-ef58b6835cd5"},{"rel":"full","uri":"http://int02.openmrs.org/openmrs/ws/rest/v1/encounter/ee2576a2-5b2b-49ea-acb2-ef58b6835cd5?v=full"}],"resourceVersion":"1.9"}
      D/OkHttp: <-- END HTTP (1353-byte body)
      

      When creating obs with value with precision:

      POST
      D/OkHttp: --> POST http://int02.openmrs.org:8080/openmrs/ws/rest/v1/encounter http/1.1
      D/OkHttp: Content-Type: application/json; charset=UTF-8
      D/OkHttp: Content-Length: 314
      D/OkHttp: Authorization: Basic QWRtaW46QWRtaW4xMjM=
      D/OkHttp: Accept: application/json
      D/OkHttp: {"encounterType":"67a71486-1a54-468f-ac3e-7091a9a79584","obs":[{"concept":"5085AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA","obsDatetime":"2016-12-23T02:27:06.310","person":"87747124-429a-4c85-922f-30ae62bee7d1","value":"50.5"}],"patient":"87747124-429a-4c85-922f-30ae62bee7d1","visit":"fb1aed4a-2f50-4e43-a587-fca84042d35d"}
      D/OkHttp: --> END POST (314-byte body)
      
      POST Response
      D/OkHttp: <-- 500 Internal Server Error http://int02.openmrs.org:8080/openmrs/ws/rest/v1/encounter (945ms)
      D/OkHttp: Server: Apache-Coyote/1.1
      D/OkHttp: Set-Cookie: JSESSIONID=FC396E252BA5AC091262492F5DFA2DCC; Path=/openmrs/
      D/OkHttp: Content-Type: application/json;charset=UTF-8
      D/OkHttp: Content-Length: 11137
      D/OkHttp: Date: Fri, 23 Dec 2016 07:27:07 GMT
      D/OkHttp: Connection: close
      D/OkHttp: OkHttp-Sent-Millis: 1482478026651
      D/OkHttp: OkHttp-Received-Millis: 1482478027459
      D/OkHttp: {"error":{"message":"['obs id is null' failed to validate with reason: valueNumeric: error.precision]","code":"org.openmrs.validator.ValidateUtil:78","detail":"org.openmrs.api.ValidationException: 'obs id is null' failed to validate with reason: valueNumeric: error.precision\n\tat org.openmrs.validator.ValidateUtil.validate(ValidateUtil.java:78)\n\tat org.openmrs.aop.RequiredDataAdvice.before(RequiredDataAdvice.java:124)\n\tat org.springframework.aop.framework.adapter.MethodBeforeAdviceInterceptor.invoke(MethodBeforeAdviceInterceptor.java:51)\n\tat org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179)\n\tat org.springframework.aop.framework.adapter.MethodBeforeAdviceInterceptor.invoke(MethodBeforeAdviceInterceptor.java:52)\n\tat org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179)\n\tat org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:207)\n\tat com.sun.proxy.$Proxy170.saveObs(Unknown Source)\n\tat org.openmrs.api.impl.EncounterServiceImpl.saveEncounter(EncounterServiceImpl.java:207)\n\tat sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)\n\tat sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)\n\tat sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)\n\tat java.lang.reflect.Method.invoke(Method.java:498)\n\tat org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:317)\n\tat org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:190)\n\tat org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:157)\n\tat org.springframework.transaction.interceptor.TransactionInterceptor$1.proceedWithInvocation(TransactionInterceptor.java:99)\n\tat org.springframework.transaction.interceptor.TransactionAspectSupport.invokeWithinTransaction(TransactionAspectSupport.java:281)\n\tat org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:96)\n\tat org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179)\n\tat org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:207)\n\tat com.sun.proxy.$Proxy171.saveEncounter(Unknown Source)\n\tat sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)\n\tat sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)\n\tat sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)\n\tat java.lang.reflect.Method.invoke(Method.java:498)\n\tat org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:317)\n\tat org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:190)\n\tat org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:157)\n\tat org.openmrs.aop.LoggingAdvice.invoke(LoggingAdvice.java:121)\n\tat org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179)\n\tat org.springframework.aop.framework.adapter.MethodBeforeAdviceInterceptor.invoke(MethodBeforeAdviceInterceptor.java:52)\n\tat org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179)\n\tat org.springframework.aop.framework.adapter.MethodBeforeAdviceInterceptor.invoke(MethodBeforeAdviceInterceptor.java:52)\n\tat org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179)\n\tat org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:207)\n\tat com.sun.proxy.$Proxy172.saveEncounter(Unknown Source)\n\tat org.openmrs.module.webservices.rest.web.v1_0.resource.openmrs1_9.EncounterResource1_9.save(EncounterResource1_9.java:81)\n\tat org.openmrs.module.webservic
      D/OkHttp: es.rest.web.v1_0.resource.openmrs1_9.EncounterResource1_9.save(EncounterResource1_9.java:31)\n\tat org.openmrs.module.webservices.rest.web.resource.impl.DelegatingCrudResource.create(DelegatingCrudResource.java:78)\n\tat org.openmrs.module.webservices.rest.web.v1_0.controller.MainResourceController.create(MainResourceController.java:92)\n\tat sun.reflect.GeneratedMethodAccessor650.invoke(Unknown Source)\n\tat sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)\n\tat java.lang.reflect.Method.invoke(Method.java:498)\n\tat org.springframework.web.bind.annotation.support.HandlerMethodInvoker.invokeHandlerMethod(HandlerMethodInvoker.java:177)\n\tat org.springframework.web.servlet.mvc.annotation.AnnotationMethodHandlerAdapter.invokeHandlerMethod(AnnotationMethodHandlerAdapter.java:446)\n\tat org.springframework.web.servlet.mvc.annotation.AnnotationMethodHandlerAdapter.handle(AnnotationMethodHandlerAdapter.java:434)\n\tat org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:943)\n\tat org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:877)\n\tat org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:966)\n\tat org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:868)\n\tat javax.servlet.http.HttpServlet.service(HttpServlet.java:650)\n\tat org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:842)\n\tat javax.servlet.http.HttpServlet.service(HttpServlet.java:731)\n\tat org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:303)\n\tat org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)\n\tat org.openmrs.module.web.filter.ForcePasswordChangeFilter.doFilter(ForcePasswordChangeFilter.java:60)\n\tat org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241)\n\tat org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)\n\tat org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)\n\tat org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241)\n\tat org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)\n\tat org.openmrs.module.web.filter.ModuleFilterChain.doFilter(ModuleFilterChain.java:72)\n\tat org.openmrs.web.filter.GZIPFilter.doFilterInternal(GZIPFilter.java:64)\n\tat org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)\n\tat org.openmrs.module.web.filter.ModuleFilterChain.doFilter(ModuleFilterChain.java:70)\n\tat org.openmrs.module.webservices.rest.web.filter.AuthorizationFilter.doFilter(AuthorizationFilter.java:104)\n\tat org.openmrs.module.web.filter.ModuleFilterChain.doFilter(ModuleFilterChain.java:70)\n\tat org.springframework.web.filter.ShallowEtagHeaderFilter.doFilterInternal(ShallowEtagHeaderFilter.java:82)\n\tat org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)\n\tat org.openmrs.module.web.filter.ModuleFilterChain.doFilter(ModuleFilterChain.java:70)\n\tat org.openmrs.module.owa.filter.OwaFilter.doFilter(OwaFilter.java:64)\n\tat org.openmrs.module.web.filter.ModuleFilterChain.doFilter(ModuleFilterChain.java:70)\n\tat org.openmrs.module.xforms.web.XformsFilter.doFilter(XformsFilter.java:69)\n\tat org.openmrs.module.web.filter.ModuleFilterChain.doFilter(ModuleFilterChain.java:70)\n\tat org.openmrs.module.web.filter.ModuleFilter.doFilter(ModuleFilter.java:54)\n\tat org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241)\n\tat org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)\n\tat org.openmrs.web.filter.OpenmrsFilter.doFilterInternal(OpenmrsFilter.java:108)\n\tat org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)\n\tat org
      D/OkHttp: .apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241)\n\tat org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)\n\tat org.springframework.orm.hibernate4.support.OpenSessionInViewFilter.doFilterInternal(OpenSessionInViewFilter.java:150)\n\tat org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)\n\tat org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241)\n\tat org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)\n\tat org.openmrs.web.filter.StartupFilter.doFilter(StartupFilter.java:105)\n\tat org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241)\n\tat org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)\n\tat org.openmrs.web.filter.StartupFilter.doFilter(StartupFilter.java:105)\n\tat org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241)\n\tat org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)\n\tat org.openmrs.web.filter.StartupFilter.doFilter(StartupFilter.java:105)\n\tat org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241)\n\tat org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)\n\tat org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:88)\n\tat org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)\n\tat org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241)\n\tat org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)\n\tat org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:218)\n\tat org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:122)\n\tat org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:505)\n\tat org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:169)\n\tat org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:103)\n\tat org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:956)\n\tat org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:116)\n\tat org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:442)\n\tat org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1082)\n\tat org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:623)\n\tat org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:316)\n\tat java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)\n\tat java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)\n\tat org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)\n\tat java.lang.Thread.run(Thread.java:745)\n"}}
      D/OkHttp: <-- END HTTP (11137-byte body)
      

      Gliffy Diagrams

        Attachments

          Issue Links

            Activity

              People

                Unassigned Unassigned
                tmarzeion Tomasz Marzeion
                Votes:
                0 Vote for this issue
                Watchers:
                3 Start watching this issue

                Dates

                  Created:
                  Updated:
                  Resolved: