Home   Package List   Routine Alphabetical List   Global Alphabetical List   FileMan Files List   FileMan Sub-Files List   Package Component Lists   Package-Namespace Mapping  
Routine: VBECA7A

VBECA7A.m

Go to the documentation of this file.
  1. VBECA7A ;HOIFO/SAE - Workload API ; 9/30/04 5:38pm
  1. ;;2.0;VBEC;;Jun 05, 2015;Build 4
  1. ;
  1. ; Note: This routine supports data exchange with an FDA registered
  1. ; medical device. As such, it may not be changed in any way without
  1. ; prior written approval from the medical device manufacturer.
  1. ;
  1. ; Integration Agreements:
  1. ; VBECS workload update supported by IA 4628
  1. ; Reference to LIST^DIC supported by DBIA #2051
  1. ; Reference to EN^MXMLPRSE supported by IA #4149
  1. ;
  1. QUIT
  1. ;
  1. UPDTWKLD ; Update Workload Event Data
  1. ;
  1. ; This routine initializes Vistalink connection values (port,
  1. ; URL, etc.), then builds a local array of selected entries
  1. ; (those that have been successfully processed) from the
  1. ; VistA VBECS WORKLOAD CAPTURE (#6002.01) file.
  1. ; For each entry, listed in the local array, does the following:
  1. ; - sends request, via VistaLink, to .Net VBECS VistALink listener
  1. ; - receives response: VBECS processing status or ErrorText message
  1. ; - If no errors (comm, VistaLink, etc.):
  1. ; - update VBECS WORKLOAD CAPTURE (#6002.01) file entry:
  1. ; - delete it (if it had been successfully processed in VBECS) or
  1. ; - update two fields in this entry (if there had been ErrorText)
  1. ; - If comm, VistaLink, etc., errors:
  1. ; - not update VistA
  1. ; - save the non-specific error for inclusion in MailMan message.
  1. ; - A MailMan message is transmitted to the G.VBECS INTERFACE ADMIN
  1. ; mail group:
  1. ; - identifying success or failure and other transaction info
  1. ;
  1. ; Input - none
  1. ; Output - no output variables.
  1. ; However, MailMan msg is sent for fatal errors.
  1. ;
  1. N VBY ; array of file 6002.01 fields from selected entries
  1. N VBIEN ; IEN of entry to delete - used in ENELE subroutine
  1. N VBRSLT ; ^TMP global array of results returned from VBECS
  1. N VBMT ; array with VistA update status messages for mail text
  1. N VBN ; loop control variable for For loop
  1. N VBECPRMS ; local array for REQUEST and results
  1. N VBIENSV ; IEN to save and use to verify same as VBECS
  1. N VBMTBLT ; flag that signifies that VBMT has been built
  1. ;
  1. S VBN=0
  1. S VBRSLT=$NA(^TMP("VBECS_XML_RES",$J)) K @VBRSLT
  1. S VBMT=$NA(^TMP("VBECS_MAIL_TEXT",$J)) K @VBMT
  1. ;
  1. D INITV^VBECRPCC("VBECS Update Workload Event") ; init VL listener
  1. D CHKERROR^VBECA7A1(.VBECPRMS,VBRSLT,VBMT)
  1. I $D(@VBMT@(" ERROR")) D Q
  1. . D BLDERMSG^VBECA7A1(.VBECPRMS,VBRSLT,VBMT)
  1. . D SENDMSG(VBMT)
  1. . D CLEANUP
  1. ;
  1. D GETVISTA(.VBY)
  1. ;
  1. ; step thru array. each node contains one entry from file 6002.01
  1. F S VBN=$O(VBY("DILIST",VBN)) Q:VBN']"" D Q:$D(@VBMT@(" ERROR"))
  1. . K @VBMT
  1. . D BLDPARMS(.VBY,VBN,.VBECPRMS)
  1. . D BLDRSLTS(.VBECPRMS)
  1. . D CHKERROR^VBECA7A1(.VBECPRMS,VBRSLT,VBMT)
  1. . Q:$D(@VBMT@(" ERROR"))
  1. . D BLDGLOB(.VBECPRMS,VBRSLT)
  1. . D CHKERROR^VBECA7A1(.VBECPRMS,VBRSLT,VBMT)
  1. . Q:$D(@VBMT@(" ERROR"))
  1. . D SETVISTA(VBRSLT)
  1. . D CHKERROR^VBECA7A1(.VBECPRMS,VBRSLT,VBMT)
  1. ;
  1. I $D(@VBMT@(" ERROR")) D Q
  1. . D BLDERMSG^VBECA7A1(.VBECPRMS,VBRSLT,VBMT)
  1. . D SENDMSG(VBMT)
  1. ;
  1. D CLEANUP
  1. Q
  1. ;
  1. GETVISTA(VBY) ; get file entries from VBECS WORKLOAD CAPTURE (#6002.01) file
  1. ;
  1. Q:$D(@VBMT@(" ERROR"))
  1. ;
  1. ;
  1. ; Input
  1. ; none
  1. ; Output
  1. ; VBY - array, with each entries' fields packed into each node:
  1. ; IEN of entry is in first piece of the node value
  1. ; Fields shown in VBECFLDS variable
  1. ; List fields in same sequence as SDD Input section 4.1.4
  1. ;
  1. N VBECFLDS ; fields to retrieve & pack in each VBY("DILIST") node
  1. N VBECSCR ; screen to filter in entries for two fields:
  1. ; PROCESSED DATE (#4) field - not null
  1. ; STATUS (#5) field - (S)UCCESSFULLY PROCESSED
  1. ;
  1. S X1=DT,X2=-14 D C^%DTC S VBOFF=X
  1. S VBECFLDS="@;.01;5I;4I;20;99"
  1. S VBECSCR("S")="I ($P(^(0),U,4)>VBOFF)&($P(^(0),U,6)=""S"")" ;RLM 6-1-2010
  1. D LIST^DIC(6002.01,"",VBECFLDS,"P","","","","",.VBECSCR,"","VBY")
  1. S VBLOOP=0 F S VBLOOP=$O(VBY("DILIST",VBLOOP)) Q:'VBLOOP S $P(VBY("DILIST",VBLOOP,0),"^",4)=$P(VBY("DILIST",VBLOOP,0),"^",4)_$E("0000000.000000",$L($P(VBY("DILIST",VBLOOP,0),"^",4)),13)
  1. ;Added formatting to ensure a six digit time. RLM 4/2/2008
  1. ; VBY("DILIST",4,0)=
  1. ; 8^AC934682-43C2-4B7E-B63B-063C7BABCFAD^^JUL 28, 2004@23:23:49^
  1. ; some sample error text^pce encounter value
  1. Q
  1. ;
  1. BLDPARMS(VBY,VBN,VBECPRMS) ; build VBECPRMS(PARAMS)
  1. ;
  1. Q:$D(@VBMT@(" ERROR"))
  1. ;
  1. ; Build VBECPRMS("PARAMS" array for current VistA entry
  1. ;
  1. ; Input
  1. ; VBY ; Array: VBECS WORKLOAD CAPTURE (#6002.01) file entries
  1. ; VBN ; Node from VBY filtered collection of entries
  1. ; VBECPRMS ; root of target 'REQUEST' array to build
  1. ; Output
  1. ; VBECPRMS ; root of target 'REQUEST' array to build
  1. ;
  1. N VBW ; field value
  1. N VBECPI ; DILIST node piece and VBECPRMS node subscript
  1. N VBNODVAL ; value of node
  1. N VBX ; array node
  1. ;
  1. S VBNODVAL=VBY("DILIST",VBN,0)
  1. S VBX="INITIAL IEN: "_$P(VBNODVAL,U)_U_$P(VBNODVAL,U)
  1. S @VBMT@("!INITIAL IEN")=VBX
  1. S VBNODVAL=$E(VBNODVAL,$F(VBNODVAL,U),$L(VBNODVAL)) ; remove IEN
  1. F VBECPI=1:1:5 D
  1. . S VBW=$P(VBNODVAL,U,VBECPI)
  1. . S VBECPRMS("PARAMS",VBECPI,"VALUE")=VBW
  1. . S VBECPRMS("PARAMS",VBECPI,"TYPE")="STRING"
  1. Q
  1. ;
  1. BLDRSLTS(VBECPRMS) ; put results in VBECPRMS("RESULTS") local array
  1. ;
  1. ; Input
  1. ; VBECPRMS ; root of target 'REQUEST' array to build
  1. ; Output
  1. ; VBECPRMS ; root of target 'REQUEST' array to build
  1. ;
  1. N VBSTAT ; temp variable
  1. ;
  1. S VBSTAT=$$EXECUTE^VBECRPCC(.VBECPRMS)
  1. Q
  1. ;
  1. BLDGLOB(VBECPRMS,VBRSLT) ; put results from VBECS in ^TMP global
  1. ;
  1. Q:$D(@VBMT@(" ERROR"))
  1. ;
  1. ;
  1. ; Input
  1. ; VBECPRMS - array
  1. ; Output
  1. ; VBRSLT - $NA of ^TMP results global to build
  1. ;
  1. D PARSE^VBECRPC1(.VBECPRMS,VBRSLT)
  1. Q
  1. ;
  1. SETVISTA(VBRSLT) ; Update Vista. MXMLPRSE invokes callback routines
  1. ;
  1. ; Input
  1. ; VBRSLT - name of results global
  1. ;
  1. N VBCBK ; callback routines
  1. ;
  1. Q:$D(@VBMT@(" ERROR"))
  1. ;
  1. ; callbacks allow MXMLPRSE to put data in file 6002.01
  1. S VBCBK("STARTELEMENT")="STELE^VBECA7A1"
  1. S VBCBK("ENDELEMENT")="ENELE^VBECA7A1"
  1. S VBCBK("CHARACTERS")="CHAR^VBECA7A1"
  1. S OPTION=""
  1. D EN^MXMLPRSE(VBRSLT,.VBCBK,.OPTION)
  1. Q
  1. ;
  1. SENDMSG(VBMT) ; Function - send error message to mail group
  1. ;
  1. ; If unsuccessful deletion, send error text
  1. ;
  1. ; Input:
  1. ; VBMT array with info about transaction
  1. ;
  1. N VBT ; node in array during $Q
  1. N VBLN ; message parameters
  1. N VBGROUP ; name of mail group to which message will be sent
  1. N VBCNT ; line count of VBLN array
  1. N VBUSERNM ; IEN of user's entry in NEW PERSON file
  1. N VBUSER ; name of user running this program
  1. N XMDUZ ; sender
  1. N XMSUB ; message subject
  1. N XMTEXT ; message text array
  1. N XMY ; recipient array
  1. N XMZ ; returned message number
  1. ;
  1. I '$D(@VBMT@(" ERROR")) Q
  1. ;. S VBX="SUCCESSFUL VBECS-VistA dialog"
  1. ;. S @VBMT@("!SUCCESSFUL VBECS-VISTA DIALOG")=VBX
  1. ;
  1. S VBCNT=1
  1. S VBT=$NA(@VBMT)
  1. ;
  1. ;S VBUSERNM=$$GET1^DIQ(200,DUZ,.01)
  1. ;
  1. S VBLN(VBCNT)="* * * VBECS Workload Event Error Notification * * *"
  1. F S VBT=$Q(@VBT) Q:VBT="" Q:$NA(@VBT)'[$J D
  1. . S VBCNT=VBCNT+1
  1. . S:VBT["DILIST" VBLN(VBCNT)=$G(@VBT)
  1. . S:VBT'["DILIST" VBLN(VBCNT)=$P($G(@VBT),U)
  1. . S VBLN(VBCNT)=$TR(VBLN(VBCNT),"""","'")
  1. ;
  1. S XMDUZ="VBECS Workload Event"
  1. S XMSUB="VBECS Workload Event"
  1. S XMTEXT="VBLN("
  1. ; reactivate the following ling after testing:
  1. S XMY("G.VBECS INTERFACE ADMIN")=""
  1. ;S XMY(VBUSERNM)=""
  1. D ^XMD
  1. Q
  1. ;
  1. CLEANUP K ATR,CBK,DIERR,ELE,VBFDA,OPTION,TEXT,VBECPRMS,@VBRSLT,@VBMT
  1. Q