+ q8
authorEric Prud'hommeaux <eric@w3.org>
Thu, 07 Oct 2010 03:35:00 -0400
changeset 30 d5cb0312ef53
parent 29 aead6064834c
child 31 adb31ffd0258
+ q8
syntheticPatients/AD_PCHR_1-tmo.trig
syntheticPatients/AD_PCHR_2-tmo.trig
syntheticPatients/AD_PCHR_3-tmo.trig
syntheticPatients/AD_PCHR_4-tmo.trig
syntheticPatients/AD_PCHR_5-tmo.trig
syntheticPatients/AD_PCHR_6-tmo.trig
syntheticPatients/AD_PCHR_7-tmo.trig
syntheticPatients/Indivo2Trig.xsl
syntheticPatients/Makefile
syntheticPatients/tests/q8.rq
syntheticPatients/tests/q8_1.srt
syntheticPatients/tests/q8_2.srt
syntheticPatients/tests/q8_3.srt
syntheticPatients/tests/q8_4.srt
syntheticPatients/tests/q8_5.srt
syntheticPatients/tests/q8_6.srt
syntheticPatients/tests/q8_7.srt
--- a/syntheticPatients/AD_PCHR_1-tmo.trig	Thu Oct 07 03:06:28 2010 -0400
+++ b/syntheticPatients/AD_PCHR_1-tmo.trig	Thu Oct 07 03:35:00 2010 -0400
@@ -41,6 +41,11 @@
       
   . 
 
