- BSTSSTA ;GDIT/HSCD/ALA-Check status of a Web Service ; 27 Mar 2015 11:35 AM
- ;;2.0;IHS STANDARD TERMINOLOGY;**1**;Dec 01, 2016;Build 36
- ;
- EN ; EP
- ; Select an existing web service and run sample calls for testing
- ;
- NEW DIC,Y,DIR,QUIT,DEBUG,SR,RES,IADT,SCNT,RESULT,DLAYGO,CT,%H
- NEW DIROUT,DIRUT,DTOUT,DUOUT,STS,SERV,SDATA,DTSON,BSTUP,%I,ERROR
- ;
- ;First Select the web service
- SRV ;EP
- W !!
- S DIC="^BSTS(9002318.2,",DIC(0)="AEMNZ"
- S DLAYGO=9002318.2 D ^DIC S SERV=+Y
- I SERV=-1 Q
- ;
- ;Check if active
- S IADT=$$GET1^DIQ(9002318.2,SERV_",",".1","I")
- I IADT]"",IADT<DT W !!,"This Web Service is not Active",! H 2 G SRV
- ;
- DSP ;EP - Display information
- ;
- NEW BSTSRPT
- ;
- ;Retrieve status information
- D STATUS(SERV,.BSTSRPT)
- ;
- ;Write formfeed
- I $G(IOF)]"" W @IOF
- ;
- D EN^DDIOL(.BSTSRPT)
- K BSTSRPT
- ;
- NEW DIR,X,Y,ANS
- S DIR(0)="LO^1:5"
- S DIR("A")="Select number or return to quit"
- S DIR("A",1)=" "
- S DIR("A",2)="1. Refresh Current information"
- S DIR("A",3)="2. Check DTS and Enable if Available"
- S DIR("A",4)="3. Turn off the DTS Link"
- S DIR("A",5)="4. Edit Server Settings"
- S DIR("A",6)="5. Other Options..."
- S DIR("A",7)=" "
- D ^DIR
- I Y="" G SRV
- I $G(DTOUT)!$G(DUOUT)!$G(DIROUT)!$G(DIRUT) G SRV
- S ANS=+Y
- ;
- ;Refresh Display
- I ANS=1 G DSP
- ;
- ;Check Link and Enable
- I ANS=2 D G DSP
- . NEW SDATA,DTSON
- . S SDATA=^BSTS(9002318.2,SERV,0)
- . S DTSON=$P(SDATA,"^",13)
- . I DTSON="" D CHK Q
- . S BSTUP(9002318.2,SERV_",",.13)="@"
- . S BSTUP(9002318.2,SERV_",",3)="@"
- . D FILE^DIE("","BSTUP","ERROR")
- . D ELOG^BSTSVOFL($$GET1^DIQ(200,DUZ_",",".01","E")_" turned on DTS link from BSTS STS option")
- . D CHK
- ;
- ;Turn off the DTS Link
- I ANS=3 D G DSP
- . NEW DIR,X,Y,DTOUT,DUOUT,DIROUT,DIRUT
- . S DIR("A")="Turn off the DTS link until"
- . S DIR("A",1)="Enter a date and time more than 10 mins in the future. "
- . S DIR("A",2)=" [Current date and time is "_$$FMTE^XLFDT($$NOW^XLFDT())_"]"
- . S DIR(0)="D^"_$$FMADD^XLFDT($$NOW^XLFDT(),"","",10)_":"_$$FMADD^XLFDT(DT,7)_".2359:ERTX"
- . D ^DIR I $G(DTOUT)!$G(DUOUT)!$G(DIROUT)!$G(DIRUT) Q
- . S BSTUP(9002318.2,SERV_",",.13)=Y
- . D FILE^DIE("","BSTUP","ERROR")
- . D ELOG^BSTSVOFL($$GET1^DIQ(200,DUZ_",",".01","E")_" turned off DTS link from BSTS STS option")
- ;
- ;Edit Server Settings
- I ANS=4 D G DSP
- . NEW DIE,DA,DR
- . S DIE="^BSTS(9002318.2,",DA=SERV,DR=".14;.12;.15;.05;.16"
- . D ^DIE
- ;
- ;Other Options
- I ANS=5 D DSP1
- ;
- G DSP
- ;
- ;Prompt for other option
- DSP1 NEW DIR,X,Y,DTOUT,DUOUT,DIROUT,DIRUT,ANS
- W !!,"Other options menu"
- S DIR(0)="LO^1:6"
- S DIR("A")="Select number or return to quit"
- S DIR("A",1)=" "
- S DIR("A",2)="1. Run daily update checks"
- S DIR("A",3)="2. Kick off background process now"
- S DIR("A",4)="3. Terminate current background process"
- S DIR("A",5)="4. BSTS reporting..."
- S DIR("A",6)="5. Retrieve Search History from DTS"
- S DIR("A",7)="6. Retrieve Log History from DTS"
- S DIR("A",8)=" "
- D ^DIR
- I Y="" Q
- I $G(DTOUT)!$G(DUOUT)!$G(DIROUT)!$G(DIRUT) Q
- S ANS=+Y
- ;
- ;Run daily update checks
- I ANS=1 D G DSP1
- . W !!,"Running update checks. This may take a minute or two"
- . D DAYCHK^BSTSVOF1(1) W !!,"Daily update checks completed" H 3
- ;
- ;Kick off a daily background process
- I ANS=2 D START G DSP1
- ;
- ;Terminate current background process
- I ANS=3 D STOP G DSP1
- ;
- ;BSTS Reporting
- I ANS=4 D DSP^BSTSDSP(SERV) G DSP1
- ;
- ;Retrieve search history
- I ANS=5 D SRSTRING G DSP1
- ;
- ;Retrieve log history
- I ANS=6 D LGHST^BSTSAPIL G DSP1
- ;
- Q
- ;
- ;Start a background process
- START NEW RUN,TRY
- ;
- ;First see if a process is running
- S RUN="" D
- . L +^XTMP("BSTSPROCQ",1):1 E S RUN=1 Q
- . L -^XTMP("BSTSPROCQ",1)
- . L +^BSTS(9002318.1,0):1 E S RUN=1 Q
- . L -^BSTS(9002318.1,0)
- . L +^TMP("BSTSICD2SMD"):1 E S RUN=1 Q
- . L -^TMP("BSTSICD2SMD")
- I RUN=1 W !!,"A background process is currently running" H 3 Q
- ;
- ;Job the process
- D JOBNOW^BSTSVOFL
- ;
- ;See if it started
- W !!,"Attempting to start the background process. This may take several minutes"
- S RUN="" F TRY=1:1:90 D H 1 Q:RUN
- . ;
- . W "."
- . ;
- . ;See if started
- . L +^XTMP("BSTSPROCQ",1):1 E S RUN=1 Q
- . L -^XTMP("BSTSPROCQ",1)
- ;
- ;Display status
- I RUN=1 W !!,"Background process has been started" H 3 Q
- E D
- . W !!,"The background process has been queued but has either not started"
- . W !,"or ran so quickly that its status wasn't captured. Verify Taskman"
- . W !,"is running and run the BSTSMENU/STS option again in a few minutes to see if"
- . W !,"it has started or display a history of completed processes to see if it"
- . W !,"finished already."
- ;
- Q
- ;
- ;Terminate the current background process
- STOP NEW TRY,STOP,RUN
- ;
- ;First see if a process is running
- S RUN="" D
- . L +^XTMP("BSTSPROCQ",1):1 E S RUN=1 Q
- . L -^XTMP("BSTSPROCQ",1)
- . L +^BSTS(9002318.1,0):1 E S RUN=1 Q
- . L -^BSTS(9002318.1,0)
- . L +^TMP("BSTSICD2SMD"):1 E S RUN=1 Q
- . L -^TMP("BSTSICD2SMD")
- I RUN="" W !!,"No background process is currently running" H 3 Q
- ;
- ;Set flag to stop the process
- S ^XTMP("BSTSLCMP","QUIT")=1
- S ^XTMP("BSTSPROCQ","QUIT")=1
- ;
- ;Check if process stopped
- W !!,"Attempting to stop the process"
- ;
- S STOP="" F TRY=1:1:90 D H 1 Q:STOP
- . ;
- . W "."
- . ;
- . ;Attempt to grab possible process lock1
- . L +^XTMP("BSTSPROCQ",1):1 E Q
- . L -^XTMP("BSTSPROCQ",1)
- . ;
- . ;Attempt to grab possible process lock2
- . L +^BSTS(9002318.1,0):1 E Q
- . L -^BSTS(9002318.1,0)
- . ;
- . ;Attempt to grab possible process lock3
- . L +^TMP("BSTSICD2SMD"):1 E Q
- . L -^TMP("BSTSICD2SMD")
- . ;
- . ;No process running
- . S STOP=1
- . ;
- . ;Reset quit flag
- . K ^XTMP("BSTSLCMP","QUIT")
- . K ^XTMP("BSTSPROCQ","QUIT")
- ;
- ;Display status
- I STOP W !!,"Background process has been terminated"
- E D
- . W !!,"Background process is still running but has been queued to stop."
- . W !,"Please wait for several minutes and run the STS option to check if the process has been stopped."
- ;
- Q
- ;
- CHK ;EP - Check the server status
- NEW STS,BSTUP
- S STS=$$CALL^BSTSTST(SERV,"COMMON COLD","")
- Q
- ;
- FRMT(VALUE) ;EP - Format the data
- S VALUE=$E(" ",$L(VALUE))_VALUE
- Q VALUE
- ;
- STATUS(SERV,BSTSRPT) ;Set up Server Status Display
- ;
- I '+$G(SERV) Q
- ;
- NEW SDATA,DTSON,CT
- ;
- S SDATA=^BSTS(9002318.2,SERV,0)
- S DTSON=$P(SDATA,"^",13)
- I DTSON="" D
- . D CHK
- . S SDATA=^BSTS(9002318.2,SERV,0)
- . S DTSON=$P(SDATA,"^",13)
- ;
- ;Get latest entry
- S CT=+$O(BSTSRPT(""),-1)
- ;
- S:CT=0 CT=1,BSTSRPT(CT)=" "
- S CT=CT+1,BSTSRPT(CT)=" "
- S CT=CT+1,BSTSRPT(1)="Current Server Status:"
- S CT=CT+1,BSTSRPT(CT,"F")="!?5",BSTSRPT(CT)="Web Service: "
- S CT=CT+1,BSTSRPT(CT,"F")="?25",BSTSRPT(CT)=$P(SDATA,"^",1)
- S CT=CT+1,BSTSRPT(CT,"F")="!?5",BSTSRPT(CT)="Current Status: "
- S CT=CT+1,BSTSRPT(CT,"F")="?25",BSTSRPT(CT)=$S(DTSON="":"ONLINE",1:"OFFLINE")
- S CT=CT+1,BSTSRPT(CT,"F")="!?5",BSTSRPT(CT)="Offline Until: "
- S CT=CT+1,BSTSRPT(CT,"F")="?25",BSTSRPT(CT)=$S(DTSON="":"N/A",1:$$FMTE^XLFDT(DTSON))
- S CT=CT+1,BSTSRPT(CT,"F")="!?5",BSTSRPT(CT)="Last Error Message: "
- S CT=CT+1,BSTSRPT(CT,"F")="?25",BSTSRPT(CT)=$S(DTSON="":"N/A",1:$$GET1^DIQ(9002318.2,SERV_",",3,"E"))
- ;
- ;Check if any processes are running
- L +^BSTS(9002318.1,0):0 E D
- . S CT=CT+1,BSTSRPT(CT,"F")="!?5",BSTSRPT(CT)="Background process: "
- . S CT=CT+1,BSTSRPT(CT,"F")="?25",BSTSRPT(CT)=$P($G(^XTMP("BSTSLCMP",0)),U,3)
- . I $G(^XTMP("BSTSLCMP","STS"))]"" S CT=CT+1,BSTSRPT(CT,"F")="!?25",BSTSRPT(CT)=$G(^XTMP("BSTSLCMP","STS"))
- L -^BSTS(9002318.1,0)
- ;
- ;Check if Description Id Population Utility is running
- L +^XTMP("BSTSCFIX"):0 E D
- . NEW RUN
- . S CT=CT+1,BSTSRPT(CT,"F")="!?5",BSTSRPT(CT)="Background process: "
- . S CT=CT+1,BSTSRPT(CT,"F")="?25",BSTSRPT(CT)="Description Id Population Utility is running"
- . S RUN=$G(^XTMP("BSTSCFIX","RUN")) Q:RUN=""
- . I $G(^XTMP("BSTSCFIX",RUN,"STS"))]"" S CT=CT+1,BSTSRPT(CT,"F")="!?25",BSTSRPT(CT)=$G(^XTMP("BSTSCFIX",RUN,"STS"))
- L -^XTMP("BSTSCFIX")
- ;
- ;Check if ICD9 to SNOMED process is running
- L +^TMP("BSTSICD2SMD"):0 E D
- . S CT=CT+1,BSTSRPT(CT,"F")="!?5",BSTSRPT(CT)="Background process: "
- . S CT=CT+1,BSTSRPT(CT,"F")="?25",BSTSRPT(CT)="ICD9 to SNOMED process is running"
- L -^TMP("BSTSICD2SMD")
- ;
- ;Check if install conversion process is running
- L +^TMP("BSTSPBFH"):0 E D
- . S CT=CT+1,BSTSRPT(CT,"F")="!?5",BSTSRPT(CT)="Background process: "
- . S CT=CT+1,BSTSRPT(CT,"F")="?25",BSTSRPT(CT)="Installation conversion process is running"
- L -^TMP("BSTSPBFH")
- ;
- S CT=CT+1,BSTSRPT(CT,"F")="!!",BSTSRPT(CT)="Current Server Settings: "
- S CT=CT+1,BSTSRPT(CT)=" "
- S CT=CT+1,BSTSRPT(CT,"F")="!?5",BSTSRPT(CT)="CHECK FOR CONNECTION AFTER: "
- S CT=CT+1,BSTSRPT(CT,"F")="?35",BSTSRPT(CT)=$S($P(SDATA,"^",14)="":"60 minutes (default)",1:$$FRMT($P(SDATA,"^",14))_" minutes")
- S CT=CT+1,BSTSRPT(CT,"F")="!?5",BSTSRPT(CT)="CONNECTION TIMEOUT OVERRIDE: "
- S CT=CT+1,BSTSRPT(CT,"F")="?35",BSTSRPT(CT)=$S($P(SDATA,"^",12)="":" 2 seconds (default)",1:$$FRMT($P(SDATA,"^",12))_" seconds")
- S CT=CT+1,BSTSRPT(CT,"F")="!?5",BSTSRPT(CT)="MAXIMUM REMOTE SEARCH TIME: "
- S CT=CT+1,BSTSRPT(CT,"F")="?35",BSTSRPT(CT)=$S($P(SDATA,"^",15)="":"60 seconds (default)",1:$$FRMT($P(SDATA,"^",15))_" seconds")
- S CT=CT+1,BSTSRPT(CT,"F")="!?5",BSTSRPT(CT)="TIMEOUT OVERRIDE: "
- S CT=CT+1,BSTSRPT(CT,"F")="?35",BSTSRPT(CT)=$S($P(SDATA,"^",5)="":"60 seconds (default)",1:$$FRMT($P(SDATA,"^",5))_" seconds")
- S CT=CT+1,BSTSRPT(CT,"F")="!?5",BSTSRPT(CT)="ENABLE SEARCH LOGGING: "
- S CT=CT+1,BSTSRPT(CT,"F")="?35",BSTSRPT(CT)=$S($P(SDATA,"^",16):"YES",1:"NO")
- ;
- Q
- ;
- SRSTRING ;Return list of search strings
- ;
- NEW FRDT,TODT,ESERV,SRV,SIEN,SNUM,RNAME,EXEC,ENSPACE,BSTSWS,SERVERS
- NEW SPACE,STS,POP,CT,BSTSRPT,ICNT,SRMAX,SCNT
- ;
- S $P(SPACE," ",80)=" "
- ;
- W !!,"DISPLAY BSTS SEARCH STRINGS USED"
- ;
- ;Get From Date
- S FRDT=$$DATE^BSTSDSP("From Date","T-7") Q:'FRDT
- ;
- ;Get To Date
- S TODT=$$DATE^BSTSDSP("To Date","T",FRDT) Q:'TODT
- ;
- ;Get maximum search results to display
- S SRMAX=$$SMAX() Q:'SRMAX
- ;
- S ENSPACE=36
- ;
- ;Get the server information
- S ESERV=$$WSERVER^BSTSWSV(.SERVERS,"") Q:'ESERV
- S SRV=$O(SERVERS(0)) Q:'SRV
- M BSTSWS=SERVERS(SRV)
- ;
- ;Get the site
- S SIEN=$O(^AUTTSITE(0)) Q:'+SIEN
- S SNUM=$$GET1^DIQ(9999999.39,SIEN_",",.01,"I") Q:SNUM=""
- ;
- ;Get search results
- S BSTSWS("FRDT")=$P($$FMTE^BSTSUTIL(FRDT),":",1,2)_" 00:00"
- S BSTSWS("TODT")=$P($$FMTE^BSTSUTIL(TODT),":",1,2)_" 23:59"
- S BSTSWS("ENSPACE")=ENSPACE
- S BSTSWS("ESITE")=SNUM
- S BSTSWS("EPROD")=$$PROD^XUPROD()
- S RNAME="",EXEC="S RNAME=$"_"ZNSPACE" X EXEC
- S BSTSWS("RNAME")=RNAME
- ;
- ;Pull the search list
- S STS=$$SRCNT^BSTSCMCL(.BSTSWS,.RES)
- ;
- ;Get device
- W !
- S POP="" D ^%ZIS I POP Q
- U IO
- ;
- ;Display results
- S (SCNT,CT)=0,CT=CT+1,BSTSRPT(CT)="BSTS SEARCH HISTORY: "_$$FMTE^XLFDT(FRDT,"2ZD")_" TO "_$$FMTE^XLFDT(TODT,"2ZD")_" - "_SRMAX_" MOST FREQUENTLY USED"
- S CT=CT+1,BSTSRPT(CT)=" "
- S CT=CT+1,BSTSRPT(CT)=$E("SEARCH STRING"_SPACE,1,50)_$E("COUNT"_SPACE,1,8)
- S CT=CT+1,BSTSRPT(CT)=" "
- S ICNT="" F S ICNT=$O(^TMP("BSTSCMCL",$J,ICNT)) Q:ICNT="" D I (SCNT+1)>SRMAX Q
- . ;
- . NEW NODE
- . ;
- . S NODE=$G(^TMP("BSTSCMCL",$J,ICNT))
- . S CT=CT+1,BSTSRPT(CT)=$E($P(NODE,U)_SPACE,1,50)_$E($P(NODE,U,2)_SPACE,1,8)
- . S SCNT=SCNT+1
- ;
- ;Check for no results
- I SCNT=0 D
- . S CT=CT+1,BSTSRPT(CT)="No results found. This could be because SEARCH LOGGING is disabled or the"
- . S CT=CT+1,BSTSRPT(CT)="report date range is too far in the past and the search history has been"
- . S CT=CT+1,BSTSRPT(CT)="purged from the DTS server. *Note also that the current day's search"
- . S CT=CT+1,BSTSRPT(CT)="history does not get sent until later in the evening so it will not be"
- . S CT=CT+1,BSTSRPT(CT)="immediately available."
- ;
- S CT=CT+1,BSTSRPT(CT)=" "
- S CT=CT+1,BSTSRPT(CT)="<END OF REPORT>"
- ;
- ;Display the report
- D EN^DDIOL(.BSTSRPT)
- ;
- ;Close the device
- D ^%ZISC
- ;
- I $D(IOST),IOST["C-",'$D(DIRUT),'$D(DTOUT) D
- . NEW DIR,X,Y
- . W ! S DIR(0)="E",DIR("A")="Press 'Return to continue'" D ^DIR
- ;
- Q
- ;
- SMAX() ;Prompt for maximum search results to display
- ;
- NEW DIR,DTOUT,DUOUT,DIRUT,DIROUT,X,Y
- ;
- W !
- S DIR(0)="N^1:9999:4"
- S DIR("A")="Maximum number of results to return: "
- S DIR("B")="25"
- D ^DIR
- I Y="" Q ""
- I $G(DTOUT)!$G(DUOUT)!$G(DIRUT)!$G(DIROUT) Q ""
- ;
- Q Y
- BSTSSTA ;GDIT/HSCD/ALA-Check status of a Web Service ; 27 Mar 2015 11:35 AM
- +1 ;;2.0;IHS STANDARD TERMINOLOGY;**1**;Dec 01, 2016;Build 36
- +2 ;
- EN ; EP
- +1 ; Select an existing web service and run sample calls for testing
- +2 ;
- +3 NEW DIC,Y,DIR,QUIT,DEBUG,SR,RES,IADT,SCNT,RESULT,DLAYGO,CT,%H
- +4 NEW DIROUT,DIRUT,DTOUT,DUOUT,STS,SERV,SDATA,DTSON,BSTUP,%I,ERROR
- +5 ;
- +6 ;First Select the web service
- SRV ;EP
- +1 WRITE !!
- +2 SET DIC="^BSTS(9002318.2,"
- SET DIC(0)="AEMNZ"
- +3 SET DLAYGO=9002318.2
- DO ^DIC
- SET SERV=+Y
- +4 IF SERV=-1
- QUIT
- +5 ;
- +6 ;Check if active
- +7 SET IADT=$$GET1^DIQ(9002318.2,SERV_",",".1","I")
- +8 IF IADT]""
- IF IADT<DT
- WRITE !!,"This Web Service is not Active",!
- HANG 2
- GOTO SRV
- +9 ;
- DSP ;EP - Display information
- +1 ;
- +2 NEW BSTSRPT
- +3 ;
- +4 ;Retrieve status information
- +5 DO STATUS(SERV,.BSTSRPT)
- +6 ;
- +7 ;Write formfeed
- +8 IF $GET(IOF)]""
- WRITE @IOF
- +9 ;
- +10 DO EN^DDIOL(.BSTSRPT)
- +11 KILL BSTSRPT
- +12 ;
- +13 NEW DIR,X,Y,ANS
- +14 SET DIR(0)="LO^1:5"
- +15 SET DIR("A")="Select number or return to quit"
- +16 SET DIR("A",1)=" "
- +17 SET DIR("A",2)="1. Refresh Current information"
- +18 SET DIR("A",3)="2. Check DTS and Enable if Available"
- +19 SET DIR("A",4)="3. Turn off the DTS Link"
- +20 SET DIR("A",5)="4. Edit Server Settings"
- +21 SET DIR("A",6)="5. Other Options..."
- +22 SET DIR("A",7)=" "
- +23 DO ^DIR
- +24 IF Y=""
- GOTO SRV
- +25 IF $GET(DTOUT)!$GET(DUOUT)!$GET(DIROUT)!$GET(DIRUT)
- GOTO SRV
- +26 SET ANS=+Y
- +27 ;
- +28 ;Refresh Display
- +29 IF ANS=1
- GOTO DSP
- +30 ;
- +31 ;Check Link and Enable
- +32 IF ANS=2
- Begin DoDot:1
- +33 NEW SDATA,DTSON
- +34 SET SDATA=^BSTS(9002318.2,SERV,0)
- +35 SET DTSON=$PIECE(SDATA,"^",13)
- +36 IF DTSON=""
- DO CHK
- QUIT
- +37 SET BSTUP(9002318.2,SERV_",",.13)="@"
- +38 SET BSTUP(9002318.2,SERV_",",3)="@"
- +39 DO FILE^DIE("","BSTUP","ERROR")
- +40 DO ELOG^BSTSVOFL($$GET1^DIQ(200,DUZ_",",".01","E")_" turned on DTS link from BSTS STS option")
- +41 DO CHK
- End DoDot:1
- GOTO DSP
- +42 ;
- +43 ;Turn off the DTS Link
- +44 IF ANS=3
- Begin DoDot:1
- +45 NEW DIR,X,Y,DTOUT,DUOUT,DIROUT,DIRUT
- +46 SET DIR("A")="Turn off the DTS link until"
- +47 SET DIR("A",1)="Enter a date and time more than 10 mins in the future. "
- +48 SET DIR("A",2)=" [Current date and time is "_$$FMTE^XLFDT($$NOW^XLFDT())_"]"
- +49 SET DIR(0)="D^"_$$FMADD^XLFDT($$NOW^XLFDT(),"","",10)_":"_$$FMADD^XLFDT(DT,7)_".2359:ERTX"
- +50 DO ^DIR
- IF $GET(DTOUT)!$GET(DUOUT)!$GET(DIROUT)!$GET(DIRUT)
- QUIT
- +51 SET BSTUP(9002318.2,SERV_",",.13)=Y
- +52 DO FILE^DIE("","BSTUP","ERROR")
- +53 DO ELOG^BSTSVOFL($$GET1^DIQ(200,DUZ_",",".01","E")_" turned off DTS link from BSTS STS option")
- End DoDot:1
- GOTO DSP
- +54 ;
- +55 ;Edit Server Settings
- +56 IF ANS=4
- Begin DoDot:1
- +57 NEW DIE,DA,DR
- +58 SET DIE="^BSTS(9002318.2,"
- SET DA=SERV
- SET DR=".14;.12;.15;.05;.16"
- +59 DO ^DIE
- End DoDot:1
- GOTO DSP
- +60 ;
- +61 ;Other Options
- +62 IF ANS=5
- DO DSP1
- +63 ;
- +64 GOTO DSP
- +65 ;
- +66 ;Prompt for other option
- DSP1 NEW DIR,X,Y,DTOUT,DUOUT,DIROUT,DIRUT,ANS
- +1 WRITE !!,"Other options menu"
- +2 SET DIR(0)="LO^1:6"
- +3 SET DIR("A")="Select number or return to quit"
- +4 SET DIR("A",1)=" "
- +5 SET DIR("A",2)="1. Run daily update checks"
- +6 SET DIR("A",3)="2. Kick off background process now"
- +7 SET DIR("A",4)="3. Terminate current background process"
- +8 SET DIR("A",5)="4. BSTS reporting..."
- +9 SET DIR("A",6)="5. Retrieve Search History from DTS"
- +10 SET DIR("A",7)="6. Retrieve Log History from DTS"
- +11 SET DIR("A",8)=" "
- +12 DO ^DIR
- +13 IF Y=""
- QUIT
- +14 IF $GET(DTOUT)!$GET(DUOUT)!$GET(DIROUT)!$GET(DIRUT)
- QUIT
- +15 SET ANS=+Y
- +16 ;
- +17 ;Run daily update checks
- +18 IF ANS=1
- Begin DoDot:1
- +19 WRITE !!,"Running update checks. This may take a minute or two"
- +20 DO DAYCHK^BSTSVOF1(1)
- WRITE !!,"Daily update checks completed"
- HANG 3
- End DoDot:1
- GOTO DSP1
- +21 ;
- +22 ;Kick off a daily background process
- +23 IF ANS=2
- DO START
- GOTO DSP1
- +24 ;
- +25 ;Terminate current background process
- +26 IF ANS=3
- DO STOP
- GOTO DSP1
- +27 ;
- +28 ;BSTS Reporting
- +29 IF ANS=4
- DO DSP^BSTSDSP(SERV)
- GOTO DSP1
- +30 ;
- +31 ;Retrieve search history
- +32 IF ANS=5
- DO SRSTRING
- GOTO DSP1
- +33 ;
- +34 ;Retrieve log history
- +35 IF ANS=6
- DO LGHST^BSTSAPIL
- GOTO DSP1
- +36 ;
- +37 QUIT
- +38 ;
- +39 ;Start a background process
- START NEW RUN,TRY
- +1 ;
- +2 ;First see if a process is running
- +3 SET RUN=""
- Begin DoDot:1
- +4 LOCK +^XTMP("BSTSPROCQ",1):1
- IF '$TEST
- SET RUN=1
- QUIT
- +5 LOCK -^XTMP("BSTSPROCQ",1)
- +6 LOCK +^BSTS(9002318.1,0):1
- IF '$TEST
- SET RUN=1
- QUIT
- +7 LOCK -^BSTS(9002318.1,0)
- +8 LOCK +^TMP("BSTSICD2SMD"):1
- IF '$TEST
- SET RUN=1
- QUIT
- +9 LOCK -^TMP("BSTSICD2SMD")
- End DoDot:1
- +10 IF RUN=1
- WRITE !!,"A background process is currently running"
- HANG 3
- QUIT
- +11 ;
- +12 ;Job the process
- +13 DO JOBNOW^BSTSVOFL
- +14 ;
- +15 ;See if it started
- +16 WRITE !!,"Attempting to start the background process. This may take several minutes"
- +17 SET RUN=""
- FOR TRY=1:1:90
- Begin DoDot:1
- +18 ;
- +19 WRITE "."
- +20 ;
- +21 ;See if started
- +22 LOCK +^XTMP("BSTSPROCQ",1):1
- IF '$TEST
- SET RUN=1
- QUIT
- +23 LOCK -^XTMP("BSTSPROCQ",1)
- End DoDot:1
- HANG 1
- IF RUN
- QUIT
- +24 ;
- +25 ;Display status
- +26 IF RUN=1
- WRITE !!,"Background process has been started"
- HANG 3
- QUIT
- +27 IF '$TEST
- Begin DoDot:1
- +28 WRITE !!,"The background process has been queued but has either not started"
- +29 WRITE !,"or ran so quickly that its status wasn't captured. Verify Taskman"
- +30 WRITE !,"is running and run the BSTSMENU/STS option again in a few minutes to see if"
- +31 WRITE !,"it has started or display a history of completed processes to see if it"
- +32 WRITE !,"finished already."
- End DoDot:1
- +33 ;
- +34 QUIT
- +35 ;
- +36 ;Terminate the current background process
- STOP NEW TRY,STOP,RUN
- +1 ;
- +2 ;First see if a process is running
- +3 SET RUN=""
- Begin DoDot:1
- +4 LOCK +^XTMP("BSTSPROCQ",1):1
- IF '$TEST
- SET RUN=1
- QUIT
- +5 LOCK -^XTMP("BSTSPROCQ",1)
- +6 LOCK +^BSTS(9002318.1,0):1
- IF '$TEST
- SET RUN=1
- QUIT
- +7 LOCK -^BSTS(9002318.1,0)
- +8 LOCK +^TMP("BSTSICD2SMD"):1
- IF '$TEST
- SET RUN=1
- QUIT
- +9 LOCK -^TMP("BSTSICD2SMD")
- End DoDot:1
- +10 IF RUN=""
- WRITE !!,"No background process is currently running"
- HANG 3
- QUIT
- +11 ;
- +12 ;Set flag to stop the process
- +13 SET ^XTMP("BSTSLCMP","QUIT")=1
- +14 SET ^XTMP("BSTSPROCQ","QUIT")=1
- +15 ;
- +16 ;Check if process stopped
- +17 WRITE !!,"Attempting to stop the process"
- +18 ;
- +19 SET STOP=""
- FOR TRY=1:1:90
- Begin DoDot:1
- +20 ;
- +21 WRITE "."
- +22 ;
- +23 ;Attempt to grab possible process lock1
- +24 LOCK +^XTMP("BSTSPROCQ",1):1
- IF '$TEST
- QUIT
- +25 LOCK -^XTMP("BSTSPROCQ",1)
- +26 ;
- +27 ;Attempt to grab possible process lock2
- +28 LOCK +^BSTS(9002318.1,0):1
- IF '$TEST
- QUIT
- +29 LOCK -^BSTS(9002318.1,0)
- +30 ;
- +31 ;Attempt to grab possible process lock3
- +32 LOCK +^TMP("BSTSICD2SMD"):1
- IF '$TEST
- QUIT
- +33 LOCK -^TMP("BSTSICD2SMD")
- +34 ;
- +35 ;No process running
- +36 SET STOP=1
- +37 ;
- +38 ;Reset quit flag
- +39 KILL ^XTMP("BSTSLCMP","QUIT")
- +40 KILL ^XTMP("BSTSPROCQ","QUIT")
- End DoDot:1
- HANG 1
- IF STOP
- QUIT
- +41 ;
- +42 ;Display status
- +43 IF STOP
- WRITE !!,"Background process has been terminated"
- +44 IF '$TEST
- Begin DoDot:1
- +45 WRITE !!,"Background process is still running but has been queued to stop."
- +46 WRITE !,"Please wait for several minutes and run the STS option to check if the process has been stopped."
- End DoDot:1
- +47 ;
- +48 QUIT
- +49 ;
- CHK ;EP - Check the server status
- +1 NEW STS,BSTUP
- +2 SET STS=$$CALL^BSTSTST(SERV,"COMMON COLD","")
- +3 QUIT
- +4 ;
- FRMT(VALUE) ;EP - Format the data
- +1 SET VALUE=$EXTRACT(" ",$LENGTH(VALUE))_VALUE
- +2 QUIT VALUE
- +3 ;
- STATUS(SERV,BSTSRPT) ;Set up Server Status Display
- +1 ;
- +2 IF '+$GET(SERV)
- QUIT
- +3 ;
- +4 NEW SDATA,DTSON,CT
- +5 ;
- +6 SET SDATA=^BSTS(9002318.2,SERV,0)
- +7 SET DTSON=$PIECE(SDATA,"^",13)
- +8 IF DTSON=""
- Begin DoDot:1
- +9 DO CHK
- +10 SET SDATA=^BSTS(9002318.2,SERV,0)
- +11 SET DTSON=$PIECE(SDATA,"^",13)
- End DoDot:1
- +12 ;
- +13 ;Get latest entry
- +14 SET CT=+$ORDER(BSTSRPT(""),-1)
- +15 ;
- +16 IF CT=0
- SET CT=1
- SET BSTSRPT(CT)=" "
- +17 SET CT=CT+1
- SET BSTSRPT(CT)=" "
- +18 SET CT=CT+1
- SET BSTSRPT(1)="Current Server Status:"
- +19 SET CT=CT+1
- SET BSTSRPT(CT,"F")="!?5"
- SET BSTSRPT(CT)="Web Service: "
- +20 SET CT=CT+1
- SET BSTSRPT(CT,"F")="?25"
- SET BSTSRPT(CT)=$PIECE(SDATA,"^",1)
- +21 SET CT=CT+1
- SET BSTSRPT(CT,"F")="!?5"
- SET BSTSRPT(CT)="Current Status: "
- +22 SET CT=CT+1
- SET BSTSRPT(CT,"F")="?25"
- SET BSTSRPT(CT)=$SELECT(DTSON="":"ONLINE",1:"OFFLINE")
- +23 SET CT=CT+1
- SET BSTSRPT(CT,"F")="!?5"
- SET BSTSRPT(CT)="Offline Until: "
- +24 SET CT=CT+1
- SET BSTSRPT(CT,"F")="?25"
- SET BSTSRPT(CT)=$SELECT(DTSON="":"N/A",1:$$FMTE^XLFDT(DTSON))
- +25 SET CT=CT+1
- SET BSTSRPT(CT,"F")="!?5"
- SET BSTSRPT(CT)="Last Error Message: "
- +26 SET CT=CT+1
- SET BSTSRPT(CT,"F")="?25"
- SET BSTSRPT(CT)=$SELECT(DTSON="":"N/A",1:$$GET1^DIQ(9002318.2,SERV_",",3,"E"))
- +27 ;
- +28 ;Check if any processes are running
- +29 LOCK +^BSTS(9002318.1,0):0
- IF '$TEST
- Begin DoDot:1
- +30 SET CT=CT+1
- SET BSTSRPT(CT,"F")="!?5"
- SET BSTSRPT(CT)="Background process: "
- +31 SET CT=CT+1
- SET BSTSRPT(CT,"F")="?25"
- SET BSTSRPT(CT)=$PIECE($GET(^XTMP("BSTSLCMP",0)),U,3)
- +32 IF $GET(^XTMP("BSTSLCMP","STS"))]""
- SET CT=CT+1
- SET BSTSRPT(CT,"F")="!?25"
- SET BSTSRPT(CT)=$GET(^XTMP("BSTSLCMP","STS"))
- End DoDot:1
- +33 LOCK -^BSTS(9002318.1,0)
- +34 ;
- +35 ;Check if Description Id Population Utility is running
- +36 LOCK +^XTMP("BSTSCFIX"):0
- IF '$TEST
- Begin DoDot:1
- +37 NEW RUN
- +38 SET CT=CT+1
- SET BSTSRPT(CT,"F")="!?5"
- SET BSTSRPT(CT)="Background process: "
- +39 SET CT=CT+1
- SET BSTSRPT(CT,"F")="?25"
- SET BSTSRPT(CT)="Description Id Population Utility is running"
- +40 SET RUN=$GET(^XTMP("BSTSCFIX","RUN"))
- IF RUN=""
- QUIT
- +41 IF $GET(^XTMP("BSTSCFIX",RUN,"STS"))]""
- SET CT=CT+1
- SET BSTSRPT(CT,"F")="!?25"
- SET BSTSRPT(CT)=$GET(^XTMP("BSTSCFIX",RUN,"STS"))
- End DoDot:1
- +42 LOCK -^XTMP("BSTSCFIX")
- +43 ;
- +44 ;Check if ICD9 to SNOMED process is running
- +45 LOCK +^TMP("BSTSICD2SMD"):0
- IF '$TEST
- Begin DoDot:1
- +46 SET CT=CT+1
- SET BSTSRPT(CT,"F")="!?5"
- SET BSTSRPT(CT)="Background process: "
- +47 SET CT=CT+1
- SET BSTSRPT(CT,"F")="?25"
- SET BSTSRPT(CT)="ICD9 to SNOMED process is running"
- End DoDot:1
- +48 LOCK -^TMP("BSTSICD2SMD")
- +49 ;
- +50 ;Check if install conversion process is running
- +51 LOCK +^TMP("BSTSPBFH"):0
- IF '$TEST
- Begin DoDot:1
- +52 SET CT=CT+1
- SET BSTSRPT(CT,"F")="!?5"
- SET BSTSRPT(CT)="Background process: "
- +53 SET CT=CT+1
- SET BSTSRPT(CT,"F")="?25"
- SET BSTSRPT(CT)="Installation conversion process is running"
- End DoDot:1
- +54 LOCK -^TMP("BSTSPBFH")
- +55 ;
- +56 SET CT=CT+1
- SET BSTSRPT(CT,"F")="!!"
- SET BSTSRPT(CT)="Current Server Settings: "
- +57 SET CT=CT+1
- SET BSTSRPT(CT)=" "
- +58 SET CT=CT+1
- SET BSTSRPT(CT,"F")="!?5"
- SET BSTSRPT(CT)="CHECK FOR CONNECTION AFTER: "
- +59 SET CT=CT+1
- SET BSTSRPT(CT,"F")="?35"
- SET BSTSRPT(CT)=$SELECT($PIECE(SDATA,"^",14)="":"60 minutes (default)",1:$$FRMT($PIECE(SDATA,"^",14))_" minutes")
- +60 SET CT=CT+1
- SET BSTSRPT(CT,"F")="!?5"
- SET BSTSRPT(CT)="CONNECTION TIMEOUT OVERRIDE: "
- +61 SET CT=CT+1
- SET BSTSRPT(CT,"F")="?35"
- SET BSTSRPT(CT)=$SELECT($PIECE(SDATA,"^",12)="":" 2 seconds (default)",1:$$FRMT($PIECE(SDATA,"^",12))_" seconds")
- +62 SET CT=CT+1
- SET BSTSRPT(CT,"F")="!?5"
- SET BSTSRPT(CT)="MAXIMUM REMOTE SEARCH TIME: "
- +63 SET CT=CT+1
- SET BSTSRPT(CT,"F")="?35"
- SET BSTSRPT(CT)=$SELECT($PIECE(SDATA,"^",15)="":"60 seconds (default)",1:$$FRMT($PIECE(SDATA,"^",15))_" seconds")
- +64 SET CT=CT+1
- SET BSTSRPT(CT,"F")="!?5"
- SET BSTSRPT(CT)="TIMEOUT OVERRIDE: "
- +65 SET CT=CT+1
- SET BSTSRPT(CT,"F")="?35"
- SET BSTSRPT(CT)=$SELECT($PIECE(SDATA,"^",5)="":"60 seconds (default)",1:$$FRMT($PIECE(SDATA,"^",5))_" seconds")
- +66 SET CT=CT+1
- SET BSTSRPT(CT,"F")="!?5"
- SET BSTSRPT(CT)="ENABLE SEARCH LOGGING: "
- +67 SET CT=CT+1
- SET BSTSRPT(CT,"F")="?35"
- SET BSTSRPT(CT)=$SELECT($PIECE(SDATA,"^",16):"YES",1:"NO")
- +68 ;
- +69 QUIT
- +70 ;
- SRSTRING ;Return list of search strings
- +1 ;
- +2 NEW FRDT,TODT,ESERV,SRV,SIEN,SNUM,RNAME,EXEC,ENSPACE,BSTSWS,SERVERS
- +3 NEW SPACE,STS,POP,CT,BSTSRPT,ICNT,SRMAX,SCNT
- +4 ;
- +5 SET $PIECE(SPACE," ",80)=" "
- +6 ;
- +7 WRITE !!,"DISPLAY BSTS SEARCH STRINGS USED"
- +8 ;
- +9 ;Get From Date
- +10 SET FRDT=$$DATE^BSTSDSP("From Date","T-7")
- IF 'FRDT
- QUIT
- +11 ;
- +12 ;Get To Date
- +13 SET TODT=$$DATE^BSTSDSP("To Date","T",FRDT)
- IF 'TODT
- QUIT
- +14 ;
- +15 ;Get maximum search results to display
- +16 SET SRMAX=$$SMAX()
- IF 'SRMAX
- QUIT
- +17 ;
- +18 SET ENSPACE=36
- +19 ;
- +20 ;Get the server information
- +21 SET ESERV=$$WSERVER^BSTSWSV(.SERVERS,"")
- IF 'ESERV
- QUIT
- +22 SET SRV=$ORDER(SERVERS(0))
- IF 'SRV
- QUIT
- +23 MERGE BSTSWS=SERVERS(SRV)
- +24 ;
- +25 ;Get the site
- +26 SET SIEN=$ORDER(^AUTTSITE(0))
- IF '+SIEN
- QUIT
- +27 SET SNUM=$$GET1^DIQ(9999999.39,SIEN_",",.01,"I")
- IF SNUM=""
- QUIT
- +28 ;
- +29 ;Get search results
- +30 SET BSTSWS("FRDT")=$PIECE($$FMTE^BSTSUTIL(FRDT),":",1,2)_" 00:00"
- +31 SET BSTSWS("TODT")=$PIECE($$FMTE^BSTSUTIL(TODT),":",1,2)_" 23:59"
- +32 SET BSTSWS("ENSPACE")=ENSPACE
- +33 SET BSTSWS("ESITE")=SNUM
- +34 SET BSTSWS("EPROD")=$$PROD^XUPROD()
- +35 SET RNAME=""
- SET EXEC="S RNAME=$"_"ZNSPACE"
- XECUTE EXEC
- +36 SET BSTSWS("RNAME")=RNAME
- +37 ;
- +38 ;Pull the search list
- +39 SET STS=$$SRCNT^BSTSCMCL(.BSTSWS,.RES)
- +40 ;
- +41 ;Get device
- +42 WRITE !
- +43 SET POP=""
- DO ^%ZIS
- IF POP
- QUIT
- +44 USE IO
- +45 ;
- +46 ;Display results
- +47 SET (SCNT,CT)=0
- SET CT=CT+1
- SET BSTSRPT(CT)="BSTS SEARCH HISTORY: "_$$FMTE^XLFDT(FRDT,"2ZD")_" TO "_$$FMTE^XLFDT(TODT,"2ZD")_" - "_SRMAX_" MOST FREQUENTLY USED"
- +48 SET CT=CT+1
- SET BSTSRPT(CT)=" "
- +49 SET CT=CT+1
- SET BSTSRPT(CT)=$EXTRACT("SEARCH STRING"_SPACE,1,50)_$EXTRACT("COUNT"_SPACE,1,8)
- +50 SET CT=CT+1
- SET BSTSRPT(CT)=" "
- +51 SET ICNT=""
- FOR
- SET ICNT=$ORDER(^TMP("BSTSCMCL",$JOB,ICNT))
- IF ICNT=""
- QUIT
- Begin DoDot:1
- +52 ;
- +53 NEW NODE
- +54 ;
- +55 SET NODE=$GET(^TMP("BSTSCMCL",$JOB,ICNT))
- +56 SET CT=CT+1
- SET BSTSRPT(CT)=$EXTRACT($PIECE(NODE,U)_SPACE,1,50)_$EXTRACT($PIECE(NODE,U,2)_SPACE,1,8)
- +57 SET SCNT=SCNT+1
- End DoDot:1
- IF (SCNT+1)>SRMAX
- QUIT
- +58 ;
- +59 ;Check for no results
- +60 IF SCNT=0
- Begin DoDot:1
- +61 SET CT=CT+1
- SET BSTSRPT(CT)="No results found. This could be because SEARCH LOGGING is disabled or the"
- +62 SET CT=CT+1
- SET BSTSRPT(CT)="report date range is too far in the past and the search history has been"
- +63 SET CT=CT+1
- SET BSTSRPT(CT)="purged from the DTS server. *Note also that the current day's search"
- +64 SET CT=CT+1
- SET BSTSRPT(CT)="history does not get sent until later in the evening so it will not be"
- +65 SET CT=CT+1
- SET BSTSRPT(CT)="immediately available."
- End DoDot:1
- +66 ;
- +67 SET CT=CT+1
- SET BSTSRPT(CT)=" "
- +68 SET CT=CT+1
- SET BSTSRPT(CT)="<END OF REPORT>"
- +69 ;
- +70 ;Display the report
- +71 DO EN^DDIOL(.BSTSRPT)
- +72 ;
- +73 ;Close the device
- +74 DO ^%ZISC
- +75 ;
- +76 IF $DATA(IOST)
- IF IOST["C-"
- IF '$DATA(DIRUT)
- IF '$DATA(DTOUT)
- Begin DoDot:1
- +77 NEW DIR,X,Y
- +78 WRITE !
- SET DIR(0)="E"
- SET DIR("A")="Press 'Return to continue'"
- DO ^DIR
- End DoDot:1
- +79 ;
- +80 QUIT
- +81 ;
- SMAX() ;Prompt for maximum search results to display
- +1 ;
- +2 NEW DIR,DTOUT,DUOUT,DIRUT,DIROUT,X,Y
- +3 ;
- +4 WRITE !
- +5 SET DIR(0)="N^1:9999:4"
- +6 SET DIR("A")="Maximum number of results to return: "
- +7 SET DIR("B")="25"
- +8 DO ^DIR
- +9 IF Y=""
- QUIT ""
- +10 IF $GET(DTOUT)!$GET(DUOUT)!$GET(DIRUT)!$GET(DIROUT)
- QUIT ""
- +11 ;
- +12 QUIT Y