RGMTUT02 ;BIR/CML-MPI/PD Compile and Correct Data Validation Data for Local Sites (CON'T) ;07/30/02
;;1.0;CLINICAL INFO RESOURCE NETWORK;**20,37,41**;30 Apr 99
;
;Reference to ^DPT("AICN" & ^DPT("AICNL" supported by IA #2070
;Reference to $$SETLOC MPIF001 supported by IA #2705
;Reference to EDIT^VAFCPTED supported by IA #2784
;
Q
;
REIND ;Correct any existing xref problems:
;patch RG*1.0*41 only removed code - specifically the check to see if the REIND has already run that day
; - missing SSN xref (only if they have a local or national ICN)
; - missing AICN xref
; - missing AICNL xref and field Locally assigned ICN
;Also get counts of national ICNs, Local ICNs and NO ICNs
;
;NOSSN = number of patients missing an SSN xref (only if they have a local or national ICN)
;NOAICN = number of patients missing an AICN xref
;NOAICNL = number of patients missing an AICNL xref
;NICNCNT = number of patients with a national ICN
;LICNCNT = number of patients with a local ICN
;NOICNCNT = number of patients no ICN
;
K ^XTMP("RGMT","UT01","REIND")
S (NOSSN,NOAICN,NOAICNL,NICNCNT,LICNCNT,NOICNCNT,DFNCNT)=0
F TYPE="MISSING SSN XREF","MISSING AICN XREF","MISSING AICNL XREF","NATIONAL ICN COUNT","LOCAL ICN COUNT","NO ICN COUNT" D
.S ^XTMP("RGMT","UT01","REIND",TYPE)=0
;
S SITE=$P($$SITE^VASITE(),"^",3)
;
I '$D(RGHLMQ) D
.W !!,"Checking for:"
.W !,"Missing ""SSN"" xrefs in ^DPT"
.W !,"Missing ""AICN"" xrefs in ^DPT"
.W !,"Missing ""AICNL"" xrefs in ^DPT"
.W !,"Counts on total National ICNs"
.W !,"Counts on total Local ICNs"
.W !,"Counts on total patients without ICNs"
;
S DFN=0 F S DFN=$O(^DPT(DFN)) Q:'DFN S DFNCNT=DFNCNT+1 S MNODE=$G(^DPT(DFN,"MPI")) D
.I '$D(RGHLMQ),'(DFNCNT#10000) W !,DFN
.I MNODE="" S NOICNCNT=NOICNCNT+1 Q
.S ICN=$P(MNODE,"^") I ICN="" S NOICNCNT=NOICNCNT+1 Q
.S SSN=$P($G(^DPT(DFN,0)),"^",9)
.I $G(SSN),'$D(^DPT("SSN",SSN,DFN)) S NOSSN=NOSSN+1 D
..; if SSN xref exists for a different patient, send exception and quit
..; otherwise, edit the field to set the xref
..I $D(^DPT("SSN",SSN)) D Q
...D EXC^RGHLLOG(210,"SSN xref does not exist for patient DFN #"_DFN_" for SSN "_SSN_". This SSN appears to exist for a different patient.",DFN)
..I $L(SSN)>8 K ARR S ARR(2,.09)=SSN D EDIT^VAFCPTED(DFN,"ARR(2)",".09")
.I '$D(^DPT("AICN",ICN,DFN)) S NOAICN=NOAICN+1,^DPT("AICN",ICN,DFN)=""
.I $E(ICN,1,3)'=SITE S NICNCNT=NICNCNT+1 Q
.I $E(ICN,1,3)=SITE D
..S LICNCNT=LICNCNT+1
..I '$D(^DPT("AICNL",1,DFN)) S LOCAL=$$SETLOC^MPIF001(DFN,1),^DPT("AICNL",1,DFN)="",NOAICNL=NOAICNL+1
;
;
S ^XTMP("RGMT","UT01","REIND","MISSING SSN XREF")=NOSSN
S ^XTMP("RGMT","UT01","REIND","MISSING AICN XREF")=NOAICN
S ^XTMP("RGMT","UT01","REIND","MISSING AICNL XREF")=NOAICNL
S ^XTMP("RGMT","UT01","REIND","NATIONAL ICN COUNT")=NICNCNT
S ^XTMP("RGMT","UT01","REIND","LOCAL ICN COUNT")=LICNCNT
S ^XTMP("RGMT","UT01","REIND","NO ICN COUNT")=NOICNCNT
;
I '$D(RGHLMQ) D
.W !!,"Results:"
.W !?3,"Missing SSN xrefs created :",?41,$J(NOSSN,7)
.W !?3,"Missing AICN xrefs created :",?41,$J(NOAICN,7)
.W !?3,"Missing AICNL xrefs created:",?41,$J(NOAICNL,7)
.W !?3,"Total DFNs processed : ",$J(DFNCNT,8)
.W !?6,"Total National ICNs : ",$J(NICNCNT,8)
.W !?6,"Total Local ICNs : ",$J(LICNCNT,8)
.W !?6,"Total without ICNs : ",$J(NOICNCNT,8)
.W !!,"(List global ^XTMP(""RGMT"",""UT01"",""REIND"" for data.)"
;
K ARR,CURDT,DFN,DFNCNT,ICN,LICNCNT,LOCAL,MNODE,NICNCNT,NOAICN,NOAICNL,NOICNCNT,NOSSN,SITE,SSN,TYPE
Q
--- Routine Detail --- with STRUCTURED ROUTINE LISTING ---[H[J[2J[HRGMTUT02 3559 printed Nov 22, 2024@16:52:42 Page 2
RGMTUT02 ;BIR/CML-MPI/PD Compile and Correct Data Validation Data for Local Sites (CON'T) ;07/30/02
+1 ;;1.0;CLINICAL INFO RESOURCE NETWORK;**20,37,41**;30 Apr 99
+2 ;
+3 ;Reference to ^DPT("AICN" & ^DPT("AICNL" supported by IA #2070
+4 ;Reference to $$SETLOC MPIF001 supported by IA #2705
+5 ;Reference to EDIT^VAFCPTED supported by IA #2784
+6 ;
+7 QUIT
+8 ;
REIND ;Correct any existing xref problems:
+1 ;patch RG*1.0*41 only removed code - specifically the check to see if the REIND has already run that day
+2 ; - missing SSN xref (only if they have a local or national ICN)
+3 ; - missing AICN xref
+4 ; - missing AICNL xref and field Locally assigned ICN
+5 ;Also get counts of national ICNs, Local ICNs and NO ICNs
+6 ;
+7 ;NOSSN = number of patients missing an SSN xref (only if they have a local or national ICN)
+8 ;NOAICN = number of patients missing an AICN xref
+9 ;NOAICNL = number of patients missing an AICNL xref
+10 ;NICNCNT = number of patients with a national ICN
+11 ;LICNCNT = number of patients with a local ICN
+12 ;NOICNCNT = number of patients no ICN
+13 ;
+14 KILL ^XTMP("RGMT","UT01","REIND")
+15 SET (NOSSN,NOAICN,NOAICNL,NICNCNT,LICNCNT,NOICNCNT,DFNCNT)=0
+16 FOR TYPE="MISSING SSN XREF","MISSING AICN XREF","MISSING AICNL XREF","NATIONAL ICN COUNT","LOCAL ICN COUNT","NO ICN COUNT"
Begin DoDot:1
+17 SET ^XTMP("RGMT","UT01","REIND",TYPE)=0
End DoDot:1
+18 ;
+19 SET SITE=$PIECE($$SITE^VASITE(),"^",3)
+20 ;
+21 IF '$DATA(RGHLMQ)
Begin DoDot:1
+22 WRITE !!,"Checking for:"
+23 WRITE !,"Missing ""SSN"" xrefs in ^DPT"
+24 WRITE !,"Missing ""AICN"" xrefs in ^DPT"
+25 WRITE !,"Missing ""AICNL"" xrefs in ^DPT"
+26 WRITE !,"Counts on total National ICNs"
+27 WRITE !,"Counts on total Local ICNs"
+28 WRITE !,"Counts on total patients without ICNs"
End DoDot:1
+29 ;
+30 SET DFN=0
FOR
SET DFN=$ORDER(^DPT(DFN))
if 'DFN
QUIT
SET DFNCNT=DFNCNT+1
SET MNODE=$GET(^DPT(DFN,"MPI"))
Begin DoDot:1
+31 IF '$DATA(RGHLMQ)
IF '(DFNCNT#10000)
WRITE !,DFN
+32 IF MNODE=""
SET NOICNCNT=NOICNCNT+1
QUIT
+33 SET ICN=$PIECE(MNODE,"^")
IF ICN=""
SET NOICNCNT=NOICNCNT+1
QUIT
+34 SET SSN=$PIECE($GET(^DPT(DFN,0)),"^",9)
+35 IF $GET(SSN)
IF '$DATA(^DPT("SSN",SSN,DFN))
SET NOSSN=NOSSN+1
Begin DoDot:2
+36 ; if SSN xref exists for a different patient, send exception and quit
+37 ; otherwise, edit the field to set the xref
+38 IF $DATA(^DPT("SSN",SSN))
Begin DoDot:3
+39 DO EXC^RGHLLOG(210,"SSN xref does not exist for patient DFN #"_DFN_" for SSN "_SSN_". This SSN appears to exist for a different patient.",DFN)
End DoDot:3
QUIT
+40 IF $LENGTH(SSN)>8
KILL ARR
SET ARR(2,.09)=SSN
DO EDIT^VAFCPTED(DFN,"ARR(2)",".09")
End DoDot:2
+41 IF '$DATA(^DPT("AICN",ICN,DFN))
SET NOAICN=NOAICN+1
SET ^DPT("AICN",ICN,DFN)=""
+42 IF $EXTRACT(ICN,1,3)'=SITE
SET NICNCNT=NICNCNT+1
QUIT
+43 IF $EXTRACT(ICN,1,3)=SITE
Begin DoDot:2
+44 SET LICNCNT=LICNCNT+1
+45 IF '$DATA(^DPT("AICNL",1,DFN))
SET LOCAL=$$SETLOC^MPIF001(DFN,1)
SET ^DPT("AICNL",1,DFN)=""
SET NOAICNL=NOAICNL+1
End DoDot:2
End DoDot:1
+46 ;
+47 ;
+48 SET ^XTMP("RGMT","UT01","REIND","MISSING SSN XREF")=NOSSN
+49 SET ^XTMP("RGMT","UT01","REIND","MISSING AICN XREF")=NOAICN
+50 SET ^XTMP("RGMT","UT01","REIND","MISSING AICNL XREF")=NOAICNL
+51 SET ^XTMP("RGMT","UT01","REIND","NATIONAL ICN COUNT")=NICNCNT
+52 SET ^XTMP("RGMT","UT01","REIND","LOCAL ICN COUNT")=LICNCNT
+53 SET ^XTMP("RGMT","UT01","REIND","NO ICN COUNT")=NOICNCNT
+54 ;
+55 IF '$DATA(RGHLMQ)
Begin DoDot:1
+56 WRITE !!,"Results:"
+57 WRITE !?3,"Missing SSN xrefs created :",?41,$JUSTIFY(NOSSN,7)
+58 WRITE !?3,"Missing AICN xrefs created :",?41,$JUSTIFY(NOAICN,7)
+59 WRITE !?3,"Missing AICNL xrefs created:",?41,$JUSTIFY(NOAICNL,7)
+60 WRITE !?3,"Total DFNs processed : ",$JUSTIFY(DFNCNT,8)
+61 WRITE !?6,"Total National ICNs : ",$JUSTIFY(NICNCNT,8)
+62 WRITE !?6,"Total Local ICNs : ",$JUSTIFY(LICNCNT,8)
+63 WRITE !?6,"Total without ICNs : ",$JUSTIFY(NOICNCNT,8)
+64 WRITE !!,"(List global ^XTMP(""RGMT"",""UT01"",""REIND"" for data.)"
End DoDot:1
+65 ;
+66 KILL ARR,CURDT,DFN,DFNCNT,ICN,LICNCNT,LOCAL,MNODE,NICNCNT,NOAICN,NOAICNL,NOICNCNT,NOSSN,SITE,SSN,TYPE
+67 QUIT