1st Appearance: Version 1.0.6
Class Name: SQLAPIGlobals
Scope: Public - Unrestricted - Static class no object creation needed.
'We will change the Message Control ID using the SQLAPIGlobals static class 'We'll also set the MessageDate to Now. Dim i As Integer For i = 1 To MyStringAnalyzer.Count 'We'll do this the most verbose way for effect Dim sNewID As String = SQLAPIGlobals.MessageControlID() TraceIn("Setting Control ID of Message #" & i.ToString() & " to " & sNewID) 'Get the message object out of the string analyzer Dim o As HTSQLHL7Message = MyStringAnalyzer.GetMessageObject(i) 'set the values o.MessageControlID = sNewID o.SetMessageDate(System.DateTime.Now, HL7DateTimePrecision.enSeconds) 'Do some conditional querying just to show that these are 'both read and write properties. If o.AcceptAcknowledgmentType.Length = 0 Then o.AcceptAcknowledgmentType = "AA" End If If o.ApplicationAcknowledgmentType.Length = 0 Then o.ApplicationAcknowledgmentType = "AE" End If 'That's it, we're done. Next
|
String Alphabet - The english alphabet (a-z) in lower case.
String Numerals - 0-9 in 1 string "0123456789" String UndefinedDateString - A DateTime.ToString() format string used to create UndefinedDateValue. DateTime UndefinedDateValue - Across the spectrum of classes in the SQL Schema API there are numerous DateTime properties. Quick examples might be the metrics properties OperationStarted and OperationEnded used by many classes. This UndefinedDateValue Global property is used by all class objects to initialize or reset their DateTime properties or as the "Exception Occurred" return value of DateTime Methods. String UniversalDateFormat - A DateTime.ToString() format string which when used will create a String value which can be converted back into a DateTime across any Windows platform or region. It can also be used in SQL Server or MySQL Insert or Update statements for SQL date fields just by enclosing in single quotes.
Example C#:
String MyString = System.DateTime.Now.ToString(SQLAPIGlobals.UniversalDateFormat); //Now I can email MyString to my coding friend in Taiwan or Moscow //And they can use their visual studio to bring it back into a date DateTime myDate = DateTime.Parse(MyString);
|
String MessageControlID()
Returns: A fully HL7 compliant, unique Message Control ID fit for putting in MSH 10.1. This method is synclocked and multi-thread safe. There's nothing complex or secret here, it is just a date-time stamp down to the millisecond followed by a rolling 4 digit number between 1 and 9999 which rolls back to 1 after 9999. What makes this method useful is that:
1.It's here in the SQLAPIGlobals class and it's easy to use so that IF you need to generate Message Control IDs you don't have to hash out how you'll do it. 2.It satisfies HL7 rules into infinity with very remote chances of duplication. The most "dangerous" period for running into potential duplication issues is the ONE hour every year where the clock moves backward for daylight savings time. Thus repeating an hour for the timestamp portion of the MessageControlID() value. That's where the rolling 4 digit number comes into play. You would have to generate an HL7 message control ID at the EXACT millisecond you did in the previous hour AND you would then have only a 1 in 9999 chance of that control ID being replicated. 3.It's multi-thread safe, so you can have multiple threads going which can generate Message Control IDs and they will never get the same ones.
HL7 Rules for Message Control IDs (MSH 10.1): According to HL7 standards the Message Control ID should be a maximum of 20 characters in length and should be an absolutely UNIQUE identifier of that particular message between the sender of the message and the receiver. You can reuse Message Control IDs, but HL7 is kind of vague about when that's ok to do. There is some reference to the Federal/State/Local rules/laws governing BOTH parties regarding the retention of Medical Records. So it's best to just not do it.
Boolean IsFatalException(Integer) Parameter 1: Integer - exNumber The ExceptionNumber property of a HTException object.
Returns: True/False. If the exNumber is one of the "Treat as Fatal" exception numbers outlined in Properties above.
Boolean HasFatalException(HTException) Parameter 1: HTException - oException - Exception object created by an Import Operation.
Returns: True/False. If ExceptionNumber property of oException is one of the "Treat as Fatal" exception numbers outlined in Properties above.
|