PXAIHFV ;ISL/PKR - VALIDATE HEALTH FACTOR 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("HF")=1
S PXADI("DIALOG")=8390001.001
S PXAERR(7)="HEALTH FACTOR"
Q
;
VAL ;Validate the input.
I $G(PXAA("HEALTH FACTOR"))="" D Q
. S PXAERR(9)="HEALTH FACTOR"
. S PXAERR(12)="The Health Factor is missing."
. D ERRSET
;
;Check that it is a valid pointer.
I '$D(^AUTTHF(PXAA("HEALTH FACTOR"))) D Q
. S PXAERR(9)="HEALTH FACTOR"
. S PXAERR(11)=PXAA("HEALTH FACTOR")
. S PXAERR(12)="The Health Factor pointer is not valid."
. D ERRSET
;
;If this is a deletion no further verification is required.
I $G(PXAA("DELETE"))=1 Q
;
N TEMP S TEMP=$G(^AUTTHF(PXAA("HEALTH FACTOR"),0))
;Check that the .01 is not null.
I $P(TEMP,U,1)="" D Q
. S PXAERR(9)="HEALTH FACTOR"
. S PXAERR(11)=PXAA("HEALTH FACTOR")
. S PXAERR(12)="The Health Factor does not have a .01."
. D ERRSET
;
;Check that it is active.
I $P(TEMP,U,11)=1 D
. S PXAERR(9)="INACTIVE"
. S PXAERR(11)=PXAA("HEALTH FACTOR")
. S PXAERR(12)="The Health Factor is inactive."
. D ERRSET
;
;Make sure the Entry Type is not Category.
;*I $P(TEMP,U,10)="C" D Q
;*. S PXAERR(9)="CATEGORY"
;*. S PXAERR(11)=PXAA("HEALTH FACTOR")
;*. S PXAERR(12)="The Entry Type is Category, patients cannot be given Category health factors."
;*. D ERRSET
;
;If a Level/Severity is being input validate it.
;* I $G(PXAA("LEVEL/SEVERITY"))'="",'$$SET^PXAIVAL(9000010.23,"LEVEL/SEVERITY",.04,PXAA("LEVEL/SEVERITY"),.PXAERR) D Q
;* . D ERRSET
;
;If Event D/T is input verify it is a valid FileMan date .
;* 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(^AUTTHF(PXAA("HEALTH FACTOR"),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
;* I $G(STOP)=1 Q
Q
;
--- Routine Detail --- with STRUCTURED ROUTINE LISTING ---[H[J[2J[HPXAIHFV 3073 printed Nov 22, 2024@17:35:50 Page 2
PXAIHFV ;ISL/PKR - VALIDATE HEALTH FACTOR 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("HF")=1
+3 SET PXADI("DIALOG")=8390001.001
+4 SET PXAERR(7)="HEALTH FACTOR"
+5 QUIT
+6 ;
VAL ;Validate the input.
+1 IF $GET(PXAA("HEALTH FACTOR"))=""
Begin DoDot:1
+2 SET PXAERR(9)="HEALTH FACTOR"
+3 SET PXAERR(12)="The Health Factor is missing."
+4 DO ERRSET
End DoDot:1
QUIT
+5 ;
+6 ;Check that it is a valid pointer.
+7 IF '$DATA(^AUTTHF(PXAA("HEALTH FACTOR")))
Begin DoDot:1
+8 SET PXAERR(9)="HEALTH FACTOR"
+9 SET PXAERR(11)=PXAA("HEALTH FACTOR")
+10 SET PXAERR(12)="The Health Factor pointer is not valid."
+11 DO ERRSET
End DoDot:1
QUIT
+12 ;
+13 ;If this is a deletion no further verification is required.
+14 IF $GET(PXAA("DELETE"))=1
QUIT
+15 ;
+16 NEW TEMP
SET TEMP=$GET(^AUTTHF(PXAA("HEALTH FACTOR"),0))
+17 ;Check that the .01 is not null.
+18 IF $PIECE(TEMP,U,1)=""
Begin DoDot:1
+19 SET PXAERR(9)="HEALTH FACTOR"
+20 SET PXAERR(11)=PXAA("HEALTH FACTOR")
+21 SET PXAERR(12)="The Health Factor does not have a .01."
+22 DO ERRSET
End DoDot:1
QUIT
+23 ;
+24 ;Check that it is active.
+25 IF $PIECE(TEMP,U,11)=1
Begin DoDot:1
+26 SET PXAERR(9)="INACTIVE"
+27 SET PXAERR(11)=PXAA("HEALTH FACTOR")
+28 SET PXAERR(12)="The Health Factor is inactive."
+29 DO ERRSET
End DoDot:1
+30 ;
+31 ;Make sure the Entry Type is not Category.
+32 ;*I $P(TEMP,U,10)="C" D Q
+33 ;*. S PXAERR(9)="CATEGORY"
+34 ;*. S PXAERR(11)=PXAA("HEALTH FACTOR")
+35 ;*. S PXAERR(12)="The Entry Type is Category, patients cannot be given Category health factors."
+36 ;*. D ERRSET
+37 ;
+38 ;If a Level/Severity is being input validate it.
+39 ;* I $G(PXAA("LEVEL/SEVERITY"))'="",'$$SET^PXAIVAL(9000010.23,"LEVEL/SEVERITY",.04,PXAA("LEVEL/SEVERITY"),.PXAERR) D Q
+40 ;* . D ERRSET
+41 ;
+42 ;If Event D/T is input verify it is a valid FileMan date .
+43 ;* I $G(PXAA("EVENT D/T"))'="",'$$EVENTDT^PXAIVAL(PXAA("EVENT D/T"),"T",.PXAERR) D Q
+44 ;* . D ERRSET
+45 ;
+46 ;If a Comment is passed verify it.
+47 ;* I $G(PXAA("COMMENT"))'="",'$$TEXT^PXAIVAL("COMMENT",PXAA("COMMENT"),1,245,.PXAERR) D Q
+48 ;* . D ERRSET
+49 ;
+50 ;If an Ordering Provider is passed verify it is valid.
+51 ;* I $G(PXAA("ORD PROVIDER"))'="",'$$PRV^PXAIVAL(PXAA("ORD PROVIDER"),"ORD",.PXAA,.PXAERR,PXAVISIT) D Q
+52 ;* . D ERRSET
+53 ;
+54 ;If an Encounter Provider is passed verify it is valid.
+55 ;* I $G(PXAA("ENC PROVIDER"))'="",'$$PRV^PXAIVAL(PXAA("ENC PROVIDER"),"ENC",.PXAA,.PXAERR,PXAVISIT) D Q
+56 ;* . D ERRSET
+57 ;
+58 ;If a measurement is being input verify that it is in the allowed
+59 ;range.
+60 IF $DATA(PXAA("MAGNITUDE"))
Begin DoDot:1
+61 IF '$$MAG^PXAIVAL(PXAA("MAGNITUDE"),$GET(^AUTTHF(PXAA("HEALTH FACTOR"),220)),.PXAERR)
DO ERRSET
QUIT
+62 SET PXAA("MAGNITUDE")=$$MAGFORMAT^PXMEASUREMENT(PXAA("MAGNITUDE"))
End DoDot:1
+63 ;
+64 ;If PKG is input verify it.
+65 ;* I $G(PXAA("PKG"))'="" D
+66 ;* . N PKG
+67 ;* . S PKG=$$VPKG^PXAIVAL(PXAA("PKG"),.PXAERR)
+68 ;* . I PKG=0 S PXAERR(9)="PKG" D ERRSET Q
+69 ;* . S PXAA("PKG")=PKG
+70 ;* I $G(STOP)=1 Q
+71 ;
+72 ;If SOURCE is input verify it.
+73 ;* I $G(PXAA("SOURCE"))'="" D
+74 ;* . N SRC
+75 ;* . S SRC=$$VSOURCE^PXAIVAL(PXAA("SOURCE"),.PXAERR)
+76 ;* . I SRC=0 S PXAERR(9)="SOURCE" D ERRSET Q
+77 ;* . S PXAA("SOURCE")=SRC
+78 ;* I $G(STOP)=1 Q
+79 QUIT
+80 ;