Skip to content

Transaction: CH:PHARM 1

Quentin Ligier edited this page Apr 19, 2022 · 4 revisions

Transaction: CH:PHARM-1

CH:PHARM-1 is an extension of IHE PHARM-1 for the Swiss EPR environment. The specifications aren't completed yet.

Only the simplified request models are redefined, other models are those from IPF. The Camel components, services and WSDL are used so the Camel scheme stays cmpd-pharm1. The validators are customized.

Current issues

  • The parameter date becomes created in MHD 4.
  • The date modifier gt should be ge.

Models

Requests

ebXML data model: org.openehealth.ipf.commons.ihe.xds.core.stub.ebrs30.query.AdhocQueryRequest
Simplified data model:

  • org.husky.communication.ch.camel.chpharm1.requests.ChFindMedicationTreatmentPlansQuery
  • org.husky.communication.ch.camel.chpharm1.requests.ChFindPrescriptionsQuery
  • org.husky.communication.ch.camel.chpharm1.requests.ChFindDispensesQuery
  • org.husky.communication.ch.camel.chpharm1.requests.ChFindMedicationAdministrationsQuery (this one should always return an empty response, as CMA is not a supported profile in Switzerland)
  • org.husky.communication.ch.camel.chpharm1.requests.ChFindPrescriptionsForValidationQuery
  • org.husky.communication.ch.camel.chpharm1.requests.ChFindPrescriptionsForDispenseQuery
  • org.husky.communication.ch.camel.chpharm1.requests.ChFindMedicationListQuery
  • org.husky.communication.ch.camel.chpharm1.requests.ChFindMedicationCardQuery

Responses

ebXML data model: org.openehealth.ipf.commons.ihe.xds.core.stub.ebrs30.query.AdhocQueryResponse
Simplified data model: org.openehealth.ipf.commons.ihe.xds.core.responses.QueryResponse

Validation

org.husky.communication.ch.camel.chpharm1.ChPharm1Validators provides validators for requests and responses.

Consumer example

@Component
public class ChPharm1RouteBuilder extends RouteBuilder {

    /**
     * Called on initialization to build the routes using the fluent builder syntax.
     */
    @Override
    public void configure() {

        // On other exceptions, don't retry but go to the response creation
        onException(Exception.class)
            .log("CH:PHARM-1 route: caught Exception: ${exception.message}")
            .handled(true)
            .bean(ChPharm1ResponseConverter.class)
            .stop();

        // Declare the route and its processing pipeline
        from("cmpd-pharm1:path/to/cmpd/chpharm1")
            .routeId("cmpd-ch:pharm1-consumer")
            .process(ChPharm1Validators.chpharm1RequestValidator())
            .bean(PharmacySearchProcessor.class)
            .process(ChPharm1Validators.chpharm1ResponseValidator());
    }
}

Producer example

final var query = new ChFindDispensesQuery();
query.setPatientId(new Identifiable("patientId"));

final var exchange = new Exchange();
exchange.getMessage().setBody(query);

producerTemplate.send("cmpd-pharm1://example.com/cmpd/chpharm1?secure=true", exchange);

var response = exchange.getMessage().getBody(QueryResponse.class);