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

HLCSRPT4.m

Go to the documentation of this file.
  1. HLCSRPT4 ;OIFO-O/LJA - Error Listing code ;3/18/02 10:19 [ 04/02/2003 8:38 AM ]
  1. ;;1.6;HEALTH LEVEL SEVEN;**1004**;APR 1, 2003
  1. ;;1.6;HEALTH LEVEL SEVEN;**85**;Oct 13, 1995
  1. ;
  1. ; Patch HL*1.6*85 created a significant amount of code; enough
  1. ; that this routine had to be created to hold it.
  1. ;
  1. LOADERR ; Find latest NUMERR statuses in ERRDTB->ERRDTE date range. ;HL*1.6*85
  1. ;ERRDTB,ERRDTE,HLCSER,HLCSTER1,NUMERR -- req
  1. ;
  1. N CT,ERR,ERR4,IEN,TIME
  1. ;
  1. KILL ^TMP("HLERR",$J),^TMP("ERRLST",$J)
  1. ;
  1. S HLERR=3.9,CT=0
  1. F S HLERR=$O(^HLMA("AG",HLERR)) QUIT:HLERR'>0!(HLERR>7) D
  1. . S IEN773=0
  1. . F S IEN773=$O(^HLMA("AG",HLERR,IEN773)) Q:IEN773'>0 D
  1. . . S ERR4=$P($G(^HLMA(+IEN773,"P")),U,4) QUIT:ERR4'>0 ;->
  1. . . D CHKERR(ERR4,IEN773,ERRDTB,ERRDTE)
  1. . . S CT=CT+1 W:'(CT#1000) "."
  1. ;
  1. S ERR=0
  1. F S ERR=$O(^TMP("HLERR",$J,ERR)) Q:ERR'>0 D
  1. . S TIME=0
  1. . F S TIME=$O(^TMP("HLERR",$J,ERR,TIME)) Q:TIME'>0 D
  1. . . S IEN=0
  1. . . F S IEN=$O(^TMP("HLERR",$J,ERR,TIME,IEN)) Q:IEN'>0 D
  1. . . . S ^TMP("ERRLST",$J,+ERR,+IEN)=""
  1. ;
  1. KILL ^TMP("HLERR",$J)
  1. ;
  1. QUIT
  1. ;
  1. CHKERR(ERR4,IEN773,DTB,DTE) ; Should this entry be included? ;HL*1.6*85
  1. ;NUMERR -- req
  1. ;
  1. N ERRNO,OLD773,OLDPDT,PROCDT
  1. ;
  1. ; Processing date/time check...
  1. S PROCDT=$$PROCDT(IEN773) QUIT:PROCDT'>0 ;->
  1. I PROCDT<DTB!(PROCDT>DTE) QUIT ;->
  1. ; OK. Date check passes. But, is it among NUMERR latest?
  1. ;
  1. ; How many errors recorded for error status?
  1. S ERRNO=$G(^TMP("HLERR",$J,ERR4))
  1. ;
  1. ; Number of errors recorded less than # maximum per status...
  1. I ERRNO<NUMERR D RECERR(ERR4,IEN773) QUIT ;->
  1. ;
  1. ; Find oldest entry's process date/time & last 773 IEN...
  1. S OLDPDT=$O(^TMP("HLERR",$J,ERR4,0)) QUIT:OLDPDT'>0 ;->
  1. S OLD773=$O(^TMP("HLERR",$J,ERR4,+OLDPDT,0)) QUIT:OLD773'>0 ;->
  1. ;
  1. ; Now see if "this" error is newer...
  1. QUIT:PROCDT<OLDPDT ;->
  1. I PROCDT=OLDPDT,IEN773<OLD773 QUIT ;->
  1. ;
  1. ; Max number errors reached, but this error is newer than newest...
  1. ;
  1. ; Zilch oldest entry, then record "this" error...
  1. D KILLERR(ERR4,OLDPDT,OLD773)
  1. D RECERR(ERR4,IEN773)
  1. ;
  1. QUIT
  1. ;
  1. KILLERR(ERR4,OLDPDT,OLD773) ; Remove entry and adjust counts... ;HL*1.6*85
  1. N NUM
  1. ;
  1. KILL ^TMP("HLERR",$J,ERR4,OLDPDT,OLD773)
  1. ;
  1. I $O(^TMP("HLERR",$J,ERR4,OLDPDT,0))'>0 D
  1. . KILL ^TMP("HLERR",$J,ERR4,OLDPDT)
  1. I $O(^TMP("HLERR",$J,ERR4,OLDPDT,0))>0 D
  1. . S NUM=$G(^TMP("HLERR",$J,ERR4,OLDPDT))-1,NUM=$S(NUM'<0:+NUM,1:0)
  1. . S ^TMP("HLERR",$J,ERR4,OLDPDT)=NUM
  1. ;
  1. I $O(^TMP("HLERR",$J,ERR4,0))'>0 D
  1. . KILL ^TMP("HLERR",$J,ERR4)
  1. I $O(^TMP("HLERR",$J,ERR4,0))>0 D
  1. . S NUM=$G(^TMP("HLERR",$J,ERR4))-1,NUM=$S(NUM'<0:+NUM,1:0)
  1. . S ^TMP("HLERR",$J,ERR4)=NUM
  1. ;
  1. I $O(^TMP("HLERR",$J,0))'>0 D
  1. . KILL ^TMP("HLERR",$J)
  1. I $O(^TMP("HLERR",$J,0))>0 D
  1. . S NUM=$G(^TMP("HLERR",$J))-1,NUM=$S(NUM'<0:+NUM,1:0)
  1. . S ^TMP("HLERR",$J)=NUM
  1. ;
  1. QUIT
  1. ;
  1. RECERR(ERR4,IEN773) ; Store error in ^TMP("HLERR",$J,STATUS,IEN773) ;HL*1.6*85
  1. S ^TMP("HLERR",$J,ERR4)=$G(^TMP("HLERR",$J,ERR4))+1
  1. S ^TMP("HLERR",$J,ERR4,PROCDT)=$G(^TMP("HLERR",$J,ERR4,PROCDT))+1
  1. S ^TMP("HLERR",$J,ERR4,PROCDT,IEN773)=""
  1. QUIT
  1. ;
  1. SETUP() ; Setup "limit" variables... ;HL*1.6*85
  1. S TYPEINFO=$$TYPEINFO QUIT:TYPEINFO']"" "" ;->
  1. ;
  1. S (ERRDTB,ERRDTE,NUMERR)=""
  1. W !!," If you answer NO below, you will be allowed to specify the number of"
  1. W !," errors to be included in the report."
  1. W !
  1. S NUMERR=$$YN("Print all errors","No") QUIT:NUMERR']"" "" ;->
  1. S NUMERR=$S(NUMERR=1:9999999,1:$$NUMERR) QUIT:NUMERR'>0 "" ;->
  1. I NUMERR=9999999 D
  1. . W !!," All errors in the date range you specify next will be included"
  1. . W !," in the report."
  1. I NUMERR'=9999999 D
  1. . W !!," The newest ",NUMERR," errors, for every error status, in the date range you"
  1. . W !," specify next will be included in the report."
  1. W !!,"The first entry at your site is from ",$$FMTE^XLFDT($O(^HL(772,"B",2840000))),"."
  1. W !
  1. S1 S ERRDTB=$$DATE("Enter START DATE/TIME",,$$FMADD^XLFDT($$DT^XLFDT,-90)) QUIT:ERRDTB'>0 "" ;->
  1. W !
  1. S ERRDTE=$$DATE("Enter END DATE/TIME",ERRDTB,"NOW") QUIT:ERRDTE'>0 "" ;->
  1. I ERRDTB=ERRDTE D G S1 ;->
  1. . W !!,"You cannot enter the same values for the beginning and ending times!"
  1. . W !
  1. QUIT 1
  1. ;
  1. NUMERR() ; How many errors, maximum, does user want to see ;HL*1.6*85
  1. ; HLCSER -- req
  1. N DIR,DIRUT,DTOUT,DUOUT,X,Y
  1. W !!,"Enter the maximum number errors to report for every error status."
  1. W !
  1. S DIR(0)="N",DIR("A")="Enter maximum number errors/status"
  1. S DIR("B")=999
  1. S DIR("?",1)="If you enter '1000' for the maximum number errors/status..."
  1. S DIR("?",2)=""
  1. I HLCSER="ALL" D
  1. . S DIR("?",3)="... The most recent 1000 errors for every error type will be included in the"
  1. . S DIR("?",4)="... report. If two different error types exist, and each error type has"
  1. . S DIR("?",5)="... more than 1000 entries, then 2000 errors will be reported."
  1. . S DIR("?")="... (I.e., 1000 errors per error type.)"
  1. I HLCSER'="ALL" D
  1. . S DIR("?",3)="... The most recent 1000 errors for the error type you just selected"
  1. . S DIR("?")="... will be included in the report."
  1. D ^DIR
  1. QUIT $S(Y>0:+Y,1:"")
  1. ;
  1. DATE(PMT,BDT,PDT) ; Entry of date for looping ;HL*1.6*85
  1. N DIR,DIRUT,DTOUT,DUOUT,X,Y
  1. S BDT=$S($G(BDT)?7N.E:BDT,1:"")
  1. S DIR(0)="DA^"_$G(BDT)_"::ET"
  1. I $G(BDT)>0 D
  1. . N TXT
  1. . S TXT="Enter a date/time after "_$$FMTE^XLFDT(BDT)_"..."
  1. . S DIR("?")=TXT
  1. S DIR("A")=PMT_": "
  1. I $G(PDT)?7N.E S DIR("B")=$P($$FMTE^XLFDT(PDT),":",1,2)
  1. I $G(PDT)="NOW" S DIR("B")="NOW"
  1. D ^DIR
  1. I Y?7N.E,$G(PMT)="NOW",$G(PDT)="NOW" QUIT 9999999.24 ;->
  1. QUIT $S(Y>0:+Y,1:"")
  1. ;
  1. YN(PMT,DEF,FF) ; Generic YES/NO DIR call... ;HL*1.6*85
  1. N DIR,DIRUT,DTOUT,DUOUT,X,Y
  1. F X=1:1:$G(FF) W !
  1. S DIR(0)="Y",DIR("A")=PMT
  1. S:$G(DEF)]"" DIR("B")=DEF
  1. D ^DIR
  1. QUIT:$D(DIRUT)!($D(DTOUT))!($D(DUOUT)) "" ;->
  1. QUIT $S(Y=1:1,1:0)
  1. ;
  1. TMPLOG ; Reset ^TMP("TMPLOG") data created in ERRRPT to ^TMP("TLOG") format
  1. ; expected by the browser. (See DISPLAY^HLCSRPT)
  1. ; [This subroutine created by HL*1.6*85.]
  1. N HLCSLN,PROCDT,IEN773
  1. S HLCSLN=0,PROCDT="zzzzz"
  1. F S PROCDT=$O(^TMP("TMPLOG",$J,PROCDT),-1) Q:PROCDT']"" D
  1. . S IEN773=":"
  1. . F S IEN773=$O(^TMP("TMPLOG",$J,PROCDT,IEN773),-1) Q:IEN773'>0 D
  1. . . S HLCSLN=HLCSLN+1
  1. . . S ^TMP("TLOG",$J,+HLCSLN)=$G(^TMP("TMPLOG",$J,PROCDT,IEN773))
  1. KILL ^TMP("TMPLOG",$J)
  1. QUIT
  1. ;
  1. OKDATE(IEN773,DTBEG,DTEND) ; Does 773 processing time fall in date range? ;HL*1.6*85
  1. N PROCDT
  1. ;
  1. ; Check what's passed in...
  1. QUIT:'$D(^HLMA(+IEN773,0)) "" ;->
  1. QUIT:$G(DTBEG)'?7N.E "" ;->
  1. QUIT:$G(DTEND)'?7N.E "" ;->
  1. ;
  1. ; Get processing date/time...
  1. S PROCDT=$$PROCDT(IEN773) QUIT:PROCDT'?7N.E "" ;->
  1. ;
  1. ; Compare dates...
  1. I PROCDT=DTBEG!(PROCDT=DTEND) QUIT 1 ;->
  1. QUIT:PROCDT<DTBEG "" ;->
  1. QUIT:PROCDT>DTEND "" ;->
  1. ;
  1. QUIT 1
  1. ;
  1. PROCDT(IEN773) ; Return 773'S processing date (1st), or if not available
  1. ; return the 772 creation date/time. ;HL*1.6*85
  1. N PROCDT
  1. S PROCDT=$P($G(^HLMA(+IEN773,"S")),U) QUIT:PROCDT?7N.E PROCDT ;->
  1. QUIT $P($G(^HL(772,+$G(^HLMA(+IEN773,0)),0)),U)
  1. ;
  1. DTORTM(DTB,DTE,PDT) ; Show date or time?
  1. QUIT $S($E(DTB,1,7)=$E(DTE,1,7):$$TM(PDT),1:$$DT(PDT))
  1. ;
  1. TM(PDT) ; Show the 5 character hh:mm time
  1. QUIT $E($P($$FMTE^XLFDT(+PDT),"@",2),1,5)
  1. ;
  1. DT(PDT) ; Show the 8 character mm/dd/yy date
  1. QUIT $E(PDT,4,5)_"/"_$E(PDT,6,7)_"/"_$E(PDT,2,3)
  1. ;
  1. TYPEINFO() ; Display error type or application information?
  1. N DIR,DIRUT,DTOUT,DUOUT,X,Y
  1. W !!,"Select the report view now. There are two report views. Both list the "
  1. W !,"internal entry number from the HL7 Message Administration file (#773) entry,"
  1. W !,"message ID, processing date or time, and logical link. The two report views"
  1. W !,"differ in the remainder of the information displayed on the report. "
  1. S DIR(0)="S^1:Display message, event, & application data;2:Display error type"
  1. S DIR("A")="Select data to display",DIR("B")=1
  1. S DIR("?",1)="Select the data to be displayed in the last few columns of the report after"
  1. S DIR("?")="the IEN, message ID, processing date or time, and logical link."
  1. D ^DIR
  1. QUIT $S(Y>0:+Y,1:"")
  1. ;
  1. EOR ;HLCSRPT4 - Error Listing code ;3/18/02 10:19