org.hl7.fhir.core
org.hl7.fhir.core copied to clipboard
Validator - Unable to resolve cross-version extension in slicing logic
We're seeing the error message Slicing cannot be evaluated: Unable to resolve profile CanonicalType[http://hl7.org/fhir/5.0/StructureDefinition/extension-Claim.encounter]
in certain cases when validating against the Da Vinci PAS Claim profile
http://hl7.org/fhir/us/davinci-pas/StructureDefinition/profile-claim .
There are a few different scenarios of interest here, which are illustrated by some of the official examples for this profile:
Example 1 - https://hl7.org/fhir/us/davinci-pas/STU2/Claim-HomecareAuthorizationExample.json
(permalink)
In this instance, there is an extension on the resource, but it's not that Claim.encounter extension. Here we see the error.
Example 2 - https://hl7.org/fhir/us/davinci-pas/STU2/Claim-SurgicalAuthorizationRequestExample.json (permalink) In this instance, there are extensions on the resource, and one is the Claim.encounter extension. We do not see the error here.
Example 3 - Re-run example 1 in the same session after running example 2 and it will not report the error.
Example 4 - https://hl7.org/fhir/us/davinci-pas/STU2/Claim-MedicalServicesAuthorizationExample.json (permalink) In this instance, there are no extensions on the resource, and we do not see the error.
(To reproduce these, just make sure you are using R4. You can specify -ig hl7.fhir.us.davinci-pas#2.0.1
but since the resources report the profile it will be fetched automatically anyway. They can be reproduced on https://validator.fhir.org/ without changing any settings but make sure to refresh the page to get a new session in between tests)
My sense is that there's some reason the cross-version extension StructureDef isn't fetched or derived correctly via the slicing check logic, but if the StructureDef is already loaded in the validator session then it works. This isn't high priority for us so I haven't dug super deep into it.
I did see that the error is reported from inside an exception catch block, so the full stack trace for the original exception is:
org.hl7.fhir.exceptions.DefinitionException: Unable to resolve profile CanonicalType[http://hl7.org/fhir/5.0/StructureDefinition/extension-Claim.encounter]
at org.hl7.fhir.validation.instance.InstanceValidator.getCriteriaForDiscriminator(InstanceValidator.java:4303)
at org.hl7.fhir.validation.instance.InstanceValidator.sliceMatches(InstanceValidator.java:4833)
at org.hl7.fhir.validation.instance.InstanceValidator.matchSlice(InstanceValidator.java:6755)
at org.hl7.fhir.validation.instance.InstanceValidator.assignChildren(InstanceValidator.java:6660)
at org.hl7.fhir.validation.instance.InstanceValidator.validateElement(InstanceValidator.java:5998)
at org.hl7.fhir.validation.instance.InstanceValidator.startInner(InstanceValidator.java:5529)
at org.hl7.fhir.validation.instance.InstanceValidator.start(InstanceValidator.java:5365)
at org.hl7.fhir.validation.instance.InstanceValidator.validateResource(InstanceValidator.java:7070)
at org.hl7.fhir.validation.instance.InstanceValidator.validate(InstanceValidator.java:1005)
at org.hl7.fhir.validation.instance.InstanceValidator.validate(InstanceValidator.java:842)
at org.hl7.fhir.validation.ValidationEngine.validate(ValidationEngine.java:661)
at org.hl7.fhir.validation.ValidationEngine.validate(ValidationEngine.java:621)
at org.hl7.fhir.validation.cli.services.ValidationService.validateSources(ValidationService.java:209)
at org.hl7.fhir.validation.cli.tasks.ValidateTask.executeTask(ValidateTask.java:62)
at org.hl7.fhir.validation.ValidatorCli.readParamsAndExecuteTask(ValidatorCli.java:374)
at org.hl7.fhir.validation.ValidatorCli.readParamsAndExecuteTask(ValidatorCli.java:171)
at org.hl7.fhir.validation.ValidatorCli.main(ValidatorCli.java:206)