Navigating the Schema |
Top Previous Next |
This section assumes that you have a working knowledge of SQL. Navigate the Schema using a SQL Query engine such as MySQL Query Browser or your own custom code. To get a quick start on browsing the schema tables try using the Schema Browser. It allows you to generate queries and view the resulting SQL statements.
The most common navigation need is to retrieve HL7 message data that has been imported into the system. To do this there are 2 tables which will be of extreme importance to you.
Another important thing you'll need to know before you start retrieving HL7 data elements is how to determine the table and field names which contain the data you're looking for. All of the segment data tables will be dynamically named based on three things, the Schema Prefix, the HL7 Segment Name and the number of HL7 data fields that segment contains. If the HL7 segment contains 40 or more HL7 data fields (like the GT1 [Guarantor Data] or IN1 [Insurance Information] segments), the segment will be represented by two tables.
Example: If the Schema Prefix is V23 the table for the PID (Patient Information) will be named V23_Segment_PID_A. The IN1 (Insurance Information) segment tables would be named V23_Segment_IN1_A which would hold data for fields 1-39 and V23_Segment_IN1_B which would hold data for fields 40-nnn.
The SQL Statement:
Select * from v23_Segment_PID_A Where MessageID = '9A3FF083DE1F384584553969F1745497' Order By IDX
Would return 1 row for each PID segment contained in the message.
Of equal importance is how to identify which data fields you care about within each table. Here is where some knowledge of HL7 structure is required. As an example we'll use a common field that everyone can relate to: The patient's last name. Assuming a Schema Prefix of v23, to access the patient's last name first you need to know which segment in the message contains it (the PID segment). This gives you the table name v23_Segment_PID_A. To know which field contains the patient's last name you have know which HL7 data field contains the patient name and which specific COMPONENT within that field contains the last name (Field 5 Component 1). Field names within the tables will be derived as <segment>_F<fieldnumber>_C<componentnumber> so the field name for the patient last name is: PID_F5_C1
The SQL Statetment:
SELECT IDX, PID_F5_C1 As LastName, PID_F5_C2 As FirstName FROM v23_segment_pid_a v WHERE MessageID = '053B06284340B64C8EF6D79BD2AB3817' Order By IDX
Would return 1 row containing the patient's last name for each PID segment contained in the message.
.
|