Code Search for Developers
 
 
  

createDispense.xsl from HL7v3 Test Harness at Krugle


Show createDispense.xsl syntax highlighted

<?xml version="1.0" encoding="UTF-8" ?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns="urn:hl7-org:v3">
    <xsl:template match="text()|@*"/>

    <xsl:param name="now"/>
    <xsl:param name="OID"/>

    <xsl:param name="patientPHN"/>
    <xsl:param name="providerName"/>

    <xsl:param name="prescriptionID"/>
    <xsl:param name="Drug-name"/>
    <xsl:param name="Drug-quantity"/>
    <xsl:param name="Drug-quantity-unit"/>
    <xsl:param name="Drug-total-days"/>
    <xsl:param name="Drug-doseInstruction"/>
    <xsl:param name="Drug-maxDosePerDay"/>

  <xsl:param name="xslDir"/>
  <xsl:variable name="datafile">
    <xsl:value-of select="$xslDir"/>Data.xml
  </xsl:variable>
  <xsl:variable name="Data" select="document($datafile)/Data"/>
  <xsl:variable name="Drugs" select="$Data/drugs"/>
    <xsl:variable name="Providers" select="$Data/providers"/>

    <xsl:template match="/">

        <xsl:variable name="Drug" select="$Drugs/drug[name = $Drug-name]"/>
        <xsl:variable name="provider" select="$Providers/provider[name = $providerName]"/>

        <PORX_IN020190CA ITSVersion="XML_1.0">
            <!-- A unique identifier for the message -->
            <id root="2.16.124.9.101.1.8.1" extension="122">
                <xsl:attribute name="extension">
                    <xsl:value-of select="$OID"/>
                </xsl:attribute>
            </id>
            <creationTime value="20050101102001">
                <xsl:attribute name="value">
                    <xsl:value-of select="$now"/>
                </xsl:attribute>
            </creationTime>
            <versionCode code="V3-2005-05"/>
            <interactionId root="2.16.840.1.113883.1.6" extension="PORX_IN020190CA"/>
            <processingCode code="P"/>
            <processingModeCode code="T"/>
            <acceptAckCode code="ER"/>

            <receiver>
                <!-- The address to which this message is being sent to - ie network addresses of DIS. -->
                <telecom use="WP" value="uri:198.203.1.23"/>
                <device>
                    <id root="2.16.124.9.101.1.1"/>
                </device>
            </receiver>

            <sender>
                <!-- The address to which this message is being sent from - ie network addresses of Portal -->
                <telecom use="WP" value="uri:198.203.1.23"/>
                <device>
                    <id root="2.16.124.9.101.1.8"/>
                </device>
            </sender>

            <controlActEvent classCode="CACT" moodCode="EVN">
                <!-- identifier should be stored for use in ‘undos’.  They should be stored in such a way that they are associated with the item that was modified by this event.  For example, a system should be able to show the list of trigger event identifiers for the actions that have been recorded against a particular prescription. -->
                <id root="2.16.124.9.101.1.8.5" extension="1245">
                    <xsl:attribute name="extension">
                        <xsl:value-of select="$OID"/>
                    </xsl:attribute>
                </id>
                <!-- HL7TriggerEventCode - Identifies the trigger event that occurred -->
                <code code="PORX_TE020220UV"/>
                <!-- don't know what status code is for -->
                <statusCode code="active"/>
                <effectiveTime>
                    <xsl:attribute name="value">
                        <xsl:value-of select="$now"/>
                    </xsl:attribute>
                </effectiveTime>
                <!-- person responsible for the event that caused this message - the pharmacist, doctor, or most likely a public health nurse -->
                <author typeCode="AUT">
                    <time value="20050101102001">
                        <xsl:attribute name="value">
                            <xsl:value-of select="$now"/>
                        </xsl:attribute>
                    </time>
                    <!--ParticipationMode -  Indicates how the person who recorded the event became aware of it -->
                    <modeCode code="PHYSICAL"/>
                    <assignedPerson>
                        <!-- pharmacist or prescriber id  -->
                        <id root="2.16.124.9.101.1.1.7" extension="123456">
                            <xsl:attribute name="root">
                                <xsl:value-of select="$provider/id/@root"/>
                            </xsl:attribute>
                            <xsl:attribute name="extension">
                                <xsl:value-of select="$provider/id/@extension"/>
                            </xsl:attribute>
                        </id>
                        <!--  HealthcareProviderRoleType -->
                        <code nullFlavor="NI"/>
                        <representedPerson>
                            <name nullFlavor="NI"/>
                        </representedPerson>
                    </assignedPerson>
                </author>
                <!-- An identification of a service location (or facility) where health service has been or can be delivered.  E.g. Pharmacy -->
                <location>
                    <serviceDeliveryLocation>
                        <!-- a pharmacy id -->
                        <id root="2.16.124.9.101.1.1.2" extension="123445">
                            <xsl:attribute name="root">
                                <xsl:value-of select="$provider/location/@root"/>
                            </xsl:attribute>
                            <xsl:attribute name="extension">
                                <xsl:value-of select="$provider/location/@extension"/>
                            </xsl:attribute>
                        </id>
                        <addr/>
                        <telecom nullFlavor="NI"/>
                        <location>
                            <name nullFlavor="NI"/>
                        </location>
                    </serviceDeliveryLocation>
                </location>
                <!-- details of the dispense -->
                <subject contextConductionInd="false">
                    <medicationDispense>
                        <!-- Identifier assigned by the dispensing facility -->
                        <id root="2.16.124.9.101.1.8.6" extension="13567">
                            <xsl:attribute name="extension">
                                <xsl:value-of select="$OID"/>
                            </xsl:attribute>
                        </id>
                        <!-- the patient -->

                        <subject>
                            <patient1>
                                <id root="2.1" extension="">
                                    <xsl:attribute name="extension">
                                        <xsl:value-of select="$patientPHN"/>
                                    </xsl:attribute>
                                </id>
                                <telecom nullFlavor="NI"/>
                                <patientPerson>
                                    <name nullFlavor="NI"/>
                                    <administrativeGenderCode nullFlavor="NI"/>
                                    <birthTime nullFlavor="NI"/>
                                </patientPerson>
                            </patient1>
                        </subject>

                        <!-- optionally Indicates the prescription that is being dispensed against -->
                        <inFulfillmentOf>
                            <!-- Information pertaining to the prescription for which a dispense is being created -->
                            <substanceAdministrationRequest>
                                <!-- The identifier of the prescription for which a dispense is being created. The ID is only 'populated' because in some cases the prescription will not yet exist electronically  -->
                                <id root="2.16.124.9.101.1.1.4" extension="1245">
                                    <xsl:attribute name="extension">
                                        <xsl:value-of select="$prescriptionID"/>
                                    </xsl:attribute>
                                </id>
                                <!-- fixed value of drug -->
                                <code code="DRUG"/>
                            </substanceAdministrationRequest>
                        </inFulfillmentOf>


                        <!-- 1..10 elements for the dosage instructions (these are the admin instructions from old dispense message) -->
                        <component2>
                            <dosageInstruction moodCode="RQO">
                                <!-- Distinguishes types of dosage : For SNOMED this will pre-coordinate route, body site and potentially drug.  For non-SNOMED, this will be a fixed value of DRUG. -->
                                <code code="DRUG"/>
                                <!-- required value free form textual specification made up of either an 'Ad-hoc dosage instruction' or 'Textual rendition of the structured dosage lines', plus route, 
                              dosage unit, and other pertinent administration information specified by the provider -->
                                <text>
                                    <xsl:value-of select="$Drug-doseInstruction"/>
                                </text>
                                <xsl:if test="$Drug-maxDosePerDay and not($Drug-maxDosePerDay = '')">
                                    <maxDoseQuantity>
                                        <numerator value="2" unit="">
                                            <xsl:attribute name="value">
                                                <xsl:value-of select="$Drug-maxDosePerDay"/>
                                            </xsl:attribute>
                                        </numerator>
                                        <denominator value="1" unit="day"/>
                                    </maxDoseQuantity>
                                </xsl:if>

                                <consumable>
                                    <medication3>
                                        <player>
                                            <code>
                                                <xsl:attribute name="code">
                                                    <xsl:value-of select="$Drug/code/@code"/>
                                                </xsl:attribute>
                                                <xsl:attribute name="codeSystem">
                                                    <xsl:value-of select="$Drug/code/@codeSystem"/>
                                                </xsl:attribute>
                                            </code>
                                            <name>
                                                <xsl:value-of select="$Drug-name"/>
                                                <!-- <xsl:value-of select="$Drug/name"/> -->
                                            </name>
                                        </player>
                                    </medication3>
                                </consumable>

                            </dosageInstruction>
                        </component2>


                        <component3>
                            <supplyEvent>
                                <!-- Indicates the type of dispensing event that is performed. Examples include: Trial Fill, Completion of Trial, Partial Fill, Emergency Fill, Samples, etc. ActPharmacySupplyType vocab -->
                                <code code="RF"/>
                                <!-- Dispense Processing and Pickup Date Represents the date the dispense product was prepared and when the product was picked up by or delivered to the patient. 
                              The dispense processing date and pickup date can be back dated to reflect when the actual processing and pickup occurred. 
                              The lower-bound of the period signifies the dispense-processing date whereas the upper-bound signifies the dispense-pickup date. Since we don't know
                              the pickup date at this point, only the low value should be used.
                        -->
                                <effectiveTime>
                                    <low value="20040101">
                                        <xsl:attribute name="value">
                                            <xsl:value-of select="$now"/>
                                        </xsl:attribute>
                                    </low>
                                    <high nullFlavor="NA"/>
                                </effectiveTime>
                                <!-- The amount of medication that has been dispensed. Includes unit of measure. -->
                                <quantity value="100" unit="mg">
                                    <xsl:attribute name="value">
                                        <xsl:value-of select="$Drug-quantity"/>
                                    </xsl:attribute>
                                    <xsl:attribute name="unit">
                                        <xsl:value-of select="$Drug-quantity-unit"/>
                                    </xsl:attribute>
                                </quantity>
                                <!-- The number of days that the dispensed quantity is expected to last 
                             useful in determining and managing certain contraindications ('Fill-Too-Soon', 'Fill-Too-Late', and 'Duration of Therapy')
                        -->
                                <expectedUseTime>
                                    <width unit="d" value="10">
                                        <xsl:attribute name="value">
                                            <xsl:value-of select="$Drug-total-days"/>
                                        </xsl:attribute>
                                    </width>
                                </expectedUseTime>

                                <!-- the drug -->
                                <product>
                                    <medication>
                                        <player>
                                            <code>
                                                <xsl:attribute name="code">
                                                    <xsl:value-of select="$Drug/code/@code"/>
                                                </xsl:attribute>
                                                <xsl:attribute name="codeSystem">
                                                    <xsl:value-of select="$Drug/code/@codeSystem"/>
                                                </xsl:attribute>
                                            </code>
                                            <name>
                                                <xsl:value-of select="$Drug-name"/>
                                                <!-- <xsl:value-of select="$Drug/name"/> -->
                                            </name>
                                        </player>
                                    </medication>
                                </product>

                            </supplyEvent>
                        </component3>

                    </medicationDispense>
                </subject>


            </controlActEvent>


        </PORX_IN020190CA>

    </xsl:template>
</xsl:stylesheet>




See more files for this project here

HL7v3 Test Harness

The HL7 Test Harness system is an HL7 v3 message conformance testing application that also provides the ability to simulate the message processing actions of a client and/or server system. The app provides message workflow, format and content testing.

Project homepage: http://sourceforge.net/projects/hl7-testharness
Programming language(s): C#,XML
License: gpl2

  Data.xml
  allergyGrid.xsl
  allergyQuery.xsl
  createAllergy.xsl
  createDispense.xsl
  createDispensePickup.xsl
  createPrescription.xsl
  dispenseGrid.xsl
  patientSearch.xsl
  prescriptionGrid.xsl
  prescriptionQuery.xsl
  searchGrid.xsl