Tabnine Logo
MessageTypeRouter.processMessage
Code IndexAdd Tabnine to your IDE (free)

How to use
processMessage
method
in
ca.uhn.hl7v2.app.MessageTypeRouter

Best Java code snippets using ca.uhn.hl7v2.app.MessageTypeRouter.processMessage (Showing top 20 results out of 315)

origin: openmrs/openmrs-core

/**
 * @see ORUR01Handler#processMessage(Message)
 */
@Test(expected = ApplicationException.class)
public void processMessage_shouldFailOnEmptyConceptAnswers() throws Exception {
  String hl7string = "MSH|^~\\&|FORMENTRY|AMRS.ELD|HL7LISTENER|AMRS.ELD|20080630094800||ORU^R01|kgWdFt0SVwwClOfJm3pe|P|2.5|1||||||||15^AMRS.ELD.FORMID\r"
      + "PID|||3^^^^~d3811480^^^^||John3^Doe^||\r"
      + "PV1||O|1^Unknown||||1^Super User (admin)|||||||||||||||||||||||||||||||||||||20080208|||||||V\r"
      + "ORC|RE||||||||20080208000000|1^Super User\r"
      + "OBR|1|||1238^MEDICAL RECORD OBSERVATIONS^99DCT\r"
      + "OBX|1|CWE|5497^CD4, BY FACS^99DCT||^^99DCT|||||||||20080208";
  Message hl7message = parser.parse(hl7string);
  router.processMessage(hl7message);
}

origin: openmrs/openmrs-core

/**
 * @see ORUR01Handler#processMessage(Message)
 */
@Test(expected = ApplicationException.class)
public void processMessage_shouldFailIfTheProviderNameTypeCodeIsNotSpecifiedAndIsNotAPersonId() throws Exception {
  int patientId = 2;
  String hl7string = "MSH|^~\\&|FORMENTRY|AMRS.ELD|HL7LISTENER|AMRS.ELD|20080226102656||ORU^R01|JqnfhKKtouEz8kzTk6Zo|P|2.5|1||||||||16^AMRS.ELD.FORMID\r"
      + "PID|||"
      + patientId
      + "^^^^||Hornblower^Horatio^Test||\r"
      + "PV1||O|1^Unknown Location||||Test^Super User (1-8)^^^^^^^&"
      + HL7Constants.PROVIDER_ASSIGNING_AUTH_IDENTIFIER
      + "&^|||||||||||||||||||||||||||||||||||||20080212|||||||V\r"
      + "ORC|RE||||||||20080226102537|1^Super User\r" + "OBR|1|||1238^MEDICAL RECORD OBSERVATIONS^99DCT";
  Message hl7message = parser.parse(hl7string);
  router.processMessage(hl7message);
}

origin: openmrs/openmrs-core

/**
 * @see ORUR01Handler#processMessage(Message)
 */
@Test(expected = ApplicationException.class)
public void processMessage_shouldFailOnEmptyConceptProposals() throws Exception {
  String hl7string = "MSH|^~\\&|FORMENTRY|AMRS.ELD|HL7LISTENER|AMRS.ELD|20080630094800||ORU^R01|kgWdFt0SVwwClOfJm3pe|P|2.5|1||||||||15^AMRS.ELD.FORMID\r"
      + "PID|||3^^^^~d3811480^^^^||John3^Doe^||\r"
      + "PV1||O|1^Unknown||||1^Super User (admin)|||||||||||||||||||||||||||||||||||||20080208|||||||V\r"
      + "ORC|RE||||||||20080208000000|1^Super User\r"
      + "OBR|1|||1238^MEDICAL RECORD OBSERVATIONS^99DCT\r"
      + "OBR|1|||1284^PROBLEM LIST^99DCT\r"
      + "OBX|1|CWE|6042^PROBLEM ADDED^99DCT||PROPOSED^^99DCT|||||||||20080208";
  Message hl7message = parser.parse(hl7string);
  router.processMessage(hl7message);
}

origin: openmrs/openmrs-core

/**
 * @see org.openmrs.hl7.HL7Service#processHL7Message(ca.uhn.hl7v2.model.Message)
 */
@Override
public Message processHL7Message(Message message) throws HL7Exception {
  // Any post-parsing (pre-routing) processing would go here
  // or a module can use AOP to do the post-parsing
  
  Message response;
  try {
    if (!router.canProcess(message)) {
      throw new HL7Exception("No route for hl7 message: " + message.getName()
          + ". Make sure you have a module installed that registers a hl7handler for this type");
    }
    response = router.processMessage(message);
  }
  catch (ApplicationException e) {
    throw new HL7Exception("Error while processing HL7 message: " + message.getName(), e);
  }
  
  return response;
}

origin: openmrs/openmrs-core

/**
 * Should create a concept proposal because of the key string in the message
 * 
 * @see ORUR01Handler#processMessage(Message)
 */
@Test
public void processMessage_shouldCreateConceptProposalAndWithObsAlongside() throws Exception {
  
  // remember initial occurrence of proposal's text in the model
  int initialOccurrences = Context.getConceptService().getConceptProposals("ASDFASDFASDF").size();
  
  String hl7string = "MSH|^~\\&|FORMENTRY|AMRS.ELD|HL7LISTENER|AMRS.ELD|20081006115934||ORU^R01|a1NZBpKqu54QyrWBEUKf|P|2.5|1||||||||3^AMRS.ELD.FORMID\r"
      + "PID|||7^^^^~asdf^^^^||Joe^ ^Smith||\r"
      + "PV1||O|1^Bishop Muge||||1^asdf asdf (5-9)|||||||||||||||||||||||||||||||||||||20081003|||||||V\r"
      + "ORC|RE||||||||20081006115645|1^Super User\r"
      + "OBR|1|||1238^MEDICAL RECORD OBSERVATIONS^99DCT\r"
      + "OBX|2|DT|5096^RETURN VISIT DATE^99DCT||20081004|||||||||20081003\r"
      + "OBR|3|||1284^PROBLEM LIST^99DCT\r"
      + "OBX|2|CWE|6042^PROBLEM ADDED^99DCT||PROPOSED^ASDFASDFASDF^99DCT|||||||||20081003";
  Message hl7message = parser.parse(hl7string);
  router.processMessage(hl7message);
  
  //make sure that the proposal was added
  Assert.assertEquals("Processing of the HL7 message did not result in the new proposal being added to the model",
    initialOccurrences + 1, Context.getConceptService().getConceptProposals("ASDFASDFASDF").size());
  
}

origin: openmrs/openmrs-core

/**
 * @see ORUR01Handler#processMessage(Message)
 */
@Test
public void processMessage_shouldCreateAnEncounterAndFindTheProviderByPersonId() throws Exception {
  int patientId = 2;
  Patient patient = new Patient(patientId);
  List<Encounter> encForPatient1 = Context.getEncounterService().getEncountersByPatient(patient);
  
  String hl7string = "MSH|^~\\&|FORMENTRY|AMRS.ELD|HL7LISTENER|AMRS.ELD|20080226102656||ORU^R01|JqnfhKKtouEz8kzTk6Zo|P|2.5|1||||||||16^AMRS.ELD.FORMID\r"
      + "PID|||"
      + patientId
      + "^^^^||Hornblower^Horatio^Test||\r"
      + "PV1||O|1^Unknown Location||||1^name|||||||||||||||||||||||||||||||||||||20080212|||||||V\r"
      + "ORC|RE||||||||20080226102537|1^Super User\r" + "OBR|1|||1238^MEDICAL RECORD OBSERVATIONS^99DCT";
  Message hl7message = parser.parse(hl7string);
  router.processMessage(hl7message);
  
  List<Encounter> encForPatient2 = Context.getEncounterService().getEncountersByPatient(patient);
  assertTrue("An encounter should have been created", (encForPatient1.size() + 1) == encForPatient2.size());
  
  encForPatient2.removeAll(encForPatient1);
  Assert.assertTrue(encForPatient2.size() == 1);
  
  Provider newProvider = encForPatient2.get(0).getProvidersByRole(
    Context.getEncounterService().getEncounterRoleByUuid(EncounterRole.UNKNOWN_ENCOUNTER_ROLE_UUID)).iterator()
      .next();
  Assert.assertEquals("c2299800-cca9-11e0-9572-0800200c9a66", newProvider.getUuid());
}

origin: openmrs/openmrs-core

/**
 * Should create a concept proposal because of the key string in the message
 * 
 * @see ORUR01Handler#processMessage(Message)
 */
@Test
public void processMessage_shouldCreateBasicConceptProposal() throws Exception {
  
  // remember initial occurrence of proposal's text in the model
  int initialOccurrences = Context.getConceptService().getConceptProposals("PELVIC MASS").size();
  
  String hl7string = "MSH|^~\\&|FORMENTRY|AMRS.ELD|HL7LISTENER|AMRS.ELD|20080924022306||ORU^R01|Z185fTD0YozQ5kvQZD7i|P|2.5|1||||||||3^AMRS.ELD.FORMID\r"
      + "PID|||7^^^^||Joe^S^Mith||\r"
      + "PV1||O|1^Unknown Module 2||||1^Joe (1-1)|||||||||||||||||||||||||||||||||||||20080212|||||||V\r"
      + "ORC|RE||||||||20080219085345|1^Joe\r"
      + "OBR|1|||1238^MEDICAL RECORD OBSERVATIONS^99DCT\r"
      + "OBX|18|DT|5096^RETURN VISIT DATE^99DCT||20080506|||||||||20080212\r"
      + "OBR|19|||1284^PROBLEM LIST^99DCT\r"
      + "OBX|1|CWE|6042^PROBLEM ADDED^99DCT||PROPOSED^PELVIC MASS^99DCT|||||||||20080212";
  Message hl7message = parser.parse(hl7string);
  router.processMessage(hl7message);
  
  //make sure that the proposal was added
  Assert.assertEquals("Processing of the HL7 message did not result in the new proposal being added to the model",
    initialOccurrences + 1, Context.getConceptService().getConceptProposals("PELVIC MASS").size());
  
}
origin: openmrs/openmrs-core

router.processMessage(hl7message);
origin: openmrs/openmrs-core

router.processMessage(hl7message);
origin: openmrs/openmrs-core

router.processMessage(hl7message);
origin: openmrs/openmrs-core

    + "ORC|RE||||||||20080226102537|1^Super User\r" + "OBR|1|||1238^MEDICAL RECORD OBSERVATIONS^99DCT";
Message hl7message = parser.parse(hl7string);
router.processMessage(hl7message);
origin: openmrs/openmrs-core

    + "OBX|1|CWE|6042^PROBLEM ADDED^99DCT||PROPOSED^SEVERO DOLOR DE CABEZA^99DCT|||||||||20080208";
Message hl7message = parser.parse(hl7String);
router.processMessage(hl7message);
origin: openmrs/openmrs-core

/**
 * @see ORUR01Handler#processMessage(Message)
 */
@Test(expected = ApplicationException.class)
public void processMessage_shouldFailIfQuestionDatatypeIsNeitherBooleanNorNumericNorCoded() throws Exception {
  String hl7string = "MSH|^~\\&|FORMENTRY|AMRS.ELD|HL7LISTENER|AMRS.ELD|20080226102656||ORU^R01|JqnfhKKtouEz8kzTk6Zo|P|2.5|1||||||||16^AMRS.ELD.FORMID\r"
      + "PID|||7^^^^||Collet^Test^Chebaskwony||\r"
      + "PV1||O|1^Unknown Location||||1^Super User (1-8)|||||||||||||||||||||||||||||||||||||20080212|||||||V\r"
      + "ORC|RE||||||||20080226102537|1^Super User\r"
      + "OBR|1|||1238^MEDICAL RECORD OBSERVATIONS^99DCT\r"
      + "OBX|2|NM|19^FAVORITE FOOD, NON-CODED^99DCT||1|||||||||20080206";
  Assert.assertEquals("Text", Context.getConceptService().getConcept(19).getDatatype().getName());
  Message hl7message = parser.parse(hl7string);
  router.processMessage(hl7message);
}

origin: openmrs/openmrs-core

    + "OBX|1|CWE|21^FOOD ASSISTANCE FOR ENTIRE FAMILY^99DCT||22^UNKNOWN^99DCT^2471^UNKNOWN^99NAM|||||||||20090714";
Message hl7message = parser.parse(hl7String);
router.processMessage(hl7message);
origin: openmrs/openmrs-core

/**
 * @see ORUR01Handler#parseObs(Encounter,OBX,OBR,String)
 */
@Test
public void parseObs_shouldAddCommentsToAnObservationGroup() throws Exception {
  ObsService os = Context.getObsService();
  String hl7string = "MSH|^~\\&|FORMENTRY|AMRS.ELD|HL7LISTENER|AMRS.ELD|20080226102656||ORU^R01|JqnfhKKtouEz8kzTk6Zo|P|2.5|1||||||||16^AMRS.ELD.FORMID\r"
      + "PID|||7^^^^||Collet^Test^Chebaskwony||\r"
      + "PV1||O|1^Unknown Location||||1^Super User (1-8)|||||||||||||||||||||||||||||||||||||20080212|||||||V\r"
      + "ORC|RE||||||||20080226102537|1^Super User\r"
      + "OBR|1|||23^FOOD CONSTRUCT^99DCT\r"
      + "NTE|1|L|This is a comment\r"
      + "OBX|1|NM|5497^CD4, BY FACS^99DCT||1|||||||||20080206\r"
      + "NTE|1|L|This should not be considered :-)";
  List<Obs> oldList = os.getObservationsByPersonAndConcept(new Person(7), new Concept(23));
  Message hl7message = parser.parse(hl7string);
  router.processMessage(hl7message);
  List<Obs> newList = os.getObservationsByPersonAndConcept(new Person(7), new Concept(23));
  Obs newObservation = null;
  for (Obs newObs : newList) {
    if (!oldList.contains(newObs) && newObs.isObsGrouping()) {
      newObservation = newObs;
    }
  }
  Assert.assertEquals("This is a comment", newObservation.getComment());
}

origin: openmrs/openmrs-core

/**
 * @see ORUR01Handler#processMessage(Message)
 */
@Test
public void processMessage_shouldSetValue_NumericForObsIfQuestionDatatypeIsNumericAndTheAnswerIsEither0Or1()
    throws Exception {
  ObsService os = Context.getObsService();
  String hl7string = "MSH|^~\\&|FORMENTRY|AMRS.ELD|HL7LISTENER|AMRS.ELD|20080226102656||ORU^R01|JqnfhKKtouEz8kzTk6Zo|P|2.5|1||||||||16^AMRS.ELD.FORMID\r"
      + "PID|||7^^^^||Collet^Test^Chebaskwony||\r"
      + "PV1||O|1^Unknown Location||||1^Super User (1-8)|||||||||||||||||||||||||||||||||||||20080212|||||||V\r"
      + "ORC|RE||||||||20080226102537|1^Super User\r"
      + "OBR|1|||1238^MEDICAL RECORD OBSERVATIONS^99DCT\r"
      + "OBX|1|NM|5497^CD4, BY FACS^99DCT||1|||||||||20080206";
  // the expected question for the obs in the hl7 message has to be
  // numeric
  Assert.assertEquals("Numeric", Context.getConceptService().getConcept(5497).getDatatype().getName());
  List<Obs> oldList = os.getObservationsByPersonAndConcept(new Person(7), new Concept(5497));
  Message hl7message = parser.parse(hl7string);
  router.processMessage(hl7message);
  List<Obs> newList = os.getObservationsByPersonAndConcept(new Person(7), new Concept(5497));
  Obs newObservation = null;
  for (Obs newObs : newList) {
    if (!oldList.contains(newObs) && !newObs.isObsGrouping()) {
      newObservation = newObs;
    }
  }
  Assert.assertEquals(1, newObservation.getValueNumeric().intValue());
}

origin: openmrs/openmrs-core

/**
 * @see ORUR01Handler#processMessage(Message)
 * 
 */
@Test
public void processMessage_shouldSetComplexDataForObsWithComplexConcepts() throws Exception {
  ObsHandler handler = new ObsHandler();
  final String handlerName = "NeigborHandler";
  final String data = "{\"firstname\":\"Horatio\"}";
  Context.getObsService().registerHandler(handlerName, handler);
  try {
    String hl7string = "MSH|^~\\&|FORMENTRY|AMRS.ELD|HL7LISTENER|AMRS.ELD|20080226102656||ORU^R01|JqnfhKKtouEz8kzTk6Zo|P|2.5|1||||||||16^AMRS.ELD.FORMID\r"
        + "PID|||3^^^^||John3^Doe^||\r"
        + "PV1||O|1^Unknown Location||||1^Super User (1-8)|||||||||||||||||||||||||||||||||||||20080212|||||||V\r"
        + "ORC|RE||||||||20080226102537|1^Super User\r"
        + "OBR|1|||1238^MEDICAL RECORD OBSERVATIONS^99DCT\r"
        + "OBX|1|ED|6043^uiNEIHBOR^99DCT||^^^^" + data + "|||||||||20080206\r";
    Message hl7message = parser.parse(hl7string);
    router.processMessage(hl7message);
  }
  finally {
    Context.getObsService().removeHandler(handlerName);
  }
  Assert.assertEquals(data, handler.getCreatedObs().getComplexData().getData());
}

origin: openmrs/openmrs-core

/**
 * @see ORUR01Handler#processMessage(Message)
 */
@Test(expected = ApplicationException.class)
public void processMessage_shouldFailIfQuestionDatatypeIsCodedAndABooleanIsNotAValidAnswer() throws Exception {
  GlobalProperty trueConceptGlobalProperty = new GlobalProperty(OpenmrsConstants.GLOBAL_PROPERTY_TRUE_CONCEPT, "7",
      "Concept id of the concept defining the TRUE boolean concept");
  GlobalProperty falseConceptGlobalProperty = new GlobalProperty(OpenmrsConstants.GLOBAL_PROPERTY_FALSE_CONCEPT, "8",
      "Concept id of the concept defining the TRUE boolean concept");
  Context.getAdministrationService().saveGlobalProperty(trueConceptGlobalProperty);
  Context.getAdministrationService().saveGlobalProperty(falseConceptGlobalProperty);
  String hl7string = "MSH|^~\\&|FORMENTRY|AMRS.ELD|HL7LISTENER|AMRS.ELD|20080226102656||ORU^R01|JqnfhKKtouEz8kzTk6Zo|P|2.5|1||||||||16^AMRS.ELD.FORMID\r"
      + "PID|||7^^^^||Collet^Test^Chebaskwony||\r"
      + "PV1||O|1^Unknown Location||||1^Super User (1-8)|||||||||||||||||||||||||||||||||||||20080212|||||||V\r"
      + "ORC|RE||||||||20080226102537|1^Super User\r"
      + "OBR|1|||1238^MEDICAL RECORD OBSERVATIONS^99DCT\r"
      + "OBX|2|NM|4^CIVIL STATUS^99DCT||1|||||||||20080206";
  Assert.assertEquals("Coded", Context.getConceptService().getConcept(4).getDatatype().getName());
  Message hl7message = parser.parse(hl7string);
  router.processMessage(hl7message);
}

origin: openmrs/openmrs-core

/**
 * @see ORUR01Handler#parseObs(Encounter,OBX,OBR,String)
 */
@Test
public void parseObs_shouldAddCommentsToAnObservationFromNTESegments() throws Exception {
  ObsService os = Context.getObsService();
  String hl7string = "MSH|^~\\&|FORMENTRY|AMRS.ELD|HL7LISTENER|AMRS.ELD|20080226102656||ORU^R01|JqnfhKKtouEz8kzTk6Zo|P|2.5|1||||||||16^AMRS.ELD.FORMID\r"
      + "PID|||7^^^^||Collet^Test^Chebaskwony||\r"
      + "PV1||O|1^Unknown Location||||1^Super User (1-8)|||||||||||||||||||||||||||||||||||||20080212|||||||V\r"
      + "ORC|RE||||||||20080226102537|1^Super User\r"
      + "OBR|1|||1238^MEDICAL RECORD OBSERVATIONS^99DCT\r"
      + "OBX|1|NM|5497^CD4, BY FACS^99DCT||1|||||||||20080206\r" + "NTE|1|L|This is a comment";
  // the expected question for the obs in the hl7 message has to be
  // numeric
  Assert.assertEquals("Numeric", Context.getConceptService().getConcept(5497).getDatatype().getName());
  List<Obs> oldList = os.getObservationsByPersonAndConcept(new Person(7), new Concept(5497));
  Message hl7message = parser.parse(hl7string);
  router.processMessage(hl7message);
  List<Obs> newList = os.getObservationsByPersonAndConcept(new Person(7), new Concept(5497));
  Obs newObservation = null;
  for (Obs newObs : newList) {
    if (!oldList.contains(newObs) && !newObs.isObsGrouping()) {
      newObservation = newObs;
    }
  }
  Assert.assertEquals("This is a comment", newObservation.getComment());
}

origin: openmrs/openmrs-core

/**
 * @see ORUR01Handler#processMessage(Message)
 */
@Test
public void processMessage_shouldSetValue_CodedMatchingABooleanConceptForObsIfTheAnswerIs0Or1AndQuestionDatatypeIsCoded()
    throws Exception {
  ObsService os = Context.getObsService();
  String hl7string = "MSH|^~\\&|FORMENTRY|AMRS.ELD|HL7LISTENER|AMRS.ELD|20080226102656||ORU^R01|JqnfhKKtouEz8kzTk6Zo|P|2.5|1||||||||16^AMRS.ELD.FORMID\r"
      + "PID|||7^^^^||Collet^Test^Chebaskwony||\r"
      + "PV1||O|1^Unknown Location||||1^Super User (1-8)|||||||||||||||||||||||||||||||||||||20080212|||||||V\r"
      + "ORC|RE||||||||20080226102537|1^Super User\r"
      + "OBR|1|||1238^MEDICAL RECORD OBSERVATIONS^99DCT\r"
      + "OBX|2|NM|21^CIVIL STATUS^99DCT||1|||||||||20080206";
  // the expected question for the obs in the hl7 message has to be coded
  Assert.assertEquals("Coded", Context.getConceptService().getConcept(21).getDatatype().getName());
  List<Obs> oldList = os.getObservationsByPersonAndConcept(new Person(7), new Concept(21));
  Message hl7message = parser.parse(hl7string);
  router.processMessage(hl7message);
  // hacky way to get the newly added obs and make tests on it
  List<Obs> newList = os.getObservationsByPersonAndConcept(new Person(7), new Concept(21));
  Obs newObservation = null;
  for (Obs newObs : newList) {
    if (!oldList.contains(newObs) && !newObs.isObsGrouping()) {
      newObservation = newObs;
    }
  }
  Assert.assertEquals(Context.getConceptService().getTrueConcept(), newObservation.getValueCoded());
}

ca.uhn.hl7v2.appMessageTypeRouterprocessMessage

Popular methods of MessageTypeRouter

  • canProcess
  • registerApplication

Popular in Java

  • Finding current android device location
  • getResourceAsStream (ClassLoader)
  • orElseThrow (Optional)
    Return the contained value, if present, otherwise throw an exception to be created by the provided s
  • getSharedPreferences (Context)
  • Point (java.awt)
    A point representing a location in (x,y) coordinate space, specified in integer precision.
  • File (java.io)
    An "abstract" representation of a file system entity identified by a pathname. The pathname may be a
  • ByteBuffer (java.nio)
    A buffer for bytes. A byte buffer can be created in either one of the following ways: * #allocate
  • HttpServletRequest (javax.servlet.http)
    Extends the javax.servlet.ServletRequest interface to provide request information for HTTP servlets.
  • Response (javax.ws.rs.core)
    Defines the contract between a returned instance and the runtime when an application needs to provid
  • Get (org.apache.hadoop.hbase.client)
    Used to perform Get operations on a single row. To get everything for a row, instantiate a Get objec
  • CodeWhisperer alternatives
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now