|Tutorial #8A : Introduction to the Lexicon Server and its Uses|
The management of the Lexicon Server, as well as a much more in depth look at the idea of terminologies can be found in the documentation to the Lexicon Manager. For the purposes of this tutorial, we only need a rough idea.
The Lexicon Manager is a facility to store and define terminologies, terms and their representations. It enables re-use of data, and enables a receiving system to understand the meaning of data from a foreign system. In other words, it allows the receiving system to understand the data sent to it by the foreign system. It acts as a translator between the terminologies used in the two systems.
Suppose a HL7 message is sent containing a reference to Sodium. Unfortunately, as there is no standard way to express information like this, the foreign and receiving systems both have different expressions for Sodium. The foreign system had encoded it in the message as Na, but the receiving system expects the code to be 2947-0. Although a translation script like the one written in would work, the Lexicon Server provides a much simpler and elegant solution, allowing you greatly simplify the replacement of the variable using the provided functions.
To perform these translations, we have provided a premade terminology here. Save the file somewhere. Access the( ). Make sure your options (accessed from the login box) are set correctly (ie in most cases like below), and login using your HL7Connect username and password.
First we need to create some terminologies to import our terms into. Clickand fill out the screen similar to that given.
Now, create another terminology with the SYSTEMA and a of urn://www.hl7connect.com/SysCodes. Do not click OK however, as we must modify the SYSTEMA terminology more in order for it to allow our translations. Go to the tab and create a new attribute with the same values as the following window:of
This equivalency will allow us to translate terms between these two terminologies. Accept the changes to go back to thescreen.
Now, select Next. Select , and in the next stage set the mapping of values like so:and choose " ". Browse to the saved file and accept. Select the terminology to import the terminology into and click
Select to match the termsand finish importing the terms.
Import the same file the same way for theterminology, but this time alter the mapping to be like the following table:
We now have a set of terminologies able to be used by the Lex functions. We are now able to start writing our translation script.
rcodein = aEvent.message.hl7.segment("OBR",0).Element("4").AsString; tcodekeyin = Lex.LexGetTermByCode("urn://www.hl7connect.com/SysCodes", rcodein); tcodekeyout = Lex.LexTranslate(tcodekeyin, "urn://www.hl7connect.com/LOINC", 0); tcodeout = Lex.LexGetTermRepresentation(tcodekeyout, "Code"); tdescout = Lex.LexGetTermRepresentation(tcodekeyout, "Defn"); aEvent.message.hl7.segment("OBR",i).element("4.1").AsString = tcodeout; aEvent.message.hl7.segment("OBR",i).element("4.2").AsString = tdescout; aEvent.message.hl7.segment("OBR",i).element("4.3").AsString = "HL7Connect";
The first line takes the fourth element of the first OBR segment, and assigns it (as a string) to rcodein.
Line 2 looks in the terminology urn://www.hl7connect.com/SysCodes for the code rcodein, and assigns the key for the given code in the terminology.
LexTranslate, on the third line, gets the translation for the codekey in the terminology urn://www.hl7connect.com/LOINC. If there is no translation, the default (in this case 0) is returned.
The next two lines simply get String representations of the type. The Code representation, in the example case, would be the numerical code 2947-0, while the Defn would be the more descriptive SODIUM.
The translation is inserted back into the message in the final three lines.