Skip to content
Duane Edwards edited this page Jun 10, 2016 · 10 revisions
string message = @"MSH|^~\&|CohieCentral|COHIE|Clinical Data Provider|TCH|20060228155525||QRY^R02^QRY_R02|1|P|2.3|QRD|20060228155525|R|I||||10^RD&Records&0126|38923^^^^^^^^&TCH|||";

PipeParser parser = new PipeParser();
IMessage m = parser.Parse(message);
QRY_R02 qryR02 = m as QRY_R02;
Assert.IsNotNull(qryR02);
Assert.AreEqual("38923", qryR02.QRD.GetWhoSubjectFilter(0).IDNumber.Value);

Event Map to Code Structure Mappings

Some message types are not mapped to their exact same event type and this can cause some confusion when you first encounter it.

For example ADT^A01, ADT^A04, ADT^A08 and ADT^A13 event types will all be parsed into the ADT^01 structure.

The following unit test illustrates this behaviour:

[Test]
public void TestAdtA04AndA01MessageStructure()
{
	var result = PipeParser.GetMessageStructureForEvent("ADT_A04", "2.5.1");
	bool isSame = string.Compare("ADT_A01", result, StringComparison.InvariantCultureIgnoreCase) == 0;
	Assert.IsTrue(isSame, "ADT_A04 returns ADT_A01");

	result = PipeParser.GetMessageStructureForEvent("ADT_A13", "2.5.1");
	isSame = string.Compare("ADT_A01", result, StringComparison.InvariantCultureIgnoreCase) == 0;
	Assert.IsTrue(isSame, "ADT_A13 returns ADT_A01");

	result = PipeParser.GetMessageStructureForEvent("ADT_A08", "2.5.1");
	isSame = string.Compare("ADT_A01", result, StringComparison.InvariantCultureIgnoreCase) == 0;
	Assert.IsTrue(isSame, "ADT_A08 returns ADT_A01");

	result = PipeParser.GetMessageStructureForEvent("ADT_A01", "2.5.1");
	isSame = string.Compare("ADT_A01", result, StringComparison.InvariantCultureIgnoreCase) == 0;
	Assert.IsTrue(isSame, "ADT_A01 returns ADT_A01");
}

The Event to Structure Map for each version of HL7 supported can be found below:

Clone this wiki locally