Failed validate slicing profile "SLICING_CANNOT_BE_EVALUATED"


Dear all,
I meet several difficulties in creating profile with slicing, and validate resource with slicing profile.
I m creating profile for image annotation, which required to fill the component svg-annotation.
But I keep encountered “the slicing cannot be evaluated” error.

Here is my image annotation SD:

{
  "resourceType": "StructureDefinition",
  "id": "d10dda59-237b-4683-8cf6-4ee22bf6309d",
  "meta": {
    "versionId": "8",
    "lastUpdated": "2023-03-16T22:56:57.413+08:00",
    "source": "#oGBGtqAcVQFVoYBS"
  },
  "url": "base/StructureDefinition/ImageAnnotationObservation",
  "name": "ImageAnnotation",
  "title": "ImageAnnotation",
  "status": "draft",
  "description": "The standard specification for storing image annotation",
  "purpose": "The standard specification for storing image annotation",
  "fhirVersion": "5.0.0-snapshot1",
  "kind": "resource",
  "abstract": false,
  "type": "Observation",
  "baseDefinition": "http://hl7.org/fhir/StructureDefinition/Observation",
  "derivation": "constraint",
  "differential": {
    "element": [ {
      "id": "Observation.status",
      "path": "Observation.status",
      "binding": {
        "strength": "required",
        "description": "Codes providing the status of an observation annotation.",
        "valueSet": "http://hl7.org/fhir/ValueSet/observation-status|5.0.0-cibuild"
      }
    }, {
      "id": "Observation.category",
      "path": "Observation.category",
      "slicing": {
        "discriminator": [ {
          "type": "pattern",
          "path": "$this"
        } ],
        "rules": "open"
      },
      "min": 1,
      "max": "1"
    }, {
      "id": "Observation.category:imaging-category",
      "path": "Observation.category",
      "sliceName": "imaging-category",
      "min": 1,
      "max": "1",
      "patternCodeableConcept": {
        "coding": [ {
          "system": "http://terminology.hl7.org/CodeSystem/observation-category",
          "code": "imaging",
          "display": "Imaging"
        } ]
      }
    }, {
      "id": "Observation.code.coding",
      "path": "Observation.code.coding",
      "min": 1,
      "max": "1",
      "fixedCoding": {
        "system": "cs",
        "code": "image.annotation",
        "display": "Image annotation"
      }
    }, {
      "id": "Observation.subject",
      "path": "Observation.subject",
      "min": 1,
      "type": [ {
        "code": "Reference",
        "targetProfile": [ "http://hl7.org/fhir/StructureDefinition/Patient" ]
      } ]
    }, {
      "id": "Observation.effective[x]",
      "path": "Observation.effective[x]",
      "min": 1,
      "type": [ {
        "code": "dateTime"
      } ]
    }, {
      "id": "Observation.performer",
      "path": "Observation.performer",
      "short": "Who is responsible for the observation annotation",
      "min": 1,
      "max": "1",
      "type": [ {
        "code": "Reference",
        "targetProfile": [ "http://hl7.org/fhir/StructureDefinition/Practitioner", "http://hl7.org/fhir/StructureDefinition/PractitionerRole" ]
      } ]
    }, {
      "id": "Observation.derivedFrom",
      "path": "Observation.derivedFrom",
      "min": 1,
      "max": "1",
      "type": [ {
        "code": "Reference",
        "targetProfile": [ "http://hl7.org/fhir/StructureDefinition/DocumentReference", "http://hl7.org/fhir/StructureDefinition/ImagingStudy" ]
      } ]
    }, {
      "id": "Observation.component",
      "path": "Observation.component",
      "slicing": {
        "discriminator": [ {
          "type": "pattern",
          "path": "$this"
        } ],
        "rules": "open"
      }
    }, {
      "id": "Observation.component:svg-annotation",
      "path": "Observation.component",
      "sliceName": "svg-annotation",
      "code": [ {
        "system": "https://docs.google.com/spreadsheets/d/1BBBZZbEO82wkvLbHtbpa4ihdFTMoIG0KQGH5bgUoo70/edit#gid=0",
        "code": "svg.annotation",
        "display": "SVG Annotation"
      } ],
      "min": 1,
      "max": "1"
    }, {
      "id": "Observation.component:svg-annotation.code",
      "path": "Observation.component.code",
      "patternCodeableConcept": {
        "coding": [ {
          "system": "cs",
          "code": "svg.annotation",
          "display": "SVG Annotation"
        } ]
      }
    }, {
      "id": "Observation.component:svg-annotation.value[x]",
      "path": "Observation.component.value[x]",
      "type": [ {
        "code": "Attachment"
      } ]
    }, {
      "id": "Observation.component:svg-annotation.value[x].contentType",
      "path": "Observation.component.value[x].contentType",
      "min": 1,
      "fixedCode": "image/svg+xml"
    }, {
      "id": "Observation.component:svg-annotation.value[x].data",
      "path": "Observation.component.value[x].data",
      "min": 1
    } ]
  }
}

