MAGGSQI ;WOIFO/GEK ; Image Integrity Checker ; [ 11/08/2001 17:18 ] ;;3.0;IMAGING;**8**;Sep 15, 2004 ;; +---------------------------------------------------------------+ ;; | Property of the US Government. | ;; | No permission to copy or redistribute this software is given. | ;; | Use of unreleased versions of this software requires the user | ;; | to execute a written test agreement with the VistA Imaging | ;; | Development Office of the Department of Veterans Affairs, | ;; | telephone (301) 734-0100. | ;; | | ;; | The Food and Drug Administration classifies this software as | ;; | a medical device. As such, it may not be changed in any way. | ;; | Modifications to this software may result in an adulterated | ;; | medical device under 21CFR820, the use of which is considered | ;; | to be a violation of US Federal Statutes. | ;; +---------------------------------------------------------------+ ;; RPT(MAGRY,CT,LASTIEN) ; Run the check for the last CT entries in Image file. N I,J,MAGX,ERRCT,ACTCT,TYPECT,MAGSTART,MAGPUR K ^XTMP("MAGCHK") S LASTIEN=$G(LASTIEN) ; See DOCU^MAGCRTP for documenation on this global D NOW^%DTC S MAGSTART=% S X1=%,X2=60 D C^%DTC S MAGPUR=X K X,X1,X2 ;Set purge, create and purge date S $P(^XTMP("MAGCHK",$J,0),"^",1)=MAGPUR,$P(^(0),"^",2)=MAGSTART S $P(^XTMP("MAGCHK",$J,0),"^",5)=MAGSTART ;Set description S $P(^XTMP("MAGCHK",$J,0),"^",3)="Imaging Scan DB" ;Set status to active S $P(^XTMP("MAGCHK",$J,0),"^",4)="ACTIVE" S MAGRY(0)="0^Checking..." S I="A" S CT=$G(CT,5000),ERRCT=0,ACTCT=0 F S I=$O(^MAG(2005,I),-1) Q:CT<1 Q:'I Q:I689.999)&(MAGPK<703)) D Q . ; Patch. if MAGPK exists, but not a MAGPKDA . I 'MAGPKDA S MAGRY(0)="0^Missing the Parent root pointer" Q . I '$D(^MCAR(MAGPK,MAGPKDA,0)) S MAGRY(0)="0^Invalid Image pointer to associated package report entry" Q . I MAGPKIP I '$D(^MCAR(MAGPK,MAGPKDA,2005,MAGPKIP,0)) S MAGRY(0)="0^Invalid Image pointer in associated package file" Q . I '(MAGDFN=$P($G(^MCAR(MAGPK,MAGPKDA,0)),U,2)) S MAGRY(0)="0^Image and associated report have different patient pointers" Q . ;I '(MAGIEN=+^MCAR(MAGPK,MAGPKDA,2005,MAGPKIP,0)) S MAGRY(0)="0^Associated report does not point back to Image" Q . I '$D(^MCAR(MAGPK,MAGPKDA,2005,"B",MAGIEN)) S MAGRY(0)="0^Associated report does not point back to Image" Q . S MAGRY(0)="1^Okay" . ; . ; S MCFILE=+$P($P(^MCAR(697.2,PSIEN,0),U,2),"(",2) . ; S PATFLD=$O(^DD(MCFILE,"B","MEDICAL PATIENT","")) . ; S:PATFLD="" PATFLD=1 . ; . ; S TMP=$P($P(^DD(MCFILE,PATFLD,0),U,4),";",2) . ; Q $S(DFN'=$P(^MCAR(MCFILE,MCIEN,0),U,TMP):"O^Image and associated report have different patient pointers",1:"1") ; ; Radiology reports I MAGPK=74 D Q . ; Patch. if MAGPK exists, but not a MAGPKDA . I 'MAGPKDA S MAGRY(0)="0^Missing the Parent root pointer" Q . I '$D(^RARPT(MAGPKDA,0)) S MAGRY(0)="0^Invalid Image pointer to associated package report entry" Q . I MAGPKIP I '$D(^RARPT(MAGPKDA,2005,MAGPKIP,0)) S MAGRY(0)="0^Invalid Image pointer in associated package file" Q . ; . I '(MAGDFN=$P($G(^RARPT(MAGPKDA,0)),U,2)) S MAGRY(0)="0^Image and associated report have different patient pointers" Q . ;I '(MAGIEN=+$G(^RARPT(MAGPKDA,2005,MAGPKIP,0))) S MAGRY(0)="0^Associated report does not point back to Image" Q . I '$D(^RARPT(MAGPKDA,2005,"B",MAGIEN)) S MAGRY(0)="0^Associated report does not point back to Image" Q . S MAGRY(0)="1^Okay" ; ; Laboratory reports I (MAGPK>62.999)&(MAGPK<64) D Q . ;I $P(^MAG(2005.03,MAGTMPRT,0),"^",4)=63 . S MAGRY(0)="1^Lab image not checked " . ;D @$S(MAGTMPRT=63:"AU",MAGTMPRT=63.2:"AU",1:"LAB") Q ; S MAGRY(0)="2^Images only point to Patient." Q CHKGRPCH(CHKY,GRPIEN,GRPDFN,GRPCH) ; Check the child of a Group. ; i.e. an IEN in the "1" node of the Group. ; Can't just check the IEN by calling CHK. It might be okay that way. ; Have to compare it to Groups IEN, and DFN N CHN0 S CHN0=$G(^MAG(2005,GRPCH,0)) I '$L(CHN0) S CHKY="0^Invalid Image pointer" Q I $P(CHN0,U,7)'=GRPDFN S CHKY="0^Patient Mismatch in Group member:"_GRPCH Q I $P(CHN0,U,10)'=GRPIEN S CHKY="0^Pointer Mismatch in Group member:"_GRPCH Q S CHKY="1^Okay Group Image" Q