EnsLib.InteropTools.HL7.ProductionGenerator

class EnsLib.InteropTools.HL7.ProductionGenerator extends %Library.RegisteredObject

A class designed to load production data from a CSV file
Example: Set tSC = ##class(EnsLib.InteropTools.HL7.ProductionGenerator).Load("/wtemp/configuration.csv","/wtemp/items.csv",.tInformation)

Property Inventory

Method Inventory

Parameters

parameter DEFAULTPOOLSIZE = 0;
parameter HOSTADAPTERDELIMITER = :;
parameter RULEDISABLED = 0;
Rules should be disabled and only enabled after review

Properties

property BaseValues [ MultiDimensional ];
Property methods: BaseValuesDisplayToLogical(), BaseValuesGet(), BaseValuesIsValid(), BaseValuesLogicalToDisplay(), BaseValuesLogicalToOdbc(), BaseValuesNormalize(), BaseValuesSet()
property ConfigJSON as %DynamicAbstractObject;
Property methods: ConfigJSONGet(), ConfigJSONGetObject(), ConfigJSONGetObjectId(), ConfigJSONGetSwizzled(), ConfigJSONIsValid(), ConfigJSONNewObject(), ConfigJSONSet(), ConfigJSONSetObject(), ConfigJSONSetObjectId(), ConfigJSONUnSwizzle()
property Errors [ MultiDimensional ];
Property methods: ErrorsDisplayToLogical(), ErrorsGet(), ErrorsIsValid(), ErrorsLogicalToDisplay(), ErrorsLogicalToOdbc(), ErrorsNormalize(), ErrorsSet()
property ItemsJSON as %DynamicAbstractObject;
Property methods: ItemsJSONGet(), ItemsJSONGetObject(), ItemsJSONGetObjectId(), ItemsJSONGetSwizzled(), ItemsJSONIsValid(), ItemsJSONNewObject(), ItemsJSONSet(), ItemsJSONSetObject(), ItemsJSONSetObjectId(), ItemsJSONUnSwizzle()
property RowCount [ InitialExpression = 0 ];
Property methods: RowCountDisplayToLogical(), RowCountGet(), RowCountIsValid(), RowCountLogicalToDisplay(), RowCountLogicalToOdbc(), RowCountNormalize(), RowCountSet()
property Structure [ MultiDimensional ];
Property methods: StructureDisplayToLogical(), StructureGet(), StructureIsValid(), StructureLogicalToDisplay(), StructureLogicalToOdbc(), StructureNormalize(), StructureSet()
property TypeMap [ MultiDimensional ];
a map of {service/operation},{type - file tcp} to class
Property methods: TypeMapDisplayToLogical(), TypeMapGet(), TypeMapIsValid(), TypeMapLogicalToDisplay(), TypeMapLogicalToOdbc(), TypeMapNormalize(), TypeMapSet()

Methods

