{*****************************************************************************}
{ }
{ llHL7Script.pas - THL7Script and related types & constants }
{ }
{ (c)2013-2022 Illuminated Logic, LLC / Ray Marron (see license.txt) }
{ }
{*****************************************************************************}
unit llHL7Script;
{
Typical usage of THL7Script:
Instantiate a THL7Script object.
Assign the OnLogEntry [and OnOutput] event properties.
Assign the DBConnection and/or NamedFieldsFile properties if desired.
Open the input file or query and set the InputFilename/PK property. [*]
Call LoadFromFile or manually load the script and set the Script and
ScriptFilename properties. [**]
try
For each input message:
- Load it into a THL7Message and assign that to the InputHL7 property.
OR
- Assign InputHL7 once and then LoadFromFile or set MessageStr for each.
Call ProcessScript. It returns False when Aborted.
Close the input file/query. Free InputHL7 if created per-message.
Upon the end of input/interval, If HasPostProcessing is True (and not
aborted), call DoPostProcessing.
except
Call DoErrorProcessing with the captured exception and end the current
input/interval.
end
To run again, repeat from step [*]. If using the same script, the [**] step
should be replaced by a call to the ResetScript method.
Call DoFinal (Trap errors, call DoErrorProcessing if needed).
Free the InputHL7 message if created only once.
Free the script object.
The EvalBoolExpression, ValidateBoolExpression, and EvalDataExpression
functions can be used without loading a script. Just create the object, assign
any required properties (HL7Input, etc.), use the desired functions, and Free.
}
interface
uses
SysUtils, Classes, Contnrs, Variants, Xml.xmldom, Xml.XMLIntf, Xml.XMLDoc,
Data.Db, FireDAC.Comp.Client, FireDAC.Phys.Intf,
FireDAC.Stan.Option, FireDAC.Stan.Param,
llLike, llSharedVars, llHL7Msg, llHL7Anonymizer;
const
HL7ScriptVersion = '10.425';
ScriptHelpURL = 'https://www.raymarron.com/hl7/hl7scriptreference.html';
AnyKeyWild = '*';
ConcatChar = '+';
FuncOpen = '[';
FuncClose = ']';
ModChar = '@';
QuoteChar = '"';
DefaultMaxLoops = 1000;
DefaultCSVNewLine = '\.br\';
DefaultFileEOL = #13#10;
InitStart = '
'; PreProcEnd = ''; PostProcStart = '