--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/syntheticPatients/AD_PCHR_1-indivo.xml Wed Jul 07 15:26:14 2010 -0400
@@ -0,0 +1,46 @@
+<!-- -*- XML -*- --><?xml-stylesheet type="text/xsl" href="Patrdf2html.xsl"?>
+<!-- $Id$ -->
+<indi:IndivoDocument xmlns:pim="tag:eric@w3.org:2009/pim/basic"
+ xmlns:xsd="http://www.w3.org/2001/XMLSchema#"
+ xmlns:indivo="http://indivo.org/vocab/xml/documents#"
+ xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#"
+ xmlns:vcard="http://www.w3.org/2001/vcard-rdf/3.0#"
+ xmlns:fn="http://www.w3.org/2005/xpath-functions/"
+ xmlns:indi="http://indivo.org/xml/phr/document"
+ xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
+ xmlns:trans="tag:eric@w3.org:2009/tmo/translator#"
+ xmlns:foaf="http://xmlns.com/foaf/0.1/">
+ <indi:DocumentHeader>
+ <CreationDateTime>2010-07-06T01:01:01</CreationDateTime>
+ <LastModifiedDateTime>2010-07-06T01:01:01</LastModifiedDateTime>
+ <Author>
+ <IndivoId>gtour@hotmail.com</IndivoId>
+ <Name>George Andrew Tour</Name>
+ <Role>Patient999</Role>
+ </Author>
+ <DocumentIndex>string</DocumentIndex>
+ <indi:DocumentClassification>
+ <Classification>indi:Classification999</Classification>
+ </indi:DocumentClassification>
+ <indi:ContentDescription>
+ <SchemaLocation>http://indivo.org/xml/phr/document</SchemaLocation>
+ <ContentType>indi:ContentType999</ContentType>
+ </indi:ContentDescription>
+ <Active>true</Active>
+ </indi:DocumentHeader>
+ <indi:DocumentVersion>
+ <indi:VersionHeader>
+ <VersionDateTime>2010-07-06T01:01:01</VersionDateTime>
+ <VersionAuthor>
+ <IndivoId>eric@w3.org</IndivoId>
+ <Name>ericP</Name>
+ <Role>hacker</Role>
+ </VersionAuthor>
+ </indi:VersionHeader>
+ <indi:VersionBody>
+ <foaf:Person rdf:about="http://www.w3.org/People/Eric/ericP-foaf#me">
+ <foaf:name>Eric Prud'hommeaux</foaf:name>
+ </foaf:Person>
+ </indi:VersionBody>
+ </indi:DocumentVersion>
+</indi:IndivoDocument>
\ No newline at end of file
--- a/syntheticPatients/Makefile Tue Jul 06 14:06:18 2010 -0400
+++ b/syntheticPatients/Makefile Wed Jul 07 15:26:14 2010 -0400
@@ -1,4 +1,4 @@
-XSLT := saxonb-xslt
+XSLT := saxonb-xslt -ext:on
all : \
AD_PCHR_1.html AD_PCHR_2.html \
@@ -12,6 +12,19 @@
%.rdf : %.xml Pat2rdf.xsl
$(XSLT) $^ > $@
+%-indivo.xml : %.xml Pat2Indivo.xsl
+ $(XSLT) $^ > $@
+
%.html: %.rdf Patrdf2html.xsl
$(XSLT) $^ > $@
+xerces2val.class: xerces2val.java
+ javac $^
+
+test: AD_PCHR_1-indivo.xml document.xsd
+ # java xerces2val document.xsd $<
+ xmllint --noout --schema document.xsd $<
+
+note:
+ xmllint --noout --schema note.xsd note.xml
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/syntheticPatients/Pat2Indivo.xsl Wed Jul 07 15:26:14 2010 -0400
@@ -0,0 +1,913 @@
+<?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/xml/phr/document'
+xmlns:rdf='http://www.w3.org/1999/02/22-rdf-syntax-ns#'
+xmlns:trans='tag:eric@w3.org:2009/tmo/translator#'
+xmlns:foaf="http://xmlns.com/foaf/0.1/"
+xmlns:pim='tag:eric@w3.org:2009/pim/basic'
+xmlns:xsd="http://www.w3.org/2001/XMLSchema#"
+xmlns:indivo="http://indivo.org/vocab/xml/documents#"
+xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#"
+xmlns:vcard="http://www.w3.org/2001/vcard-rdf/3.0#"
+exclude-result-prefixes="">
+
+<xsl:output method="xml" indent='yes' encoding='utf-8'
+omit-xml-declaration="yes"
+media-type="application/rdf+xml" version="1.0"/>
+
+<!-- How do I get fn:current-dateTime() to work in saxonb? -->
+<xsl:variable name="DateTime">2010-07-06T01:01:01</xsl:variable>
+
+ <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><xsl:text>
+</xsl:text><xsl:comment> $Id$ </xsl:comment><xsl:text>
+</xsl:text>
+ <indi:IndivoDocument>
+ <xsl:apply-templates select="Contact" mode="header"/>
+ <indi:DocumentVersion>
+ <indi:VersionHeader>
+ <VersionDateTime><xsl:value-of select="$DateTime"/></VersionDateTime>
+ <VersionAuthor>
+ <IndivoId>eric@w3.org</IndivoId>
+ <Name>ericP</Name>
+ <Role>hacker</Role>
+ </VersionAuthor>
+ </indi:VersionHeader>
+ <indi:VersionBody>
+ <foaf:Person rdf:about="http://www.w3.org/People/Eric/ericP-foaf#me">
+ <foaf:name>Eric Prud'hommeaux</foaf:name>
+ </foaf:Person>
+ </indi:VersionBody>
+ </indi:DocumentVersion>
+ <!-- xsl:apply-templates/ -->
+ </indi:IndivoDocument>
+ </xsl:template>
+
+ <xsl:template match="Contact" mode="header">
+ <indi:DocumentHeader>
+ <CreationDateTime><xsl:value-of select="$DateTime"/></CreationDateTime>
+ <LastModifiedDateTime><xsl:value-of select="$DateTime"/></LastModifiedDateTime>
+ <Author>
+ <IndivoId><xsl:value-of select="normalize-space(email[@type='personal'])"/></IndivoId>
+ <Name><xsl:value-of select="name/fullName"/></Name>
+ <Role>Patient999</Role>
+ </Author>
+ <DocumentIndex>string</DocumentIndex>
+ <indi:DocumentClassification>
+ <Classification>indi:Classification999</Classification>
+ </indi:DocumentClassification>
+ <indi:ContentDescription>
+ <SchemaLocation>http://indivo.org/xml/phr/document</SchemaLocation>
+ <ContentType>indi:ContentType999</ContentType>
+ </indi:ContentDescription>
+ <Active>true</Active>
+ </indi:DocumentHeader>
+ </xsl:template>
+
+ <xsl:template match="Practice">
+ <trans:Practice>
+ <xsl:for-each select="*">
+ <xsl:variable name="ln" select="local-name()"/>
+ <xsl:choose>
+ <xsl:when test="$ln='practiceName'">
+ <trans:practiceName><xsl:copy-of select="text()"/></trans:practiceName>
+ </xsl:when>
+ <xsl:when test="$ln='practiceAddress'">
+ <pim:addr>
+ <xsl:apply-templates mode="address" select="."/>
+ </pim:addr>
+ </xsl:when>
+ <xsl:when test="$ln='primaryCarePhysician'">
+ <trans:primaryCarePhysician>
+ <foaf:Person>
+ <xsl:apply-templates mode="person" select="."/>
+ </foaf:Person>
+ </trans:primaryCarePhysician>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:apply-templates mode="pred" select="."/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:for-each>
+ </trans:Practice>
+ </xsl:template>
+
+ <xsl:template mode="address" match="*">
+ <pim:Address>
+ <xsl:for-each select="*">
+ <xsl:variable name="ln2" select="local-name()"/>
+ <xsl:choose>
+ <xsl:when test="$ln2='streetAddress'">
+ <vcard:Street><xsl:copy-of select="text()"/></vcard:Street>
+ </xsl:when>
+ <xsl:when test="$ln2='postalCode'">
+ <vcard:Pcode><xsl:copy-of select="text()"/></vcard:Pcode>
+ </xsl:when>
+ <xsl:when test="$ln2='locality'">
+ <vcard:Locality><xsl:copy-of select="text()"/></vcard:Locality>
+ </xsl:when>
+ <xsl:when test="$ln2='region'">
+ <vcard:Region><xsl:copy-of select="text()"/></vcard:Region>
+ </xsl:when>
+ <xsl:when test="$ln2='country'">
+ <vcard:Country><xsl:copy-of select="text()"/></vcard:Country>
+ </xsl:when>
+ <xsl:when test="$ln2='timeZone'">
+ <pim:timeZone><xsl:copy-of select="text()"/></pim:timeZone>
+ </xsl:when>
+ <xsl:when test="$ln2='phoneNumber'">
+ <foaf:phone><xsl:copy-of select="text()"/></foaf:phone>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:apply-templates mode="pred" select="."/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:for-each>
+ </pim:Address>
+ </xsl:template>
+
+ <xsl:template match="Demographics">
+ <rdf:Description rdf:about="#me"><trans:demographics rdf:resource="#demog"/></rdf:Description>
+ <trans:Demographics rdf:about="#demog">
+ <xsl:for-each select="*">
+ <xsl:variable name="ln" select="local-name()"/>
+ <xsl:choose>
+ <xsl:when test="$ln='practiceName'">
+ <trans:practiceName><xsl:copy-of select="text()"/></trans:practiceName>
+ </xsl:when>
+ <xsl:when test="$ln='dateOfBirth'">
+ <indivo:dateOfBirth><xsl:copy-of select="text()"/></indivo:dateOfBirth>
+ </xsl:when>
+ <xsl:when test="$ln='dateOfDeath'">
+ <indivo:dateOfDeath><xsl:copy-of select="text()"/></indivo:dateOfDeath>
+ </xsl:when>
+ <xsl:when test="$ln='gender'">
+ <indivo:gender><xsl:copy-of select="text()"/></indivo:gender>
+ </xsl:when>
+ <xsl:when test="$ln='ethnicity'">
+ <indivo:ethnicity><xsl:copy-of select="text()"/></indivo:ethnicity>
+ </xsl:when>
+ <xsl:when test="$ln='language'">
+ <indivo:language><xsl:copy-of select="text()"/></indivo:language>
+ </xsl:when>
+ <xsl:when test="$ln='maritalStatus'">
+ <indivo:maritalStatus><xsl:copy-of select="text()"/></indivo:maritalStatus>
+ </xsl:when>
+ <xsl:when test="$ln='employmentStatus'">
+ <indivo:employmentStatus><xsl:copy-of select="text()"/></indivo:employmentStatus>
+ </xsl:when>
+ <xsl:when test="$ln='employmentIndustry'">
+ <indivo:employmentIndustry><xsl:copy-of select="text()"/></indivo:employmentIndustry>
+ </xsl:when>
+ <xsl:when test="$ln='occupation'">
+ <indivo:occupation><xsl:copy-of select="text()"/></indivo:occupation>
+ </xsl:when>
+ <xsl:when test="$ln='religion'">
+ <indivo:religion><xsl:copy-of select="text()"/></indivo:religion>
+ </xsl:when>
+ <xsl:when test="$ln='income'">
+ <indivo:income><xsl:copy-of select="text()"/></indivo:income>
+ </xsl:when>
+ <xsl:when test="$ln='highestEducation'">
+ <indivo:highestEducation><xsl:copy-of select="text()"/></indivo:highestEducation>
+ </xsl:when>
+ <xsl:when test="$ln='organDonor'">
+ <indivo:organDonor><xsl:copy-of select="text()"/></indivo:organDonor>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:apply-templates mode="pred" select="."/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:for-each>
+ </trans:Demographics>
+ </xsl:template>
+
+ <xsl:template mode="person" match="*">
+ <xsl:for-each select="*">
+ <xsl:variable name="ln" select="local-name()"/>
+ <xsl:choose>
+ <xsl:when test="$ln='name'"> <!-- flatten <name><fullName/></name> -->
+ <xsl:apply-templates mode="person" select="."/>
+ </xsl:when>
+ <xsl:when test="$ln='fullName'">
+ <foaf:name><xsl:copy-of select="text()"/></foaf:name>
+ </xsl:when>
+ <xsl:when test="$ln='givenName'">
+ <foaf:givenName><xsl:copy-of select="text()"/></foaf:givenName>
+ </xsl:when>
+ <xsl:when test="$ln='familyName'">
+ <foaf:familyName><xsl:copy-of select="text()"/></foaf:familyName>
+ </xsl:when>
+ <xsl:when test="$ln='email' and @type='personal'"><xsl:comment>personal mbox</xsl:comment>
+ <foaf:mbox><xsl:copy-of select="text()"/></foaf:mbox>
+ </xsl:when>
+ <xsl:when test="$ln='email' and @type='work'"><xsl:comment>work mbox</xsl:comment>
+ <foaf:mbox><xsl:copy-of select="text()"/></foaf:mbox>
+ </xsl:when>
+ <xsl:when test="$ln='address'">
+ <foaf:address><xsl:apply-templates mode="address" select="."/></foaf:address>
+ </xsl:when>
+ <xsl:when test="$ln='location'">
+ <pim:location rdf:parseType="Resource">
+ <xsl:for-each select="*">
+ <xsl:variable name="ln2" select="local-name()"/>
+ <xsl:choose>
+ <xsl:when test="$ln2='latitude'">
+ <geo:lat><xsl:copy-of select="text()"/></geo:lat>
+ </xsl:when>
+ <xsl:when test="$ln2='longitude'">
+ <geo:long><xsl:copy-of select="text()"/></geo:long>
+ </xsl:when>
+ </xsl:choose>
+ </xsl:for-each>
+ </pim:location>
+ </xsl:when>
+ <xsl:when test="$ln='phoneNumber'">
+ <foaf:phone><xsl:copy-of select="text()"/></foaf:phone>
+ </xsl:when>
+ <xsl:when test="$ln='instantMessengerName'">
+ <foaf:accountName><xsl:copy-of select="text()"/></foaf:accountName>
+ </xsl:when>
+ <xsl:when test="$ln='license'">
+ <trans:license><xsl:copy-of select="text()"/></trans:license>
+ </xsl:when>
+ <xsl:when test="$ln='gender'">
+ <foaf:gender><xsl:copy-of select="text()"/></foaf:gender>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:apply-templates mode="pred" select="."/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:for-each>
+ </xsl:template>
+
+ <xsl:template match="prescriptions">
+ <xsl:apply-templates mode="prescriptions"/>
+ </xsl:template>
+
+ <xsl:template mode="prescriptions" match="drug">
+ <trans:Drug>
+ <trans:prescribedTo rdf:resource="#me"/>
+ <xsl:for-each select="*">
+ <xsl:variable name="ln" select="local-name()"/>
+ <xsl:choose>
+ <xsl:when test="$ln='ontology'">
+ <trans:ontology><xsl:copy-of select="text()"/></trans:ontology>
+ </xsl:when>
+ <xsl:when test="$ln='NDC'">
+ <trans:NDC><xsl:copy-of select="text()"/></trans:NDC>
+ </xsl:when>
+ <xsl:when test="$ln='genericName'">
+ <trans:genericName><xsl:copy-of select="text()"/></trans:genericName>
+ </xsl:when>
+ <xsl:when test="$ln='strength'"><xsl:comment> ++ indivo:Prescription/strength/value </xsl:comment>
+ <trans:strength><xsl:copy-of select="text()"/></trans:strength>
+ </xsl:when>
+ <xsl:when test="$ln='unit'"><xsl:comment> ++ indivo:Prescription/strength/value </xsl:comment>
+ <trans:unit><xsl:copy-of select="text()"/></trans:unit>
+ </xsl:when>
+ <xsl:when test="$ln='packSize'">
+ <trans:packSize><xsl:copy-of select="text()"/></trans:packSize>
+ </xsl:when>
+ <xsl:when test="$ln='packType'">
+ <trans:packType><xsl:copy-of select="text()"/></trans:packType>
+ </xsl:when>
+ <xsl:when test="$ln='routeName'">
+ <trans:routeName><xsl:copy-of select="text()"/></trans:routeName>
+ </xsl:when>
+ <xsl:when test="$ln='dosageName'">
+ <trans:dosageName><xsl:copy-of select="text()"/></trans:dosageName>
+ </xsl:when>
+ <xsl:when test="$ln='frequency'">
+ <trans:frequency><xsl:copy-of select="text()"/></trans:frequency>
+ </xsl:when>
+ <xsl:when test="$ln='refill'"><xsl:comment> ++ indivo:Prescription/refillInfo </xsl:comment>
+ <trans:refill><xsl:copy-of select="text()"/></trans:refill>
+ </xsl:when>
+ <xsl:when test="$ln='daysToTake'"><xsl:comment> ++ indivo:Prescription/duration </xsl:comment>
+ <trans:daysToTake><xsl:copy-of select="text()"/></trans:daysToTake>
+ </xsl:when>
+ <xsl:when test="$ln='prescribedBy'"><xsl:comment> ++ indivo:Prescription/prescribedBy/name </xsl:comment>
+ <trans:prescribedBy><xsl:copy-of select="text()"/></trans:prescribedBy>
+ </xsl:when>
+ <xsl:when test="$ln='datePrescribed'">
+ <indivo:prescribedOn><xsl:copy-of select="text()"/></indivo:prescribedOn>
+ </xsl:when>
+ <xsl:when test="$ln='datePrescriptionEnded'">
+ <trans:datePrescriptionEnded><xsl:copy-of select="text()"/></trans:datePrescriptionEnded>
+ </xsl:when>
+ <xsl:when test="$ln='physicianNotes'">
+ <trans:physicianNotes><xsl:copy-of select="text()"/></trans:physicianNotes>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:apply-templates mode="pred" select="."/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:for-each>
+ </trans:Drug>
+ </xsl:template>
+
+ <xsl:template match="conditions">
+ <xsl:apply-templates mode="conditions"/>
+ </xsl:template>
+
+ <xsl:template mode="conditions" match="condition">
+ <rdf:Description rdf:about="#me">
+ <trans:hasCondition>
+ <trans:Condition>
+ <xsl:for-each select="*">
+ <xsl:variable name="ln" select="local-name()"/>
+ <xsl:choose>
+ <xsl:when test="$ln='diagnosedWith'"> <xsl:comment> ++ close to indivo:name </xsl:comment>
+ <trans:diagnosedWith><xsl:copy-of select="text()"/></trans:diagnosedWith>
+ </xsl:when>
+ <xsl:when test="$ln='ICD9'">
+ <trans:ICD9><xsl:copy-of select="text()"/></trans:ICD9>
+ </xsl:when>
+ <xsl:when test="$ln='dateDiagnosed'">
+ <trans:dateDiagnosed><xsl:copy-of select="text()"/></trans:dateDiagnosed>
+ </xsl:when>
+ <xsl:when test="$ln='diagnosedBy'">
+ <indivo:diagnosedBy><xsl:copy-of select="text()"/></indivo:diagnosedBy>
+ </xsl:when>
+ <xsl:when test="$ln='physicianNotes'">
+ <trans:physicianNotes><xsl:copy-of select="text()"/></trans:physicianNotes>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:apply-templates mode="pred" select="."/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:for-each>
+ </trans:Condition>
+ </trans:hasCondition>
+ </rdf:Description>
+ </xsl:template>
+
+
+ <xsl:template match="procedures">
+ <xsl:apply-templates mode="procedures"/>
+ </xsl:template>
+
+ <xsl:template mode="procedures" match="procedure">
+ <trans:Procedure>
+ <trans:performedOn rdf:resource="#me"/>
+ <xsl:for-each select="*">
+ <xsl:variable name="ln" select="local-name()"/>
+ <xsl:choose>
+ <xsl:when test="$ln='procedureName'"><xsl:comment> ++ close to indivo:Procedure/name </xsl:comment>
+ <trans:procedureName><xsl:copy-of select="text()"/></trans:procedureName>
+ </xsl:when>
+ <xsl:when test="$ln='ICD9'">
+ <trans:ICD9><xsl:copy-of select="text()"/></trans:ICD9>
+ </xsl:when>
+ <xsl:when test="$ln='ICD9_Procedure'">
+ <trans:ICD9procedure><xsl:copy-of select="text()"/></trans:ICD9procedure>
+ </xsl:when>
+ <xsl:when test="$ln='procedureDate'">
+ <indivo:datePerformed><xsl:copy-of select="text()"/></indivo:datePerformed>
+ </xsl:when>
+ <xsl:when test="$ln='procedureNotes'">
+ <trans:procedureNotes><xsl:copy-of select="text()"/></trans:procedureNotes>
+ </xsl:when>
+ <xsl:when test="$ln='referredBy'">
+ <trans:referredBy><xsl:copy-of select="text()"/></trans:referredBy>
+ </xsl:when>
+ <xsl:when test="$ln='referredInstitution'">
+ <trans:referredInstitution><xsl:copy-of select="text()"/></trans:referredInstitution>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:apply-templates mode="pred" select="."/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:for-each>
+ </trans:Procedure>
+ </xsl:template>
+
+
+ <xsl:template match="allergies">
+ <xsl:apply-templates mode="allergies"/>
+ </xsl:template>
+
+ <xsl:template mode="allergies" match="*">
+ <xsl:variable name="allergyType" select="local-name()"/>
+ <rdf:Description rdf:about="#me">
+ <trans:hasAllergy>
+ <trans:Allergy>
+ <trans:allergyType><xsl:value-of select="$allergyType"/></trans:allergyType>
+ <trans:allergyList><xsl:value-of select="text()"/></trans:allergyList>
+ </trans:Allergy>
+ </trans:hasAllergy>
+ </rdf:Description>
+ </xsl:template>
+
+
+ <xsl:template match="immunizations">
+ <xsl:apply-templates mode="immunizations"/>
+ </xsl:template>
+
+ <xsl:template mode="immunizations" match="*">
+ <xsl:variable name="disease" select="local-name()"/>
+ <rdf:Description rdf:about="#me">
+ <trans:immunization>
+ <trans:Immunization>
+ <trans:diseaseName><xsl:value-of select="$disease"/></trans:diseaseName>
+ <xsl:for-each select="*">
+ <xsl:variable name="ln" select="local-name()"/>
+ <xsl:choose>
+ <xsl:when test="$ln='date'">
+ <indivo:dateAdministered><xsl:copy-of select="text()"/></indivo:dateAdministered>
+ </xsl:when>
+ <xsl:when test="$ln='method'">
+ <trans:method><xsl:copy-of select="text()"/></trans:method>
+ </xsl:when>
+ <xsl:when test="$ln='compound'">
+ <trans:compound><xsl:copy-of select="text()"/></trans:compound>
+ </xsl:when>
+ <xsl:when test="$ln='stage'">
+ <trans:stage><xsl:copy-of select="text()"/></trans:stage>
+ </xsl:when>
+ <xsl:when test="$ln='administeredBy'">
+ <trans:administeredBy><xsl:copy-of select="text()"/></trans:administeredBy>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:apply-templates mode="pred" select="."/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:for-each>
+ </trans:Immunization>
+ </trans:immunization>
+ </rdf:Description>
+ </xsl:template>
+
+
+ <xsl:template match="lifestyle">
+ <xsl:apply-templates mode="lifestyle"/>
+ </xsl:template>
+
+ <xsl:template mode="lifestyle" match="*">
+ <xsl:variable name="behavoir" select="local-name()"/>
+ <rdf:Description rdf:about="#me">
+ <trans:behavoir>
+ <trans:Behavoir>
+ <trans:behavoirName><xsl:value-of select="$behavoir"/></trans:behavoirName>
+ <xsl:for-each select="*">
+ <xsl:variable name="ln" select="local-name()"/>
+ <xsl:choose>
+ <xsl:when test="$ln='frequency'">
+ <trans:frequency><xsl:copy-of select="text()"/></trans:frequency>
+ </xsl:when>
+ <xsl:when test="$ln='units'">
+ <trans:units><xsl:copy-of select="text()"/></trans:units>
+ </xsl:when>
+ <xsl:when test="$ln='quantity'">
+ <trans:quantity><xsl:copy-of select="text()"/></trans:quantity>
+ </xsl:when>
+ <xsl:when test="$ln='averageDuration'">
+ <trans:averageDuration><xsl:copy-of select="text()"/></trans:averageDuration>
+ </xsl:when>
+ <xsl:when test="$ln='packYears'">
+ <trans:packYears><xsl:copy-of select="text()"/></trans:packYears>
+ </xsl:when>
+ <xsl:when test="$ln='history'">
+ <trans:history><xsl:copy-of select="text()"/></trans:history>
+ </xsl:when>
+ <xsl:when test="$ln='fruitVegetablesRating'">
+ <trans:fruitVegetablesRating><xsl:copy-of select="text()"/></trans:fruitVegetablesRating>
+ </xsl:when>
+ <xsl:when test="$ln='wholeGrainsRating'">
+ <trans:wholeGrainsRating><xsl:copy-of select="text()"/></trans:wholeGrainsRating>
+ </xsl:when>
+ <xsl:when test="$ln='dairyRating'">
+ <trans:dairyRating><xsl:copy-of select="text()"/></trans:dairyRating>
+ </xsl:when>
+ <xsl:when test="$ln='proteinRating'">
+ <trans:proteinRating><xsl:copy-of select="text()"/></trans:proteinRating>
+ </xsl:when>
+ <xsl:when test="$ln='fatsRating'">
+ <trans:fatsRating><xsl:copy-of select="text()"/></trans:fatsRating>
+ </xsl:when>
+ <xsl:when test="$ln='junkFoodRating'">
+ <trans:junkFoodRating><xsl:copy-of select="text()"/></trans:junkFoodRating>
+ </xsl:when>
+ <xsl:when test="$ln='date'">
+ <trans:date><xsl:copy-of select="text()"/></trans:date>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:apply-templates mode="pred" select="."/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:for-each>
+ </trans:Behavoir>
+ </trans:behavoir>
+ </rdf:Description>
+ </xsl:template>
+
+
+ <xsl:template match="familyHistory">
+ <xsl:apply-templates mode="familyHistory"/>
+ </xsl:template>
+
+ <xsl:template mode="familyHistory" match="subject">
+ <rdf:Description rdf:about="#me">
+ <trans:relation>
+ <trans:Relation>
+ <xsl:for-each select="*">
+ <xsl:variable name="ln" select="local-name()"/>
+ <xsl:choose>
+ <xsl:when test="$ln='relation'">
+ <trans:relation><xsl:copy-of select="text()"/></trans:relation>
+ </xsl:when>
+ <xsl:when test="$ln='fname'">
+ <trans:fname><xsl:copy-of select="text()"/></trans:fname>
+ </xsl:when>
+ <xsl:when test="$ln='sex'">
+ <trans:sex><xsl:copy-of select="text()"/></trans:sex>
+ </xsl:when>
+ <xsl:when test="$ln='medicalConditions' and @x_1='RA'">
+ <xsl:comment>@@ x_1="RA", whatever that means</xsl:comment>
+ <trans:medicalConditions><xsl:copy-of select="text()"/></trans:medicalConditions>
+ </xsl:when>
+ <xsl:when test="$ln='alive'">
+ <trans:alive><xsl:copy-of select="text()"/></trans:alive>
+ </xsl:when>
+ <xsl:when test="$ln='ageAtDeath'">
+ <trans:ageAtDeath><xsl:copy-of select="text()"/></trans:ageAtDeath>
+ </xsl:when>
+ <xsl:when test="$ln='cancer'">
+ <trans:cancer><xsl:copy-of select="text()"/></trans:cancer>
+ </xsl:when>
+ <xsl:when test="$ln='cancerType'">
+ <trans:cancerType><xsl:copy-of select="text()"/></trans:cancerType>
+ </xsl:when>
+ <xsl:when test="$ln='cancerTypeColorectalAge'">
+ <trans:cancerTypeColorectalAge><xsl:copy-of select="text()"/></trans:cancerTypeColorectalAge>
+ </xsl:when>
+ <xsl:when test="$ln='causeOfDeath'">
+ <trans:causeOfDeath><xsl:copy-of select="text()"/></trans:causeOfDeath>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:apply-templates mode="pred" select="."/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:for-each>
+ </trans:Relation>
+ </trans:relation>
+ </rdf:Description>
+ </xsl:template>
+
+
+ <xsl:template match="Encounter">
+ <trans:Encounter>
+ <trans:patient rdf:resource="#me"/>
+ <trans:participant>
+ <trans:Participation>
+ <trans:role rdf:resource="tag:eric@w3.org:2009/tmo/translator#Patient"/>
+ <trans:persona rdf:resource="#me"/>
+ </trans:Participation>
+ </trans:participant>
+ <xsl:if test="physician">
+ <trans:participant>
+ <trans:Participation>
+ <trans:role rdf:resource="tag:eric@w3.org:2009/tmo/translator#Physician"/>
+ <trans:persona>
+ <foaf:Person>
+ <foaf:name><xsl:value-of select="physician"/></foaf:name>
+ </foaf:Person>
+ </trans:persona>
+ </trans:Participation>
+ </trans:participant>
+ </xsl:if>
+ <xsl:for-each select="*">
+ <xsl:variable name="ln" select="local-name()"/>
+ <xsl:choose>
+ <xsl:when test="$ln='dateOfEncounter'"><xsl:comment> indivo:Lab/dateMeasured </xsl:comment>
+ <trans:dateOfEncounter><xsl:copy-of select="text()"/></trans:dateOfEncounter>
+ </xsl:when>
+ <xsl:when test="$ln='physician'">
+ <trans:physician><xsl:copy-of select="text()"/></trans:physician>
+ </xsl:when>
+ <xsl:when test="$ln='referral'">
+ <trans:referral><xsl:copy-of select="text()"/></trans:referral>
+ </xsl:when>
+ <xsl:when test="$ln='medicalBaseline'">
+ <trans:medicalBaseline><xsl:copy-of select="text()"/></trans:medicalBaseline>
+ </xsl:when>
+ <xsl:when test="$ln='medicalTest'">
+ <trans:medicalTest><xsl:copy-of select="text()"/></trans:medicalTest>
+ </xsl:when>
+ <xsl:when test="$ln='reportedSymptoms'">
+ <trans:reportedSymptoms><xsl:copy-of select="text()"/></trans:reportedSymptoms>
+ </xsl:when>
+ <xsl:when test="$ln='workingDiagnosis'">
+ <trans:workingDiagnosis><xsl:copy-of select="text()"/></trans:workingDiagnosis>
+ </xsl:when>
+ <xsl:when test="$ln='physicalObservations'">
+ <trans:physicalObservations rdf:parseType="Resource">
+ <xsl:for-each select="*">
+ <xsl:variable name="obs" select="local-name()"/>
+ <xsl:choose>
+ <xsl:when test="$obs='bodyFat_x5'">
+ <trans:bodyFat_x5 rdf:parseType="Resource">
+ <xsl:for-each select="*">
+ <xsl:variable name="attr" select="local-name()"/>
+ <xsl:choose>
+ <xsl:when test="$attr='x6_bodyFat' and @units='percent'">
+ <trans:x6_bodyFat rdf:datatype="tag:eric@w3.org:2009/tmo/translator#percent"><xsl:copy-of select="text()"/></trans:x6_bodyFat>
+ </xsl:when>
+ <xsl:when test="$attr='weight' and @units='pounds'">
+ <trans:weight rdf:datatype="tag:eric@w3.org:2009/tmo/translator#pounds"><xsl:copy-of select="text()"/></trans:weight>
+ </xsl:when>
+ <xsl:when test="$attr='height' and @units='inches'">
+ <trans:height rdf:datatype="tag:eric@w3.org:2009/tmo/translator#inches"><xsl:copy-of select="text()"/></trans:height>
+ </xsl:when>
+ <xsl:when test="$attr='BMI' and @units='kg/m^2'">
+ <trans:BMI rdf:datatype="tag:eric@w3.org:2009/tmo/translator#kg/m^2"><xsl:copy-of select="text()"/></trans:BMI>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:apply-templates mode="pred" select="."/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:for-each>
+ </trans:bodyFat_x5>
+ </xsl:when>
+ <xsl:when test="$obs='waistToHips'">
+ <trans:waistToHips rdf:parseType="Resource">
+ <xsl:for-each select="*">
+ <xsl:variable name="attr" select="local-name()"/>
+ <xsl:choose>
+ <xsl:when test="$attr='waist' and @units='inches'">
+ <trans:waist rdf:datatype="tag:eric@w3.org:2009/tmo/translator#inches"><xsl:copy-of select="text()"/></trans:waist>
+ </xsl:when>
+ <xsl:when test="$attr='hips' and @units='inches'">
+ <trans:hips rdf:datatype="tag:eric@w3.org:2009/tmo/translator#inches"><xsl:copy-of select="text()"/></trans:hips>
+ </xsl:when>
+ <xsl:when test="$attr='waistToHips'">
+ <trans:waistToHips><xsl:copy-of select="text()"/></trans:waistToHips>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:apply-templates mode="pred" select="."/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:for-each>
+ </trans:waistToHips>
+ </xsl:when>
+ <xsl:when test="$obs='bloodPressure'">
+ <trans:bloodPressure rdf:parseType="Resource">
+ <xsl:for-each select="*">
+ <xsl:variable name="attr" select="local-name()"/>
+ <xsl:choose>
+ <xsl:when test="$attr='systolic' and @units='mmHg'">
+ <trans:systolic rdf:datatype="tag:eric@w3.org:2009/tmo/translator#mmHg"><xsl:copy-of select="text()"/></trans:systolic>
+ </xsl:when>
+ <xsl:when test="$attr='diastolic' and @units='mmHg'">
+ <trans:diastolic rdf:datatype="tag:eric@w3.org:2009/tmo/translator#mmHg"><xsl:copy-of select="text()"/></trans:diastolic>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:apply-templates mode="pred" select="."/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:for-each>
+ </trans:bloodPressure>
+ </xsl:when>
+ <xsl:when test="$obs='restingHeartRate'">
+ <trans:restingHeartRate rdf:parseType="Resource">
+ <xsl:for-each select="*">
+ <xsl:variable name="attr" select="local-name()"/>
+ <xsl:choose>
+ <xsl:when test="$attr='restingHeartRate' and @units='BPM'">
+ <trans:restingHeartRate rdf:datatype="tag:eric@w3.org:2009/tmo/translator#BPM"><xsl:copy-of select="text()"/></trans:restingHeartRate>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:apply-templates mode="pred" select="."/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:for-each>
+ </trans:restingHeartRate>
+ </xsl:when>
+ <xsl:when test="$obs='stamina'">
+ <trans:stamina rdf:parseType="Resource">
+ <xsl:for-each select="*">
+ <xsl:variable name="attr" select="local-name()"/>
+ <xsl:choose>
+ <xsl:when test="$attr='finalHeartRate' and @units='BPM'">
+ <trans:finalHeartRate rdf:datatype="tag:eric@w3.org:2009/tmo/translator#BPM"><xsl:copy-of select="text()"/></trans:finalHeartRate>
+ </xsl:when>
+ <xsl:when test="$attr='predictedVO2Max' and @units='ml/kg/min'">
+ <trans:predictedVO2Max rdf:datatype="tag:eric@w3.org:2009/tmo/translator#ml/kg/min"><xsl:copy-of select="text()"/></trans:predictedVO2Max>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:apply-templates mode="pred" select="."/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:for-each>
+ </trans:stamina>
+ </xsl:when>
+ <xsl:when test="$obs='lungFunction'">
+ <trans:lungFunction rdf:parseType="Resource">
+ <xsl:for-each select="*">
+ <xsl:variable name="attr" select="local-name()"/>
+ <xsl:choose>
+ <xsl:when test="$attr='PEFR' and @units='L/min'">
+ <trans:PEFR rdf:datatype="tag:eric@w3.org:2009/tmo/translator#L/min"><xsl:copy-of select="text()"/></trans:PEFR>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:apply-templates mode="pred" select="."/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:for-each>
+ </trans:lungFunction>
+ </xsl:when>
+ </xsl:choose>
+ </xsl:for-each>
+ </trans:physicalObservations>
+ </xsl:when>
+ <xsl:when test="$ln='test' and @x_2">
+ <trans:test rdf:parseType="Resource"><xsl:comment> ++ indivo:Lab/labPanel/labText or indivo:Lab/labPanel </xsl:comment>
+ <trans:testType>
+ <xsl:attribute namespace="http://www.w3.org/1999/02/22-rdf-syntax-ns#" name="resource">
+ <xsl:value-of select="concat('tag:eric@w3.org:2009/tmo/translator#', @x_2)"/>
+ </xsl:attribute>
+ </trans:testType>
+ <xsl:for-each select="*">
+ <xsl:variable name="testy" select="local-name()"/>
+ <xsl:choose>
+ <xsl:when test="$testy='CPT'">
+ <trans:CPT><xsl:copy-of select="text()"/></trans:CPT>
+ </xsl:when>
+ <xsl:when test="$testy='testName'"><xsl:comment> ++ indivo:Lab/labPanel/labText/name </xsl:comment>
+ <trans:testName><xsl:copy-of select="text()"/></trans:testName>
+ </xsl:when>
+ <xsl:when test="$testy='referredTo'">
+ <trans:referredTo><xsl:copy-of select="text()"/></trans:referredTo>
+ </xsl:when>
+ <xsl:when test="$testy='referredClinic'">
+ <trans:referredClinic><xsl:copy-of select="text()"/></trans:referredClinic>
+ </xsl:when>
+ <xsl:when test="$testy='referredBy'">
+ <trans:referredBy><xsl:copy-of select="text()"/></trans:referredBy>
+ </xsl:when>
+ <xsl:when test="$testy='originalImage'">
+ <trans:originalImage><xsl:copy-of select="text()"/></trans:originalImage>
+ </xsl:when>
+ <xsl:when test="@CPT"> <!-- !! and [testCode] -->
+ <trans:testSet>
+ <xsl:element name="{$testy}" namespace="tag:eric@w3.org:2009/tmo/translator#">
+ <trans:x_3><xsl:value-of select="@CPT"/></trans:x_3>
+ <xsl:apply-templates mode="testCodes"/>
+ </xsl:element>
+ </trans:testSet>
+ </xsl:when>
+ <xsl:when test="$testy='result'">
+ <trans:result rdf:parseType="Resource">
+ <xsl:for-each select="*">
+ <xsl:variable name="leaf" select="local-name()"/>
+ <xsl:choose>
+ <xsl:when test="$leaf='value'">
+ <trans:value><xsl:copy-of select="text()"/></trans:value>
+ </xsl:when>
+ <xsl:when test="$leaf='rs_Number'">
+ <trans:rs_Number><xsl:copy-of select="text()"/></trans:rs_Number>
+ </xsl:when>
+ <xsl:when test="$leaf='variant_Synonyms'">
+ <trans:variant_Synonyms><xsl:copy-of select="text()"/></trans:variant_Synonyms>
+ </xsl:when>
+ <xsl:when test="$leaf='gene_Symbol'">
+ <trans:gene_Symbol><xsl:copy-of select="text()"/></trans:gene_Symbol>
+ </xsl:when>
+ <xsl:when test="$leaf='gene_Name'">
+ <trans:gene_Name><xsl:copy-of select="text()"/></trans:gene_Name>
+ </xsl:when>
+ <xsl:when test="$leaf='ENTREZ_Gene_ID'">
+ <trans:ENTREZ_Gene_ID><xsl:copy-of select="text()"/></trans:ENTREZ_Gene_ID>
+ </xsl:when>
+ <xsl:when test="$leaf='Accession_ID'">
+ <trans:Accession_ID><xsl:copy-of select="text()"/></trans:Accession_ID>
+ </xsl:when>
+ <xsl:when test="$leaf='Gene_Region'">
+ <trans:Gene_Region><xsl:copy-of select="text()"/></trans:Gene_Region>
+ </xsl:when>
+ <xsl:when test="$leaf='DNA_Change'">
+ <trans:DNA_Change><xsl:copy-of select="text()"/></trans:DNA_Change>
+ </xsl:when>
+ <xsl:when test="$leaf='DNA_Change_Type'">
+ <trans:DNA_Change_Type><xsl:copy-of select="text()"/></trans:DNA_Change_Type>
+ </xsl:when>
+ <xsl:when test="$leaf='Amino_Acid_Change'">
+ <trans:Amino_Acid_Change><xsl:copy-of select="text()"/></trans:Amino_Acid_Change>
+ </xsl:when>
+ <xsl:when test="$leaf='Amino_Acid_Change_Type'">
+ <trans:Amino_Acid_Change_Type><xsl:copy-of select="text()"/></trans:Amino_Acid_Change_Type>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:apply-templates mode="pred" select="."/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:for-each>
+ </trans:result>
+ </xsl:when>
+ <xsl:when test="$testy='physicianNotes'">
+ <trans:physicianNotes><xsl:copy-of select="text()"/></trans:physicianNotes>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:apply-templates mode="pred" select="."/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:for-each>
+ </trans:test>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:apply-templates mode="pred" select="."/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:for-each>
+ </trans:Encounter>
+ </xsl:template>
+
+
+ <xsl:template mode="testCodes" match="testCode">
+ <trans:testCode rdf:parseType="Resource">
+ <trans:x_3><xsl:value-of select="@x_3"/></trans:x_3>
+ <xsl:for-each select="*">
+ <xsl:variable name="ln" select="local-name()"/>
+ <xsl:choose>
+ <xsl:when test="$ln='CPT'">
+ <trans:CPT><xsl:copy-of select="text()"/></trans:CPT>
+ </xsl:when>
+ <xsl:when test="$ln='LOINC'">
+ <trans:LOINC><xsl:copy-of select="text()"/></trans:LOINC>
+ </xsl:when>
+ <xsl:when test="$ln='description'">
+ <trans:description><xsl:copy-of select="text()"/></trans:description>
+ </xsl:when>
+ <xsl:when test="$ln='value'">
+ <trans:value><xsl:copy-of select="text()"/></trans:value>
+ </xsl:when>
+ <xsl:when test="$ln='units'">
+ <trans:units><xsl:copy-of select="text()"/></trans:units>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:apply-templates mode="pred" select="."/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:for-each>
+ </trans:testCode>
+ </xsl:template>
+
+
+ <!-- note misparses -->
+
+ <xsl:template mode="pred" match="*">
+ <trans:misParse>
+ <xsl:apply-templates mode="misparse" select="."/>
+ </trans:misParse>
+ </xsl:template>
+
+ <xsl:template match="*">
+ <rdf:Description>
+ <trans:misParse>
+ <xsl:apply-templates mode="misparse" select="."/>
+ </trans:misParse>
+ </rdf:Description>
+ </xsl:template>
+
+ <xsl:template mode="misparse" match="@*">
+ <xsl:text> </xsl:text>
+ <xsl:value-of select="local-name()"/>
+ <xsl:text>="</xsl:text>
+ <xsl:value-of select="."/>
+ <xsl:text>"</xsl:text>
+ </xsl:template>
+
+ <xsl:template mode="misparse" match="text()">
+ <xsl:copy-of select="."/>
+ </xsl:template>
+
+ <xsl:template mode="misparse" match="*">
+ <xsl:variable name="ln" select="local-name()"/>
+ <xsl:choose>
+ <xsl:when test="count(*)=0">
+ <xsl:text><</xsl:text>
+ <xsl:value-of select="$ln"/>
+ <xsl:apply-templates mode="misparse" select="@*"/>
+ <xsl:text>></xsl:text>
+ <xsl:copy-of select="text()"/>
+ <xsl:text></</xsl:text>
+ <xsl:value-of select="$ln"/>
+ <xsl:text>></xsl:text>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:text><</xsl:text>
+ <xsl:value-of select="$ln"/>
+ <xsl:apply-templates mode="misparse" select="@*"/>
+ <xsl:text>></xsl:text>
+ <xsl:apply-templates mode="misparse" select="node()"/>
+ <xsl:text></</xsl:text>
+ <xsl:value-of select="$ln"/>
+ <xsl:text>></xsl:text>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+
+</xsl:stylesheet>
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/syntheticPatients/xerces2val.java Wed Jul 07 15:26:14 2010 -0400
@@ -0,0 +1,21 @@
+// simple command-line interface to xerces 2 schema validation
+
+import java.io.*;
+import javax.xml.transform.Source;
+import javax.xml.transform.stream.StreamSource;
+import javax.xml.validation.Schema;
+import javax.xml.validation.SchemaFactory;
+import javax.xml.validation.Validator;
+
+class xerces2val {
+ public static void main(String[] args) throws org.xml.sax.SAXException, java.io.IOException {
+
+ StreamSource[] schemaDocuments = {new StreamSource(new File(args[0]))};
+ Source instanceDocument = new StreamSource(new File(args[1]));
+ SchemaFactory sf = SchemaFactory.newInstance("http://www.w3.org/2001/XMLSchema");
+ Schema s = sf.newSchema(schemaDocuments);
+ Validator v = s.newValidator();
+ v.validate(instanceDocument);
+
+ }
+}