FHIR Encounter, Visit, & Observation resources

Hi All,

As part of FHIR module implementation, below display how sample Visit, Encounter and Observation modeled through FHIR Resources.

Visit

{
    "resourceType":"Encounter",
    "id":"29f0bd73-9047-4bca-ad46-8fbc0a271cb1",
    "status":"finished",
    "class":"inpatient",
    "patient":{
        "reference":"Patient/dd6f7565-1691-11df-97a5-7038c432aabf",
        "display":"Lazaros Amutebe(Identifier:1196TS-2)"
    },
    "period":{
        "start":"2015-04-05T09:41:14",
        "end":"2015-04-05T09:42:22"
    },
    "location":[
        {
            "location":{
                "reference":"Location/8d6c993e-c2cc-11de-8d13-0010c6dffd0f",
                "display":"Inpatient Ward"
            },
            "period":{
                "start":"2015-04-05T09:41:14",
                "end":"2015-04-05T09:42:22"
            }
        }
    ]
}

Encounter

    {
        "resourceType":"Encounter",
        "id":"8ed513e5-5b6c-4c27-a603-77c01f6b4275",
        "status":"finished",
        "class":"inpatient",
        "patient":{
            "reference":"Patient/dd6f7565-1691-11df-97a5-7038c432aabf",
            "display":"Lazaros Amutebe(Identifier:1196TS-2)"
        },
        "participant":[
            {
                "individual":{
                    "reference":"Practitioner/baf6b295-df28-40ef-a1c0-317953300b43",
                    "display":"Super User(Identifier:admin)"
                }
            }
        ],
        "period":{
            "start":"2015-04-05T09:41:52",
            "end":"2015-04-05T09:41:52"
        },
        "location":[
            {
                "location":{
                    "reference":"Location/8d6c993e-c2cc-11de-8d13-0010c6dffd0f",
                    "display":"Inpatient Ward"
                },
                "period":{
                    "start":"2015-04-05T09:41:52",
                    "end":"2015-04-05T09:41:52"
                }
            }
        ],
        "partOf":{
            "reference":"Encounter/29f0bd73-9047-4bca-ad46-8fbc0a271cb1",
            "display":"Facility Visit"
        }
}

Observation

{
    "resourceType":"Observation",
    "id":"c246d0b9-ca96-4c71-af16-ff9d0479cb51",
    "extension":[
        {
            "url":"http://resources.openmrs.org/doc/fhir/profiles/vitalsigns.xml#location",
            "valueString":"Location/8d6c993e-c2cc-11de-8d13-0010c6dffd0f"
        }
    ],
    "code":{
        "coding":[
            {
                "system":"http://www.pih.org/",
                "code":"5085",
                "display":"68eb46e4-236d-31e3-9c73-a0b288a135f4"
            },
            {
                "system":"http://ampath.com/",
                "code":"5085",
                "display":"6d3ab6b7-a71a-3a93-b807-38bf374882ca"
            },
            {
                "system":"org.openmrs.module.mdrtb",
                "code":"SYSTOLIC BLOOD PRESSURE",
                "display":"afa83433-4bd8-3e42-ab18-1cae376f9f5f"
            },
            {
                "system":"http://loinc.org",
                "code":"8480-6",
                "display":"b9d125ad-fea8-3a13-bccc-d8241461005c"
            },
            {
                "system":"http://ciel.org",
                "code":"5085",
                "display":"274b867d-daa5-3531-8c20-c896f75d179d"
            },
            {
                "system":"http://snomed.info/sct",
                "code":"271649006",
                "display":"0de59c34-7991-3cbd-95d4-78b1e5ac814f"
            },
            {
                "system":"http://www.pih.org/country/malawi",
                "code":"5085",
                "display":"754223ab-8890-30a1-a024-afac52525fa3"
            },
            {
                "system":"http://loinc.org",
                "code":"53665-6",
                "display":"eb874cae-4066-3907-af72-ff5860cbca12"
            },
            {
                "system":"http://openmrs.org",
                "code":"5085AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA",
                "display":"SYSTOLIC BLOOD PRESSURE"
            }
        ]
    },
    "valueQuantity":{
        "value":123.0,
        "units":"mmHg",
        "system":"http://unitsofmeasure.org",
        "code":"mmHg"
    },
    "appliesDateTime":"2015-04-05T09:41:52",
    "issued":"2015-04-05T09:41:52.000",
    "status":"final",
    "reliability":"ok",
    "subject":{
        "reference":"Patient/dd6f7565-1691-11df-97a5-7038c432aabf",
        "display":"Lazaros Amutebe(Identifier:1196TS-2)"
    },
    "performer":[
        {
            "reference":"Practitioner/baf6b295-df28-40ef-a1c0-317953300b43",
            "display":"Super User(Identifier:admin)"
        }
    ],
    "encounter":{
        "reference":"Encounter/8ed513e5-5b6c-4c27-a603-77c01f6b4275"
    },
    "referenceRange":[
        {
            "high":{
                "value":0.0,
                "units":"mmHg",
                "system":"http://unitsofmeasure.org",
                "code":"mmHg"
            }
        }
    ]
}

