Question Smythe Smythee · Jun 13, 2023

CDA to CDA transformation

Hi Community,

 

I am new to CDA to CDA transformation in ensemble, Can anyone explain how  Match,Select,Varibel,Attribute,Copy,Method Will work in CDA transformation using xslt stylesheets

 

Smythee

Product version: Ensemble 2018.1
$ZV: Cache for Windows (x86-64) 2018.1.1 (Build 312_1_18937U) Fri Apr 26 2019 17:58:36 EDT

Comments

DC AI Bot · May 25 Bot

In InterSystems CDA XSLT work, the documents returned here explain these items mainly through examples of custom and preprocessing transforms.

  • match is used on xsl:template to define which node a template applies to. Examples shown include matching the root CDA document, any node, text nodes, or a very specific effectiveTime path, such as:

    • match="/hl7:ClinicalDocument"
    • match="node()"
    • match="text()"
    • match="*" in custom extension templates. [1][2][3]
  • select is used to choose nodes or values for processing. The examples show it being used with:

    • xsl:apply-templates select="@*" to process attributes
    • xsl:apply-templates select="node()" to process child nodes
    • xsl:copy-of select="@*" to copy attributes
    • xsl:value-of select="hl7:low/@value" to extract an attribute value
    • xsl:variable name="input" select="/hl7:ClinicalDocument" or select="exsl:node-set($inputRTF)/hl7:ClinicalDocument" to define variables from node selections. [1][4][2]
  • variable is used to store intermediate results. The preprocessing example shows replacing a direct input variable with:

    • xsl:variable name="inputRTF" to hold the result of applying templates in a custom mode
    • xsl:variable name="input" to convert that result into a node set using exsl:node-set(...).

      The debugging section also shows capturing the value of a variable with <xsl:value-of select="$variable"/>. [1][4][2]
  • attribute is used to work with XML attributes. The examples show:

    • selecting attributes with @*
    • copying attributes with xsl:copy-of select="@*"
    • reading an attribute such as hl7:low/@value
    • creating an attribute using:
      <xsl:attribute name="value">
        <xsl:value-of select="hl7:low/@value"/>
      </xsl:attribute>
      
    • debugging a CDA attribute value with select="/hl7:ClinicalDocument/hl7:id/@root". [1][2]
  • copy is used to reproduce nodes. The preprocessing template shows:

    • xsl:copy to copy the current node
    • xsl:copy-of select="@*" to copy all attributes
    • then xsl:apply-templates select="node()" to continue recursively through children.

      The debugging section also states that calling the copy template with mode="copy" returns the current XPath tree. [1][2]
  • mode is important in InterSystems CDA customization. The preprocessing examples use a custom mode such as mo:MyMODEname so that special preprocessing templates are called separately from the main transform. The top-level transform is then modified to call:

    <xsl:apply-templates select="/hl7:ClinicalDocument" mode="mo:MyMODEname"/>
    

    This lets you run a preprocessing pass before the standard transform uses the resulting document. The customization guide also shows other modes such as ImportCustom-Container, ImportCustom-Procedure, currentXPathWithPos, currentXPath, and copy. [1][4][2]

  • For custom CDA transformations in general, the documented pattern is:

    1. create a Custom subdirectory,
    2. create a custom XSL with the same name,
    3. import the original XSL with <xsl:import href="../<filename>"/>,
    4. copy the template you want to override,
    5. change its logic,
    6. restart productions to activate it. [2]
  • For CDA structure, the returned material also notes that the root node is <ClinicalDocument>, with header, sections, and entries beneath it, and transformations for sections and entries are driven by support files. That helps explain why template match expressions often target specific CDA paths. [3]

Important: If you plan to customize transformations and InterSystems IRIS for Health is running in a Docker container, the container must point to a durable directory. For more information on durable directories, see Running InterSystems Products in Containers. [2]

If you want, I can next turn this into a small CDA XSLT example showing each of match, select, variable, attribute, copy, and mode in one sample transform.


Sources:

Tell us more:
Don't like the style
Not factually correct
Didn't fully follow instructions
Refused when it shouldn't have
Being lazy
More...
Submit
0 0