+_:patient trans:demographics [
+    indivo:dateOfBirth "1934-05-15" ;
+    indivo:gender "Male" ;
+] .
+
   [ a trans:Prescription ;
     trans:prescribedTo _:patient ;
     indivo:prescribedOn "2009-05-15" ; 
--- a/syntheticPatients/AD_PCHR_2-tmo.trig	Thu Oct 07 03:06:28 2010 -0400
+++ b/syntheticPatients/AD_PCHR_2-tmo.trig	Thu Oct 07 03:35:00 2010 -0400
@@ -40,6 +40,11 @@
       
   . 
 
+_:patient trans:demographics [
+    indivo:dateOfBirth "1937-05-15" ;
+    indivo:gender "Female" ;
+] .
+
   [ a trans:Prescription ;
     trans:prescribedTo _:patient ;
     indivo:prescribedOn "2007-07-20" ; 
--- a/syntheticPatients/AD_PCHR_3-tmo.trig	Thu Oct 07 03:06:28 2010 -0400
+++ b/syntheticPatients/AD_PCHR_3-tmo.trig	Thu Oct 07 03:35:00 2010 -0400
@@ -38,6 +38,11 @@
       
   . 
 
+_:patient trans:demographics [
+    indivo:dateOfBirth "1946-12-07" ;
+    indivo:gender "Male" ;
+] .
+
   [ a trans:Prescription ;
     trans:prescribedTo _:patient ;
     indivo:prescribedOn "2005-07-09" ; 
--- a/syntheticPatients/AD_PCHR_4-tmo.trig	Thu Oct 07 03:06:28 2010 -0400
+++ b/syntheticPatients/AD_PCHR_4-tmo.trig	Thu Oct 07 03:35:00 2010 -0400
@@ -41,6 +41,11 @@
       
   . 
 
+_:patient trans:demographics [
+    indivo:dateOfBirth "1931-09-12" ;
+    indivo:gender "Male" ;
+] .
+
   [ a trans:Prescription ;
     trans:prescribedTo _:patient ;
     indivo:prescribedOn "1989-05-15" ; 
--- a/syntheticPatients/AD_PCHR_5-tmo.trig	Thu Oct 07 03:06:28 2010 -0400
+++ b/syntheticPatients/AD_PCHR_5-tmo.trig	Thu Oct 07 03:35:00 2010 -0400
@@ -41,6 +41,11 @@
       
   . 
 
+_:patient trans:demographics [
+    indivo:dateOfBirth "1945-04-05" ;
+    indivo:gender "Male" ;
+] .
+
   [ a trans:Prescription ;
     trans:prescribedTo _:patient ;
     indivo:prescribedOn "2008-02-03" ; 
--- a/syntheticPatients/AD_PCHR_6-tmo.trig	Thu Oct 07 03:06:28 2010 -0400
+++ b/syntheticPatients/AD_PCHR_6-tmo.trig	Thu Oct 07 03:35:00 2010 -0400
@@ -41,6 +41,11 @@
       
   . 
 
+_:patient trans:demographics [
+    indivo:dateOfBirth "1940-01-01" ;
+    indivo:gender "Female" ;
+] .
+
   [ a trans:Prescription ;
     trans:prescribedTo _:patient ;
     indivo:prescribedOn "2009-07-20>" ; 
--- a/syntheticPatients/AD_PCHR_7-tmo.trig	Thu Oct 07 03:06:28 2010 -0400
+++ b/syntheticPatients/AD_PCHR_7-tmo.trig	Thu Oct 07 03:35:00 2010 -0400
@@ -41,6 +41,11 @@
       
   . 
 
+_:patient trans:demographics [
+    indivo:dateOfBirth "1978-01-31" ;
+    indivo:gender "Female" ;
+] .
+
   _:patient trans:hasCondition [
   trans:onset "1978-01-31T12:00:00" ;
 
--- a/syntheticPatients/Indivo2Trig.xsl	Thu Oct 07 03:06:28 2010 -0400
+++ b/syntheticPatients/Indivo2Trig.xsl	Thu Oct 07 03:35:00 2010 -0400
@@ -25,7 +25,7 @@
 <xsl:template match="in:CurrentStatus">
   <xsl:apply-templates select="in:Contact"/>
   <xsl:apply-templates select="in:PrimaryCarePhysician"/>
-  <!-- xsl:apply-templates select="in:Demographics"/ -->
+  <xsl:apply-templates select="in:Demographics"/>
   <xsl:apply-templates select="in:Prescriptions"/>
   <xsl:apply-templates select="in:Conditions"/>
   <!-- xsl:apply-templates select="in:Procedures"/ -->
@@ -49,6 +49,13 @@
   </xsl:call-template>
 </xsl:template>
 
+<xsl:template match="in:Demographics">
+_:patient trans:demographics [
+    indivo:dateOfBirth <xsl:apply-templates mode="date" select="in:dateOfBirth"/> ;
+    indivo:gender "<xsl:value-of select="in:gender/text()"/>" ;
+] .
+</xsl:template>
+
 <xsl:template name="contact">
   <xsl:param name="subject"/>
   <xsl:param name="type"/>
--- a/syntheticPatients/Makefile	Thu Oct 07 03:06:28 2010 -0400
+++ b/syntheticPatients/Makefile	Thu Oct 07 03:35:00 2010 -0400
@@ -46,6 +46,7 @@
 Q1S := $(subst AD_PCHR_, q1_, $(INPUTLIST))
 Q4S := $(subst AD_PCHR_, q4_, $(INPUTLIST))
 Q6S := $(subst AD_PCHR_, q6_, $(INPUTLIST))
+Q8S := $(subst AD_PCHR_, q8_, $(INPUTLIST))
 #$(error TMOLIST: $(TMOLIST))
 
 mbox_%: AD_PCHR_%-tmo.trig tests/email_%.srt
@@ -60,6 +61,9 @@
 q6_%: AD_PCHR_%-tmo.trig tests/q6.rq tests/q6_%.srt
 	$(SPARQL) -qd $(word 1, $^) $(word 2, $^) --compare $(word 3, $^) || echo $<:0: error: data\\n$(word 2, $^):0: note: query\\n$(word 3, $^):0: note: expected results
 
+q8_%: AD_PCHR_%-tmo.trig tests/q8.rq tests/q8_%.srt
+	$(SPARQL) -qg pchr $(word 1, $^) $(word 2, $^) --compare $(word 3, $^) || echo $<:0: error: data\\n$(word 2, $^):0: note: query\\n$(word 3, $^):0: note: expected results
+
 test: all $(MBOXES) $(Q1S) $(Q4S) $(Q6S)
 
 clean:
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/syntheticPatients/tests/q8.rq	Thu Oct 07 03:35:00 2010 -0400
@@ -0,0 +1,30 @@
+PREFIX indivo: <http://indivo.org/vocab/xml/documents#>
+PREFIX trans: <tag:eric@w3.org:2009/tmo/translator#>
+PREFIX foaf: <http://xmlns.com/foaf/0.1/>
+SELECT distinct(?patient_name) ?dob ?gender
+WHERE {
+ graph <pchr> 
+{
+ ?patient foaf:name ?patient_name .
+ ?patient trans:demographics ?demographics .
+# female
+ ?demographics indivo:gender ?gender .
+  FILTER(?gender = "Female").
+# age > 55 ; would have been born in 1954
+ ?demographics indivo:dateOfBirth ?dob .
+ FILTER (?dob < "1954-01-01")
+
+# apoe variant
+  [] trans:patient ?patient ;
+     trans:test [ trans:result [ trans:variant_Synonyms ?synonyms ] ]
+  FILTER (regex (?synonyms, "APOE4")) .
+
+# low ADAS COG score : Alzheimer's Disease Assessment Scale-cognitive subscale
+# trans:testName "Alzheimer's Disease Assessment Scale-cognitive subscale" ;
+#  [] trans:patient ?patient ;
+#     trans:test [ trans:CPT "97532"; 
+#                  trans:result [ ?p ?stuff] 
+#                                     ].
+
+}  
+}
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/syntheticPatients/tests/q8_1.srt	Thu Oct 07 03:35:00 2010 -0400
@@ -0,0 +1,3 @@
++---------------+------+---------+
+| ?patient_name | ?dob | ?gender |
++---------------+------+---------+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/syntheticPatients/tests/q8_2.srt	Thu Oct 07 03:35:00 2010 -0400
@@ -0,0 +1,4 @@
++--------------------+--------------+----------+
+| ?patient_name      | ?dob         | ?gender  |
+| "Monica Mary Mall" | "1937-05-15" | "Female" |
++--------------------+--------------+----------+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/syntheticPatients/tests/q8_3.srt	Thu Oct 07 03:35:00 2010 -0400
@@ -0,0 +1,3 @@
++---------------+------+---------+
+| ?patient_name | ?dob | ?gender |
++---------------+------+---------+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/syntheticPatients/tests/q8_4.srt	Thu Oct 07 03:35:00 2010 -0400
@@ -0,0 +1,3 @@
++---------------+------+---------+
+| ?patient_name | ?dob | ?gender |
++---------------+------+---------+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/syntheticPatients/tests/q8_5.srt	Thu Oct 07 03:35:00 2010 -0400
@@ -0,0 +1,3 @@
++---------------+------+---------+
+| ?patient_name | ?dob | ?gender |
++---------------+------+---------+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/syntheticPatients/tests/q8_6.srt	Thu Oct 07 03:35:00 2010 -0400
@@ -0,0 +1,4 @@
++------------------+--------------+----------+
+| ?patient_name    | ?dob         | ?gender  |
+| "Marianne Huber" | "1940-01-01" | "Female" |
++------------------+--------------+----------+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/syntheticPatients/tests/q8_7.srt	Thu Oct 07 03:35:00 2010 -0400
@@ -0,0 +1,3 @@
++---------------+------+---------+
+| ?patient_name | ?dob | ?gender |
++---------------+------+---------+