Thanks @surangak me for notifying me to push the samples to talk forum :).

Thanks, Harsha

1 Like

As per our previous discussions, I will remove displaying UUID when name is not specified in Observation code and location extension in observation resource.

Thanks @harsha89!

@burke, please take a look at how we’re connecting OpenMRS visits and encounters. The problem is that a FHIR encounter representing an OpenMRS visit has no link to any of the OpenMRS encounters that it contains.

I feel that we badly need to figure out a way to do this?

And also, ideally we should be able to come up with some way to tag this as an ‘OpenMRS visit’?

However, note that when using a FHIR encounter to model an OpenMRS encounter, we can use the partOf attribute (0
*) to point to the OpenMRS visit that it belongs to


@surangak agreed, one of the major concern is how we going to differentiate the visit and encounter. Since FHIR doesn’t have a concept of Visit resource, we need to cope with that when we mapping our domain objects to FHIR resources. As suranga said, partOf attribute in a encounter can be linked to visit but we can’t link encounters of a visit from Encounter resource. Also we need to think how person can create OpenMRS visit and encounter since we represent the both Visit and Encounter in FHIR encounter resource. :).

1 Like

I wouldn’t approach this as an OpenMRS client (e.g., “how are we going to differentiate the visit and encounter”); rather, approach this from the perspective of a FHIR client who knows nothing about that OpenMRS data model and just wants information about the patient. Such a client doesn’t know anything about “visit vs. encounter”; to him, there are just encounters, because that’s the world of FHIR.

Consider these examples:

  1. Owtpay Shent comes to clinic. The nurse takes vitals and asks a few questions, then the doctor sees him. As a result, there are two separate encounters (nurse & doctor) that are part of the clinic encounter.

  2. Ima N. Patient is admitted to the hospital. There is an admission encounter, three days in the hospital with four encounters each day (doctors, nurses, nutritionists, etc.), and a discharge encounter. In total, there are 14 encounters that are all part of the inpatient encounter.

We know how these are modeled within OpenMRS. Now, forgetting anything to do with the OpenMRS way of describing the world, what is the expected/standard exchange between FHIR client & server to fetch the encounter data in these two cases? Once we have the answer to this question, then the decision of how to map our OpenMRS visits & encounters to the FHIR model should be much clearer.

2 Likes

@burke 100% agreed on your statement that we shouldn’t look from OpenMRS client perspective when accessing FHIR resource during decision making.

CRUD operations of a FHIR resource is a basic need according to the specification. Even though we can omit the CRUD operations, we need to figure out, how client can create a encounter and visit through FHIR. FHIR extentions can be used to distinguish OpenMRS visit and encounter. But extension is not a basic property of a FHIR resource. User can define any number of extensions within a resource which will cause to bound resources to their domains. As @suranga mentioned earlier, we are using partOf in the encounter to link visit. The main issue that we having on finding the mechanism to link the visit to encounter. Single visit may contains several encounters. So having extension will not be a good option as I think.

@surangak any suggestions? @suranga answering the @burke s’ questions will clear things.

FHIR can be used in following ways to filter out the data from the server.

Owtpay Shent comes to clinic. The nurse takes vitals and asks a few questions, then the doctor sees him. As a result, there are two separate encounters (nurse & doctor) that are part of the clinic encounter.

Ima N. Patient is admitted to the hospital. There is an admission encounter, three days in the hospital with four encounters each day (doctors, nurses, nutritionists, etc.), and a discharge encounter. In total, there are 14 encounters that are all part of the inpatient encounter.

Users that use FHIR, may want to know the encounters of a patient (Owtpay Shent) which happen in a specified date or time duration. With enounterId/$everything user can query all the clinical resources associate with a given encounter id.

Actually the search API specification of FHIR allow us to create useful search APIs. For example we can create a API which search the encounters with patient name, date and location. Likewise useful APIs can be expose to users.

One question in my mind is that person who don’t have any idea about OpenMRS data model will not be aware about the concept of Visit. When we should return visits when users perform searches?

