diff --git a/p/C0CRIMA.m b/p/C0CRIMA.m index 2357bea..781dde4 100644 --- a/p/C0CRIMA.m +++ b/p/C0CRIMA.m @@ -74,6 +74,9 @@ ANALYZE(BEGDFN,DFNCNT,APARMS) ; RIM COHERANCE ANALYSIS ROUTINE . I $D(^TMP("C0CCCR",$J,"RESULTS",0)) D ; RESULTS EXIST . . W "FOUND RESULTS VARS",! . . M @RIMBASE@("VARS",RIMDFN,"RESULTS")=^TMP("C0CCCR",$J,"RESULTS") + . I $$CHKSUM(RIMDFN) D ; CHECKSUM HAS CHANGED + . . W "CHECKSUM IS NEW OR HAS CHANGED",! + . . ZWR ^TMP("C0CRIM","CHKSUM",RIMDFN,*) . K ^TMP("C0CCCR",$J) ; KILL WORK AREA FOR CCR BUILDING . ; . ; EVALUATE THE VARIABLES AND CREATE AN ATTRIBUTE MAP @@ -198,6 +201,31 @@ CPUSH(CATRTN,CBASE,CTBL,CDFN,CATTR) ; ADD PATIENTS TO CATEGORIES ; Q ; +CHKSUM(CKDFN) ; DOES A CHECKSUM AND STORES IT IN MUMPS GLOBALS + ; + S C0CCKB=$NA(^TMP("C0CRIM","CHKSUM")) ;CHECKSUM BASE + S C0CGLB=$NA(^TMP("C0CRIM","VARS")) ;CCR VARIABLE BASE + S C0CI="" + F S C0CI=$O(@C0CGLB@(CKDFN,C0CI)) Q:C0CI="" D ;FOR EACH DOMAIN + . ;W "DFN:",DFN," DOMAIN:",C0CI,! + . S C0CJ=$NA(@C0CGLB@(CKDFN,C0CI)) + . I C0CI="HEADER" D ; HAVE TO TAKE OUT THE "DATE GENERATED" + . . S C0CDT=@C0CGLB@(CKDFN,C0CI,1,"DATETIME") + . . K @C0CGLB@(CKDFN,C0CI,1,"DATETIME") + . S C0CCK(C0CI)=$$CHKSUM^XUSESIG1(C0CJ) + . I C0CI="HEADER" D ; PUT IT BACK + . . S @C0CGLB@(CKDFN,C0CI,1,"DATETIME")=C0CDT + S C0CK="C0CCK" ; + S C0CALL=$$CHKSUM^XUSESIG1(C0CK) ;CHECKSUM OF ALL DOMAIN CHECKSUMS + S CHKR=0 ; RESULT DEFAULT + I $D(^TMP("C0CRIM","CHKSUM",CKDFN,"ALL")) D ; OLD CHECKSUM EXISTS + . I @C0CCKB@(CKDFN,"ALL")'=C0CALL S CHKR=1 + E S CHKR=1 ;CHECKSUM IS NEW + S @C0CCKB@(CKDFN,"ALL")=C0CALL + M @C0CCKB@(CKDFN,"DOMAIN")=C0CCK + ZWR ^TMP("C0CRIM","CHKSUM",CKDFN,*) + Q CHKR + ; CCOUNT ; RECOUNT THE CATEGORIES.. USE IN CASE OF RESTART OF ANALYZE ; I '$D(RIMBASE) D ASETUP ; FOR COMMAND LINE CALLS