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

AGSS0.m

Go to the documentation of this file.
AGSS0 ; IHS/ASDS/EFG - PROCESS NPIRS/SSA SUBMITTALS APR 14,1995 ;  
 ;;7.1;PATIENT REGISTRATION;;AUG 25,2005
 ;
PROC ;EP - start processing
 K ^AGSSTEMP(AGSSITE)
BY ;bypass
 D OPEN^%ZISH("SSNFILE",AGSSPATH,AGSSHFL,"R")
 I POP D  Q
 .S ^AGSSTEMP(AGSSITE,0,"NOPEN")=1
 .I '$D(ZTQUEUED) W !!,*7,"Could not open file.",!
 S AGSSFIO=IO
PROCESS ;>PROCESS RECORDS
 K ^AGSSTEMP(AGSSITE,0,"STOP") ;external flag for stopping
 S AGSITE=$P(^AUTTSITE(1,0),"^")
 S ^AGSSTEMP(AGSSITE,0,"1ST-BEGIN-TIME")=$G(^AGSSTEMP(AGSSITE,0,"BEGIN-TIME"))
 S ^AGSSTEMP(AGSSITE,0,"1ST-LAST-RECORD")=$G(^AGSSTEMP(AGSSITE,0,"LAST-RECORD"))
 S AGSBGTM=$H,^AGSSTEMP(AGSSITE,0,"BEGIN-TIME")=$H
 S AGSSC=+$G(^AGSSTEMP(AGSSITE,0,"LAST-RECORD"))
 D COUNT
 S AGSSRA=$G(^AGSSTEMP(AGSSITE,"TOT","RA"))
 S AGSSRV=$G(^AGSSTEMP(AGSSITE,"TOT","RV"))
 S AGSSRD=$G(^AGSSTEMP(AGSSITE,"TOT","RD"))
 S AGSSRN=$G(^AGSSTEMP(AGSSITE,"TOT","RN"))
 S AGSSRP=$G(^AGSSTEMP(AGSSITE,"TOT","RP"))
 S AGSSRR=$G(^AGSSTEMP(AGSSITE,"TOT","RR"))
 S AGSSRX=$G(^AGSSTEMP(AGSSITE,"TOT","RX"))
 I $D(AGSS("NORUN")) G ENDPROC ;skip processing (SET MANUALLY) BEFORE STARTING
LOOP ;loop through host file
 F  D  Q:$$STATUS^%ZISH!($D(^AGSSTEMP(AGSSITE,0,"STOP")))
 .U AGSSFIO R AGSCREC Q:$$STATUS^%ZISH
 .Q:$D(^AGSSTEMP(AGSSITE,0,"STOP"))
 .S AGSSC=+$G(AGSSC)+1
 .Q:AGSSC<$G(^AGSSTEMP(AGSSITE,0,"LAST-RECORD"))
 .D ^AGSS1
 .S ^AGSSTEMP(AGSSITE,0,"LAST-RECORD")=AGSSC
 .S ^AGSSTEMP(AGSSITE,0,"CURRENT-TIME")=$H
 .Q:$D(ZTQUEUED)
 .U IO(0)
 .I '(AGSSC#100) W "."
 .I '(AGSSC#1000) W AGSSC D DISP^AGSSM W !
 S ^AGSSTEMP(AGSSITE,0,"END-PROCESS")=$H
 D ^AGSSDEL ;> Process AGPATCH | DEL RECORDS | To NPIRS
 S ^AGSSTEMP(AGSSITE,0,"END-DELTRAN")=$H
ENDPROC ;
 S:$D(ZTQUEUED) XBFQ=1
 Q
