Importing HL7 Messages
Navigation: »No topics above this level«
Importing HL7 Messages
To import HL7 data into your database schemas you create an "Inbound" processor for each schema definition. An Inbound processor will:
1) Poll the HL7 Data Folder for files named *.<Data File Extension>.
2) IF any files ARE detected it will then:
•Take a "snapshot" of the HL7 Data Folder contents at that moment capturing the file names, modified dates and sizes.
•Sort that "snapshot" by the last modified date (primary) in DESCENDING order, and the filename (secondary sort) in ASCENDING.
•Process that sorted "snapshot", opening each HL7 data file, extracting from it every HL7 message and loading those HL7 messages into your UltraPort SQL Schema data tables. **Once every HL7 message in a data file is consumed that file is destroyed, see the Global Settings for file system archive settings.
•(New in V3.2) If configured, it will execute a SQL Stored Procedure (created by you) AFTER it has successfully committed each HL7 message into your data tables. See Inbound Stored Procedures for more information.
•Once the "snapshot" has been completely processed it is destroyed and the processor will IMMEDIATELY return to step 1 and poll the HL7 Data Folder again WITHOUT waiting <Data Folder Polling Interval> seconds.
3) IF NO files are detected the processor will wait <Data Folder Polling Interval> seconds and then return to step 1.
Inbound Processor Window
New in version 5.2.2! You can now double-click on the HL7 Data Folder text box to allow you to type (or paste) a valid folder path.
Next to each field is an immediate help button() click it to receive an immediate summary of what each field is and it's requirements.
Once an inbound processor has imported an HL7 message into the SQL Schema your job is then (typically) to extract the HL7 message data you care about and insert it into YOUR OWN database tables. Clients typically do this in one of three ways.
1.(Recommended Process 1) You create your own external scheduled or timed process which runs side-by-side with the Schema Engine and will periodically Poll the schema's main table (<prefix>_HL7Data) for new HL7 messages and (if detected) "process" those records by extracting the HL7 data from the Schema data tables and importing it into YOUR database tables and then flagging each HL7 message as "Processed". This external process can be created in ANY environment that you like be it a MS Windows service application written in any 4GL language (like MS Visual C#,VB, etc) or as a SQL Server scheduled job, etc etc.
2.(Recommended Process 2) New in version 3.2. If you are a SQL programmer you might want to use a SQL stored procedure to do this job. For this we recommend that you use the integrated features in the Inbound Processor to configure it to execute your SQL Procedure after each message is imported into the Schema Tables. See Inbound Stored Procedures for more information.
3.(Not Recommended) Using MS SQL Database Triggers which you design and add to the UltraPort SQL Schema data table(s). HermeTech highly recommends that you use the newer option 2 instead (see the discussion below).
A Discussion about Database Triggers
Database triggers are a wonderful thing and here at HermeTech we will be the first to admit that many of our reasons for not recommending them are selfish. This is why we don't forbid the use of triggers (we could very easily do that), we just don't recommend that you use them and here are a few of the reasons why:
•The UltraPort SQL Schema Engine's "Inbound" processor is a very well-oiled, thoroughly tested, multi-step process (see Navigating your HL7 Schema). Just determining the which type, where, when and "how-to" for your trigger requires more care and thought than it might appear to on the surface.
•Simple Errors in database triggers are deadly to the UltraPort Schema Inbound processor. If your "Update" trigger fails, our SQL Update fails, which means that our import process for that message fails, which means that, at best the processor will be in an infinite loop trying to import the same message over and over or at worst, orphaned records are created or the entire service stops.
•Our ability to support you is severely limited. We cannot help you debug your triggers, it falls outside of our mandate of free support. If you experience any issues with the UltraPort Schema Engine which would require support one of our first questions will always be "Have you added ANY triggers to our schema tables?". If the answer to that question is "Yes" then we will immediately respond with "Disable ALL triggers and try again" and if that resolves the issue (with the schema engine) then we respond with "Thank you for calling, have a nice day" and we must then consider the support issue resolved.
Inbound Processor Exceptions
When polling the HL7 Data Folder there are some conditions which cause exceptions to the process which you might want to be aware of. They are:
•All files which do not have the <HL7 Data File Extension> are ignored.
•All files which are less than 1 full second old (last modified date/time) are ignored.
•All files less than 50 bytes in size are ignored.
•If a qualifying file CANNOT be opened (IE it is "in use" by some other process) it will STOP the inbound processor and reset it. Meaning that the import process will stop, the processor will wait for <Data Folder Polling Interval> seconds and then try again.
•The inbound processor will process CONTINUOUSLY until there are NO qualifying files detected in the HL7 Data Folder.
See Navigating Your HL7 Schema for more information.