Search in sources :

Example 86 with Message

use of ca.uhn.hl7v2.model.Message in project beam by apache.

the class HL7v2IOTestUtil method testMessage.

static Message testMessage(String name) {
    Message msg = new Message();
    msg.setName(name);
    return msg;
}
Also used : Message(com.google.api.services.healthcare.v1.model.Message)

Example 87 with Message

use of ca.uhn.hl7v2.model.Message in project beam by apache.

the class HL7v2MessageCoder method decode.

@Override
public HL7v2Message decode(InputStream inStream) throws CoderException, IOException {
    Message msg = new Message();
    msg.setName(STRING_CODER.decode(inStream));
    msg.setMessageType(STRING_CODER.decode(inStream));
    msg.setCreateTime(STRING_CODER.decode(inStream));
    msg.setSendTime(STRING_CODER.decode(inStream));
    msg.setData(STRING_CODER.decode(inStream));
    msg.setSendFacility(STRING_CODER.decode(inStream));
    msg.setLabels(MAP_CODER.decode(inStream));
    HL7v2Message out = HL7v2Message.fromModel(msg);
    out.setSchematizedData(STRING_CODER.decode(inStream));
    return out;
}
Also used : Message(com.google.api.services.healthcare.v1.model.Message)

Example 88 with Message

use of ca.uhn.hl7v2.model.Message in project beam by apache.

the class HL7v2Message method toModel.

/**
 * To model message.
 *
 * @return the message
 */
public Message toModel() {
    Message out = new Message();
    out.setName(this.getName());
    out.setMessageType(this.getMessageType());
    out.setSendTime(this.getSendTime());
    out.setCreateTime(this.getCreateTime());
    out.setData(this.getData());
    out.setSendFacility(this.getSendFacility());
    if (this.schematizedData != null) {
        out.setSchematizedData(new SchematizedData().setData(this.schematizedData));
    }
    out.setLabels(this.labels);
    return out;
}
Also used : SchematizedData(com.google.api.services.healthcare.v1.model.SchematizedData) Message(com.google.api.services.healthcare.v1.model.Message)

Example 89 with Message

use of ca.uhn.hl7v2.model.Message in project streamsx.health by IBMStreams.

the class HapiMessageHandler method processMessage.

@Override
public Message processMessage(Message theMessage, Map<String, Object> arg1) throws ReceivingApplicationException, HL7Exception {
    server.messageArrived(theMessage);
    Message ack;
    try {
        // Always use the default parser to generate an ack
        // HAPI seems to get into trouble if the ADT_AXX superstructure
        // is used.  
        // Internally, when it tries to generate an ack message
        // the super structure setting in the model class factory causes the ADT_AXX message
        // to get created instead of the ACK getting created.  This is to override the model
        // class factory so that the proper class can be generated.
        theMessage.setParser(ackParser);
        ack = theMessage.generateACK();
        return ack;
    } catch (IOException e) {
        TRACE.log(TraceLevel.ERROR, "Unable to generate ack message", e);
    }
    return theMessage;
}
Also used : Message(ca.uhn.hl7v2.model.Message) IOException(java.io.IOException)

Example 90 with Message

use of ca.uhn.hl7v2.model.Message in project streamsx.health by IBMStreams.

the class OruR01Ingest method run.

@Override
public void run() {
    Topology topology = new Topology("OruR01Ingest");
    ObxToSplMapper mapper = new ObxToSplMapper();
    addDependencies(topology);
    TStream<Message> messages = topology.endlessSource(new HapiMessageSupplier(getPort()));
    // transform message to Observation object
    TStream<Observation> observationStream = messages.multiTransform(message -> {
        return mapper.messageToModel(message);
    });
    StreamSchema schema = Type.Factory.getStreamSchema(Observation.OBSERVATION_SCHEMA_SPL);
    @SuppressWarnings("serial") SPLStream splObservations = SPLStreams.convertStream(observationStream, new BiFunction<Observation, OutputTuple, OutputTuple>() {

        @Override
        public OutputTuple apply(Observation observation, OutputTuple outTuple) {
            return mapper.modelToSpl(observation, outTuple);
        }
    }, schema);
    splObservations.print();
    splObservations.publish(getTopic());
    try {
        StreamsContextFactory.getStreamsContext(StreamsContext.Type.DISTRIBUTED).submit(topology);
    } catch (Exception e) {
        TRACE.error("Unable to submit topology", e);
    }
}
Also used : Message(ca.uhn.hl7v2.model.Message) Topology(com.ibm.streamsx.topology.Topology) HapiMessageSupplier(com.ibm.streamsx.health.hapi.internal.HapiMessageSupplier) StreamSchema(com.ibm.streams.operator.StreamSchema) OutputTuple(com.ibm.streams.operator.OutputTuple) SPLStream(com.ibm.streamsx.topology.spl.SPLStream) ObxToSplMapper(com.ibm.streamsx.health.hapi.mapper.ObxToSplMapper) Observation(com.ibm.streamsx.health.hapi.model.Observation)

Aggregations

Message (ca.uhn.hl7v2.model.Message)114 Test (org.junit.Test)82 BaseContextSensitiveTest (org.openmrs.test.BaseContextSensitiveTest)60 ORU_R01 (ca.uhn.hl7v2.model.v25.message.ORU_R01)30 Patient (org.openmrs.Patient)24 NK1 (ca.uhn.hl7v2.model.v25.segment.NK1)22 HL7Exception (ca.uhn.hl7v2.HL7Exception)20 QRD (ca.uhn.hl7v2.model.v24.segment.QRD)19 ArrayList (java.util.ArrayList)19 MockEndpoint (org.apache.camel.component.mock.MockEndpoint)18 ORUR01Handler (org.openmrs.hl7.handler.ORUR01Handler)15 Concept (org.openmrs.Concept)14 Obs (org.openmrs.Obs)14 Person (org.openmrs.Person)14 MSH (ca.uhn.hl7v2.model.v24.segment.MSH)13 ObsService (org.openmrs.api.ObsService)11 ADR_A19 (ca.uhn.hl7v2.model.v24.message.ADR_A19)9 MSA (ca.uhn.hl7v2.model.v24.segment.MSA)9 Encounter (org.openmrs.Encounter)9 Structure (ca.uhn.hl7v2.model.Structure)8