0

I have to send request body as org.hl7.fhir.r4.model.CoverageEligibilityRequest which is contained Patient, Practitioner, Organization as below. This API will return Bundle response. I am using Java and Generic client from Hapi Fire library. There is provision to pass search parameter but the here I am having multilevel hierarchy of resource and input is big than usual. Can any one help me to handle this request in FHIR API.

Request Body as below,

{
      "resourceType": "CoverageEligibilityRequest",
      "contained": [
        {
          "resourceType": "Patient",
          "id": "1",
          "name": [
            {
              "family": "abcFamily",
              "given": [
                "abcGiven"
              ]
            }
          ],
          "birthDate": "1962-08-06"
        },
        {
          "resourceType": "Practitioner",
          "id": "2",
          "identifier": [
            {
              "type": {
                "coding": [
                  {
                   "code": "NPI"
                  }
                ]
              },
              "value": "123456789"
            }
          ],
          "name": [
            {
              "family": "pqrFamily",
              "given": [
                "pqrGiven"
              ]
            }
          ]
        },
        {
          "resourceType": "Organization",
          "id": "3",
          "identifier": [
            {
              "value": "12345"
            }
          ],
          "name": ""
        },
        {
          "resourceType": "Coverage",
          "id": "3",
          "status": "active",
          "subscriberId": "",         
          "class": [
            {
              "type": {
                "coding": [
                  {
                    
                    "code": "group"
                    
                  }
                ]
              },
              "value": ""
            }
          ]
        }
      ],
      "extension": [
        {
          "url": "searchOption",
          "valueString": "NameDateOfBirth"
        }
      ],
      "status": "active",
      "purpose": [
        "benefits"
      ],
      "patient": {
        "reference": "#1"
      },
      "provider": {
        "reference": "#2"
      },
      "insurer": {
        "reference": "#3"
      }
    }
Shridevi
  • 19
  • 7
  • 1
    Be aware that you appear to be using 'contained' improperly. 'contained' resources are limited to those that have no independent identity and cannot be resolved to external resource references. It is *not* a mechanism for transmitting multiple things at once. (For that, use batch/transaction.) It's not clear from your question what you're trying to do. If you're trying to post a new resource, there's no need for search parameters. If you're trying to search, you can't send an instance - unless you're invoking an operation. – Lloyd McKenzie Sep 27 '20 at 14:30
  • Thanks for reply. I want to do search operation by proving input as mentioned above. – Shridevi Sep 27 '20 at 16:01
  • 1
    Does an IG define an operation that behaves that way? (Because there's no standard FHIR operation that behaves that way...) – Lloyd McKenzie Sep 27 '20 at 20:10
  • Yes you are right. I learned after your response that API has custom operation as it is not listed in standard operation list. Currently I am trying below approach but getting MethodNotAllowedException: HTTP 405 , not sure if am using correct way to call API genericClient.operation() .onInstance(new IdType("CoverageEligibilityRequest", "1"))//This part I am still trying to figure it out, what to pass .named("$standard-eligibility") .withParameters(inParams)// inParams is input CoverageEligibilityRequest resource .execute(); – Shridevi Sep 28 '20 at 08:27
  • Out of curiosity, where is this operation defined? – Lloyd McKenzie Sep 28 '20 at 16:01
  • It is developed by a team and exposed as a rest API for external use. After analysis I found that method is using GET internally instead of POST so am getting error 405. Any idea how we can send this request POST ? – Shridevi Sep 30 '20 at 06:24
  • 1
    It seems that the team isn't necessarily defining their custom operation in the appropriate way. It's not possible to pass a resource as a parameter using GET. And if you're wanting to pass multiple resources, you should be using Parameters, not contained resources. – Lloyd McKenzie Sep 30 '20 at 13:03
  • Agreed. Until structure get change am using RestTemplate to call rest api with above payload. Overhead is parsing Java model to FHIR resources for request and vise versa for response. Thanks for your all responses as it confirmed that I am not missing anything to call API using FHIR library and we need structure change if we want to use FHIR library. – Shridevi Oct 01 '20 at 09:43

0 Answers0