thanks

Best regard,
Jeshika

Try removing the ‘display’ from your pattern. It’s possible the validator isn’t set up to handle it, and as a rule, you want the pattern matching to ignore the display value anyhow - there are a number of reasons the display might vary.

As an aside, cool idea to use a google doc as the code system to provide something that’s easy to stand up and resolvable :slight_smile:

1 Like

Thanks Iloyd, I remove the “display” element and add the fixed value, and now its works!
Yes, but Im not sure though why the google doc also perform well as code system hahaha…
Like it can know whether the value exist in the code system or not~
Do you have some explannation?

Thanks

It won’t automatically validate the content - you’ll need to expose the codes as a CodeSystem resource and/or expose via a terminology server for that purpose. However, in terms of standing up a URL that’s useful to a human analyst trying to understand an unknown code system, it’s a whole lot less work than trying to get something into a registry or stand up your own website.

1 Like

oh, I see. Thanyou so much Iloyd for the great explanation.

But now I encounter different error. I want to create image finding observation structureDefinition. inside there is rule that required to provide identifier “FindingID”. But when I do the validation, it keep saying error diagnosis “The element value is present in the instance but not allowed in the applicable fixed value specified in profile”.
How to solve this?

Thankyou

ImageFindingObservation SD:

{
    "resourceType": "StructureDefinition",
    "id": "3af7ab31-c3a5-44b6-9235-5477090be8c5",
    "meta": {
        "versionId": "19",
        "lastUpdated": "2023-03-21T17:27:42.893+08:00"
    },
    "url": "base/StructureDefinition/ImageFindingObservation",
    "name": "ImageFinding",
    "status": "draft",
    "fhirVersion": "5.0.0-snapshot1",
    "kind": "resource",
    "abstract": false,
    "type": "Observation",
    "baseDefinition": "http://hl7.org/fhir/StructureDefinition/Observation",
    "derivation": "constraint",
    "differential": {
        "element": [
            {
                "id": "Observation.identifier",
                "path": "Observation.identifier",
                "slicing": {
                    "discriminator": [
                        {
                            "type": "pattern",
                            "path": "system"
                        }
                    ],
                    "rules": "open"
                },
                "fixedIdentifier": {
                    "system": "https://docs.google.com/spreadsheets/d/1BBBZZbEO82wkvLbHtbpa4ihdFTMoIG0KQGH5bgUoo70/edit#gid=896973653"
                }
            },
            {
                "id": "Observation.identifier:FindingID",
                "path": "Observation.identifier",
                "sliceName": "FindingID",
                "min": 1,
                "max": "1"
            },
            {
                "id": "Observation.identifier:FindingID.system",
                "path": "Observation.identifier.system",
                "fixedUri": "https://docs.google.com/spreadsheets/d/1BBBZZbEO82wkvLbHtbpa4ihdFTMoIG0KQGH5bgUoo70/edit#gid=896973653"
            },
            {
                "id": "Observation.identifier:FindingID.value",
                "path": "Observation.identifier.value",
                "min": 1
            },
            {
                "id": "Observation.category",
                "path": "Observation.category",
                "slicing": {
                    "discriminator": [
                        {
                            "type": "pattern",
                            "path": "$this"
                        }
                    ],
                    "rules": "open"
                },
                "min": 1,
                "max": "1"
            },
            {
                "id": "Observation.category:imaging-category",
                "path": "Observation.category",
                "sliceName": "imaging-category",
                "min": 1,
                "max": "1",
                "patternCodeableConcept": {
                    "coding": [
                        {
                            "system": "http://terminology.hl7.org/CodeSystem/observation-category",
                            "code": "imaging"
                        }
                    ]
                }
            },
            {
                "id": "Observation.code.coding.system",
                "path": "Observation.code.coding.system",
                "fixedUri": "base/CodeSystem/8f414151-bf5f-46ce-94fe-f96d9e867d29"
            },
            {
                "id": "Observation.code.coding.code",
                "path": "Observation.code.coding.code",
                "fixedCode": "image.finding"
            },
            {
                "id": "Observation.subject",
                "path": "Observation.subject",
                "min": 1,
                "type": [
                    {
                        "code": "Reference",
                        "targetProfile": [
                            "http://hl7.org/fhir/StructureDefinition/Patient"
                        ]
                    }
                ]
            },
            {
                "id": "Observation.effective[x]",
                "path": "Observation.effective[x]",
                "min": 1,
                "type": [
                    {
                        "code": "dateTime"
                    }
                ]
            },
            {
                "id": "Observation.performer",
                "path": "Observation.performer",
                "min": 1,
                "max": "1",
                "type": [
                    {
                        "code": "Reference",
                        "targetProfile": [
                            "http://hl7.org/fhir/StructureDefinition/Practitioner",
                            "http://hl7.org/fhir/StructureDefinition/PractitionerRole"
                        ]
                    }
                ]
            },
            {
                "id": "Observation.bodySite",
                "path": "Observation.bodySite",
                "min": 1
            },
            {
                "id": "Observation.derivedFrom",
                "path": "Observation.derivedFrom",
                "min": 1,
                "max": "1",
                "type": [
                    {
                        "code": "Reference",
                        "targetProfile": [
                            "http://hl7.org/fhir/StructureDefinition/Observation"
                        ]
                    }
                ]
            },
            {
                "id": "Observation.component",
                "path": "Observation.component",
                "slicing": {
                    "discriminator": [
                        {
                            "type": "pattern",
                            "path": "code.coding.code"
                        }
                    ],
                    "rules": "open"
                }
            },
            {
                "id": "Observation.component:main-image",
                "path": "Observation.component",
                "sliceName": "main-image",
                "min": 1,
                "max": "1"
            },
            {
                "id": "Observation.component:main-image.code.coding.system",
                "path": "Observation.component.code.coding.system",
                "fixedUri": "base/8f414151-bf5f-46ce-94fe-f96d9e867d29"
            },
            {
                "id": "Observation.component:main-image.code.coding.code",
                "path": "Observation.component.code.coding.code",
                "fixedCode": "image.finding.keyimage"
            },
            {
                "id": "Observation.component:main-image.value[x]",
                "path": "Observation.component.value[x]",
                "min": 1,
                "type": [
                    {
                        "code": "Attachment"
                    }
                ]
            },
            {
                "id": "Observation.component:main-image.value[x].url",
                "path": "Observation.component.value[x].url",
                "min": 1
            }
        ]
    }
}

