FirelyTeam / firely-validator-api

Firely's official FHIR validator API for validating HL7 FHIR resources against profiles.
Other
7 stars 2 forks source link

Validation of complex constraint fails for correct bundle #300

Open AMehlem opened 1 year ago

AMehlem commented 1 year ago

Describe the bug When validating a bundle that conforms to profile https://simplifier.net/packages/de.gevko.evo.hlm/1.2.0/files/670037 the validation of the constraint

code.extension('https://fhir.gevko.de/StructureDefinition/EVO_EX_HLM_Leitsymptomatik').extension('leitsymptomatik').exists() and
(code.extension('https://fhir.gevko.de/StructureDefinition/EVO_EX_HLM_Leitsymptomatik').extension('leitsymptomatik')[0].valueCoding.code='pi' or 
code.extension('https://fhir.gevko.de/StructureDefinition/EVO_EX_HLM_Leitsymptomatik').extension('leitsymptomatik')[1].valueCoding.code='pi' or 
code.extension('https://fhir.gevko.de/StructureDefinition/EVO_EX_HLM_Leitsymptomatik').extension('leitsymptomatik')[2].valueCoding.code='pi')  implies 
code.extension('https://fhir.gevko.de/StructureDefinition/EVO_EX_HLM_Leitsymptomatik').extension('leitsymptomatik').count()=1

fails for a correct bundle that contains three extensions with url 'leitsymptomatik' with values "a", "b" and "c". This should be valid in my opinion.

To Reproduce To reproduce the issue, the code on https://github.com/AMehlem/fhir-r4-constraint-test can be cloned. When running the contained test using Visual Studio 2022, the test fails.

Expected behavior The constraint should be valid for the given testdata and the validation should not return an issue for this. The test should succeed.

Version used:

If it is helpful, I could try to add another minimal test for this to the firely-net-sdk-repository. But I would need to know what directories to add the new structuredefinitions, examples and test-code to.

Kind regards, Ashwani Mehlem

marcovisserFurore commented 1 year ago

Thanks @AMehlem for your issue. Also I am very happy with the unit test in your repo. That saves us a lot of work.

On first sight I see that the valueset https://fhir.kbv.de/ValueSet/KBV_VS_SFHIR_ICD_DIAGNOSESICHERHEIT cannot be resolved in your unit test. I will investigate a bit more and come back to you.

AMehlem commented 1 year ago

Thanks for the nice project and for looking into the issue so quickly. The mentioned valueset can be resolved on my machine, I will check if something was not comitted to the git repo. But this should not interfere with the other issue, or does it?

AMehlem commented 1 year ago

Sorry, my mistake. I see the warning about the valueset too, I just ignored it because it is an unrelated warning. There are 15 issues visible on my machine. Two of them are warnings with Code NotSupported. The third one is the relevant one with the failed constraint. The others are only informational and state that a failure happened before.