PXCAHF ;ISL/dee - Validates & Translates data from the PCE Device Interface into PCE's PXK format for Health Factors ;3/14/97
;;1.0;PCE PATIENT CARE ENCOUNTER;**27**;Aug 12, 1996
Q
; Variables
; PXCAHF Copy of a HEALTH FACTORS node of the PXCA array
; PXCAPRV Pointer to the provider (200)
; PXCANUMB Count of the number if HFs
; PXCAINDX Count of the number of HEALTH FACTORS for one provider
; PXCAFTER Temp used to build ^TMP(PXCAGLB,$J,"HF",PXCANUMB,0,"AFTER")
; PXCAPNAR Pointer to the provider narrative (9999999.27)
;
HF(PXCAHF,PXCANUMB,PXCAPRV,PXCAERRS) ;
N PXCAFTER
S PXCAFTER=$P(PXCAHF,"^",1)_"^"_PXCAPAT_"^"_PXCAVSIT_"^"
S PXCAFTER=PXCAFTER_$P(PXCAHF,"^",2)
S ^TMP(PXCAGLB,$J,"HF",PXCANUMB,"IEN")=""
S ^TMP(PXCAGLB,$J,"HF",PXCANUMB,0,"BEFORE")=""
S ^TMP(PXCAGLB,$J,"HF",PXCANUMB,0,"AFTER")=PXCAFTER
S ^TMP(PXCAGLB,$J,"HF",PXCANUMB,12,"BEFORE")=""
S ^TMP(PXCAGLB,$J,"HF",PXCANUMB,12,"AFTER")="^^^"_$S(PXCAPRV>0:PXCAPRV,1:"")
S ^TMP(PXCAGLB,$J,"HF",PXCANUMB,812,"BEFORE")=""
S ^TMP(PXCAGLB,$J,"HF",PXCANUMB,812,"AFTER")="^"_PXCAPKG_"^"_PXCASOR
Q
;
HFACTORS(PXCA,PXCABULD,PXCAERRS) ;Validation routine for HF
Q:'$D(PXCA("HEALTH FACTORS"))
N PXCAHF,PXCAPRV,PXCANUMB,PXCAINDX
N PXCAITEM
S PXCAPRV=""
S PXCANUMB=0
F S PXCAPRV=$O(PXCA("HEALTH FACTORS",PXCAPRV)) Q:PXCAPRV']"" D
. I PXCAPRV>0 D
.. I '$$ACTIVPRV^PXAPI(PXCAPRV,PXCADT) S PXCA("ERROR","HEALTH FACTORS",PXCAPRV,0,0)="Provider is not active or valid^"_PXCAPRV
.. E I PXCABULD!PXCAERRS D ANOTHPRV^PXCAPRV(PXCAPRV)
. S PXCAINDX=""
. F S PXCAINDX=$O(PXCA("HEALTH FACTORS",PXCAPRV,PXCAINDX)) Q:PXCAINDX']"" D
.. S PXCAHF=$G(PXCA("HEALTH FACTORS",PXCAPRV,PXCAINDX))
.. S PXCANUMB=PXCANUMB+1
.. I PXCAHF="" S PXCA("ERROR","HEALTH FACTORS",PXCAPRV,PXCAINDX,0)="HEALTH FACTORS data missing" Q
.. S PXCAITEM=+$P(PXCAHF,U,1)
.. I $G(^AUTTHF(PXCAITEM,0))="" S PXCA("ERROR","HEALTH FACTORS",PXCAPRV,PXCAINDX,1)="HEALTH FACTORS type not in file 9999999.14^"_PXCAITEM
.. S PXCAITEM=$P(PXCAHF,U,2)
.. I '(PXCAITEM=""!(PXCAITEM="M")!(PXCAITEM="MO")!(PXCAITEM="H")) S PXCA("ERROR","HEALTH FACTORS",PXCAPRV,PXCAINDX,2)="HEALTH FACTORS level/severity must be M|MO|H^"_PXCAITEM
.. I PXCABULD&'$D(PXCA("ERROR","HEALTH FACTORS",PXCAPRV,PXCAINDX))!PXCAERRS D HF(PXCAHF,.PXCANUMB,PXCAPRV,PXCAERRS)
Q
;
PXCAHF ;ISL/dee - Validates & Translates data from the PCE Device Interface into PCE's PXK format for Health Factors ;3/14/97
+1 ;;1.0;PCE PATIENT CARE ENCOUNTER;**27**;Aug 12, 1996
+2 QUIT
+3 ; Variables
+4 ; PXCAHF Copy of a HEALTH FACTORS node of the PXCA array
+5 ; PXCAPRV Pointer to the provider (200)
+6 ; PXCANUMB Count of the number if HFs
+7 ; PXCAINDX Count of the number of HEALTH FACTORS for one provider
+8 ; PXCAFTER Temp used to build ^TMP(PXCAGLB,$J,"HF",PXCANUMB,0,"AFTER")
+9 ; PXCAPNAR Pointer to the provider narrative (9999999.27)
+10 ;
HF(PXCAHF,PXCANUMB,PXCAPRV,PXCAERRS) ;
+1 NEW PXCAFTER
+2 SET PXCAFTER=$PIECE(PXCAHF,"^",1)_"^"_PXCAPAT_"^"_PXCAVSIT_"^"
+3 SET PXCAFTER=PXCAFTER_$PIECE(PXCAHF,"^",2)
+4 SET ^TMP(PXCAGLB,$JOB,"HF",PXCANUMB,"IEN")=""
+5 SET ^TMP(PXCAGLB,$JOB,"HF",PXCANUMB,0,"BEFORE")=""
+6 SET ^TMP(PXCAGLB,$JOB,"HF",PXCANUMB,0,"AFTER")=PXCAFTER
+7 SET ^TMP(PXCAGLB,$JOB,"HF",PXCANUMB,12,"BEFORE")=""
+8 SET ^TMP(PXCAGLB,$JOB,"HF",PXCANUMB,12,"AFTER")="^^^"_$SELECT(PXCAPRV>0:PXCAPRV,1:"")
+9 SET ^TMP(PXCAGLB,$JOB,"HF",PXCANUMB,812,"BEFORE")=""
+10 SET ^TMP(PXCAGLB,$JOB,"HF",PXCANUMB,812,"AFTER")="^"_PXCAPKG_"^"_PXCASOR
+11 QUIT
+12 ;
HFACTORS(PXCA,PXCABULD,PXCAERRS) ;Validation routine for HF
+1 IF '$DATA(PXCA("HEALTH FACTORS"))
QUIT
+2 NEW PXCAHF,PXCAPRV,PXCANUMB,PXCAINDX
+3 NEW PXCAITEM
+4 SET PXCAPRV=""
+5 SET PXCANUMB=0
+6 FOR
SET PXCAPRV=$ORDER(PXCA("HEALTH FACTORS",PXCAPRV))
IF PXCAPRV']""
QUIT
Begin DoDot:1
+7 IF PXCAPRV>0
Begin DoDot:2
+8 IF '$$ACTIVPRV^PXAPI(PXCAPRV,PXCADT)
SET PXCA("ERROR","HEALTH FACTORS",PXCAPRV,0,0)="Provider is not active or valid^"_PXCAPRV
+9 IF '$TEST
IF PXCABULD!PXCAERRS
DO ANOTHPRV^PXCAPRV(PXCAPRV)
End DoDot:2
+10 SET PXCAINDX=""
+11 FOR
SET PXCAINDX=$ORDER(PXCA("HEALTH FACTORS",PXCAPRV,PXCAINDX))
IF PXCAINDX']""
QUIT
Begin DoDot:2
+12 SET PXCAHF=$GET(PXCA("HEALTH FACTORS",PXCAPRV,PXCAINDX))
+13 SET PXCANUMB=PXCANUMB+1
+14 IF PXCAHF=""
SET PXCA("ERROR","HEALTH FACTORS",PXCAPRV,PXCAINDX,0)="HEALTH FACTORS data missing"
QUIT
+15 SET PXCAITEM=+$PIECE(PXCAHF,U,1)
+16 IF $GET(^AUTTHF(PXCAITEM,0))=""
SET PXCA("ERROR","HEALTH FACTORS",PXCAPRV,PXCAINDX,1)="HEALTH FACTORS type not in file 9999999.14^"_PXCAITEM
+17 SET PXCAITEM=$PIECE(PXCAHF,U,2)
+18 IF '(PXCAITEM=""!(PXCAITEM="M")!(PXCAITEM="MO")!(PXCAITEM="H"))
SET PXCA("ERROR","HEALTH FACTORS",PXCAPRV,PXCAINDX,2)="HEALTH FACTORS level/severity must be M|MO|H^"_PXCAITEM
+19 IF PXCABULD&'$DATA(PXCA("ERROR","HEALTH FACTORS",PXCAPRV,PXCAINDX))!PXCAERRS
DO HF(PXCAHF,.PXCANUMB,PXCAPRV,PXCAERRS)
End DoDot:2
End DoDot:1
+20 QUIT
+21 ;