DMN FEEL Expression to filter deeply nested object

ear Community Members,
Need help to write defensive FEEL Expressions to filter deeply listed object structures. I’m attaching my DMN file, and exceptions while I run it in the KOGITO (Springboot) rule engine.

My target is to remove all Entry elements where entry.resource.component.extention.url ends with “SOMETHING”. Please refer to Find Observation Resources BKM in the DMN file

The DMN File
FhirTesting.dmn (21.9 KB)

Test Data - (Errors)

{
  "Genomics Patient Lab Results": {
    "resourceType": "Bundle",
    "meta": {
      "source": "XYZ"
    },
    "identifier": {
      "system": "urn:d098c486-3434343434-457b-b2b1-fad25dc8da06",
      "value": "d098c486-b8a1-457b-b2b1-fad25dc8da06"
    },
    "type": "collection",
    "timestamp": "2023-08-04T19:12:10.564718+00:00",
    "entry": [
        {
          "fullUrl": "10urn:is_historical_data:genomic_variant:4b488c15-87b8-417c-ba0a-52db022e3eec",
          "resource": {
            "resourceType": "Observation",
            "component": [
              {
                "code": {
                  "coding": [
                    {
                      "system": "http://loinc.org",
                      "code": "48018-6"
                    }
                  ]
                },
                "valueCodeableConcept": {
                  "coding": [
                    {
                      "system": "http://www.genenames.org",
                      "code": "NBN"
                    }
                  ],
                  "text": "NBN"
                }
              },
              {
                "extension": [
                  {
                    "url": "http://www.ontada.com/fhir/StructureDefinition/LOINC/69551-0",
                    "valueString": "A"
                  },
                  {
                    "url": "http://www.ontada.com/fhir/StructureDefinition/LOINC/69547-8",
                    "valueString": "G"
                  },
                  {
                    "url": "http://www.ontada.com/fhir/StructureDefinition/codeable-status",
                    "valueCodeableConcept": {
                      "coding": [
                        {
                          "system": "http://www.ontada.com",
                          "code": "90982685"
                        }
                      ],
                      "text": "90982685"
                    }
                  },
                  {
                    "url": "http://www.ontada.com/fhir/StructureDefinition/codeable-status/62378-5",
                    "valueCodeableConcept": {
                      "coding": [
                        {
                          "system": "http://www.ontada.com",
                          "code": "90982686"
                        }
                      ],
                      "text": "90982686"
                    }
                  }
                ],
                "code": {
                  "coding": [
                    {
                      "system": "http://loinc.org",
                      "code": "81290-9"
                    }
                  ]
                },
                "valueCodeableConcept": {
                  "coding": [
                    {
                      "system": "http://varnomen.hgvs.org",
                      "code": "c.803C>T"
                    }
                  ],
                  "text": "c.803C>T"
                }
              },
              {
                "code": {
                  "coding": [
                    {
                      "system": "http://loinc.org",
                      "code": "48005-3"
                    }
                  ]
                },
                "valueCodeableConcept": {
                  "coding": [
                    {
                      "system": "http://varnomen.hgvs.org",
                      "code": "p.Thr268Met"
                    }
                  ],
                  "text": "T268M"
                }
              },
              {
                "code": {
                  "coding": [
                    {
                      "system": "http://loinc.org",
                      "code": "53037-8"
                    }
                  ]
                },
                "valueCodeableConcept": {
                  "coding": [
                    {
                      "system": "http://loinc.org",
                      "code": "LA26333-7"
                    }
                  ],
                  "text": "Variant of Uncertain Significance"
                }
              },
              {
                "code": {
                  "coding": [
                    {
                      "system": "http://loinc.org",
                      "code": "48001-2"
                    }
                  ]
                },
                "valueCodeableConcept": {
                  "coding": [
                    {
                      "system": "http://www.ontada.com",
                      "code": "chr8"
                    }
                  ],
                  "text": "chr8"
                }
              },
              {
                "code": {
                  "coding": [
                    {
                      "system": "http://loinc.org",
                      "code": "81252-9"
                    }
                  ]
                },
                "valueCodeableConcept": {
                  "coding": [
                    {
                      "system": "http://www.ncbi.nlm.nih.gov/clinvar",
                      "code": "182734"
                    }
                  ]
                }
              }
            ]
          }
        }]
    }
}

