+ p1 q1
authorEric Prud'hommeaux <eric@w3.org>
Mon, 04 Oct 2010 11:47:45 -0400
changeset 21 91ec57b253d1
parent 20 a78609605d19
child 22 ab7272a2a335
+ p1 q1
syntheticPatients/AD_PCHR_1-indivo.xml
syntheticPatients/AD_PCHR_1-tmo.trig
syntheticPatients/AD_PCHR_1.xml
syntheticPatients/Indivo2Trig.xsl
syntheticPatients/Makefile
syntheticPatients/tests/q1.rq
syntheticPatients/tests/q1_1.srt
--- a/syntheticPatients/AD_PCHR_1-indivo.xml	Sun Oct 03 23:05:34 2010 -0400
+++ b/syntheticPatients/AD_PCHR_1-indivo.xml	Mon Oct 04 11:47:45 2010 -0400
@@ -544,19 +544,12 @@
    </Encounter>
    <Encounter>
       <Date>2009-07-15</Date>
-      <Date>2009-07-16</Date>
       <Contact>
          <fullName>Henry No</fullName>
       </Contact>
-      <Contact>
-         <fullName>Mark Tourney</fullName>
-      </Contact>
-      <MedicalBaseline>false</MedicalBaseline>
       <MedicalBaseline>false</MedicalBaseline>
       <MedicalTest>false</MedicalTest>
-      <MedicalTest>true</MedicalTest>
       <ReportedSymptoms>Confusion, Declining memory</ReportedSymptoms>
-      <ReportedSymptoms> Confusion, Declining memory </ReportedSymptoms>
       <WorkingDiagnosis>
          <PreliminaryDiagnosis>
             <DiagnosisDescription>Dementia</DiagnosisDescription>
@@ -566,6 +559,16 @@
          <DifferentialDiagnosis>
        </DifferentialDiagnosis>
       </WorkingDiagnosis>
+      <LabTests/>
+   </Encounter>
+   <Encounter>
+      <Date>2009-07-16</Date>
+      <Contact>
+         <fullName>Mark Tourney</fullName>
+      </Contact>
+      <MedicalBaseline>false</MedicalBaseline>
+      <MedicalTest>true</MedicalTest>
+      <ReportedSymptoms> Confusion, Declining memory </ReportedSymptoms>
       <WorkingDiagnosis>
          <PreliminaryDiagnosis>
             <DiagnosisDescription>Dementia</DiagnosisDescription>
@@ -579,7 +582,7 @@
       </WorkingDiagnosis>
       <LabTests>
          <Test>
-            <dateMeasured>2009-07-15</dateMeasured>
+            <dateMeasured>2009-07-16</dateMeasured>
             <name>Other psychologic evaluation and testing</name>
             <HCLSresult>
                <LabTest>
@@ -589,7 +592,7 @@
             <status>@@@</status>
          </Test>
          <Test>
-            <dateMeasured>2009-07-15</dateMeasured>
+            <dateMeasured>2009-07-16</dateMeasured>
             <name>Magnetic resonance imaging of brain and brain</name>
             <HCLSresult>
                <LabTest>
@@ -599,12 +602,12 @@
             <status>@@@</status>
          </Test>
          <Test>
-            <dateMeasured>2009-07-15</dateMeasured>
+            <dateMeasured>2009-07-16</dateMeasured>
             <name>Blood count; complete (CBC), automated (Hgb, Hct, RBC, WBC and platelet count) and automated differential WBC count</name>
             <status>@@@</status>
          </Test>
          <Test>
-            <dateMeasured>2009-07-15</dateMeasured>
+            <dateMeasured>2009-07-16</dateMeasured>
             <name>ADmark Alzheimer's Evaluation</name>
             <SNPresult>
                <LabTest>
