source: fmts/trunk/p/C0XPV.m

Last change on this file was 1483, checked in by George Lilly, 12 years ago

updates for the no-triplestore parse

File size: 2.0 KB
Line 
1C0XPV ; GPL - Patient Viewer utilities ;11/07/11 17:05
2 ;;0.1;C0X;nopatch;noreleasedate;Build 7
3 ;Copyright 2011 George Lilly. Licensed under the terms of the GNU
4 ;General Public License See attached copy of the License.
5 ;
6 ;This program is free software; you can redistribute it and/or modify
7 ;it under the terms of the GNU General Public License as published by
8 ;the Free Software Foundation; either version 2 of the License, or
9 ;(at your option) any later version.
10 ;
11 ;This program is distributed in the hope that it will be useful,
12 ;but WITHOUT ANY WARRANTY; without even the implied warranty of
13 ;MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 ;GNU General Public License for more details.
15 ;
16 ;You should have received a copy of the GNU General Public License along
17 ;with this program; if not, write to the Free Software Foundation, Inc.,
18 ;51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
19 ;
20 Q
21 ;
22CREATE(ZRTN,DFN,PART,FORM) ; CREATE A PATIENT RDF FILE. ALSO INSERT IT INTO THE
23 ; triple store
24 N ZARY ; array of values from the NHIN extract
25 I '$D(PART) S PART="" ; NULL MEANS ALL
26 D EN^C0SNHIN(.ZARY,DFN,"")
27 I '$D(ZARY) Q ; no information for this patient
28 N ZGRF S ZGRF="/dewdrop/patient/"_DFN
29 D DELGRAPH^C0XF2N(ZGRF) ; delete the graph from the triplestore
30 N ZSUB S ZSUB="" ; start out with null subject
31 N ZTRIP ; place to put triples
32 N ZI S ZI=""
33 F S ZI=$O(ZARY(ZI)) Q:ZI="" D ; for each clinical section
34 . N ZJ S ZJ=""
35 . F S ZJ=$O(ZARY(ZI,ZJ)) Q:ZJ="" D ; for each occurance
36 . . S ZSUB=ZGRF_"/"_ZI_"/"_ZJ ; ie /dewdrop/patient/32/allergy/1
37 . . S ZTRIP(ZSUB,"sp:belongsTo",ZGRF)="" ; upward reference
38 . . S ZTRIP(ZSUB,"rdf:type",ZI)="" ; ie rdf:type allergy
39 . . N ZK S ZK=""
40 . . F S ZK=$O(ZARY(ZI,ZJ,ZK)) Q:ZK="" D ; for each predicate
41 . . . S ZTRIP(ZSUB,ZK,ZARY(ZI,ZJ,ZK))="" ; ie entered@value 3110624.1909
42 B
43 D PUTGRAF^C0XXFRM("ZTRIP",ZGRF) ; insert the graph into the triplestore
44 D getGraph^C0XGET1(.ZRTN,ZGRF,"rdf") ; return the graph in RDF format
45 Q
46 ;
Note: See TracBrowser for help on using the repository browser.