They won’t know about OpenMRS Visits, but they still know the patient was in the hospital and a 3-day hospitalization isn’t going to be fully represented by a single Encounter; rather, they will expect one Encounter representing the hospitalization and n Encounters that are part of that Encounter (representing daily notes, etc.). So, the question remains: how does someone working with FHIR get a list of hospital and clinic Encounters for patient and, given any one of these, fetch the Encounters that occurred within it? It doesn’t matter whether they are working with Cerner, Epic, OpenMRS, or any other FHIR-compatible EHR, the concept of a hospitalization or clinic Encounter with the possibility of multiple Encounters with is universal (that’s whey there’s Encounter.partOf).

1 Like

Good points @burke. Definitely we need to incorporate our encounter API to look for all possible matching Visits resources as well. That way FHIR clients will get the OpenmRS Encounters and OpenMRS Visits and identify them through partOf attribute. :). Basically we need to go through OpenMRS Encounter Service and Visit Service when client perform a search based of specific attributes. :smile:. We need to adapt API with the use cases. :).

There are two aspects of the FHIR spec that I’m unclear about. Perhaps Grahame could shed some light. If we knew how to do both of these queries with FHIR, then it would be relatively straightforward to imagine how someone would navigate FHIR Encounters for a patient.

As a client, I want to get a list of top level encounters (similar to OpenMRS Visits). I would expect this to be a list of hospitalizations, clinic visits, telephone visits, home visits, and assorted encounters that are not parts of a parent encounter (even including episodes of care if they were implemented). If the patient were hospitalized for 4 weeks, I would expect one result for the hospitalization and not the 200 encounters recorded during the hospital stay. Once I had this list, I would find the clinic visit or hospitalization that I cared about and then ask for all encounters that were part of that encounter.

  1. Is there a way to query for all Encounters that are not part of another (i.e., Encounter.partOf == null)? If not, then I (the FHIR client) am forced to retrieve potentially hundreds of encounters and fish through them to find the top level encounters.

  2. Given an encounter, is there a way to query for all of the encounter below it (i.e., given Encounter._id == 123, fetch any Encounter, where Encounter.partOf == 123)? If not, then, once again, I’m an unhappy client, trying to fetch and sift through potentially hundreds of encounters to (hopefully) get the right list of encounters.

@burke The above two queries can be implemented. Because FHIR allows to search with conjunctions and disjunctions[1]., But we may need to pass some special value to encounter part of which will indicate that user need to search visits. User may query encounters which belongs to a particular patient which specified in query param and encounter part of may be none or some kind of identifier. :).

I think we need to be more specific bit. Client may interest visits of a particular patient. Possible to implement with above approach that I have mentioned before.

This can be achieved easily :).

One other question that I’m having is that, is every encounter belongs to a visit? As I remember I can create encounter without a visit through legacy UI.

Thanks, Harsha

