Show createAllergy.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="Allergy-type"/>
<xsl:param name="Allergy-status"/>
<xsl:param name="Allergy-startDate"/>
<xsl:param name="Allergy-severity"/>
<xsl:param name="Allergy-uncertainty"/>
<xsl:param name="Allergy-code"/>
<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="Providers" select="$Data/providers"/>
<xsl:template match="/">
<xsl:variable name="provider" select="$Providers/provider[name = $providerName]"/>
<REPC_IN000012CA 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="REPC_IN000012CA"/>
<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="REPC_TE000001UV"/>
<!-- don't know what status code is for -->
<statusCode code="completed"/>
<effectiveTime value="20050101100101">
<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>
<subject contextConductionInd="false">
<!-- A record of a patient's allergy or intolerance. -->
<intoleranceCondition negationInd="false">
<!-- required element for a coded value denoting whether the record pertains to an intolerance or a true allergy.
(Allergies result from immunologic reactions. Intolerances do not.). ObservationIntoleranceType Vocab -->
<code code="FALG" codeSystem="2.16.840.1.113883.5.4">
<xsl:attribute name="code"><xsl:value-of select="$Allergy-type"/></xsl:attribute>
</code>
<!-- food allergy -->
<!-- required element to give a coded value that indicates whether an allergy/intolerance is 'ACTIVE' or 'COMPLETE' (indicating no longer active).
The system should always default the status of an allergy/intolerance record to 'ACTIVE'. -->
<statusCode code="active">
<xsl:attribute name="code"><xsl:value-of select="$Allergy-status"/></xsl:attribute>
</statusCode>
<!-- an optional element to give the date on which the recorded allergy is considered active -->
<effectiveTime value="20050101">
<xsl:attribute name="value"><xsl:value-of select="$Allergy-startDate"/></xsl:attribute>
</effectiveTime>
<!-- ActUncertainty vocab - N: stated with no assertion of uncertainty U: stated with uncertainty -->
<uncertaintyCode code="U">
<xsl:attribute name="code"><xsl:value-of select="$Allergy-uncertainty"/></xsl:attribute>
</uncertaintyCode>
<!-- Indicates the drug or other material to which the patient is allergic or has an intolerance , IntoleranceValue Vocab CWE as not all allergens have coded values-->
<value codeSystem="2.16.840.1.113883.5.1060" code="NDA04">
<xsl:attribute name="code"><xsl:value-of select="$Allergy-code"/></xsl:attribute>
</value>
<!-- the patient to whom the allergy applies -->
<subject>
<patient>
<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>
</patient>
</subject>
<!-- severity of allergy -->
<subjectOf2>
<severityObservation>
<!-- fixed value SEV -->
<code code="SEV"/>
<!-- some fixed value: irrelevant -->
<statusCode code="active"/>
<!-- Indicates the gravity of the allergy, intolerance or reaction in terms of its actual or potential impact on the patient. SeverityObservation vocab -->
<value code="L">
<xsl:attribute name="code"><xsl:value-of select="$Allergy-severity"/></xsl:attribute>
</value>
<!-- LOW -->
</severityObservation>
</subjectOf2>
</intoleranceCondition>
</subject>
</controlActEvent>
</REPC_IN000012CA>
</xsl:template>
</xsl:stylesheet>
See more files for this project here