--- a/syntheticPatients/AD_PCHR_1-tmo.trig	Sun Oct 03 23:05:34 2010 -0400
+++ b/syntheticPatients/AD_PCHR_1-tmo.trig	Mon Oct 04 11:47:45 2010 -0400
@@ -42,41 +42,43 @@
 
   [ a trans:Prescription ;
     trans:prescribedTo _:patient ;
-    trans:prescribedOn "2009-05-15"^^xsd:dateTime ; 
+    trans:prescribedOn "2009-05-15" ; 
 
     trans:genericName "COREG TABLETS" ;    
   ] .
 
   [ a trans:Prescription ;
     trans:prescribedTo _:patient ;
-    trans:prescribedOn "2009-05-20"^^xsd:dateTime ; 
+    trans:prescribedOn "2009-05-20" ; 
 
     trans:genericName "LIPITOR TABLETS" ;    
   ] .
 
   [ a trans:Prescription ;
     trans:prescribedTo _:patient ;
-    trans:prescribedOn "2009-05-20"^^xsd:dateTime ; 
+    trans:prescribedOn "2009-05-20" ; 
 
     trans:genericName "COUMADIN TABLETS" ;    
   ] .
 
   [ a trans:Prescription ;
     trans:prescribedTo _:patient ;
-    trans:prescribedOn "2009-08-10"^^xsd:dateTime ; 
+    trans:prescribedOn "2009-08-10" ; 
+ 
+    trans:datePrescriptionEnded "2009-08-15" ;
 
     trans:genericName "DONEPEZIL HYDROCHLORIDE TABLETS" ;    
   ] .
 
   [ a trans:Prescription ;
     trans:prescribedTo _:patient ;
-    trans:prescribedOn "2009-08-15"^^xsd:dateTime ; 
+    trans:prescribedOn "2009-08-15" ; 
 
     trans:genericName "ARICEPT TABLETS ORALLY DISINTEGRATING" ;    
   ] .
 
   _:patient trans:hasCondition [
-  trans:onset "2009-05-15T12:00:00"^^xsd:dateTime ;
+  trans:onset "2009-05-15T12:00:00" ;
 
   trans:diagnosedWith "hypertension" ;
 
@@ -85,7 +87,7 @@
   ] .
 
   _:patient trans:hasCondition [
-  trans:onset "2009-05-20T12:00:00"^^xsd:dateTime ;
+  trans:onset "2009-05-20T12:00:00" ;
 
   trans:diagnosedWith "hypercholesterolaemia" ;
 
@@ -94,7 +96,7 @@
   ] .
 
   _:patient trans:hasCondition [
-  trans:onset "2009-05-20T12:00:00"^^xsd:dateTime ;
+  trans:onset "2009-05-20T12:00:00" ;
 
   trans:diagnosedWith "atrial fibrillation" ;
 
@@ -103,7 +105,7 @@
   ] .
 
   _:patient trans:hasCondition [
-  trans:onset "2009-08-10T12:00:00"^^xsd:dateTime ;
+  trans:onset "2009-08-10T12:00:00" ;
 
   trans:diagnosedWith "alzheimer’s disease" ;
 
@@ -113,7 +115,7 @@
 
   [ a trans:Encounter ;
     trans:patient _:patient ;
-    trans:dateOfEncounter "2009-05-15"^^xsd:dateTime ;
+    trans:dateOfEncounter "2009-05-15" ;
 
     trans:workingDiagnosis "false" ;
 
@@ -123,7 +125,7 @@
 
   [ a trans:Encounter ;
     trans:patient _:patient ;
-    trans:dateOfEncounter "2009-05-17"^^xsd:dateTime ;
+    trans:dateOfEncounter "2009-05-17" ;
 
     trans:workingDiagnosis "atrial fibrillation" ;
 
@@ -133,7 +135,7 @@
 
   [ a trans:Encounter ;
     trans:patient _:patient ;
-    trans:dateOfEncounter "2009-05-18"^^xsd:dateTime ;
+    trans:dateOfEncounter "2009-05-18" ;
 
     trans:workingDiagnosis "atrial fibrillation" ;
 
@@ -143,17 +145,7 @@
 
   [ a trans:Encounter ;
     trans:patient _:patient ;
-    trans:dateOfEncounter "2009-05-20"^^xsd:dateTime ;
-
-    trans:workingDiagnosis "none" ;
-
-    trans:reportedSymptoms "none"
-    
-  ] .
-
-  [ a trans:Encounter ;
-    trans:patient _:patient ;
-    trans:dateOfEncounter "2009-06-03"^^xsd:dateTime ;
+    trans:dateOfEncounter "2009-05-20" ;
 
     trans:workingDiagnosis "none" ;
 
@@ -163,7 +155,7 @@
 
   [ a trans:Encounter ;
     trans:patient _:patient ;
-    trans:dateOfEncounter "2009-07-03"^^xsd:dateTime ;
+    trans:dateOfEncounter "2009-06-03" ;
 
     trans:workingDiagnosis "none" ;
 
@@ -173,9 +165,17 @@
 
   [ a trans:Encounter ;
     trans:patient _:patient ;
-    trans:dateOfEncounter "2009-07-15"^^xsd:dateTime ;
+    trans:dateOfEncounter "2009-07-03" ;
 
-    trans:workingDiagnosis "Dementia" ;
+    trans:workingDiagnosis "none" ;
+
+    trans:reportedSymptoms "none"
+    
+  ] .
+
+  [ a trans:Encounter ;
+    trans:patient _:patient ;
+    trans:dateOfEncounter "2009-07-15" ;
 
     trans:workingDiagnosis "Dementia" ;
 
@@ -185,7 +185,17 @@
 
   [ a trans:Encounter ;
     trans:patient _:patient ;
-    trans:dateOfEncounter "2009-08-03"^^xsd:dateTime ;
+    trans:dateOfEncounter "2009-07-16" ;
+
+    trans:workingDiagnosis "Dementia" ;
+
+    trans:reportedSymptoms " Confusion, Declining memory "
+    
+  ] .
+
+  [ a trans:Encounter ;
+    trans:patient _:patient ;
+    trans:dateOfEncounter "2009-08-03" ;
 
     trans:workingDiagnosis "false" ;
 
@@ -195,7 +205,7 @@
 
   [ a trans:Encounter ;
     trans:patient _:patient ;
-    trans:dateOfEncounter "2009-08-15"^^xsd:dateTime ;
+    trans:dateOfEncounter "2009-08-15" ;
 
     trans:workingDiagnosis "adverse event to Donepezil" ;
 
@@ -205,7 +215,7 @@
 
   [ a trans:Encounter ;
     trans:patient _:patient ;
-    trans:dateOfEncounter "2009-11-03"^^xsd:dateTime ;
+    trans:dateOfEncounter "2009-11-03" ;
 
     trans:workingDiagnosis "false" ;
 
--- a/syntheticPatients/AD_PCHR_1.xml	Sun Oct 03 23:05:34 2010 -0400
+++ b/syntheticPatients/AD_PCHR_1.xml	Mon Oct 04 11:47:45 2010 -0400
@@ -860,6 +860,9 @@
        </differentialDiagnosis>
     </workingDiagnosis>
 
+<!-- I *think* this was supposed to be two encounters. -->
+</Encounter>
+<Encounter>
 
 <dateOfEncounter>2009-07-16</dateOfEncounter>
     <physician>Mark Tourney</physician>
--- a/syntheticPatients/Indivo2Trig.xsl	Sun Oct 03 23:05:34 2010 -0400
+++ b/syntheticPatients/Indivo2Trig.xsl	Mon Oct 04 11:47:45 2010 -0400
@@ -86,9 +86,9 @@
 <xsl:template match="in:Prescription">
   [ a trans:Prescription ;
     trans:prescribedTo _:patient ;
-    trans:prescribedOn "<xsl:value-of select="in:medication/in:dateStarted"/>"^^xsd:dateTime ; <!-- trans:dateStarted -->
-<xsl:if test="in:medication/dateStopped"> 
-    trans:datePrescriptionEnded "<xsl:value-of select="in:medication/in:dateStopped"/>"^^xsd:dateTime ;
+    trans:prescribedOn <xsl:apply-templates mode="date" select="in:medication/in:dateStarted"/> ; <!-- trans:dateStarted -->
+<xsl:if test="in:medication/in:dateStopped"> 
+    trans:datePrescriptionEnded <xsl:apply-templates mode="date" select="in:medication/in:dateStopped"/> ;
 </xsl:if>
     trans:genericName "<xsl:value-of select="in:medication/in:genericName"/>" ;    
   ] .
@@ -104,7 +104,7 @@
 </xsl:template>
 
 <xsl:template mode="problem" match="in:dateOnset">
-  trans:onset "<xsl:value-of select="text()"/>"^^xsd:dateTime ;
+  trans:onset <xsl:apply-templates mode="date" select="."/> ;
 </xsl:template>
 
 <xsl:template mode="problem" match="in:name">
@@ -118,7 +118,7 @@
 <xsl:template match="in:Encounter">
   [ a trans:Encounter ;
     trans:patient _:patient ;
-    trans:dateOfEncounter "<xsl:value-of select="in:Date/text()"/>"^^xsd:dateTime ;
+    trans:dateOfEncounter <xsl:apply-templates mode="date" select="in:Date"/> ;
 <xsl:apply-templates select="in:WorkingDiagnosis/in:PreliminaryDiagnosis"/>
     trans:reportedSymptoms "<xsl:value-of select="in:ReportedSymptoms/text()"/>"
     
@@ -129,4 +129,9 @@
     trans:workingDiagnosis "<xsl:value-of select="in:DiagnosisDescription/text()"/>" ;
 </xsl:template>
 
+<!-- Utility templates
+-->
+
+<xsl:template mode="date" match="*">"<xsl:value-of select="text()"/>"<!-- ^^xsd:dateTime --></xsl:template>
+
 </xsl:stylesheet>
\ No newline at end of file
--- a/syntheticPatients/Makefile	Sun Oct 03 23:05:34 2010 -0400
+++ b/syntheticPatients/Makefile	Mon Oct 04 11:47:45 2010 -0400
@@ -51,7 +51,7 @@
 	$(SPARQL) -qd $(word 1, $^) -e 'PREFIX foaf: <http://xmlns.com/foaf/0.1/> SELECT ?mbox { ?s foaf:mbox ?mbox }' --compare $(word 2, $^) || echo $<\(0\): error !mbox
 
 q1_%: AD_PCHR_%-tmo.trig tests/q1.rq tests/q1_%.srt
-	$(SPARQL) -g pchr $(word 1, $^) $(word 2, $^) --compare $(word 3, $^) || echo $<\(0\): error !q1
+	$(SPARQL) -qg pchr $(word 1, $^) $(word 2, $^) --compare $(word 3, $^) || echo $<\(0\): error !q1
 
 test: all $(MBOXES) $(Q1S)
 
--- a/syntheticPatients/tests/q1.rq	Sun Oct 03 23:05:34 2010 -0400
+++ b/syntheticPatients/tests/q1.rq	Mon Oct 04 11:47:45 2010 -0400
@@ -12,9 +12,9 @@
             trans:dateOfEncounter ?encounter_date .
  ?drug trans:prescribedTo ?patient ; # dateStarted
        trans:prescribedOn ?prescription_start;
-#       trans:datePrescriptionEnded ?prescription_end;
-#       trans:genericName ?drug_name
-# FILTER regex(?drug_name,"DONEPEZIL","i").
-# FILTER (?prescription_start <= ?encounter_date && ?prescription_end >= ?encounter_date)
+       trans:datePrescriptionEnded ?prescription_end;
+       trans:genericName ?drug_name
+ FILTER regex(?drug_name,"DONEPEZIL","i").
+ FILTER (?prescription_start <= ?encounter_date && ?prescription_end >= ?encounter_date)
  }   
 }
--- a/syntheticPatients/tests/q1_1.srt	Sun Oct 03 23:05:34 2010 -0400
+++ b/syntheticPatients/tests/q1_1.srt	Mon Oct 04 11:47:45 2010 -0400
@@ -1,4 +1,4 @@
-+--------------------+----------------------+-----------------+-----------+------------------------------+-----------------------------------+---------------------+
-| ?patient           | ?patient_name        | ?encounter_date | ?symptoms | ?diagnosis                   | ?drug_name                        | ?prescription_start |
-| <AD_PCHR_1.rdf#me> | "George Andrew Tour" |    "2009-08-15" |  "nausea" | "adverse event to Donepezil" | "DONEPEZIL HYDROCHLORIDE TABLETS" |        "2009-08-10" |
-+--------------------+----------------------+-----------------+-----------+------------------------------+-----------------------------------+---------------------+
++----------+----------------------+-----------------+-----------+------------------------------+-----------------------------------+---------------------+
+| ?patient | ?patient_name        | ?encounter_date | ?symptoms | ?diagnosis                   | ?drug_name                        | ?prescription_start |
+| _:x      | "George Andrew Tour" |    "2009-08-15" |  "nausea" | "adverse event to Donepezil" | "DONEPEZIL HYDROCHLORIDE TABLETS" |        "2009-08-10" |
++----------+----------------------+-----------------+-----------+------------------------------+-----------------------------------+---------------------+