PRINT ;EP PRINT report of processing SSA SSNs
 D COUNT
 S AGHDDR="Report for SSA SSN Matching Application" D AGSSHDR
 I $D(AGSS("NORUN")) W !,"NO RUN SET SO ... NO REPORT",! Q
 S AGSSRTOT=$G(^AGSSTEMP(AGSSITE,0,"LAST-RECORD"))
 S ^AGSSTEMP(AGSSITE,"TOT","RR")=AGSSRTOT-^AGSSTEMP(AGSSITE,"TOT")
 W !,"Records Processed from NPIRS/SSA ",?40,AGSSRTOT
 S (AGSSBGT,%H)=$G(^AGSSTEMP(AGSSITE,0,"BEGIN-TIME")) D YX^%DTC
 W !,"Starting Time",?40,Y
 S (AGSSFNT,%H)=$G(^AGSSTEMP(AGSSITE,0,"END-DELTRAN")) D YX^%DTC
 W !,"Ending Time",?40,Y
 S AGSSDAY=(AGSSFNT/1)-(AGSSBGT/1)*24*60*60,AGSSSEC=AGSSDAY+($P(AGSSFNT,",",2))-($P(AGSSBGT,",",2)),AGSSMIN=AGSSSEC\60
 W !,"Processing Time",?50,AGSSMIN,"  minutes"
 W !!!,?2,"""A"" SSNs ADDED",?50,$J(^AGSSTEMP(AGSSITE,"TOT","RA"),8)
 W !!,?2,"""V"" SSNs VERIFIED",?50,$J(^AGSSTEMP(AGSSITE,"TOT","RV"),8)
 W !!,?2,"""N"" SSN NUMBERS differ but DATA agrees",?50,$J(^AGSSTEMP(AGSSITE,"TOT","RN"),8)
 W !!,?2,"""D"" DATA differs but SSN NUMBERS agree,",?50,$J(^AGSSTEMP(AGSSITE,"TOT","RD"),8)
 W !!,?2,"""P"" Possible SSNs for patients with a match",?50,$J(^AGSSTEMP(AGSSITE,"TOT","RP"),8)
 W !,?2,"to NPIRS HRN but either Name or DOB differs"
 W !!,?2,"DELETES sent to NPIRS",?50,$J(^AGSSTEMP(AGSSITE,"TOT","DEL"),8)
 W !!,?2,"""O"" Other",?50,$J(^AGSSTEMP(AGSSITE,"TOT","RR"),8),!
 I '$D(ZTQUEUED) U IO(0) K DIR S DIR(0)="E" D ^DIR K DIR
 Q
EXIT ;
 D ^%ZISC
 S AGK="AG" F  S AGK=$O(@AGK) Q:((AGK="")!($E(AGK,1,2)'="AG"))  I AGK'="AGK" K @AGK
 K AG,AGK
 Q
AGSSPG ;EP PAGE HANDLER
 Q:($Y<(IOSL-4))!($G(DOUT)!$G(DFOUT))  S:'$D(AGSSPG) AGSSPG=0 S AGSSPG=AGSSPG+1 I $E(IOST)="C" R !,"^ to quit ",X:DTIME I $E(X)="^" S DOUT=1,DFOUT=1 Q
AGSSHDR ;EP PAGE HEADER HANDLER
 W !,@IOF Q:'$D(AGSSHDR)  S:'$D(AGSSLINE) $P(AGSSLINE,"-",IOM-2)="" S:'$D(AGSSPG) AGSSPG=1 I '$D(AGSSDT) D DT^DICRW S Y=DT D DD^%DT S AGSSDT=Y
 W ?(IOM-20-$L(AGSSHDR)/2),AGSSHDR,?(IOM-25),AGSSDT,?(IOM-10),"PAGE: ",AGSSPG,!,AGSSLINE
EAGSSPG Q
STOP ;EP to stop background processing
 S ^AGSSTEMP(AGSSITE,0,"STOP")=1
 Q
COUNT ;count up entries
 F I="RA","RV","RN","RD","RP","RX","DEL" D
 .Q:$G(^AGSSTEMP(AGSSITE,"TOT",I))
 .S AGSSCNT=0
 .S J=0
 .F  S J=$O(^AGSSTEMP(AGSSITE,I,J)) Q:'J  D
 ..S AGSSCNT=AGSSCNT+1
 .S ^AGSSTEMP(AGSSITE,"TOT",I)=AGSSCNT
 .S ^AGSSTEMP(AGSSITE,"TOT")=+$G(^AGSSTEMP(AGSSITE,"TOT"))+AGSSCNT
 Q