finding observation:

{
  "resourceType": "Observation",
  "status": "final",
  "text" : {
    "status" : "generated",
    "div": "<div xmlns=\"http://www.w3.org/1999/xhtml\">There is a history of <span id=\"a1\">Asthma</span></div>" 
  },
  "meta": {
       "profile": [
           "base/StructureDefinition/ImageFindingObservation"
       ]
   },
   "identifier":[{
  "system" : "https://docs.google.com/spreadsheets/d/1BBBZZbEO82wkvLbHtbpa4ihdFTMoIG0KQGH5bgUoo70/edit#gid=896973653", 
  "value" : "S2023-00135"
   }],
   "derivedFrom": [ {
"reference": "DocumentReference/665f781e-5666-4e22-a3c9-638d23ca1043"
} ]
,
  "category": [
    {
      "coding": [
        {
          "system": "http://terminology.hl7.org/CodeSystem/observation-category",
          "code": "imaging",
          "display": "Imaging"
        }
      ]
    }
  ],
  "code": {
    "coding": [
      {
        "system": "base/CodeSystem/8f414151-bf5f-46ce-94fe-f96d9e867d29",
        "code": "image.finding",
        "display": "Image annotation"
      }
    ]
  },
  "subject": {
    "reference": "Patient/88df8172-9f58-4a0f-bcca-bcdcd5ea6485",
    "display": "Will Smith"
  },
  "effectiveDateTime": "2015-02-07T13:28:17-05:00",
  "performer": [
    {
      "reference": "PractitionerRole/af055cb6-bd06-4ce4-9967-90d4e9f25044",
    "display": "Maria Angelina Yashinta G Dr. Sp.Rad"

    }
  ],
  "bodySite" : { 
      "coding" : [{ 
        "system": "http://snomed.info/sct",
        "code": "7769000",
        "display": "Right foot"
       }]
   },
  "component": [
 {
      "code": {
        "coding": [
          {
            "system": "base/CodeSystem/8f414151-bf5f-46ce-94fe-f96d9e867d29",
            "code": "image.finding.keyimage" 
          }
        ]
      },
      "valueAttachment" : { 
"url":"base/DocumentReference/665f781e-5666-4e22-a3c9-638d23ca1043"
    }
}
  ]
}

My error: