Skip to content

Operation $apply-fhirpath

Operation $apply-fhirpath is a custom operation that allows to return the result of constraint performed on a resource. When invoking this operation, a client SHALL provide both the constraint and the resource. The resource is validated against the profile specified in meta.profile element. In case resource does not have a profile it is validated against base fhir profile, and constraint.

Endpoints

[fhir_base]/$apply-fhirpath

Query parameters

This is an idempotent operation

In Parameters:
Name Cardinality Type Binding Profile Documentation
fhirPath 1..1 string The fhirPath expression that should be applied to the resource
resource 1..1 Resource Resource to apply the fhirPath expression
Out Parameters:
Name Cardinality Type Binding Profile Documentation
outcome 1..1 string in Parameters resource result of operation will be returned

Example

Example - Apply-fhirpath

curl --location 'https://demo.kodjin.com/fhir/$apply-fhirpath' \
--header 'Content-Type: application/json' \
--header 'Cookie: cookie=e3f7cd66a576cbfa; session=T8mHJ0uxnck9Qb3q8qmSnA|1689349873|FATFY_uwswuASoOeva3amj_3czw' \
--data '{
    "ResourceType": "Parameters",
    "parameter": [
        {
            "name": "fhirPath",
            "valueString": "(Medication.ingredient.isActive=true and Medication.ingredient.strength.exists()) or (Medication.ingredient.isActive=false)"
        },
        {
            "name": "resource",
            "resource": {
                "resourceType": "Medication",
                "text": {
                    "status": "generated",
                    "div": "<div> </div>"
                },
                "id": "30b5fe00-e09d-423f-92ff-a169d52cf318",
                "status": "active",
                "form": {
                    "coding": [
                        {
                            "display": "tablets"
                        }
                    ]
                },

                "ingredient": [
                    {
                        "itemCodeableConcept": {
                            "coding": [
                                {
                                    "system": "http://ksa-ehealth.sa/fhir/terminology/CodeSystem/ksa-ehealth-medication-ingredient",
                                    "code": "i00003",
                                    "display": "Amoxicillin"
                                }
                            ]
                        },
                        "isActive": false
                    }
                ]
            }
        }
    ]
}'
{
    "ResourceType": "Parameters",
    "parameter": [
        {
            "name": "outcome",
            "valueString": "[true]"
        }
    ]
}   

Try operation $apply-fhirpath with Kodjin FHIRPath Helper or with our Kodjin FHIR Server Postman Collection