HI Bukhtiar,

Iris has built in validation against a schema see: HL7 Schemas and Available Tools

But, is simple to iterate over all segments of a HL7 message  or any Virtual Document like this example:

#Dim hl7Msg   As EnsLib.HL7.Message = ##Class(EnsLib.HL7.Message).%OpenId(<changByAId>)
#Dim segIndex As %Integer           = 0
For segIndex = 1 : 1 : hl7Msg.SegCount
{
    #Dim segment As EnsLib.HL7.Segment = hl7Msg.getSegmentByIndex(segIndex)
    //
    Write segment.Name, !
}

For more details se then documentation:

EnsLib.HL7.Message

EnsLib.HL7.Segment

Yes.

 /// <p>
/// <b>2020-04-23 - Cristiano José da Silva</b><br/>
/// Conjunto de fuincões a serem utilizadas pelas regras , tranformações e process
/// <p>
Class HC.distribuicao.utils.FunctionSet Extends Ens.Rule.FunctionSet
{ 

ClassMethod HL7AtribuirValor(valor As %String, caminhoPropriedade As %String, mensagem As EnsLib.HL7.Message) As %Boolean [ Final ]
{
    If ('mensagem.IsMutable)
    {
        Throw ##Class(%Exception.General).%New("ObjetoImutavel", 5001, $$$CurrentClass _ "." _ $$$CurrentMethod, "Impossível atribuir valor a mensagem imutável.")
    }
    Do mensagem.SetValueAt(valor, caminhoPropriedade, "set", "")
    //
    Return 1
}
 
}

Hi John,

If I understood, you want to pass the code to a method and return the description.

All descriptions of HL7 code tables are stored in the global ^EnsHL7.Description.

The structure of global is ^EnsHL7.Description(<category>,"CT",<codeTableCode,valurKey>)=<descritpion>.

For HL7 Schema Category 2.3.1 the global have the content:

^EnsHL7.Description("2.3.1","CT",270)="Document type"
^EnsHL7.Description("2.3.1","CT",270,"AR")="Autopsy report"
                                     "CD")="Cardiodiagnostics"
                                     "CN")="Consultation"
                                     "DI")="Diagnostic imaging"
                                     "DS")="Discharge summary"
                                     "ED")="Emergency department report"
                                     "HP")="History and physical examination"
                                     "OP")="Operative report"
                                     "PC")="Psychiatric consultation"
                                     "PH")="Psychiatric history and physical examination"
                                     "PN")="Procedure note"
                                     "PR")="Progress note"
                                     "SP")="Surgical pathology"
                                     "TS")="Transfer summary"

A generic method would be like:

Hi Igor,

This occur because some Business Host still processing a message or waiting for a response.

You can override the method StopProduction to force the production to stop.

Class br.cjs.test.TestProduction Extends %UnitTest.TestProduction
{ 

/// Class name of the production. It must contain the production class name.
Parameter PRODUCTION As %String = "HC.Production"; 

/// Paratmerter used to force stop production by Ens.Director
Parameter FORCESTOPPRODUCTION As %Boolean = 1;

/// Code to run right after the production is started. Used, for example, to call a method that initiates the test.
/// If an error status is returned, the test will be aborted and failed and the production will be stopped.
/// So if a non fatal error occurs, you may invoke ..LogErrors(status,"OnAfterProductionStart()") and return $$$OK.
Method OnAfterProductionStart() As %Status
{
    #Dim exception As %Exception.General = ""
    #Dim statusCode As %Status = $System.Status.OK()
    Try
    {
        // Do Yor Tests
    }
    Catch (exception)
    {
        Set statusCode = exception.AsStatus()
    }
    Return statusCode
} 

Method StopProduction() As %Boolean [ Internal, Private ]
{
    Do ..GetMacros(.Macro)
    Do $$$LogMessage("Stopping production '"_..#PRODUCTION_"'")
    Set r = $$$AssertStatusOK(##class(Ens.Director).StopProduction(..#MAXWAIT, ..#FORCESTOPPRODUCTION), "Invoking Ens.Director::StopProduction")
    If 'r Quit 0
    Set r = $$$AssertStatusOK(..WaitForState(Macro("eProductionStateStopped")), "Verifying Ensemble state is 'Stopped'")
    If 'r Quit 0
    Quit 1
} 

}

Hi Jeff,

You need to traverse the array using the foreach action. The key of you array wil be the key of the OBXgrp. for the others group I'll assume that are fix with the key "1". Bellow a simple example. 

 <transform sourceClass='br.cjs.test.ArrayMessage' targetClass='EnsLib.HL7.Message' targetDocType='2.3.1:ORU_R01' create='new' language='objectscript' >
<foreach property='source.ArrayData()' key='k1' >
<assign value='source.ArrayData.(k1)' property='target.{PIDgrpgrp(1).ORCgrp(1).OBXgrp(k1).OBX:SetIDOBX}' action='set' />
</foreach>
</transform>
}

Hi Robert,

Have you tired to export in UDL format (the UDL format is the document that we edit in Studio, VSCode, or in Atelier) via classmethod ExportUDL from the class %SYSTEM.OBJ

https://docs.intersystems.com/irisforhealth20201/csp/documatic/%25CSP.Documatic.cls?PAGE=CLASS&LIBRARY=%25SYS&CLASSNAME=%25SYSTEM.OBJ#METHOD_ExportUDL

To import you can use the classmethods Load, LoadDir  or any other method that load code from disk,. Or you can import from Studio to.

https://docs.intersystems.com/irisforhealth20201/csp/documatic/%25CSP.Documatic.cls?PAGE=CLASS&LIBRARY=%25SYS&CLASSNAME=%25SYSTEM.OBJ#METHOD_Load

For me worked export from:

IRIS for Windows (x86-64) 2020.1 (Build 215U) Mon Mar 30 2020 20:14:44 EDT

And import in:

Cache for UNIX (Red Hat Enterprise Linux for x86-64) 2017.2.2 (Build 865U) Mon Jun 25 2018 10:50:02 EDT