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

IBDFBK2.m

Go to the documentation of this file.
  1. IBDFBK2 ;ALB/AAS - AICS broker Utilities ;23-May-95
  1. ;;3.0;AUTOMATED INFO COLLECTION SYS;;APR 24, 1997
  1. ;
  1. RECV(RESULT,IBD) ; -- called by broker
  1. ; -- receives raw data array from scanning workstation and returns
  1. ; data may come in spurs, IBD("MOREDATA") = 1 if more data pending
  1. ;
  1. ; errors, warnings, and expanded data.
  1. ; Input : Result - (called by reference, see output)
  1. ; IBD - (called by reference) contains the raw
  1. ; data from the workstation (IBD(FD1) - IBD(FD9))
  1. ; IB("MOREDATA") - if more data pending.
  1. ;
  1. ; Output: RESULT - a new array element (result(lcnt) will be
  1. ; created for each error, warning and
  1. ; data element received
  1. ;
  1. N I,J,X,Y,IBDATA,CNT,LCNT,IBDJ,INODE,ZTQUEUED,IOM,IBDF,PXCA,PXCAVSIT,ORVP,IBQUIT,SDFN,FORMID,DIE,DIC,DR,DA,DFN,D,D0,DA,DI,DK,DL,AUPNPAT,AUPNDOB,AUPNDOD,AUPNDAYS,AUPNSEX
  1. I $D(IBD)=0 S RESULT(1)="NO DATA RECEIVED" G RECVQ
  1. S ZTQUEUED="",IOM=80
  1. ;
  1. S I=""
  1. S IBDJ=$J
  1. I $D(IBTEST) S IBDJ=$G(IBD("IBDJ"))
  1. F S I=$O(IBD(I)) Q:I="" S ^TMP("IBD-SCAN-RAWDATA",IBDJ,I)=IBD(I)
  1. I $G(IBD("MOREDATA")) S RESULT(1)="PARTIAL DATA RECEIVED" G RECVQ
  1. ;
  1. S RESULT(1)="0^END OF DATA RECEIVED"
  1. ;
  1. ; -- parse strings
  1. ; data on workstation is built into strings upto 120 characters
  1. ; each data element delimited by a "~" and need to be parsed
  1. ; into an array IBDATA() which is then parsed into the bubbles,
  1. ; dynamic, and handprint arrays. IBDATA() represents data as it
  1. ; is received from the scanner.
  1. ;
  1. S CNT=0
  1. F I=1:1 S INODE="FD"_I S IBDATA=$G(^TMP("IBD-SCAN-RAWDATA",IBDJ,INODE)) Q:IBDATA="" D
  1. . F J=1:1 S X=$P(IBDATA,"~",J) Q:X="" S CNT=CNT+1,IBDF(CNT)=X
  1. ;
  1. S RESULT(1)="DATA PARSED INTO FIRST ARRAY"
  1. K IBD
  1. ;
  1. S RESULT(1)=$$PCE^IBDFBKR(.IBDF,.PXCA)
  1. I $D(PXCA("ERROR")) S RESULT(1)="9^DATA REJECTED BY PCE: Critical data missing or incorrect"
  1. I $D(PXCA("IBD-ABORT")) S RESULT(1)="9^DATA NOT SENT TO PCE"
  1. S LCNT=1
  1. ;
  1. ; -- Don't try to parse array if data isn't valid
  1. S IBQUIT=+RESULT(1),RESULT(1)=$P(RESULT(1),"^",2,99)
  1. G:(IBQUIT<8!(IBQUIT>10)) RECVQ
  1. D EW(.RESULT,.PXCA,.LCNT)
  1. ;
  1. ; -- create result array to pass back to workstation
  1. D LSTDATA^IBDFBK3(.RESULT,.PXCA,.LCNT)
  1. ;
  1. I '$D(IBTEST),'$G(IBD("MOREDATA")) K ^TMP("IBD-SCAN-RAWDATA",$J)
  1. ;remember to uncomment the line above - done 10/29/96 cmr
  1. RECVQ I '$D(IBTEST) K PXCA,IBDF
  1. ;I IBQUIT<8
  1. Q
  1. ;
  1. EW(RESULT,PXCA,LCNT,AICS) ;
  1. ; -- List Errors and Warning generated in PCE
  1. ; Input : Result - (called by reference, see output)
  1. ; PXCA - (by referencethe array of data formated to
  1. ; the PCE device interface specification
  1. ; lcnt - (by reference) a counter for the result array
  1. ; Output: RESULT - a new array element result(lcnt) will be
  1. ; created for each error and warning received
  1. ;
  1. N I,J,K,L,M,X,IBX
  1. F M="ERROR","WARNING","AICS ERROR" I $D(PXCA(M)) D
  1. .I $G(AICS),M="AICS ERROR" Q
  1. .S I="" F S I=$O(PXCA(M,I)) Q:I="" S J="" F S J=$O(PXCA(M,I,J)) Q:J="" D
  1. ..S K="" F S K=$O(PXCA(M,I,J,K)) Q:K="" S L="" F S L=$O(PXCA(M,I,J,K,L)) Q:L="" S IBX=$G(PXCA(M,I,J,K,L)) D
  1. ...S X=M_": "_$P(IBX,"^")
  1. ...I $E(X,1,4)'="AICS" S X="PCE "_X
  1. ...I $P(IBX,"^",2)'="" S X=X_" - "_$P(IBX,"^",2)
  1. ...I $P(IBX,"^",3)'="" S X=X_" - "_$P(IBX,"^",3)
  1. ...I I="DIAGNOSIS/PROBLEM" S X=X_", ICD9: "_$P($G(^ICD9(+$G(PXCA(I,J,K)),0)),"^")_", "_$P($G(PXCA(I,J,K)),"^",13) I L=2,$P(PXCA(I,J,K),"^",2)="P" S $P(PXCA(I,J,K),"^",2)="S"
  1. ...I I="ENCOUNTER",L=15 S X=X_", "_$P($G(^VA(200,+$P($G(PXCA(I)),"^",4),0)),"^") I $P(PXCA(I),"^",15)="P" S $P(PXCA(I),"^",15)="S"
  1. ...D NEWLINE^IBDFBK3(.RESULT,X,.LCNT)
  1. EWQ Q
  1. ;
  1. UNRECV(FID) ; -- used by test to un received data when testing.
  1. ;
  1. N IBI
  1. I +$G(FID)<1 Q
  1. S IBI=0 F S IBI=$O(^IBD(357.96,+FID,9,IBI)) Q:'IBI I $G(^IBD(357.96,+FID,9,IBI,0))'="" S $P(^(0),"^",2)=""
  1. K ^IBD(357.96,+FID,10)
  1. Q
  1. ;
  1. RECVERR(FORMID,ER) ; -- error occurred in ibdfbkr, store in 359.3
  1. Q:ER<11
  1. S DIALOG=$S(ER=11:3579610,ER=12:3579607,ER=13:3579607,ER=14:3579604,ER=15:3579606,ER=16:3579605,ER=17:3579608,ER=18:3579609,1:3570001)
  1. S FORMID=$G(FORMID("FORMID")),FORMID("SOURCE")=1
  1. S FORMID("APPT")=$P($G(^IBD(357.96,+$G(FORMID),0)),"^",3)
  1. D LOGERR^IBDF18E2(DIALOG,.FORMID)
  1. Q
  1. ;
  1. TESTR ;
  1. S IBTEST="" K ALAN
  1. S IBD("MOREDATA")=0
  1. S IBD("IBDJ")=576718735
  1. S FORMID=+$P($G(^TMP("IBD-SCAN-RAWDATA",IBD("IBDJ"),"FD1")),"FORMID=",2)
  1. I +FORMID>0 D UNRECV(FORMID)
  1. D RECV(.ALAN,.IBD)
  1. W !! X "ZW ALAN W !! ZW PXCA"
  1. K IBTEST
  1. Q