MPIFFULL ;BP/CMC-ALLOW ASSIGNMENT OF LOCAL ICNS FOR X PATIENTS ;29 Dec 2011 4:06 PM
;;1.0;MASTER PATIENT INDEX VISTA;**54**;30 Apr 99;Build 2
;
; Integration Agreement Utilized:
; ^DPT( - #2070
;
; $O through Patient file (#2) finding patients that don't have ICNs
; assigning X patients local ICNs
;
LOCALIA(RETURN,HOWM) ;
;RETURN IS USED TO RETURN COUNTER OF HOW MANY COMPLETED AND IF PROCESS HAS COMPLETED FOR THE SITE
;HOWM IS HOW MANY PATIENTS SHOULD BE PROCESSED THIS TIME
;
N IEN,NODE,DFN,CNT,X,Y,%,%H,%I,ICN,LAST
I $D(^XTMP("MPIF FULL ENUMERATION")) S RETURN=0,RETURN(0)="1^PROCESS ALREADY RUNNING" Q
D NOW^%DTC
I '$D(^XTMP("MPIF FULL ENUMERATION")) S ^XTMP("MPIF FULL ENUMERATION",0)=%+10_"^"_%_"^"_"Full Enumeration of Patients to MPI"
;
;**54,MVI_913: Set 0 node of ^XTMP that will contain list of records that appear to be "old"
S ^XTMP("MPIF OLD RECORDS",0)=$$FMADD^XLFDT(X,90)_"^"_%_"^List of 'old' records"
;
;GET LAST DFN COMPLETED
S IEN=$O(^MPIF(984.8,"B","ONE","")),NODE=$G(^MPIF(984.8,IEN,0))
I $P(NODE,"^",5)'="" S RETURN(0)="1^FULL ENUMERATION COMPLETED",RETURN=0 K ^XTMP("MPIF FULL ENUMERATION",0) Q
; ^ FULL ENUMERATION COMPLETED
S DFN=0,CNT=0,RETURN=1
I $P(NODE,"^",4)'="" S DFN=$P(NODE,"^",4)
D NOW^%DTC
S $P(NODE,"^",2)=%
F S DFN=$O(^DPT(DFN)) Q:DFN=""!(CNT=HOWM) D
.I $P($G(^DPT(DFN,"MPI")),"^")="",'$D(^DPT(DFN,-9)) D
..;**54,MVI_913: Add DFN to ^XTMP old list
..S:$D(^DPT("AMPIMIS",DFN))[0 ^XTMP("MPIF OLD RECORDS",DFN)=""
..S ICN=$$ICNLC^MPIF001(DFN),CNT=CNT+1,LAST=DFN
D NOW^%DTC
S $P(NODE,"^",3)=%,$P(NODE,"^",4)=LAST
I DFN="" S RETURN(0)="1^"_CNT_" PROCESSED^FULL ENUMERATION COMPLETED "_%,$P(NODE,"^",5)="FULL ENUMERATION COMPLETED"
I DFN'="" S RETURN(0)="1^"_CNT_" PROCESSED - COMPLETED @ "_%
S ^MPIF(984.8,IEN,0)=NODE
K ^XTMP("MPIF FULL ENUMERATION",0)
Q
;
STATS(RETURN) ;
;RETURN IS THE ARRAY TO HOLD THE STAT DATA
N IEN,CNT,DFN,ICN,SITE
S SITE=$P($$SITE^VASITE(),"^",3)
S CNT("NICN")=0,CNT("LOCAL")=0,CNT("MERGED")=0,CNT("NOICN")=0
S IEN=$O(^MPIF(984.8,"B","ONE","")),RETURN=0
Q:IEN<1
S NODE=$G(^MPIF(984.8,IEN,0)),RETURN=1
S DFN=0
F S DFN=$O(^DPT(DFN)) Q:DFN="" D
.S ICN=$P($G(^DPT(DFN,"MPI")),"^")
.I $E(ICN,1,3)=SITE S CNT("LOCAL")=CNT("LOCAL")+1
.I $E(ICN,1)=1 S CNT("NICN")=CNT("NICN")+1
.I $D(^DPT(DFN,-9)) S CNT("MERGED")=CNT("MERGED")+1
.I ICN="",'$D(^DPT(DFN,-9)) S CNT("NOICN")=CNT("NOICN")+1
S RETURN(1)=$P(NODE,"^",5)_"^"_$P(NODE,"^",3)_"^"_CNT("NICN")_"^"_CNT("LOCAL")_"^"_CNT("MERGED")_"^"_CNT("NOICN")
;COMPLETED?^LAST COMPLETED RUN^TOTAL NATIONAL ICNS^TOTAL LOCAL ICNS^TOTAL MERGED RECORDS^TOTAL RECORDS WITHOUT ICN
Q
--- Routine Detail --- with STRUCTURED ROUTINE LISTING ---[H[J[2J[HMPIFFULL 2696 printed Oct 16, 2024@18:11:54 Page 2
MPIFFULL ;BP/CMC-ALLOW ASSIGNMENT OF LOCAL ICNS FOR X PATIENTS ;29 Dec 2011 4:06 PM
+1 ;;1.0;MASTER PATIENT INDEX VISTA;**54**;30 Apr 99;Build 2
+2 ;
+3 ; Integration Agreement Utilized:
+4 ; ^DPT( - #2070
+5 ;
+6 ; $O through Patient file (#2) finding patients that don't have ICNs
+7 ; assigning X patients local ICNs
+8 ;
LOCALIA(RETURN,HOWM) ;
+1 ;RETURN IS USED TO RETURN COUNTER OF HOW MANY COMPLETED AND IF PROCESS HAS COMPLETED FOR THE SITE
+2 ;HOWM IS HOW MANY PATIENTS SHOULD BE PROCESSED THIS TIME
+3 ;
+4 NEW IEN,NODE,DFN,CNT,X,Y,%,%H,%I,ICN,LAST
+5 IF $DATA(^XTMP("MPIF FULL ENUMERATION"))
SET RETURN=0
SET RETURN(0)="1^PROCESS ALREADY RUNNING"
QUIT
+6 DO NOW^%DTC
+7 IF '$DATA(^XTMP("MPIF FULL ENUMERATION"))
SET ^XTMP("MPIF FULL ENUMERATION",0)=%+10_"^"_%_"^"_"Full Enumeration of Patients to MPI"
+8 ;
+9 ;**54,MVI_913: Set 0 node of ^XTMP that will contain list of records that appear to be "old"
+10 SET ^XTMP("MPIF OLD RECORDS",0)=$$FMADD^XLFDT(X,90)_"^"_%_"^List of 'old' records"
+11 ;
+12 ;GET LAST DFN COMPLETED
+13 SET IEN=$ORDER(^MPIF(984.8,"B","ONE",""))
SET NODE=$GET(^MPIF(984.8,IEN,0))
+14 IF $PIECE(NODE,"^",5)'=""
SET RETURN(0)="1^FULL ENUMERATION COMPLETED"
SET RETURN=0
KILL ^XTMP("MPIF FULL ENUMERATION",0)
QUIT
+15 ; ^ FULL ENUMERATION COMPLETED
+16 SET DFN=0
SET CNT=0
SET RETURN=1
+17 IF $PIECE(NODE,"^",4)'=""
SET DFN=$PIECE(NODE,"^",4)
+18 DO NOW^%DTC
+19 SET $PIECE(NODE,"^",2)=%
+20 FOR
SET DFN=$ORDER(^DPT(DFN))
if DFN=""!(CNT=HOWM)
QUIT
Begin DoDot:1
+21 IF $PIECE($GET(^DPT(DFN,"MPI")),"^")=""
IF '$DATA(^DPT(DFN,-9))
Begin DoDot:2
+22 ;**54,MVI_913: Add DFN to ^XTMP old list
+23 if $DATA(^DPT("AMPIMIS",DFN))[0
SET ^XTMP("MPIF OLD RECORDS",DFN)=""
+24 SET ICN=$$ICNLC^MPIF001(DFN)
SET CNT=CNT+1
SET LAST=DFN
End DoDot:2
End DoDot:1
+25 DO NOW^%DTC
+26 SET $PIECE(NODE,"^",3)=%
SET $PIECE(NODE,"^",4)=LAST
+27 IF DFN=""
SET RETURN(0)="1^"_CNT_" PROCESSED^FULL ENUMERATION COMPLETED "_%
SET $PIECE(NODE,"^",5)="FULL ENUMERATION COMPLETED"
+28 IF DFN'=""
SET RETURN(0)="1^"_CNT_" PROCESSED - COMPLETED @ "_%
+29 SET ^MPIF(984.8,IEN,0)=NODE
+30 KILL ^XTMP("MPIF FULL ENUMERATION",0)
+31 QUIT
+32 ;
STATS(RETURN) ;
+1 ;RETURN IS THE ARRAY TO HOLD THE STAT DATA
+2 NEW IEN,CNT,DFN,ICN,SITE
+3 SET SITE=$PIECE($$SITE^VASITE(),"^",3)
+4 SET CNT("NICN")=0
SET CNT("LOCAL")=0
SET CNT("MERGED")=0
SET CNT("NOICN")=0
+5 SET IEN=$ORDER(^MPIF(984.8,"B","ONE",""))
SET RETURN=0
+6 if IEN<1
QUIT
+7 SET NODE=$GET(^MPIF(984.8,IEN,0))
SET RETURN=1
+8 SET DFN=0
+9 FOR
SET DFN=$ORDER(^DPT(DFN))
if DFN=""
QUIT
Begin DoDot:1
+10 SET ICN=$PIECE($GET(^DPT(DFN,"MPI")),"^")
+11 IF $EXTRACT(ICN,1,3)=SITE
SET CNT("LOCAL")=CNT("LOCAL")+1
+12 IF $EXTRACT(ICN,1)=1
SET CNT("NICN")=CNT("NICN")+1
+13 IF $DATA(^DPT(DFN,-9))
SET CNT("MERGED")=CNT("MERGED")+1
+14 IF ICN=""
IF '$DATA(^DPT(DFN,-9))
SET CNT("NOICN")=CNT("NOICN")+1
End DoDot:1
+15 SET RETURN(1)=$PIECE(NODE,"^",5)_"^"_$PIECE(NODE,"^",3)_"^"_CNT("NICN")_"^"_CNT("LOCAL")_"^"_CNT("MERGED")_"^"_CNT("NOICN")
+16 ;COMPLETED?^LAST COMPLETED RUN^TOTAL NATIONAL ICNS^TOTAL LOCAL ICNS^TOTAL MERGED RECORDS^TOTAL RECORDS WITHOUT ICN
+17 QUIT