+Pat2Indivo for the new schemas (Encounters missing)
authorThomas Gambet <tgambet@w3.org>
Thu, 15 Jul 2010 17:09:08 -0400
changeset 6 60a6e23e92b5
parent 5 b70efe65b168
child 7 82b276753f0f
+Pat2Indivo for the new schemas (Encounters missing)
syntheticPatients/Pat2Indivo2.xsl
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/syntheticPatients/Pat2Indivo2.xsl	Thu Jul 15 17:09:08 2010 -0400
@@ -0,0 +1,169 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- $Id: Pat2rdf.xsl,v 1.23 2009/11/30 03:42:28 eric Exp $ -->
+<xsl:stylesheet 
+	xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+	version="2.0"
+	xmlns:fn="http://www.w3.org/2005/xpath-functions/"
+	xmlns:indi='http://indivo.org/vocab/xml/documents#'
+	exclude-result-prefixes="">
+
+<xsl:output method="xml" indent='yes' encoding='utf-8'
+omit-xml-declaration="yes"	    
+media-type="application/rdf+xml" version="1.0"/>
+
+<xsl:template match="/root">
+	<xsl:comment> -*- XML -*- </xsl:comment><xsl:processing-instruction name="xml-stylesheet"><xsl:text>type="text/xsl" href="Patrdf2html.xsl"</xsl:text></xsl:processing-instruction>
+	<Envelope>
+		<CurrentStatus>
+			<xsl:copy-of select="Contact"/>
+			<xsl:apply-templates select="Practice"/>
+			<xsl:copy-of select="Demographics"/>
+			<xsl:apply-templates select="prescriptions"/>
+			<xsl:apply-templates select="conditions"/>
+			<xsl:apply-templates select="procedures"/>
+			<xsl:apply-templates select="allergies"/>
+			<xsl:apply-templates select="immunizations"/>
+			<xsl:copy-of select="lifestyle"/>
+			<xsl:copy-of select="familyHistory"/>
+		</CurrentStatus>
+	</Envelope>
+</xsl:template>
+
+<xsl:template match="Practice">
+	<PrimaryCarePhysician>
+		<name>
+			<xsl:copy-of select="primaryCarePhysician/fullName"/>
+			<xsl:copy-of select="primaryCarePhysician/givenName"/>
+			<xsl:copy-of select="primaryCarePhysician/familyName"/>
+		</name>
+		<address>
+			<xsl:copy-of select="practiceAddress/streetAddress"/>
+			<xsl:copy-of select="practiceAddress/postalCode"/>
+			<xsl:copy-of select="practiceAddress/locality"/>
+			<xsl:copy-of select="practiceAddress/region"/>
+			<xsl:copy-of select="practiceAddress/country"/>
+			<xsl:copy-of select="practiceAddress/timeZone"/>
+		</address>
+		<xsl:copy-of select="practiceAddress/phoneNumber"/>
+	</PrimaryCarePhysician>
+</xsl:template>
+
+<xsl:template match="prescriptions">
+	<Prescriptions>
+		<xsl:for-each select="drug">
+			<Prescription>
+				<medication>
+					<dateStarted><xsl:value-of select="datePrescribed"/></dateStarted>
+					<xsl:if test="datePrescriptionEnded != 'false'">
+						<dateStopped><xsl:value-of select="datePrescriptionEnded"/></dateStopped>
+					</xsl:if>
+					<name>
+						<xsl:attribute name="type">http://indivo.org/codes/ndc</xsl:attribute>
+						<xsl:value-of select="NDC"/>
+					</name>
+					<brandName>
+						
+					</brandName>
+					<dose>
+						<value><xsl:value-of select="999"/></value>
+						<unit type="http://indivo.org/codes/units#">
+							<xsl:attribute name="value">
+								<xsl:value-of select="999"/>
+							</xsl:attribute>
+						</unit>
+					</dose>
+					<strength>
+						<value><xsl:value-of select="strengh"/></value>
+						<unit type="http://indivo.org/codes/units#">
+							<xsl:attribute name="value">
+								<xsl:value-of select="unit"/>
+							</xsl:attribute>
+						</unit>
+					</strength>
+					<xsl:copy-of select="frequency"/>
+				</medication>
+				<prescribedBy>
+					<name><xsl:value-of select="prescribedBy"/></name>
+				</prescribedBy>
+				<dispenseAsWritten>true</dispenseAsWritten>
+				<refillInfo><xsl:value-of select="refill"/></refillInfo>
+				<instructions><xsl:value-of select="physicianNotes"/></instructions>
+			</Prescription>
+		</xsl:for-each>
+	</Prescriptions>
+</xsl:template>
+
+<xsl:template match="conditions">
+	<Conditions>
+		<xsl:for-each select="condition">
+			<Problem>
+				<dateOnset><xsl:value-of select="dateDiagnosed"/>T12:00:00</dateOnset> <!-- dateOnset should be different that dateDiagnosed -->
+				<!-- <dateResolution></dateResolution> -->
+				<name type="http://indivo.org/codes/ICD9">
+					<xsl:attribute name="value">
+						<xsl:value-of select="ICD9"/>
+					</xsl:attribute>
+					<xsl:value-of select="diagnosedWith"/>
+				</name>
+				<comments><xsl:value-of select="physicianNotes"/></comments>
+				<xsl:copy-of select="diagnosedBy"/>
+			</Problem>
+		</xsl:for-each>
+	</Conditions>
+</xsl:template>
+
+<xsl:template match="procedures">
+	<Procedures>
+		<xsl:for-each select="procedure">
+			<Procedure>
+				<datePerformed><xsl:value-of select="procedureDate"/>T12:00:00</datePerformed>
+				<name type="http://indivo.org/codes/ICD9_Procedure">
+					<xsl:attribute name="value">
+						<xsl:value-of select="ICD9_Procedure"/>
+					</xsl:attribute>
+					<xsl:value-of select="procedureName"/>
+				</name>
+				<Provider>
+					<name><xsl:value-of select="referredBy"/></name>
+					<institution><xsl:value-of select="referredInstitution"/></institution>
+				</Provider>
+				<comments><xsl:value-of select="procedureNotes"/></comments>
+			</Procedure>
+		</xsl:for-each>
+	</Procedures>
+</xsl:template>
+
+<xsl:template match="allergies">
+	<Allergies>
+		<xsl:for-each select="child::*">
+			<Allergy>
+				<allergen>
+					<type type="http://codes.indivo.org/codes/allergentypes/"><xsl:value-of select="name(.)"/></type>
+					<name type="http://codes.indivo.org/codes/allergens/"><xsl:value-of select="."/></name>
+				</allergen>
+			</Allergy>
+		</xsl:for-each>
+	</Allergies>
+</xsl:template>
+
+<xsl:template match="immunizations">
+	<Immunizations>
+		<xsl:for-each select="child::*">
+			<Immunization>
+				<dateAdministered><xsl:value-of select="date"/>T12:00:00</dateAdministered>
+				<xsl:copy-of select="administeredBy"/>
+				<vaccine>
+					<type><xsl:value-of select="name(.)"/></type>
+					<manufacturer></manufacturer>
+					<lot></lot>
+					<expiration></expiration>
+				</vaccine>
+				<sequence><xsl:value-of select="stage"/></sequence>
+				<anatomicSurface><xsl:value-of select="method"/></anatomicSurface> <!-- Not exactly.. -->
+				<adverseEvent></adverseEvent>
+			</Immunization>
+		</xsl:for-each>
+	</Immunizations>
+</xsl:template>
+
+</xsl:stylesheet>