PXAIXAMV ;SLC/PKR - VALIDATE EXAMINATION DATA ;03/08/2022
;;1.0;PCE PATIENT CARE ENCOUNTER;**211,217**;Aug 12, 1996;Build 134
;
ERRSET ;Set the rest of the error data.
S STOP=1
S PXAERRF("XAM")=1
S PXADI("DIALOG")=8390001.001
S PXAERR(7)="EXAM"
Q
;
VAL ;Validate the input data.
I $G(PXAA("EXAM"))="" D Q
. S PXAERR(9)="EXAM"
. S PXAERR(12)="The Exam is missing."
. D ERRSET
;
;If this is a deletion no further verification is required.
I $G(PXAA("DELETE"))=1 Q
;
;Check that it is a valid pointer.
I '$D(^AUTTEXAM(PXAA("EXAM"))) D Q
. S PXAERR(9)="EXAM"
. S PXAERR(11)=PXAA("EXAM")
. S PXAERR(12)="The Exam pointer is not valid."
. D ERRSET
;
N TEMP S TEMP=$G(^AUTTEXAM(PXAA("EXAM"),0))
;Check that the .01 is not null.
I $P(TEMP,U,1)="" D Q
. S PXAERR(9)="EXAM"
. S PXAERR(11)=PXAA("EXAM")
. S PXAERR(12)="The Exam does not have a .01."
. D ERRSET
;
;Check that it is active.
;* I $P(TEMP,U,4)=1 D
;* . S PXAERR(9)="INACTIVE"
;* . S PXAERR(11)=PXAA("EXAM")
;* . S PXAERR(12)="The Exam is inactive."
;* . D ERRSET
;
;If a Result is being input validate it.
;* I $G(PXAA("RESULT"))'="",'$$SET^PXAIVAL(9000010.13,"RESULT",.04,PXAA("RESULT"),.PXAERR) D Q
;* . D ERRSET
;
;If Event D/T is input verify it is a valid FileMan date and not in
;the future.
;* I $G(PXAA("EVENT D/T"))'="",'$$EVENTDT^PXAIVAL(PXAA("EVENT D/T"),"T",.PXAERR) D Q
;* . D ERRSET
;
;If a Comment is passed verify it.
;* I $G(PXAA("COMMENT"))'="",'$$TEXT^PXAIVAL("COMMENT",PXAA("COMMENT"),1,245,.PXAERR) D Q
;* . D ERRSET
;
;If an Ordering Provider is passed verify it is valid.
;* I $G(PXAA("ORD PROVIDER"))'="",'$$PRV^PXAIVAL(PXAA("ORD PROVIDER"),"ORD",.PXAA,.PXAERR,PXAVISIT) D Q
;* . D ERRSET
;
;If an Encounter Provider is passed verify it is valid.
;* I $G(PXAA("ENC PROVIDER"))'="",'$$PRV^PXAIVAL(PXAA("ENC PROVIDER"),"ENC",.PXAA,.PXAERR,PXAVISIT) D Q
;* . D ERRSET
;
;If a measurement is being input verify that it is in the allowed
;range.
I $D(PXAA("MAGNITUDE")) D
. I '$$MAG^PXAIVAL(PXAA("MAGNITUDE"),$G(^AUTTEXAM(PXAA("EXAM"),220)),.PXAERR) D ERRSET Q
. S PXAA("MAGNITUDE")=$$MAGFORMAT^PXMEASUREMENT(PXAA("MAGNITUDE"))
;
;If PKG is input verify it.
;* I $G(PXAA("PKG"))'="" D
;* . N PKG
;* . S PKG=$$VPKG^PXAIVAL(PXAA("PKG"),.PXAERR)
;* . I PKG=0 S PXAERR(9)="PKG" D ERRSET Q
;* . S PXAA("PKG")=PKG
;* I $G(STOP)=1 Q
;
;If SOURCE is input verify it.
;* I $G(PXAA("SOURCE"))'="" D
;* . N SRC
;* . S SRC=$$VSOURCE^PXAIVAL(PXAA("SOURCE"),.PXAERR)
;* . I SRC=0 S PXAERR(9)="SOURCE" D ERRSET Q
;* . S PXAA("SOURCE")=SRC
Q
;
--- Routine Detail --- with STRUCTURED ROUTINE LISTING ---[H[J[2J[HPXAIXAMV 2673 printed Oct 16, 2024@18:26:52 Page 2
PXAIXAMV ;SLC/PKR - VALIDATE EXAMINATION DATA ;03/08/2022
+1 ;;1.0;PCE PATIENT CARE ENCOUNTER;**211,217**;Aug 12, 1996;Build 134
+2 ;
ERRSET ;Set the rest of the error data.
+1 SET STOP=1
+2 SET PXAERRF("XAM")=1
+3 SET PXADI("DIALOG")=8390001.001
+4 SET PXAERR(7)="EXAM"
+5 QUIT
+6 ;
VAL ;Validate the input data.
+1 IF $GET(PXAA("EXAM"))=""
Begin DoDot:1
+2 SET PXAERR(9)="EXAM"
+3 SET PXAERR(12)="The Exam is missing."
+4 DO ERRSET
End DoDot:1
QUIT
+5 ;
+6 ;If this is a deletion no further verification is required.
+7 IF $GET(PXAA("DELETE"))=1
QUIT
+8 ;
+9 ;Check that it is a valid pointer.
+10 IF '$DATA(^AUTTEXAM(PXAA("EXAM")))
Begin DoDot:1
+11 SET PXAERR(9)="EXAM"
+12 SET PXAERR(11)=PXAA("EXAM")
+13 SET PXAERR(12)="The Exam pointer is not valid."
+14 DO ERRSET
End DoDot:1
QUIT
+15 ;
+16 NEW TEMP
SET TEMP=$GET(^AUTTEXAM(PXAA("EXAM"),0))
+17 ;Check that the .01 is not null.
+18 IF $PIECE(TEMP,U,1)=""
Begin DoDot:1
+19 SET PXAERR(9)="EXAM"
+20 SET PXAERR(11)=PXAA("EXAM")
+21 SET PXAERR(12)="The Exam does not have a .01."
+22 DO ERRSET
End DoDot:1
QUIT
+23 ;
+24 ;Check that it is active.
+25 ;* I $P(TEMP,U,4)=1 D
+26 ;* . S PXAERR(9)="INACTIVE"
+27 ;* . S PXAERR(11)=PXAA("EXAM")
+28 ;* . S PXAERR(12)="The Exam is inactive."
+29 ;* . D ERRSET
+30 ;
+31 ;If a Result is being input validate it.
+32 ;* I $G(PXAA("RESULT"))'="",'$$SET^PXAIVAL(9000010.13,"RESULT",.04,PXAA("RESULT"),.PXAERR) D Q
+33 ;* . D ERRSET
+34 ;
+35 ;If Event D/T is input verify it is a valid FileMan date and not in
+36 ;the future.
+37 ;* I $G(PXAA("EVENT D/T"))'="",'$$EVENTDT^PXAIVAL(PXAA("EVENT D/T"),"T",.PXAERR) D Q
+38 ;* . D ERRSET
+39 ;
+40 ;If a Comment is passed verify it.
+41 ;* I $G(PXAA("COMMENT"))'="",'$$TEXT^PXAIVAL("COMMENT",PXAA("COMMENT"),1,245,.PXAERR) D Q
+42 ;* . D ERRSET
+43 ;
+44 ;If an Ordering Provider is passed verify it is valid.
+45 ;* I $G(PXAA("ORD PROVIDER"))'="",'$$PRV^PXAIVAL(PXAA("ORD PROVIDER"),"ORD",.PXAA,.PXAERR,PXAVISIT) D Q
+46 ;* . D ERRSET
+47 ;
+48 ;If an Encounter Provider is passed verify it is valid.
+49 ;* I $G(PXAA("ENC PROVIDER"))'="",'$$PRV^PXAIVAL(PXAA("ENC PROVIDER"),"ENC",.PXAA,.PXAERR,PXAVISIT) D Q
+50 ;* . D ERRSET
+51 ;
+52 ;If a measurement is being input verify that it is in the allowed
+53 ;range.
+54 IF $DATA(PXAA("MAGNITUDE"))
Begin DoDot:1
+55 IF '$$MAG^PXAIVAL(PXAA("MAGNITUDE"),$GET(^AUTTEXAM(PXAA("EXAM"),220)),.PXAERR)
DO ERRSET
QUIT
+56 SET PXAA("MAGNITUDE")=$$MAGFORMAT^PXMEASUREMENT(PXAA("MAGNITUDE"))
End DoDot:1
+57 ;
+58 ;If PKG is input verify it.
+59 ;* I $G(PXAA("PKG"))'="" D
+60 ;* . N PKG
+61 ;* . S PKG=$$VPKG^PXAIVAL(PXAA("PKG"),.PXAERR)
+62 ;* . I PKG=0 S PXAERR(9)="PKG" D ERRSET Q
+63 ;* . S PXAA("PKG")=PKG
+64 ;* I $G(STOP)=1 Q
+65 ;
+66 ;If SOURCE is input verify it.
+67 ;* I $G(PXAA("SOURCE"))'="" D
+68 ;* . N SRC
+69 ;* . S SRC=$$VSOURCE^PXAIVAL(PXAA("SOURCE"),.PXAERR)
+70 ;* . I SRC=0 S PXAERR(9)="SOURCE" D ERRSET Q
+71 ;* . S PXAA("SOURCE")=SRC
+72 QUIT
+73 ;