Please enable JavaScript to view this site.

HL7 C# Script Reference

 

 

Download Example Scripts in CheckPoint files (zip file)

 

In this zip file you will find some example CORE HL7 C# Script CheckPoint files. You can import these CheckPoints into your CORE HL7 Script Library in either the CORE HL7 Viewer OR a CORE HL7 Script Engine to play with. There is a YouTube video which explains how to import and export CheckPoints here: https://youtu.be/QePXF3Wi46g. If a CheckPoint requires HL7 messages to run there will be an example HL7 message file to play with as well.

Example 1: Continuous Processing Example.cshl7. This script actually does nothing except run in a continuous loop while tracing and logging an entry every 10 seconds. What it does demonstrate is how to create a stand-alone Type 2 script which does NOT use a HL7 message feed and how one may create an infinite loop, while querying the globals.StopAllProcessing value to determine when to exit, as well as how to implementing the globals.Sleep() method to block the script thread and yield CPU back to the OS so that your infinite loop doesn't just "spin" constantly. This script also shows how to implement the globals.OpenHours value (which can only be set in a CORE Script Engine) to restrict scripts from running during certain hours of the day.

Example 2: ORU Message Splitter Example.cshl7. This script takes a HL7 message of type ORU as an input message. It will then examine that HL7 message and potentially create 2 different output messages. It will examine the input message and remove ANY OBX segments which contain an embedded binary document (IE has the value ED in OBX2.1) and IF any OBX segments remain it will commit that message. It will then reexamine the input message and remove ANY OBX segments which DO NOT contain an embedded binary document and IF any OBX segments remain it will commit that message as well.

Example 3: ADT Built-In Delay Example.cshl7. This is a complex script. It does NOT use a HL7 message feed and runs in it's own continuous loop, even though you DO have to provide HL7 messages via another path (in the CORE HL7 Viewer you can use the example ADT messages from the Tools menu to test). Read the script description carefully on this one for instructions. It was created to cure the following scenario (outlandish but it's real). Your client sends you ADT HL7 messages over TCP/IP, but frequently they will send several identical ADT messages for the same patient multiple times over the course of just a few seconds or minutes (why doesn't matter). Since the client sends messages for up to 50,000 different patients per day this means that they may actually deliver you up to 400,000 messages per day of which most are duplicates. To cure the problem this script will poll the Inbound folder (see the script description), and move messages to the Queue folder named using the Patient ID (from PID 3.1) and message type/event as the file name (Example: 54312.ADT.A08.hl7). Messsage files will remain in this folder until they are 2 minutes (120 seconds) old and only then will they be transferred to the Outbound folder with a unique file name. Since the Queue folder file names are NOT unique, as duplicate messages are received they are OVERWRITTEN in the Queue folder and thus their 2 minute "clock" starts over.

Example 4: PDF Extractor.cshl7. This Type 1 script will read ORU hl7 messages, detect whether there are any embedded binary documents (PDF, JPG etc), decode them and write them to the Output Folder. Use the file PDF Extractor Examples.hl7 in the zip file to test using your CORE HL7 Viewer or CORE Script Engine. Make sure that you read notes in the Script Description.

Example 5: Simple XML Script.cshl7. This Type 1 script takes a HL7 message input, extracts some simple data from the message and creates an XML document with the COREScriptXML object. It then writes the message to the Output Folder and also writes the XML document as well using the same file name plus a .xml file extension.

Example 6: CharacterScrubber.cshl7. This Type 1 script is very simple, but solved a very big problem for our customer. They receive HL7 messages over a TCP/IP Listener which are placed into a folder and then picked up and CONSUMED by their downstream HL7 interfaces. The problem occurred when they started receiving HL7 messages with non-printable characters embedded in the message data which caused errors in their downstream systems. This simple script examines HL7 messages and removes the offending characters replacing them with a period. Use the example file CharacterScrubber.hl7 to see it in action.

 

 

 

 

 

 

  

Keyboard Navigation

F7 for caret browsing
Hold ALT and press letter

This Info: ALT+q
Nav Header: ALT+n
Page Header: ALT+h
Topic Header: ALT+t
Topic Body: ALT+b
Exit Menu/Up: ESC