Kogito Springboot throws the following exceptions
2023-10-09 23:00:13.825 ERROR 44787 — [0.0-8080-exec-1] o.k.d.f.r.f.StringLengthFunction : Unable to find function ‘string length( lass org.kie.dmn.feel.runtime.functions.StringLengthFunctio )’
2023-10-09 23:00:13.826 ERROR 44787 — [0.0-8080-exec-1] o.k.d.f.r.f.StringLengthFunction : Unable to find function ‘string length( lass org.kie.dmn.feel.runtime.functions.StringLengthFunctio )’
2023-10-09 23:00:13.826 ERROR 44787 — [0.0-8080-exec-1] o.k.d.f.r.functions.SubstringFunction : Unable to find function ‘substring( lass org.kie.dmn.feel.runtime.functions.SubstringFunctio )’
2023-10-09 23:00:13.827 ERROR 44787 — [0.0-8080-exec-1] o.k.d.c.a.DMNLiteralExpressionEvaluator : FEEL ERROR while evaluating literal expression ‘for aResource in ToBeInspectedResources return
fo… [string clipped after 50 chars, total length is 288]’: Unable to find function ‘string length( lass org.kie.dmn.feel.runtime.functions.StringLengthFunctio )’
2023-10-09 23:00:13.827 ERROR 44787 — [0.0-8080-exec-1] o.k.d.c.a.DMNLiteralExpressionEvaluator : FEEL ERROR while evaluating literal expression ‘for aResource in ToBeInspectedResources return
fo… [string clipped after 50 chars, total length is 288]’: Unable to find function ‘string length( lass org.kie.dmn.feel.runtime.functions.StringLengthFunctio )’
2023-10-09 23:00:13.827 ERROR 44787 — [0.0-8080-exec-1] o.k.d.c.a.DMNLiteralExpressionEvaluator : FEEL ERROR while evaluating literal expression ‘for aResource in ToBeInspectedResources return
fo… [string clipped after 50 chars, total length is 288]’: Unable to find function ‘substring( lass org.kie.dmn.feel.runtime.functions.SubstringFunctio )’
2023-10-09 23:00:13.827 ERROR 44787 — [0.0-8080-exec-1] o.kie.dmn.core.ast.DMNContextEvaluator : Error evaluating context extry ‘FilteredData’ on context ‘Find Observation Resources’
2023-10-09 23:00:13.827 ERROR 44787 — [0.0-8080-exec-1] o.kie.dmn.core.ast.DMNContextEvaluator : Error evaluating context extry ‘FilteredBy6’ on context ‘Find Observation Resources’

Test Data (Working fine)

