BPXRMIMF ; IHS/MSC/MGH - Handle immunization forecaster. ;18-Apr-2014 15:21;DU
;;2.0;CLINICAL REMINDERS;**1001,1002**;Feb 04, 2005;Build 15
;=================================================================
;This routine is designed to check and see if the forecaster has
;already run for this patient. If it has run, the data is current.
;If it hasn't run the forecaster is called to update the data
;=====================================================================
CHECK(DFN,TEST,DATE,VALUE,TEXT) ;
;Check if forecaster already has already run
N X,Y,TODAY,BIERR
S TODAY=$$DT^XLFDT()
I $D(^XTMP("BIPDUE",DFN)) D
.I $G(^XTMP("BIPDUR",DFN))'=TODAY D RUN
I '$D(^XTMP("BIPDUE",DFN)) D RUN
Q
RUN ;Run the forecaster
I '$$FORECAS^BIUTL2(DUZ(2)) S TEST=1,VALUE="Forecasting not enabled",DATE=TODAY Q
D UPDATE^BIPATUP(DFN,DT,.BIERR,1)
I BIERR'="" S TEST=1,VALUE="Error on running forecaster",DATE=TODAY
E S TEST=1,DATE=TODAY,VALUE="Immunization due"
Q
BPXRMIMF ; IHS/MSC/MGH - Handle immunization forecaster. ;18-Apr-2014 15:21;DU
+1 ;;2.0;CLINICAL REMINDERS;**1001,1002**;Feb 04, 2005;Build 15
+2 ;=================================================================
+3 ;This routine is designed to check and see if the forecaster has
+4 ;already run for this patient. If it has run, the data is current.
+5 ;If it hasn't run the forecaster is called to update the data
+6 ;=====================================================================
CHECK(DFN,TEST,DATE,VALUE,TEXT) ;
+1 ;Check if forecaster already has already run
+2 NEW X,Y,TODAY,BIERR
+3 SET TODAY=$$DT^XLFDT()
+4 IF $DATA(^XTMP("BIPDUE",DFN))
Begin DoDot:1
+5 IF $GET(^XTMP("BIPDUR",DFN))'=TODAY
DO RUN
End DoDot:1
+6 IF '$DATA(^XTMP("BIPDUE",DFN))
DO RUN
+7 QUIT
RUN ;Run the forecaster
+1 IF '$$FORECAS^BIUTL2(DUZ(2))
SET TEST=1
SET VALUE="Forecasting not enabled"
SET DATE=TODAY
QUIT
+2 DO UPDATE^BIPATUP(DFN,DT,.BIERR,1)
+3 IF BIERR'=""
SET TEST=1
SET VALUE="Error on running forecaster"
SET DATE=TODAY
+4 IF '$TEST
SET TEST=1
SET DATE=TODAY
SET VALUE="Immunization due"
+5 QUIT