method AddActivityOperation(ByRef pProduction) as %Status
Add the Ens.Activity.Operation.Local operation unless configuration item AddActivityOperation specifically set to 0
method AddOperation(pValues, pRecordSet As %SQL.CSVResultSet, ByRef pProduction) as %Status
create Operation based on settings provided with a host name of {OperationName}
method BuildMap()
Map of Service / Operation type text to class ie file -> EnsLib.HL7.Service.FileService
classmethod ConvertCSVFileToJSONStream(pFilename As %String = "", ByRef pJSONStream, pGroupName="Items") as %Status
Convert CSV file into JSON Stream
pFilename name of csv file
pGroupName is the root node
classmethod ConvertCSVStreamToJSON(pStream As %Stream.FileCharacter = "", ByRef pJSONStream, pGroupName="Items", ByRef pGroup, pDelimiter=",") as %Status
pStream - a file character stream of the CSV file
pJSONStream - The newly created JSON file character stream
pGroupName - the root node of the JSON stream (Items for production items and keys for configuration)
pGroup - a by ref variable containing the JSON object (to avoid having to re-parse the json)
classmethod CreateClassParameter(pName, pDefault) as %Dictionary.ParameterDefinition
Create %Dictionary.ParameterDefinition object for name and default
method CreateRouterProcess(pValues, pRecordSet As %SQL.CSVResultSet, ByRef pProduction) as %Status
Create business process {package}.{ServiceName}
method CreateTransformation(ByRef pValues, pRecordSet As %SQL.CSVResultSet, Output pTransformationName) as %Status
Create Transformation Class which extends Ens.DataTransformDTL, this code is only called if SourceDocType and TargetDocType are set
method CreateUpdateBusinessRule(ByRef pValues, pRecordSet As %SQL.CSVResultSet, pRuleName, pTransformationName As %String) as %Status
Create/Update a RouterRule based on service / operation names
classmethod GetConfigurationCSVStreamFromJSON(pJSONStream, Output pCSVStream As %Stream.FileCharacter = "", pGroup) as %Status
Convert Configuration JSON stream to csv stream
classmethod GetItemsCSVStreamFromJSON(pJSONStream, Output pCSVStream As %Stream.FileCharacter = "", pGroup, pIncludesHeader=1) as %Status
Convert Items JSON stream to csv stream
Although streams are used to make it easier to pass from a file or other mechanism, the maximum length of the document is that of a long string
method GetProduction(Output pProdRef As Ens.Production) as %Status
Locate / Generate production specified by Configuration key ProductionClassName
method GetRecordSetProperty(pRecordSet, pField="", pDefault="") as %String
Retrieve pField from pRecordSet (if defined), otherwise return default
classmethod GetStream(pPathAndFile As %String, pStream As %Stream.FileCharacter) as %Status
Given a fully qualified filename return a FileCharacter stream
method GetStructureFromItems()
Build Structure array from all JSON items
classmethod Load(pConfigurationPathAndFile As %String = "", pItemsPathAndFile As %String = "", ByRef pInformation) as %Status
Method to load csv configuration file and items file
pConfigurationPathAndFile - fully qualified file name for configuration CSV file
pItemsPathAndFile - fully qualified file name for configuration items CSV file
byRef pInformation - returned array of issues from loading file
Returns Status
method LogError(pString)
classmethod ParseCSV(pStream As %Stream.FileCharacter, Output pStructure As %String = "", Output pRecordSet As %SQL.CSVResultSet, pDelimiter=",") as %Status
Given a fully qualified filename and an expected structure return a pRecordSet from a CSV file pStructure is the expected header (ServiceName [VARCHAR 200], OperationsName, PortIn) structure but the code will adapt to a different order pRecordSet is the returned resultset
method ReturnErrors() as %ListOfDataTypes
Return errors as an object
classmethod StringAsClassName(pString) as %String
User could have provided a service name with _, remove those (and other invalid characters) from the classname
classmethod UpdateDTL(pTransform As Ens.DTL.Transform) as %Status
User Override: Using the given transform it's possible to customize the generated transform
Example (change code mode):
try {
Set tSC = $$$OK Set tGroup = ##class(Ens.DTL.Group).%New()
Set tAction = ##class(Ens.DTL.Code).%New()
Do tAction.Code.Write(" /*"_$c(13,10)_"DATE: YYYY-MM-DD"_$C(13,10)_"TASK: TASK000000"_$c(13,10)_"NAME: DeveloperName"_$C(13,10)_"NOTE: Initial Development"_$c(13,10)_" */")
Do tGroup.Actions.Insert(tAction)
Do pTransform.Actions.InsertAt(tGroup,1)
} catch ex {
Set tSC = ex.AsStatus()
}
method UpdateSettings(pHostType, pItem, pRecordSet, ByRef pValues) as %Status
pHostType - Service / Router / Operation
pItem - host item created
pRecordSet - CSV recordSet
pValues - values collected from configuration load
method ValidateConfiguration()
method ValidateItemStructure()
method evaluateExpression(pNode, pRecordSet As %SQL.CSVResultSet, Output pSC) as %String
update string replacing curly brace values with actual values strip repeating and trailing underscore characters
method getValues(pRecordSet, Output pValues) as %Status
for a given (pRecordSet) row define pValues(nodes)
method imLoad(pConfigurationPathAndFile As %String = "", pItemsPathAndFile As %String = "", ByRef pInformation, pDelimiter) as %Status
instance method processing Load pConfigurationPathAndFile - fully qualified file name for configuration CSV file
pItemsPathAndFile - fully qualified file name for configuration items CSV file
byRef pInformation - returned array of issues from loading file
Returns Status
method imLoadConfigurationFromJSONStream(pStream As %Stream.FileCharacter = "", pGroup As %DynamicAbstractObject = "") as %Status
pStream - File character stream json
Load Production Name, code package names for Transform, Rules, Custom functions
Non fatal issues are logged in ..Errors
method imLoadConfigurationFromStream(pStream As %Stream.FileCharacter = "", pDelimiter=",") as %Status
pStream - File character stream of csv file
Load Production Name, code package names for Transform, Rules, Custom functions
Non fatal issues are logged in ..Errors
method imLoadItemsFromJSONStream(pStream As %Stream.FileCharacter = "", pGroup As %DynamicAbstractObject = "") as %Status
pStream - a file character stream containing the JSON definition
pGroup - the already parsed JSON object if known
method imLoadItemsFromStream(pStream As %Stream.FileCharacter = "", pDelimiter=",") as %Status
pStream - File character stream of csv file
Convert csv files to JSON stream and Load production items using imLoadItemsfromJSONStream(tStream)

Inherited Members

Inherited Methods

Feedback