{
  "Genomics Patient Lab Results": {
    "resourceType": "Bundle",
    "meta": {
        "source": "CIS"
    },
    "identifier": {
        "system": "urn:d098c486-b8a1-457b-b2b1-fad25dc8da06",
        "value": "d098c486-b8a1-457b-b2b1-fad25dc8da06"
    },
    "type": "collection",
    "timestamp": "2023-08-04T19:12:10.564718+00:00",
    "entry": [
        {
            "fullUrl": "1urn:caris_historical_data:genomic_variant:aab346e8-249a-4dde-bc28-1722b0acaeac",
            "resource": {
                "resourceType": "Observation",
                "status": "final",
                "type": {
                    "coding": [
                        {
                            "system": "http://loinc.org",
                            "code": "51969-4"
                        }
                    ]
                },
                "date": "2023-08-04T19:12:10.564880+00:00",
                "author": [
                    {
                        "display": "Caris"
                    }
                ],
                "title": "Caris Life Sciences Lab Reports",
                "component": [
                    {
                        "extension": [
                            {
                                "url": "http://www.ontada.com/fhir/StructureDefinition/gene1",
                                "valueCodeableConcept": {
                                    "coding": [
                                        {
                                            "system": "http://www.genenames.org",
                                            "code": "EGFR"
                                        }
                                    ],
                                    "text": "EGFR"
                                }
                            }
                        ],
                        "valueCodeableConcept": {
                            "coding": [
                                {
                                    "system": "http://www.genenames.org",
                                    "code": "EGFR"
                                }
                            ],
                            "text": "EGFR"
                        },
                        "code": {
                            "coding": [
                                {
                                    "system": "http://loinc.org",
                                    "code": "48018-6"
                                }
                            ]
                        }
                    }
                ]
            
            }
        },
        {
            "fullUrl": "2urn:caris_historical_data:genomic_variant:96e66ca4-59b4-4018-8ef7-a318974dedce",
            "resource": {
                "resourceType": "Observation",
                "status": "unknown",
                "category": [
                    {
                        "coding": [
                            {
                                "system": "http://terminology.hl7.org/CodeSystem/observation-category",
                                "code": "laboratory"
                            }
                        ]
                    }
                ],
                "code": {
                    "coding": [
                        {
                            "system": "http://loinc.org",
                            "code": "69548-6"
                        }
                    ]
                },
                "subject": {
                    "identifier": {
                        "system": "urn:ontada-edw:patient-id",
                        "value": "AA0655B0A90E475E8372BD0027A4DC2F"
                    }
                },
                "effectiveDateTime": "2020-08-16T14:02:51+00:00",
                "valueCodeableConcept": {
                    "coding": [
                        {
                            "system": "http://loinc.org",
                            "code": "LA9634-2"
                        }
                    ],
                    "text": "Fusion Not Detected"
                },
                "method": {
                    "coding": [
                        {
                            "system": "https://fhir.loinc.org/CodeSystem/?url=http://loinc.org&code=LL4048-6",
                            "code": "LA26398-0"
                        }
                    ],
                    "text": "Seq"
                },
                "component": [
                    {
                        "extension": [
                            {
                                "url": "http://www.ontada.com/fhir/StructureDefinition/gene1",
                                "valueCodeableConcept": {
                                    "coding": [
                                        {
                                            "system": "http://www.genenames.org",
                                            "code": "MUSK"
                                        }
                                    ],
                                    "text": "MUSK"
                                }
                            }
                        ],
                        "valueCodeableConcept": {
                            "coding": [
                                {
                                    "system": "http://www.genenames.org",
                                    "code": "MUSK"
                                }
                            ],
                            "text": "MUSK"
                        },
                        "code": {
                            "coding": [
                                {
                                    "system": "http://loinc.org",
                                    "code": "48018-6"
                                }
                            ]
                        }
                    }
                ]
            }
        },
        {
            "fullUrl": "3urn:caris_historical_data:genomic_variant:aab346e8-249a-4dde-bc28-1722b0acaeac",
            "resource": {
                "resourceType": "Observation",
                "status": "final",
                "type": {
                    "coding": [
                        {
                            "system": "http://loinc.org",
                            "code": "51969-4"
                        }
                    ]
                },
                "date": "2023-08-04T19:12:10.564880+00:00",
                "author": [
                    {
                        "display": "Caris"
                    }
                ],
                "title": "Caris Life Sciences Lab Reports",
                "component": [
                    {
                        "extension": [
                            {
                                "url": "http://www.ontada.com/fhir/StructureDefinition/62378-5",
                                "valueCodeableConcept": {
                                    "coding": [
                                        {
                                            "system": "http://www.genenames.org",
                                            "code": "NA"
                                        }
                                    ],
                                    "text": "NA"
                                }
                            }
                        ],
                        "code": {
                            "coding": [
                                {
                                    "system": "http://loinc.org",
                                    "code": "00000-0"
                                }
                            ]
                        }
                    }
                ]
            }
        },
        {
            "fullUrl": "4urn:caris_historical_data:genomic_variant:aab346e8-249a-4dde-bc28-1722b0acaeac",
            "resource": {
                "resourceType": "Observation",
                "status": "final",
                "type": {
                    "coding": [
                        {
                            "system": "http://loinc.org",
                            "code": "51969-4"
                        }
                    ]
                },
                "date": "2023-08-04T19:12:10.564880+00:00",
                "author": [
                    {
                        "display": "Caris"
                    }
                ],
                "title": "Caris Life Sciences Lab Reports",
                "component": [
                    {
                        "extension": [
                            {
                                "url": "http://www.ontada.com/fhir/StructureDefinition/gene1",
                                "valueCodeableConcept": {
                                    "coding": [
                                        {
                                            "system": "http://www.genenames.org",
                                            "code": "NA"
                                        }
                                    ],
                                    "text": "NA"
                                }
                            }
                        ],
                        "code": {
                            "coding": [
                                {
                                    "system": "http://loinc.org",
                                    "code": "82155-3"
                                }
                            ]
                        }
                    }
                ]
            }
        },
        {
            "fullUrl": "JUNK-NO-EXTENSION-urn:caris_historical_data:genomic_variant:aab346e8-249a-4dde-bc28-1722b0acaeac",
            "resource": {
                "resourceType": "Observation",
                "status": "final",
                "type": {
                    "coding": [
                        {
                            "system": "http://loinc.org",
                            "code": "51969-4"
                        }
                    ]
                },
                "date": "2023-08-04T19:12:10.564880+00:00",
                "author": [
                    {
                        "display": "Caris"
                    }
                ],
                "title": "Caris Life Sciences Lab Reports",
                "component": [
                    {
                        "code": {
                            "coding": [
                                {
                                    "system": "http://loinc.org",
                                    "code": "JUNK-NOEXT"
                                }
                            ]
                        }
                    }
                ]
            }
        }
    ]
}
}

