Skip to content

Commit

Permalink
Cache code from last release of eHMP
Browse files Browse the repository at this point in the history
  • Loading branch information
shabiel committed Feb 1, 2018
1 parent e6589f3 commit 82b93b9
Show file tree
Hide file tree
Showing 142 changed files with 12,689 additions and 3,705 deletions.
81 changes: 50 additions & 31 deletions VPRJ.m
100755 → 100644
Original file line number Diff line number Diff line change
@@ -1,25 +1,31 @@
VPRJ ;SLC/KCM -- Menu for JSON data store utilities
;;1.0;JSON DATA STORE;;Sep 01, 2012
;
; Menu to run various utilities for the JSON data store: D ^VPRJ
;
MENU ; Allow utilities to be selected from a menu
G DOMENU^VPRJ1
;
START ; Start the HTTP listener
I $$STATUS^VPRJRCL="running" W !,"Listener is already running.",! Q
;
W !,"Starting listener on port ",$$PORT^VPRJRCL
D GO^VPRJRCL
N PORTS
S PORTS=$$PORT^VPRJRCL
W !,"Starting listener on ports "_PORTS
F I=1:1:$L(PORTS," ") D GO^VPRJRCL($P(PORTS," ",I))
H 1
W !,"Listener status: ",$$STATUS^VPRJRCL,!
Q
;
QUIT
;
STOP ; Stop the HTTP listener
N X
I $G(^VPRHTTP(0,"listener"))="stopped" W !,"Listener is already stopped.",! Q
N X,NUM,STAT
S NUM=""
S STAT="stopped"
F S NUM=$O(^VPRHTTP(NUM)) Q:NUM'=+NUM D
. I $D(^VPRHTTP(NUM,"listener"))#2,^VPRHTTP(NUM,"listener")'="stopped" S STAT=$G(^VPRHTTP(NUM,"listener"))
I STAT="stopped" W !,"Listeners are already stopped.",! QUIT
D STOPW^VPRJRCL
Q
WAIT ;
QUIT
;
WAIT ; NOT USED - also needs to be reworked for multi-listener support
N I,X
S X=$$STATUS^VPRJRCL
W !,"Listener status: ",X
Expand All @@ -29,16 +35,30 @@
. W "."
. I X="stopped" W X
Q
PORT ; Change the listening port number
ADDPORT ; Add a listener port number
N PORT
W !,"Enter port number: "
R PORT:300 E Q
I '$L(PORT) Q
I (PORT<1024)!(PORT>65000) W " ??" G PORT
I (PORT<1024)!(PORT>65000) W " ??" G ADDPORT
D STOP
D SPORT^VPRJRCL(PORT)
W !,"Added listener port: "_PORT,!
D START
Q
QUIT
;
REMOVEPORT ; Remove a listener port number
N PORT
W !,"Enter port number: "
R PORT:300 E Q
I '$L(PORT) Q
I (PORT<1024)!(PORT>65000) W " ??" G REMOVEPORT
D STOP
D RPORT^VPRJRCL(PORT)
W !,"Removed listener port: "_PORT,!
D START
QUIT
;
LOG ; Set the logging level
N X
W !,"Log level will be changed on the next connection.",!
Expand Down Expand Up @@ -149,43 +169,42 @@ D LISTPTS(0)
Q
FULLRBLD ; do a full rebuild of VPR and non-patient data
D SUSPEND
K ^TMP($J)
K:$D(^||TMP($J)) ^||TMP($J)
D RBLDALL^VPRJ2P
D RBLDALL^VPRJ2D
D RESUME
Q
FULLRSET ; reset (delete data and re-init) for VPR and non-patient data
N NMPORT
D SUSPEND
K ^TMP($J)
K:$D(^||TMP($J)) ^||TMP($J)
D KILLDB^VPRJ2P
D KILLDB^VPRJ2D
D SETUP^VPRJCONFIG
D RESUME
;BL eHMP may require multiple ports. Store ports in VPRHTTP(X,"port") and restart
I $G(^VPRHTTP(1,"port")) D
. N PORT
. S NMPORT=0
. F S NMPORT=$O(^VPRHTTP(NMPORT)) Q:NMPORT'=+NMPORT D
. . S PORT=^VPRHTTP(NMPORT,"port")
. . W !,"Restarting HTTP Listener on Port "_PORT
. . D GO^VPRJRCL(PORT)
Q
QUIT
;
SUSPEND ; suspend listener and set updating flag
S ^VPRHTTP(0,"updating")=1
I $E($G(^VPRHTTP(0,"listener")),1,4)'="stop" D
N NUM
S NUM=""
F S NUM=$O(^VPRHTTP(NUM)) Q:NUM'=+NUM I $D(^VPRHTTP(NUM,"listener"))#2,$E(^VPRHTTP(NUM,"listener"),1,4)'="stop" D Q
. S ^VPRHTTP(0,"updating","resume")=1
. W !,"Suspending HTTP Listener..."
. W !,"Suspending HTTP Listeners..."
D STOPW^VPRJRCL
Q
QUIT
;
RESUME ; resume listener if it was running before and reset updating flag
N RESUME
S RESUME=$G(^VPRHTTP(0,"updating","resume"),0)
K ^VPRHTTP(0,"updating")
K:$D(^VPRHTTP(0,"updating")) ^VPRHTTP(0,"updating")
I RESUME D
. W !,"Restarting HTTP Listener..."
. D GO^VPRJRCL
Q
. N PORTS
. S PORTS=$$PORT^VPRJRCL
. W !,"Restarting listener on ports "_PORTS
. F I=1:1:$L(PORTS," ") D GO^VPRJRCL($P(PORTS," ",I))
QUIT
;
ISYES(MSG) ; returns 1 if user answers yes to message, otherwise 0
N X
W !,MSG
Expand Down
31 changes: 17 additions & 14 deletions VPRJ1.m
100755 → 100644
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
VPRJ1 ;SLC/KCM -- Menu Handling for JSON Store Utilities
;;1.0;JSON DATA STORE;;Sep 01, 2012
;
DOMENU ; display menu and execute choice
N SEL
Expand All @@ -12,14 +11,16 @@
. I SEL="PORT^VPRJ" D HEADER
. I SEL="DELPID^VPRJ" D HEADER
Q
;
HEADER ; display header information
W !
W "Listener Port: ",$$PORT^VPRJRCL," "
W "Status: ",$$STATUS^VPRJRCL," "
W "Listener Ports: ",$$PORT^VPRJRCL,!
W "Status: ",$$STATUS^VPRJRCL,!
W "Log Level: ",$$LOG^VPRJRCL," "
W "VPR Patients: ",$G(^VPRPTX("count","patient","patient"))
W "VPR Patients: ",$G(^VPRPTX("count","patient","patient"),0)
W !
Q
QUIT
;
SHOWMENU ; display menu
N X,I
S I=0 F S I=I+1,X=$P($T(MENULST+I),";;",2,99) Q:X="zzzzz" W !,X
Expand Down Expand Up @@ -53,9 +54,10 @@
Q
MENULST ;; menu display list
;;-- Listener -- -- Logging --
;; 1 Start HTTP Listener on Port 9080 4 Change Logging Level
;; 2 Stop HTTP Listener 5 Clear Logs
;; 3 Change HTTP Listener Port 6 List Errors
;; 1 Start HTTP Listeners 5 Change Logging Level
;; 2 Stop HTTP Listeners 6 Clear Logs
;; 3 Add HTTP Listener Port 7 List Errors
;; 4 Remove HTTP Listener Port
;;
;;-- VPR Info -- -- ODC Info --
;;11 List Synced Patients (alpha) 21 List Collections (ODC)
Expand All @@ -74,21 +76,22 @@
MENUNUM ;; menu selection numbers
;;1;START^VPRJ
;;2;STOP^VPRJ
;;3;PORT^VPRJ
;;4;LOG^VPRJ
;;5;CLEAR^VPRJ
;;6;ERROR^VPRJ
;;3;ADDPORT^VPRJ
;;4;REMOVEPORT^VPRJ
;;5;LOG^VPRJ
;;6;CLEAR^VPRJ
;;7;ERROR^VPRJ
;;11;LISTPTA^VPRJ
;;12;LISTPTP^VPRJ
;;13;PIDSTAT^VPRJ
;;14;STATUS^VPRJ2P
;;21;LSTCTN^VPRJ2D
;;22;STATUS^VPRJ2D
;;31;RIDXALL^VPRJ2P
;;31;RIDX^VPRJ2P
;;32;RBLDALL^VPRJ2P
;;33;DELPID^VPRJ
;;34;RESET^VPRJ
;;41;RIDXALL^VPRJ2D
;;41;RIDX^VPRJ2D
;;42;RBLDALL^VPRJ2D
;;43;DELCTN^VPRJ2D
;;44;RESET^VPRJ2D
Expand Down
Loading

0 comments on commit 82b93b9

Please sign in to comment.