hl7ch / ch-emed

FHIR Implementation Guide which defines the documents for the exchange of medication information in the context of the Swiss EPR
https://fhir.ch/ig/ch-emed/index.html
MIT License
1 stars 1 forks source link

CHEMEDDocumentMedicationList entry slicing is ambiguous #285

Closed dvribeira closed 3 months ago

dvribeira commented 3 months ago

The slicing rules of https://github.com/hl7ch/ch-emed/blob/master/input/fsh/profiles/CHEMEDDocumentMedicationList.fsh make it so that actual validation of PML documents containing changed entries will never be successful (tested with matchbox 3.5.3 with CH EMED 4.0.1, but I believe the problem still applies):

* entry contains
    MedicationStatement 0..* and
    MedicationRequest 0..* and
    MedicationDispense 0..* and
    MedicationAdministration 0..* and
    Observation 0..* and
    MedicationStatementChanged 0..* and
    MedicationRequestChanged 0..*
* entry[MedicationStatement].resource 1..
* entry[MedicationStatement].resource only CHEMEDMedicationStatementList
* entry[MedicationRequest].resource 1..
* entry[MedicationRequest].resource only CHEMEDMedicationRequestList
* entry[MedicationDispense].resource 1..
* entry[MedicationDispense].resource only CHEMEDMedicationDispenseList 
* entry[MedicationAdministration].resource 1..
* entry[MedicationAdministration].resource only CHEMEDMedicationAdministration
* entry[Observation].resource 1..
* entry[Observation].resource only CHEMEDObservationList
* entry[MedicationStatementChanged].resource 1..
* entry[MedicationStatementChanged].resource only CHEMEDMedicationStatementChangedList
* entry[MedicationRequestChanged].resource 1..
* entry[MedicationRequestChanged].resource only CHEMEDMedicationRequestChangedList

The proposal would be to remove the distinction between original and changed resources at the document entry level, since they are anyway discriminated at the composition/references level and to use the CH EMED parent profiles. It should be enough to use CHEMEDMedicationStatement and CHEMEDMedicationRequest at this level instead:

* entry contains
    MedicationStatement 0..* and
    MedicationRequest 0..* and
    MedicationDispense 0..* and
    MedicationAdministration 0..* and
    Observation 0..*
* entry[MedicationStatement].resource 1..
* entry[MedicationStatement].resource only CHEMEDMedicationStatement
* entry[MedicationRequest].resource 1..
* entry[MedicationRequest].resource only CHEMEDMedicationRequest
* entry[MedicationDispense].resource 1..
* entry[MedicationDispense].resource only CHEMEDMedicationDispenseList 
* entry[MedicationAdministration].resource 1..
* entry[MedicationAdministration].resource only CHEMEDMedicationAdministration
* entry[Observation].resource 1..
* entry[Observation].resource only CHEMEDObservationList

Optionally, but not required to solve the issue, would be to also downgrade the dispense and observation slices to the parent resources out of consistency. No strong opinion there on my side.

ziegm commented 3 months ago

(tested with matchbox 3.5.3 with CH EMED 4.0.1, but I believe the problem still applies)

Yes, I have also encountered this problem in a similar project

ziegm commented 3 months ago

@dvribeira @pjolo please review the changes:

dvribeira commented 3 months ago

The changes are good for me.

Thanks a lot!

pjolo commented 3 months ago

The changes are also good for me.