Inserting any notion of “OpenMRS Visit” into the query would be a failure, IMHO. Our goal is not to create an OpenMRS FHIR API for OpenMRS clients; rather, to create an OpenMRS FHIR API for FHIR clients (i.e., someone with an understanding of FHIR should be able to utilize our API without needing to learn how OpenMRS has modeled the world. This Visit/Encounter issue is a perfect example. To the FHIR client, OpenMRS has only Encounters with some support for hierarchy (a single layer).

Correct. In OpenMRS, encounter.visit is optional. To a FHIR client, these visit-less encounters would appear to be a peer of a visit – i.e., they would be among the top-level Encounters.

Definitely we shouldn’t expose visit related options from our FHIR API.

@burke How would be having something like this.

http://fhir.example.com/Encounter?_id={uuid}&Encounter.partOf=none

If visit is optional sometimes client will get some encounters which client may need to aware. :smile:

If that’s what other FHIR implementations are supporting, then that’s fine. If we’re making up a solution, I’d rather ask the FHIR community what they are doing or expect to do to request top level encounters for a patient.

Hi, I am new to openmrs, I am using openmrs platform 2.6.0 with fhir-1.7.0.omod module, trying to add Observation through FHIR resource on my local machine URLhttp://localhost:8080/openmrs/ws/fhir/Observation Basic authentication “Basic YWRtaW46QWRtaW4xMjM=”

Request body

            {
            	"resourceType": "Observation",
            	"id": "c246d0b9-ca96-4c71-af16-ff9d0479cb51",
            	"extension": [{
            		"url": "http://resources.openmrs.org/doc/fhir/profiles/vitalsigns.xml#location",
            		"valueString": "Location/8d6c993e-c2cc-11de-8d13-0010c6dffd0f"
            	}],
            	"code": {
            		"coding": [{
            			"system": "http://openmrs.org",
            			"code": "ef9f609f-67a5-11e7-b2fc-0021ccd98645",
            			"display": "68eb46e4-236d-31e3-9c73-a0b288a135f4"
            		}]
            	},
            	"valueQuantity": {
            		"value": 123.0,
            		"units": "mmHg",
            		"system": "http://unitsofmeasure.org",
            		"code": "mmHg"
            	},
            	"appliesDateTime": "2015-04-05T09:41:52",
            	"issued": "2015-04-05T09:41:52.000",
            	"status": "final",
            	"reliability": "ok",
            	"effectiveDateTime": "2016-03-28",
            	"subject": {
            		"reference": "Patient/f5158523-67a5-11e7-b2fc-0021ccd98645",
            		"display": "Lazaros Amutebe(Identifier:1196TS-2)"
            	},
            	"performer": [{
            		"reference": "Practitioner/f5158523-67a5-11e7-b2fc-0021ccd98645",
            		"display": "Super User(Identifier:admin)"
            	}],
            	"encounter": {
            		"reference": "Encounter/8ed513e5-5b6c-4c27-a603-77c01f6b4275"
            	},
            	"referenceRange": [{
            		"high": {
            			"value": 0.0,
            			"units": "mmHg",
            			"system": "http://unitsofmeasure.org",
            			"code": "mmHg"
            		}
            	}]
            }

**Response body**

    {
        "resourceType": "OperationOutcome",
        "issue": [
            {
                "severity": "error",
            `    "code": "processing",`
                "diagnostics": "Failed to call access method"
            }
        ]
    }

Terminal Error Log

ERROR - ExceptionHandlingInterceptor.createOperationOutcome(121) |2017-08-04 23:25:14,193| Failure during REST processing
ca.uhn.fhir.rest.server.exceptions.InternalErrorException: Failed to call access method
        at ca.uhn.fhir.rest.method.BaseMethodBinding.invokeServerMethod(BaseMethodBinding.java:273)
        at ca.uhn.fhir.rest.method.BaseOutcomeReturningMethodBinding.invokeServer(BaseOutcomeReturningMethodBinding.java:137)
        at ca.uhn.fhir.rest.method.CreateMethodBinding.invokeServer(CreateMethodBinding.java:34)
        at ca.uhn.fhir.rest.server.RestfulServer.handleRequest(RestfulServer.java:629)
        at ca.uhn.fhir.rest.server.RestfulServer.doPost(RestfulServer.java:269)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:661)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:742)
        at org.openmrs.module.web.ModuleServlet.service(ModuleServlet.java:70)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:742)
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:231)
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
        at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
        at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:101)
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
        at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:101)
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
        at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:728)
        at org.apache.catalina.core.ApplicationDispatcher.processRequest(ApplicationDispatcher.java:467)
        at org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationDispatcher.java:392)
        at org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher.java:311)
        at org.openmrs.module.fhir.filter.ForwardingFilter.doFilter(ForwardingFilter.java:42)
        at org.openmrs.module.web.filter.ModuleFilterChain.doFilter(ModuleFilterChain.java:70)
        at org.openmrs.module.fhir.filter.AuthorizationFilter.doFilter(AuthorizationFilter.java:105)
        at org.openmrs.module.web.filter.ModuleFilterChain.doFilter(ModuleFilterChain.java:70)
        at org.openmrs.module.owa.filter.OwaFilter.doFilter(OwaFilter.java:57)
        at org.openmrs.module.web.filter.ModuleFilterChain.doFilter(ModuleFilterChain.java:70)
        at org.openmrs.module.web.filter.ModuleFilter.doFilter(ModuleFilter.java:54)
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
        at org.openmrs.web.filter.OpenmrsFilter.doFilterInternal(OpenmrsFilter.java:108)
        at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
        at org.springframework.orm.hibernate4.support.OpenSessionInViewFilter.doFilterInternal(OpenSessionInViewFilter.java:150)
        at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
        at org.openmrs.web.filter.StartupFilter.doFilter(StartupFilter.java:105)
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
        at org.openmrs.web.filter.StartupFilter.doFilter(StartupFilter.java:105)
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
        at org.openmrs.web.filter.StartupFilter.doFilter(StartupFilter.java:105)
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
        at org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:88)
        at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
        at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:198)
        at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:96)
        at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:478)
        at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:140)
        at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:80)
        at org.apache.catalina.valves.AbstractAccessLogValve.invoke(AbstractAccessLogValve.java:624)
        at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:87)
        at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:342)
        at org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:799)
        at org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:66)
        at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:868)
        at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1455)
        at org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
        at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
        at java.lang.Thread.run(Thread.java:745)
