java.lang.Object
org.projecthusky.fhir.emed.ch.epr.service.converter.emediplan.ChMed23AConverter
All Implemented Interfaces:
EMediplanConverter

public non-sealed class ChMed23AConverter extends Object implements EMediplanConverter
Utility class to convert CH EMED EPR documents to an eMediplan object equivalent according to the CHMED23A specifications.
  • Constructor Details

    • ChMed23AConverter

      public ChMed23AConverter()
  • Method Details

    • toEMediplan

      Converts the received PMLC document to an eMediplan object according to the CHMED23A specifications.
      Specified by:
      toEMediplan in interface EMediplanConverter
      Parameters:
      pmlc - The PMLC document to be converted.
      Returns:
      A best-effort equivalent eMediplan object.
    • toEMediplan

      public ChMed23AEMediplan toEMediplan(ChEmedEprDocumentPre pre)
      Converts the received PRE document to an eMediplan object according to the CHMED23A specifications.
      Specified by:
      toEMediplan in interface EMediplanConverter
      Parameters:
      pre - The PRE document to be converted.
      Returns:
      A best-effort equivalent eMediplan object.
    • toMedicament

      protected ChMed23AMedicament toMedicament(ChEmedEprMedicationStatementPmlc statement)
    • toPosology

      protected ChMed23APosology toPosology(ChEmedEprDosage baseDosage, List<@NonNull ChEmedEprDosage> additionalDosages, boolean setUnitIfAbsent)
      Converts the list of Dosage objects of a CH EMED EPR resource (either medication statement or medication request) to an ChMed23APosology object.
      Parameters:
      baseDosage - The CH EMED EPR resource base dosage.
      additionalDosages - The CH EMED EPR list of additional dosages (if split dose). It can be empty.
      setUnitIfAbsent - The eMediplan posology object unit will be set to N/A if the CH EMED EPR object has no specified structured unit.
      Returns:
      The equivalent eMediplan posology object.
    • getEMediplanDoseFromChEmedEpr

      protected static EMediplanDose getEMediplanDoseFromChEmedEpr(Dose chEmedEprDose)
      Converts a CH EMED EPR Dose to the appropriate EMediplanDose object.

      Depending on whether the dose is a simple quantity or a range, the returned object will be an instance of SimpleDose or RangeDose respectively.

      Note that the unit of the dose is ignored. The aim of this method is just to convert the quantity part of the dose object, since the unit is specified at a higher level in the eMediplan model.

      Parameters:
      chEmedEprDose - The CH EMED EPR dose to be converted.
      Returns:
      The resulting EMediplanDose object.
    • toRepetition

      protected static @Nullable Repetition toRepetition(org.hl7.fhir.r4.model.MedicationRequest.MedicationRequestDispenseRequestComponent dispenseRequest)
      Gets a repetition object from a FHIR dispense request, if possible.
      Parameters:
      dispenseRequest - The dispense request form which to create a repetition object.
      Returns:
      The resulting repetition object, if it would make sense, null otherwise.