# EnsLib.InteropTools.HL7.DataGate.Functions

class EnsLib.InteropTools.HL7.DataGate.Functions extends EnsLib.InteropTools.HL7.eGate.Functions

Functions for DataGate

## Parameters

parameter MONKCEILING = MonkCeiling;
parameter MONKCHECKDIGIT = MonkRegexMatch;
parameter MONKMAKEVECTOR = MonkMakeVector;
parameter MONKSTANDARDDATE = MonkStandardDate;
parameter MONKTOHL7DATE = MonkToHL7Date;
parameter MONKTOHL7TIME = MonkToHL7Time;
parameter MONKUNIQUEID = MonkUniqueId;

## Methods

classmethod MonkCeiling(pValue)
classmethod MonkCheckDigit(pValue, pPattern) as %String
; ; SYNOPSIS: Computes the Mod10 or Mod11 (et. al.?) with 3 different ; variations (A, B, C), as shown below: ; ; Compute the M10 check digit of 201535768 with all 3 variations: ; ; A 2 0 1 5 3 5 7 6 8 ; * 10 9 8 7 6 5 4 3 2 (multiply by increaing factors starting ; ---------------------------- with 2 for the LOW order digit) ; 20 0 8 35 18 25 28 18 16 (168 sum) (sum the products) ; ; now, 10 - (168 mod 10) = (10 - 8) = 2 check digit ; ; B 2 0 1 5 3 5 7 6 8 ; * 1 2 1 2 1 2 1 2 1 (multiply by alternating 1 and 2 ; --------------------------- starting with the HIGH order digit) ; 2 0 1 10 3 10 7 12 8 (53 sum) ; ; now, 10 - (53 mod 10) = (10 - 3) = 7 check digit ; ; C 2 0 1 5 3 5 7 6 8 ; * 1 2 1 2 1 2 1 2 1 (same as B) ; --------------------------- ; 2 0 1 10 3 10 7 12 8 ; 2 0 1 1 3 1 7 3 8 (26 sum) (further reduce products to single digits ; by adding the digits (note 10 and 12) ; ; now, 10 - (26 mod 10) = (10 - 6) = 4 check digit ; ; ; (Note: For ALL variations, if the result of the modulo is 0, the check ; digit would be 10. This case is normalized to 0.) ; ; The 3 variations yielded 3 different check digits: ; M10A = 2 ; M10B = 7 ; M10C = 4 ; ; M11 check digits are computed similarly, but substitute 11 - (x mod 11) ; in the last step. ; ; Variation C is really a sub-type of B, but for ease of use, I deemed ; it another type. (M10A, M11B1, M10B2 ??!!) ; ; I may add functionality for Mx check digits. I need to research the topic ; to determine if other modulos are used, or are even valid.
classmethod MonkMakeVector(pNum, pFill) as %String
classmethod MonkStandardDate(pDate) as %Boolean
Create a string based on a number of repetitions of a string
classmethod MonkToHL7Date(pValue)
classmethod MonkToHL7Time(pValue)
classmethod MonkUniqueId(pPrecision=2) as %String
Since precision is only available in \$ZTIMESTAMP which is UTC we need to figure out the offset and calculate from there

Feedback