Class ChPharm5RequestConverter
java.lang.Object
org.projecthusky.communication.xdsmhdconversion.converters.ChPharm5RequestConverter
Converter of
Pharm5SearchParameters to ChPharmacyDocumentsQuery.- Author:
- Quentin Ligier, Oliver Egger, Daniel Vazquez Rivera
- See Also:
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected static ChPharmacyDocumentsQueryconvertMedicationListQuery(ChFindMedicationListQuery query, org.openehealth.ipf.commons.ihe.fhir.pharm5.Pharm5SearchParameters searchParams, ChPharm5Operations operation) Fills the criteria that are specific to the FindMedicationList operation.protected static ChPharmacyDocumentsQueryconvertStableQuery(ChPharmacyStableDocumentsQuery query, org.openehealth.ipf.commons.ihe.fhir.pharm5.Pharm5SearchParameters searchParams, ChPharm5Operations operation) Fills the criteria that are specific to the stable documents query operations (e.g.protected static voidensureNotNull(@Nullable Object parameter, String parameterName, ChPharm5Operations operation) Enforces non-null validation on a parameter.protected static voidfillCommonChPharmacyDocumentsQueryInfo(ChPharmacyDocumentsQuery query, org.openehealth.ipf.commons.ihe.fhir.pharm5.Pharm5SearchParameters searchParams, ChPharm5Operations operation) Fills the criteria that is common to all PHARM queries.protected static @Nullable org.openehealth.ipf.commons.ihe.xds.core.metadata.CodeparsePaperFormat(@Nullable ca.uhn.fhir.rest.param.TokenParam param, ca.uhn.fhir.context.FhirContext fhirContext) Parses the paper format returning the resultingCodetranslation.protected static voidparsePeriodParam(@Nullable ca.uhn.fhir.rest.param.DateRangeParam param, org.openehealth.ipf.commons.ihe.xds.core.metadata.TimeRange serviceStart, org.openehealth.ipf.commons.ihe.xds.core.metadata.TimeRange serviceEnd) Parses a period param and fills the passed service start and service end criteria.protected static voidparseStatusParam(@Nullable ca.uhn.fhir.rest.param.TokenOrListParam statusTokens, ChPharmacyDocumentsQuery query, ChPharm5Operations operation) Parses the query parameter 'status' as a set ofAvailabilityStatusand adds it to the corresponding field of the CH Pharmacy documents query.static ChPharmacyDocumentsQuerytoChPharmacyDocumentsQuery(org.openehealth.ipf.commons.ihe.fhir.pharm5.Pharm5SearchParameters searchParameters) Converts a PHARM-5 parameters object to aChPharmacyDocumentsQuery.static ChPharmacyDocumentsQuerytoChPharmacyDocumentsQuery(ChPharm5FindMedicationCardSearchParameters searchParameters) Converts aChPharm5FindMedicationCardSearchParametersparameters object to aChPharmacyDocumentsQuery.
-
Constructor Details
-
ChPharm5RequestConverter
public ChPharm5RequestConverter()
-
-
Method Details
-
toChPharmacyDocumentsQuery
public static ChPharmacyDocumentsQuery toChPharmacyDocumentsQuery(org.openehealth.ipf.commons.ihe.fhir.pharm5.Pharm5SearchParameters searchParameters) throws ca.uhn.fhir.rest.server.exceptions.InvalidRequestException Converts a PHARM-5 parameters object to aChPharmacyDocumentsQuery. NOTE: CH EPR FHIR specifies that MHD transactions must use the EPR-SPID as patient.identifier, while for the XDS transactions, the XAD-PID must be used. This converter does not perform any check on the patient.identifier system and will be set as-is, any further checks and transformations should be done by the caller as post-converter-processing.NOTE: identifier param is ignored
- Parameters:
searchParameters- The PHARM-5 search parameters.- Returns:
- The equivalent
ChPharmacyDocumentsQuery. - Throws:
ca.uhn.fhir.rest.server.exceptions.InvalidRequestException
-
toChPharmacyDocumentsQuery
public static ChPharmacyDocumentsQuery toChPharmacyDocumentsQuery(ChPharm5FindMedicationCardSearchParameters searchParameters) throws ca.uhn.fhir.rest.server.exceptions.InvalidRequestException Converts aChPharm5FindMedicationCardSearchParametersparameters object to aChPharmacyDocumentsQuery. NOTE: CH EPR FHIR specifies that MHD transactions must use the EPR-SPID as patient.identifier, while for the XDS transactions, the XAD-PID must be used. This converter does not perform any check on the patient.identifier system and will be set as-is, any further checks and transformations should be done by the caller as post-converter-processing.NOTE: identifier param is ignored
- Parameters:
searchParameters- The PHARM-5 search parameters.- Returns:
- The equivalent
ChPharmacyDocumentsQuery. - Throws:
ca.uhn.fhir.rest.server.exceptions.InvalidRequestException
-
fillCommonChPharmacyDocumentsQueryInfo
protected static void fillCommonChPharmacyDocumentsQueryInfo(ChPharmacyDocumentsQuery query, org.openehealth.ipf.commons.ihe.fhir.pharm5.Pharm5SearchParameters searchParams, ChPharm5Operations operation) Fills the criteria that is common to all PHARM queries.- Parameters:
query- TheChPharmacyDocumentsQueryto be filled.searchParams- The original search parameters.operation- The PHARM-5 operation.
-
convertStableQuery
protected static ChPharmacyDocumentsQuery convertStableQuery(ChPharmacyStableDocumentsQuery query, org.openehealth.ipf.commons.ihe.fhir.pharm5.Pharm5SearchParameters searchParams, ChPharm5Operations operation) Fills the criteria that are specific to the stable documents query operations (e.g. FindTreatmentPlans).- Parameters:
query- TheChPharmacyDocumentsQueryto be filled.searchParams- The original search parameters.operation- The PHARM-5 operation.
-
convertMedicationListQuery
protected static ChPharmacyDocumentsQuery convertMedicationListQuery(ChFindMedicationListQuery query, org.openehealth.ipf.commons.ihe.fhir.pharm5.Pharm5SearchParameters searchParams, ChPharm5Operations operation) Fills the criteria that are specific to the FindMedicationList operation.- Parameters:
query- TheChPharmacyDocumentsQueryto be filled.searchParams- The original search parameters.operation- The PHARM-5 operation.
-
parsePeriodParam
protected static void parsePeriodParam(@Nullable ca.uhn.fhir.rest.param.DateRangeParam param, org.openehealth.ipf.commons.ihe.xds.core.metadata.TimeRange serviceStart, org.openehealth.ipf.commons.ihe.xds.core.metadata.TimeRange serviceEnd) Parses a period param and fills the passed service start and service end criteria.- Parameters:
param- The date range param to be parsed as criteria.serviceStart- The service start criterium to be filled from the parsed param.serviceEnd- The service end criterium to be filled from the parsed param.
-
ensureNotNull
protected static void ensureNotNull(@Nullable Object parameter, String parameterName, ChPharm5Operations operation) Enforces non-null validation on a parameter.- Parameters:
parameter- The parameter to be checked.parameterName- The name fo the parameter being checked.operation- The current operation, e.g.$find-treatment-plans.
-
parseStatusParam
protected static void parseStatusParam(@Nullable ca.uhn.fhir.rest.param.TokenOrListParam statusTokens, ChPharmacyDocumentsQuery query, ChPharm5Operations operation) Parses the query parameter 'status' as a set ofAvailabilityStatusand adds it to the corresponding field of the CH Pharmacy documents query. It is required and limited to 'current' and 'superseded' values.- Parameters:
statusTokens- The FHIR search parameters 'status'.query- The ch pharmacy documents query to fill.operation- The CH:PHARM-5 operation.
-
parsePaperFormat
protected static @Nullable org.openehealth.ipf.commons.ihe.xds.core.metadata.Code parsePaperFormat(@Nullable ca.uhn.fhir.rest.param.TokenParam param, ca.uhn.fhir.context.FhirContext fhirContext) Parses the paper format returning the resultingCodetranslation.- Parameters:
param- The paper format as received in the CH:PHARM-5 query.fhirContext- The FHIR context.- Returns:
- The parsed paper format code.
-