Hey @Mallesh_Nagothi :wave:
Camunda does not use the Kogito Rule Engine out of the box. Additionally I have problems open the provided DMN Table in the Camunda Modeler at all.

Is there a specific reason why you have chosen not to use the Camunda DMN engine. Especially since this forum is focussed on Camunda instead of jBPM/Kogito.

Sorry, I didn’t realize. Let me close this topic and will add input JSON and specific question

Following is my input and I’m trying to write a FEEL Expression to filter out a few elements in the Entry array.

Here is the high-level structure of the JSON
Entry[resource.component [ extension ] ]

I’m trying to filter and remove all the entry elements where resource.component.extension.url ends with “SOMETHING”

{
  "Results": {
    "resourceType": "Bundle",
    "meta": {
        "source": "XXXXX"
    },
    "identifier": {
        "system": "urn:d098c486-b8a1-457b-b2b1-fad25dc8da06",
        "value": "d098c486-b8a1-457b-b2b1-fad25dc8da06"
    },
    "type": "collection",
    "timestamp": "2023-08-04T19:12:10.564718+00:00",
    "entry": [
        {
            "fullUrl": "1urn:XXXXX_historical_data:genomic_variant:aab346e8-249a-4dde-bc28-1722b0acaeac",
            "resource": {
                "resourceType": "Observation",
                "status": "final",
                "type": {
                    "coding": [
                        {
                            "system": "http://loinc.org",
                            "code": "51969-4"
                        }
                    ]
                },
                "date": "2023-08-04T19:12:10.564880+00:00",
                "author": [
                    {
                        "display": "XXXXX"
                    }
                ],
                "title": "XXXXX Life Sciences Lab Reports",
                "component": [
                    {
                        "extension": [
                            {
                                "url": "http://www.ontada.com/fhir/StructureDefinition/gene1",
                                "valueCodeableConcept": {
                                    "coding": [
                                        {
                                            "system": "http://www.genenames.org",
                                            "code": "EGFR"
                                        }
                                    ],
                                    "text": "EGFR"
                                }
                            }
                        ],
                        "valueCodeableConcept": {
                            "coding": [
                                {
                                    "system": "http://www.genenames.org",
                                    "code": "EGFR"
                                }
                            ],
                            "text": "EGFR"
                        },
                        "code": {
                            "coding": [
                                {
                                    "system": "http://loinc.org",
                                    "code": "48018-6"
                                }
                            ]
                        }
                    }
                ]
            
            }
        },
        {
            "fullUrl": "2urn:XXXXX_historical_data:genomic_variant:96e66ca4-59b4-4018-8ef7-a318974dedce",
            "resource": {
                "resourceType": "Observation",
                "status": "unknown",
                "category": [
                    {
                        "coding": [
                            {
                                "system": "http://terminology.hl7.org/CodeSystem/observation-category",
                                "code": "laboratory"
                            }
                        ]
                    }
                ],
                "code": {
                    "coding": [
                        {
                            "system": "http://loinc.org",
                            "code": "69548-6"
                        }
                    ]
                },
                "subject": {
                    "identifier": {
                        "system": "urn:ontada-edw:patient-id",
                        "value": "AA0655B0A90E475E8372BD0027A4DC2F"
                    }
                },
                "effectiveDateTime": "2020-08-16T14:02:51+00:00",
                "valueCodeableConcept": {
                    "coding": [
                        {
                            "system": "http://loinc.org",
                            "code": "LA9634-2"
                        }
                    ],
                    "text": "Fusion Not Detected"
                },
                "method": {
                    "coding": [
                        {
                            "system": "https://fhir.loinc.org/CodeSystem/?url=http://loinc.org&code=LL4048-6",
                            "code": "LA26398-0"
                        }
                    ],
                    "text": "Seq"
                },
                "component": [
                    {
                        "extension": [
                            {
                                "url": "http://www.ontada.com/fhir/StructureDefinition/gene1",
                                "valueCodeableConcept": {
                                    "coding": [
                                        {
                                            "system": "http://www.genenames.org",
                                            "code": "MUSK"
                                        }
                                    ],
                                    "text": "MUSK"
                                }
                            }
                        ],
                        "valueCodeableConcept": {
                            "coding": [
                                {
                                    "system": "http://www.genenames.org",
                                    "code": "MUSK"
                                }
                            ],
                            "text": "MUSK"
                        },
                        "code": {
                            "coding": [
                                {
                                    "system": "http://loinc.org",
                                    "code": "48018-6"
                                }
                            ]
                        }
                    }
                ]
            }
        },
        {
            "fullUrl": "3urn:XXXXX_historical_data:genomic_variant:aab346e8-249a-4dde-bc28-1722b0acaeac",
            "resource": {
                "resourceType": "Observation",
                "status": "final",
                "type": {
                    "coding": [
                        {
                            "system": "http://loinc.org",
                            "code": "51969-4"
                        }
                    ]
                },
                "date": "2023-08-04T19:12:10.564880+00:00",
                "author": [
                    {
                        "display": "XXXXX"
                    }
                ],
                "title": "XXXXX Life Sciences Lab Reports",
                "component": [
                    {
                        "extension": [
                            {
                                "url": "http://www.ontada.com/fhir/StructureDefinition/62378-5",
                                "valueCodeableConcept": {
                                    "coding": [
                                        {
                                            "system": "http://www.genenames.org",
                                            "code": "NA"
                                        }
                                    ],
                                    "text": "NA"
                                }
                            }
                        ],
                        "code": {
                            "coding": [
                                {
                                    "system": "http://loinc.org",
                                    "code": "00000-0"
                                }
                            ]
                        }
                    }
                ]
            }
        },
        {
            "fullUrl": "4urn:XXXXX_historical_data:genomic_variant:aab346e8-249a-4dde-bc28-1722b0acaeac",
            "resource": {
                "resourceType": "Observation",
                "status": "final",
                "type": {
                    "coding": [
                        {
                            "system": "http://loinc.org",
                            "code": "51969-4"
                        }
                    ]
                },
                "date": "2023-08-04T19:12:10.564880+00:00",
                "author": [
                    {
                        "display": "XXXXX"
                    }
                ],
                "title": "XXXXX Life Sciences Lab Reports",
                "component": [
                    {
                        "extension": [
                            {
                                "url": "http://www.ontada.com/fhir/StructureDefinition/gene1",
                                "valueCodeableConcept": {
                                    "coding": [
                                        {
                                            "system": "http://www.genenames.org",
                                            "code": "NA"
                                        }
                                    ],
                                    "text": "NA"
                                }
                            }
                        ],
                        "code": {
                            "coding": [
                                {
                                    "system": "http://loinc.org",
                                    "code": "82155-3"
                                }
                            ]
                        }
                    }
                ]
            }
        },
        {
            "fullUrl": "JUNK-NO-EXTENSION-urn:XXXXX_historical_data:genomic_variant:aab346e8-249a-4dde-bc28-1722b0acaeac",
            "resource": {
                "resourceType": "Observation",
                "status": "final",
                "type": {
                    "coding": [
                        {
                            "system": "http://loinc.org",
                            "code": "51969-4"
                        }
                    ]
                },
                "date": "2023-08-04T19:12:10.564880+00:00",
                "author": [
                    {
                        "display": "XXXXX"
                    }
                ],
                "title": "XXXXX Life Sciences Lab Reports",
                "component": [
                    {
                        "code": {
                            "coding": [
                                {
                                    "system": "http://loinc.org",
                                    "code": "JUNK-NOEXT"
                                }
                            ]
                        }
                    }
                ]
            }
        },
        {
            "fullUrl": "10urn:XXXXX_historical_data:genomic_variant:4b488c15-87b8-417c-ba0a-52db022e3eec",
            "resource": {
                "resourceType": "Observation",
                "component": [
                    {
                        "code": {
                            "coding": [
                                {
                                    "system": "http://loinc.org",
                                    "code": "48018-6"
                                }
                            ]
                        },
                        "valueCodeableConcept": {
                            "coding": [
                                {
                                    "system": "http://www.genenames.org",
                                    "code": "NBN"
                                }
                            ],
                            "text": "NBN"
                        }
                    },
                    {
                        "extension": [
                            {
                                "url": "http://www.ontada.com/fhir/StructureDefinition/LOINC/69551-0",
                                "valueString": "A"
                            },
                            {
                                "url": "http://www.ontada.com/fhir/StructureDefinition/LOINC/69547-8",
                                "valueString": "G"
                            },
                            {
                                "url": "http://www.ontada.com/fhir/StructureDefinition/codeable-status",
                                "valueCodeableConcept": {
                                    "coding": [
                                        {
                                            "system": "http://www.ontada.com",
                                            "code": "90982685"
                                        }
                                    ],
                                    "text": "90982685"
                                }
                            },
                            {
                                "url": "http://www.ontada.com/fhir/StructureDefinition/codeable-status/62378-5",
                                "valueCodeableConcept": {
                                    "coding": [
                                        {
                                            "system": "http://www.ontada.com",
                                            "code": "90982686"
                                        }
                                    ],
                                    "text": "90982686"
                                }
                            }
                        ],
                        "code": {
                            "coding": [
                                {
                                    "system": "http://loinc.org",
                                    "code": "81290-9"
                                }
                            ]
                        },
                        "valueCodeableConcept": {
                            "coding": [
                                {
                                    "system": "http://varnomen.hgvs.org",
                                    "code": "c.803C>T"
                                }
                            ],
                            "text": "c.803C>T"
                        }
                    },
                    {
                        "code": {
                            "coding": [
                                {
                                    "system": "http://loinc.org",
                                    "code": "48005-3"
                                }
                            ]
                        },
                        "valueCodeableConcept": {
                            "coding": [
                                {
                                    "system": "http://varnomen.hgvs.org",
                                    "code": "p.Thr268Met"
                                }
                            ],
                            "text": "T268M"
                        }
                    },
                    {
                        "code": {
                            "coding": [
                                {
                                    "system": "http://loinc.org",
                                    "code": "53037-8"
                                }
                            ]
                        },
                        "valueCodeableConcept": {
                            "coding": [
                                {
                                    "system": "http://loinc.org",
                                    "code": "LA26333-7"
                                }
                            ],
                            "text": "Variant of Uncertain Significance"
                        }
                    },
                    {
                        "code": {
                            "coding": [
                                {
                                    "system": "http://loinc.org",
                                    "code": "48001-2"
                                }
                            ]
                        },
                        "valueCodeableConcept": {
                            "coding": [
                                {
                                    "system": "http://www.ontada.com",
                                    "code": "chr8"
                                }
                            ],
                            "text": "chr8"
                        }
                    },
                    {
                        "code": {
                            "coding": [
                                {
                                    "system": "http://loinc.org",
                                    "code": "81252-9"
                                }
                            ]
                        },
                        "valueCodeableConcept": {
                            "coding": [
                                {
                                    "system": "http://www.ncbi.nlm.nih.gov/clinvar",
                                    "code": "182734"
                                }
                            ]
                        }
                    }
                ]
            }
        }
    ]
}
}