-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathVPRJPMD.m
80 lines (80 loc) · 3.12 KB
/
VPRJPMD.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
VPRJPMD ;SLC/KCM -- Set up Meta Data for VPR Indexing
;
SETUP ;
M ^VPRSAVE("lastAccessTime")=^VPRMETA("JPID") ; save off lastAccessTime data
K:$D(^VPRMETA) ^VPRMETA
M ^VPRMETA("JPID")=^VPRSAVE("lastAccessTime") ; restore lastAccessTime data
K:$D(^VPRSAVE("lastAccessTime")) ^VPRSAVE("lastAccessTime")
S ^VPRMETA("system")=$$SYSID^VPRJRUT()
S ^VPRMETA("version")=$P($T(VERSION^VPRJVER),";;",2)
S ^VPRMETA("version","build")=$P($T(BUILD^VPRJVER),";;",2)
;
D INDEXES
D DOMAINS
D BLDMETA^VPRJCD("template","TLT","VPRJPMT") ; VPR templates
D BLDMETA^VPRJCD("template","TLT","VPRJDMT") ; ODC templates
D BLDMETA^VPRJCD("link","LINKED","VPRJPMR") ; VPR and ODC linkages
;
; Generic Data Store Templates
N STORE,TEMPLATE
S STORE=""
S TEMPLATE=""
F S STORE=$O(^VPRCONFIG("store",STORE)) Q:STORE="" D
. F S TEMPLATE=$O(^VPRCONFIG("store",STORE,"template",TEMPLATE)) Q:TEMPLATE="" D
. . M ^VPRMETA("template")=^VPRCONFIG("store",STORE,"template",TEMPLATE)
. . S ^VPRMETA("collection",STORE,"template",TEMPLATE)=""
;
; "every" index is special index that references all the UID's for a patient
S ^VPRMETA("index","every")="every"
S ^VPRMETA("index","every","common","levels")=0
S ^VPRMETA("index","every","common","method")="every"
;
S ^VPRMETA("codes","med","productFormCode")=""
S ^VPRMETA("codes","med","medStatus")=""
S ^VPRMETA("codes","med","medType")=""
S ^VPRMETA("codes","med","products[]","ingredientCode")=""
S ^VPRMETA("codes","med","products[]","drugClassCode")=""
S ^VPRMETA("codes","med","products[]","suppliedCode")=""
S ^VPRMETA("codes","med","products[]","ingredientRole")=""
S ^VPRMETA("codes","med","dosages[]","routeCode")=""
S ^VPRMETA("codes","med","dosages[]","bodySite")=""
S ^VPRMETA("codes","med","fills[]","fillStatus")=""
;
L +^VPRPTJ("JPID"):$G(^VPRCONFIG("timeout"),5) E QUIT
I '$G(^VPRPTJ("JPID")) S ^VPRPTJ("JPID")=0 ; initialize PID counter
I '$D(^VPRPTX("count","patient","patient")) S ^VPRPTX("count","patient","patient")=0
L -^VPRPTJ("JPID")
Q
INDEXES ; -- build meta data for all indexes
K:$D(^VPRMETA("index")) ^VPRMETA("index")
K:$D(^VPRMETA("collection")) ^VPRMETA("collection")
;
; Patient Indexes
D BLDMETA^VPRJCD("index:attr","IDXLIST","VPRJPMX")
D BLDMETA^VPRJCD("index:tally","IDXTALLY","VPRJPMX")
D BLDMETA^VPRJCD("index:time","IDXTIME","VPRJPMX")
D BLDMETA^VPRJCD("index:attr","IDXATTR","VPRJPMX")
D BLDMETA^VPRJCD("index:xattr","XIDXATTR","VPRJPMX")
; D BLDMETA^VPRJCD("index:match","IDXMATCH","VPRJPMX")
;
; Non-Patient Data Indexes
D BLDMETA^VPRJCD("index:tally","IDXTALLY","VPRJDMX")
D BLDMETA^VPRJCD("index:attr","IDXATTR","VPRJDMX")
;
; Generic Data Store Indexes
N STORE,INDEX
S STORE=""
S INDEX=""
F S STORE=$O(^VPRCONFIG("store",STORE)) Q:STORE="" D
. F S INDEX=$O(^VPRCONFIG("store",STORE,"index",INDEX)) Q:INDEX="" D
. . M ^VPRMETA("index")=^VPRCONFIG("store",STORE,"index",INDEX)
. . S ^VPRMETA("collection",STORE,"index",INDEX)=""
Q
;
;
DOMAINS ; -- Map collections to domains
N I,X,COLL,DOMAIN
S I=0 F S I=I+1,X=$P($T(DOMAIN+I^VPRJPMX),";;",2,99) Q:X="zzzzz" D
. S COLL=$P(X,":"),DOMAIN=$P(X,":",2)
. S ^VPRMETA("collection",COLL,"domain")=DOMAIN
Q