Closed smals-bvv closed 2 months ago
@smals-bvv Thanks for your feedback We will check this issue on Mon 22/7 Regards JM
@smals-bvv
Hello Brecht, thank you for bringing this issue up, although not blocking, because it will always evaluate to 'true' (exists().not()), it is indeed not formulated correctly, and was indeed intended to be what you suggest! I will modify the invariant! Thanks a lot!
It's indeed not blocking in the sense that data can't be created. But it is blocking to guarantee that when the administredProduct field is used, it is from the system atc, cnk or cti extended.
Thanks for changing it.
https://github.com/hl7-be/vaccination/blob/17ad492db09fe8df62373a8bc9c006791ad615ab/input/fsh/profiles/BeVaccination.fsh#L94
The constraint above should enforce the administeredProduct field to be of system cnk, cti extended or atc. It's not clear to me what the first OR-clause is doing:
(extension('https://www.ehealth.fgov.be/standards/fhir/vaccination/StructureDefinition/be-ext-administeredProduct').select($this.value as CodeableConcept)).exists().not()
It's checking if the extension is a CodeableConcept, which it isn't because it's a Complex extension. So it will always return true as it's negated.
Shouldn't it be checked on the coded part of the extension? Like this the statement behaves like an if check in the FHIR path expression:
extension('https://www.ehealth.fgov.be/standards/fhir/vaccination/StructureDefinition/be-ext-administeredProduct').extension('coded').select($this.value as CodeableConcept).exists().not()
The full constraint would then become:
extension('https://www.ehealth.fgov.be/standards/fhir/vaccination/StructureDefinition/be-ext-administeredProduct').extension('coded').select($this.value as CodeableConcept).exists().not() or extension('https://www.ehealth.fgov.be/standards/fhir/vaccination/StructureDefinition/be-ext-administeredProduct').extension('coded').select($this.value as CodeableConcept).coding.where(system = 'https://www.ehealth.fgov.be/standards/fhir/medication/NamingSystem/be-ns-cnk-codes').exists() or extension('https://www.ehealth.fgov.be/standards/fhir/vaccination/StructureDefinition/be-ext-administeredProduct').extension('coded').select($this.value as CodeableConcept).coding.where(system = 'https://www.ehealth.fgov.be/standards/fhir/medication/NamingSystem/be-ns-cti-extended-code').exists() or extension('https://www.ehealth.fgov.be/standards/fhir/vaccination/StructureDefinition/be-ext-administeredProduct').extension('coded').select($this.value as CodeableConcept).coding.where(system = 'http://whocc.no/atc').exists()