iNTERFACEWARE Products Manual > Learning Center > Tutorials and Sample Scenarios > Working With a Database > Database to HL7 > Step 5 - Table Groups and Repetition > Populating the Database Tables |
|
Looking for Iguana v.5 or v.6? Learn More or see the Help Center.
Now that you know what database tables have been defined for your channel, the next step is to see how these tables interact with one another. As an example, suppose that you have a patient named John Ferguson and you want to generate a Lab Result message containing lab order and lab result information for this patient. To do this, you must:
This example will assume that the message contains two groups consisting of a lab order and its associated lab results. This means that the generated Lab Result message will consist of an MSH segment, an PID segment, and two groups consisting of an OBR segment and one or more OBX segments. The rest of this section will walk you through these steps. To start, add John's patient demographics to the PatientRegistration table:
Notice that this patient demographic record has a MESSAGE_ID of ResultMsg001. Other tables will use this message ID to link lab order and lab result information to this record. In this record, the PARENT_ID is the same as the MESSAGE_ID, as the PatientRegistration table is not part of a table group. Because you have two groups of lab orders/results, you need to create two entries in the ResultGroup group table:
Here, the two groups are named ResultGroup1 and ResultGroup2. The MESSAGE_ID is set to ResultMsg001, since these groups are associated with John Ferguson's patient record. The next step is to create one row in the LabOrder table for each result group, since each row of the LabOrder table corresponds to the OBR segment that will be created for its group:
Here, MESSAGE_ID is set to ResultMsg001, which is the identifier for the message that will be generated from John Ferguson's patient information, and is the identifier that specifies John Ferguson's record in the PatientRegistration table. Because this table is part of a table group, PARENT_ID is set to match the group ID of its result group; this group ID was defined in the GROUP_ID of the ResultGroup table. From this, you can see that the first row of the table belongs to the first result group, and the second row belongs to the second result group. The next step is to create one row in the LabResult table for each lab result. Each row corresponds to one OBX segment in the final message:
In this table, MESSAGE_ID and PARENT_ID are set in the same way as in the LabOrder table: MESSAGE_ID refers to the ID of the message that will be generated from John Ferguson's patient information, and PARENT_ID matches the group ID of the result group. From the values of PARENT_ID, you can see that the first two results belong to the first result group and the last two results belong to the second result group. The SetID field was specified as the key for this table when you added it to the VMD file; for this reason, it specifies the order in which the lab results are to appear. In each group, the result with a SetID value of 1 will appear in the Lab Result message before the result with a SetID value of 2. Now that you have created these data and group tables, and established the relationships between them, the final step is to create a row in the LabResults status table. This tells Iguana that you are ready to generate a Lab Result message from the data contained in your tables:
When Iguana sees the W (for "waiting") status, it attempts to generate a LabResult message. Because all of the tables that contain John Ferguson's information have a MESSAGE_ID of ResultMsg001, Iguana is able to retrieve all of the necessary patient data. If the message is generated successfully, the W in the STATUS field is changed to Success. If an error occurs, the error message is written into the STATUS field.
|