Caused by: java.lang.reflect.InvocationTargetException
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:498)
        at ca.uhn.fhir.rest.method.BaseMethodBinding.invokeServerMethod(BaseMethodBinding.java:268)
        ... 70 more
Caused by: org.openmrs.api.ValidationException: 'obs id is null' failed to validate with reason: error.noValue, valueCoded: Cannot be empty or null
        at org.openmrs.validator.ValidateUtil.validate(ValidateUtil.java:78)
        at org.openmrs.aop.RequiredDataAdvice.before(RequiredDataAdvice.java:124)
        at org.springframework.aop.framework.adapter.MethodBeforeAdviceInterceptor.invoke(MethodBeforeAdviceInterceptor.java:51)
        at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179)
        at org.springframework.aop.framework.adapter.MethodBeforeAdviceInterceptor.invoke(MethodBeforeAdviceInterceptor.java:52)
        at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179)
        at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:207)
        at com.sun.proxy.$Proxy109.saveObs(Unknown Source)
        at org.openmrs.module.fhir.api.impl.ObsServiceImpl.createFHIRObservation(ObsServiceImpl.java:244)
        at sun.reflect.GeneratedMethodAccessor247.invoke(Unknown Source)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:498)
        at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:317)
        at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:190)
        at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:157)
        at org.springframework.transaction.interceptor.TransactionInterceptor$1.proceedWithInvocation(TransactionInterceptor.java:99)
        at org.springframework.transaction.interceptor.TransactionAspectSupport.invokeWithinTransaction(TransactionAspectSupport.java:281)
        at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:96)
        at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179)
        at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:207)
        at com.sun.proxy.$Proxy141.createFHIRObservation(Unknown Source)
        at sun.reflect.GeneratedMethodAccessor247.invoke(Unknown Source)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:498)
        at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:317)
        at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:190)
        at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:157)
        at org.springframework.transaction.interceptor.TransactionInterceptor$1.proceedWithInvocation(TransactionInterceptor.java:99)
        at org.springframework.transaction.interceptor.TransactionAspectSupport.invokeWithinTransaction(TransactionAspectSupport.java:281)
        at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:96)
        at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179)
        at org.openmrs.aop.LoggingAdvice.invoke(LoggingAdvice.java:121)
        at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179)
        at org.springframework.aop.framework.adapter.MethodBeforeAdviceInterceptor.invoke(MethodBeforeAdviceInterceptor.java:52)
        at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179)
        at org.springframework.aop.framework.adapter.MethodBeforeAdviceInterceptor.invoke(MethodBeforeAdviceInterceptor.java:52)
        at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179)
        at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:207)
        at com.sun.proxy.$Proxy142.createFHIRObservation(Unknown Source)
        at sun.reflect.GeneratedMethodAccessor247.invoke(Unknown Source)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:498)
        at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:317)
        at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:190)
        at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:157)
        at org.springframework.transaction.interceptor.TransactionInterceptor$1.proceedWithInvocation(TransactionInterceptor.java:99)
        at org.springframework.transaction.interceptor.TransactionAspectSupport.invokeWithinTransaction(TransactionAspectSupport.java:281)
        at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:96)
        at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179)
        at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:207)
        at com.sun.proxy.$Proxy142.createFHIRObservation(Unknown Source)
        at org.openmrs.module.fhir.resources.FHIRObservationResource.createFHIRObservation(FHIRObservationResource.java:100)
        at org.openmrs.module.fhir.providers.RestfulObservationResourceProvider.createFHIRObservation(RestfulObservationResourceProvider.java:164)
        ... 75 more

This seems like the relevant part of the error message. It makes me think that the concept you’ve chosen has datatype=coded, so it’s expecting a coded value not a numeric one.

Yep I believe that’s the reason. @dhananjaykadam please correct it and try it again. If not let me know.

Hi, I am new to FHIR API’s. I am trying to get the Encounters , Patient list and Visit Information using EPIC FHIR but i don’t see any API’s related to this. I can see the Encounter API info in Cerner. Can some one help me to get the Encounters with visit Info details in EPIC. Is that possible to get those info? If yes can you give me some Idea. This will help me a lot to find a solution.

Thanks, Selva

From what’s available at open.epic.com, it doesn’t look like Encounter is included (yet). Encounter is an optional property of resources they do support like Observation and Procedure, but is omitted (the demo is using DSTU2, where the property is .encounter; in DSTU3, it’s .context).

Whether or not Encounter is available through Epic’s non-open FHIR API, that’s something you’d have to find out from Epic or a site implementing Epic and using their FHIR API.