Online Help - Region 1: [CORE HL7 API Basic] |
Object: HL7StringAnalyzer
NOTE: No public entry point. Created only through a Controller object.
Description: Use the HL7StringAnalyzer to examine a blob of string data and parse out the HL7 messages contained therein.

HL7StringAnalyzer Object
The HL7StringAnalyzer allows you to parse a string containing 1 or more HL7 messages and deliver the results to you similar to the HL7FileAnalyzer object but without the file handling overhead. Ideal for use when having a file on the file system is inconvenient or not an option like capturing data from the Windows clipboard, or a data stream from a database, web service, SOAP or REST API, etc.
You can also interchangeably use the HL7DataAnalyzer object as it maintains an internal HL7StringAnalyzer object as well as an internal HL7FileAnalyzer object to analyze HL7 data by dynamically deciding which analyzer will provide the best performance for an analysis operation.
Programming Note: HL7FileAnalyzer vs HL7StringAnalyzer
Property Name |
Data Type |
ExceptionHandling |
Uses the Standard Exceptions Interface |
MaximumCapacity |
int (Default = 30 megabyts (30000 * 1024)) - The Hl7StringAnalyzer will NOT analyze a string larger than MaximumCapacity. Although read only it CAN be changed (see ResetMaximumCapacity() below) |
MessageCount |
int (read only) - Will be the number of HL7 Messages detected during the last analysis operation. |
ParentController |
Controller Object (read only) - Will be the parent controller object that created the analyzer. |
Tag |
CORETag object - General purpose Tag object for custom programming code |
Method |
Return Value |
ExceptionHandling |
Uses the Standard Exceptions Interface |
AllMessagesEX() |
COREExceptionEX[] - Returns a single dimension array of COREExceptionEX objects (See GetMessageEX()) Will be an empty array if MessageCount == 0. |
AllRawMessages() |
string[] - Returns a single dimension array of raw HL7 message strings loaded. Will be an empty array if MessageCount == 0. |
Clear() |
void - Clears the object. NOTE: Clear() is always called internally at the start of any analysis operation. |
GetMessage(int index) |
HL7Message object - Returns the HL7Message object loaded at #index in the file #index between 1 and MessageCount |
GeMessageEX(int index) |
COREExceptionEX object - See GetMessageEX() a Better Iterator. |
GetRawHL7(int index) |
string - Returns the raw HL7 string value loaded at #index in the file #index between 1 and MessageCount |
LoadFromFile(string fileName) |
bool - Returns true if fileName was successfully opened and examined and HL7 messages were discovered. NOTE: fileName file size MUST be less than or equal to MaximumCapacity. |
Refresh(string hl7String) |
bool - Returns true if hl7String was successfully examined and HL7 messages were discovered. |
ResetMaximumCapacity(int valueMB) |
void - Allows you to change the MaximumCapacity, valueMB is the size in megabytes and MUST be between 1 and 150. |
Analyzing a HL7 Data String |
|
Here's a quick C# code snippet for a Windows Forms project that displays creating and using a HL7StringAnalyzer object.
private COREUtilities MyUtilities = new COREUtilities(); private HL7Controller oController = new HL7Controller(LPInternals.ACTIVATIONHANDLE); private HL7Message oMessage = null;
private void DemoStringAnalyzer1() { //msgs10 is loaded from the program resources where I have stored a default //HL7 data file with 10 HL7 Messages string msgs10 = COREAPIExample3.Properties.Resources.AdHocDemoMessages10;
//I can create the object and pass a string right into the constructor HL7StringAnalyzer a1 = oController.NewStringAnalyzer(msgs10); if (a1.HasException) { //something went wrong FormResults.ErrorMsgBox(a1.LastException.ExtendedErrorMessage); return;
} int msgCount = a1.MessageCount; //a1 == 10
a1.Clear(); //I can create the object without an initializing blob //of HL7 data a1 = oController.NewStringAnalyzer(); msgCount = a1.MessageCount; //a1 == 0 //And then I can load the object by passing in a blob of data a1.Refresh(msgs10); msgCount = a1.MessageCount; //a1 == 10 //and iterate through the messages for (int i = 1; i <= a1.MessageCount; i++) { HL7Message oMsg = a1.GetMessage(i); /* * ...code * ...code * ...code */ } //Now I'm done so clear the object a1.Clear(); return; }
|