How to add additional fields in FHIR using Extensions?

728 Views Asked by At

I have a payload for Claim.
I want to add an additional field LOB (Line of business) using extension, and POST it to FHIR Server, and then search the resource using that field like:
GET: http://fhir_server/Claim?lob=value
In the payload I have added the extension block:

{
    "resourceType": "Claim",
    "status": "active",
    "extension" : [{
        "url" : "<i entered some random url>",
        "valueString" : "MAPD"
    }],
    "identifier": [{
                    "value": "TEST"
                }],
    "type": {
        "coding": [{
            "system": "http://terminology.hl7.org/CodeSystem/claim-type",
            "code": "institutional"
        }]
    },
    "use": "claim",
    "patient": {
        "reference": "f8d8477c-1ef4-4878-abed-51e514bfd91f",
        "display": "John_Smith"
    },
    "billablePeriod": {
        "start": "1957-04-12T21:08:35+05:30",
        "end": "1957-04-12T21:23:35+05:30"
    },
    "created": "1957-04-12T21:23:35+05:30",
    "provider": {
        "reference": "urn:uuid:Organization",
        "display": "PCP79032"
    },
    "priority": {
        "coding": [{
            "system": "http://terminology.hl7.org/CodeSystem/processpriority",
            "code": "normal"
        }]
    },
    "facility": {
        "reference": "Location",
        "display": "PCP79032"
    },
    "diagnosis": [{
        "sequence": 1,
        "diagnosisReference": {
            "reference": "0316a0c4-0e46-e3fa-a7bf-9e4f3b9c9e92"
        }
    }, {
        "sequence": 2,
        "diagnosisReference": {
            "reference": "932432b0-ac67-0f7a-1382-26c48050c62f"
        }
    }],
    "insurance": [{
        "sequence": 1,
        "focal": true,
        "coverage": {
            "display": "Blue Cross Blue Shield"
        }
    }],
    "item": [{
        "sequence": 1,
        "productOrService": {
            "coding": [{
                "system": "http://snomed.info/sct",
                "code": "162673000",
                "display": "General examination of patient (procedure)"
            }],
            "text": "General examination of patient (procedure)"
        },
        "encounter": [{
            "reference": "67062d00-2531-3ebd-8558-1de2fd3e5aab"
        }]
    }, {
        "sequence": 2,
        "diagnosisSequence": [1],
        "productOrService": {
            "coding": [{
                "system": "http://snomed.info/sct",
                "code": "713458007",
                "display": "Lack of access to transportation (finding)"
            }],
            "text": "Lack of access to transportation (finding)"
        }
    }, {
        "sequence": 3,
        "diagnosisSequence": [2],
        "productOrService": {
            "coding": [{
                "system": "http://snomed.info/sct",
                "code": "73595000",
                "display": "Stress (finding)"
            }],
            "text": "Stress (finding)"
        }
    }],
    "total": {
        "value": 786.3299999999999,
        "currency": "USD"
    }
}

and created a SearchParameter using POST:

{
    "resourceType" : "SearchParameter",
    "id": "21761828-b929-416a-8813-d3646cf288f4",
    "name": "lob",
    "status": "active",
    "url" : "https://fhir_server/StructureDefinition/f971fc4998167948838f8a8831ea914c",
    "description": "Returns a Claim with extension.valueString matching the specified one in request.",
    "code" : "lob",
    "base" : [ "Claim" ],
    "type" : "string",
    "expression": "Claim.extension.where(url ='https://fhir_server/StructureDefinition/f971fc4998167948838f8a8831ea914c').value.string"
}

but while fetching the result (GET: https://fhirserver/Claim?lob=MAPD), I am getting the full dataset instead of the filtered result.
I also did a $reindex on the /Claim/<resource_id>/$reindex, but its not listing the field lob.
Am I missing something ?

1

There are 1 best solutions below

1
On

Servers need to be configured to support new search parameters - you can't search by arbitrary elements, only by specific SearchParameters the server supports. That's true for both searching on extensions as well as core elements. You'll have to work with the owner of the server to support your desired search capability. Did you try posting on http://chat.fhir.org to find out if there was a non-extension mechanism to represent "line of business" on a Claim?