// the expected question for the obs in the hl7 message has to be coded
@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());
	}
+ "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));
@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;
@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());
}