SCDXUTL3 ;ALB/JRP - ACRP ERROR CODE UTILITIES;08-OCT-1996
;;5.3;Scheduling;**68**;AUG 13, 1993
DEMOCODE(PTRCODE) ;Determine if NPCDB error code is related to a
; patient's demographic data or if it is related to the encounter data
;
;Input : PTRCODE - Pointer to entry in TRANSMITTED OUTPATIENT
; ENCOUNTER ERROR CODE file (#409.76)
;Output : 1 - Error is related to patient's demographic data
; 0 - Error is related to the encounter data
; 0 - Bad input
;
;Check input
S PTRCODE=+$G(PTRCODE)
Q:('$D(^SD(409.76,PTRCODE,0))) 0
;Declare variables
N ERRCODE,TMP,DEMOCODE,DEMOGRP
;Convert pointer to error code
S ERRCODE=$P($G(^SD(409.76,PTRCODE,0)),"^",1)
Q:(ERRCODE="") 0
;Establish series of codes that relate to patient demographic data
F TMP=200,300,400,700,800,"000","B00","C00" S DEMOGRP(TMP)=1
;Convert error code to it's series range and determine if that range
;relates to patient demographic data
S TMP=$E(ERRCODE,1)_"00"
S DEMOCODE=+$G(DEMOGRP(TMP))
;Done
Q DEMOCODE
;
DEMOERR(PTRERR) ;Determine if error is related to a patient's demographic
; data or if it is related to the encounter data
;
;Input : PTRERR - Pointer to entry in TRANSMITTED OUTPATIENT
; ENCOUNTER ERROR file (#409.75)
;Output : 1 - Error is related to patient's demographic data
; 0 - Error is related to the encounter data
; 0 - Bad input
;
;Check input
S PTRERR=+$G(PTRERR)
Q:('$D(^SD(409.75,PTRERR,0))) 0
;Declare variables
N PTRCODE,NODE
;Get pointer to TRANSMITTED OUTPATIENT ENCOUNTER ERROR CODE file
S NODE=$G(^SD(409.75,PTRERR,0))
S PTRCODE=+$P(NODE,"^",2)
;Return whether or not error code is related to demographic data
Q $$DEMOCODE(PTRCODE)
;
REJ4DEMO(XMITPTR) ;Determine if encounter was rejected due to a
; demographic error
;
;Input : XMITPTR - Pointer to TRANSMITTED OUTPATIENT ENCOUNTER
; file (#409.73)
;Output : 1 - At least one of the error codes listed for the
; encounter is related to the patient's demographic data
; 0 - None of the error codes listed for the encounter are
; related to the patient's demographic data
; 0 - Bad input/no error codes listed
;
;Check input
S XMITPTR=+$G(XMITPTR)
Q:('$D(^SD(409.73,XMITPTR,0))) 0
;Declare variables
N PTRERR,PTRCODE,NODE,REJ4DEMO
S REJ4DEMO=0
;Loop through TRANSMITTED OUTPATIENT ENCOUNTER ERROR file (#409.75)
S PTRERR=""
F S PTRERR=+$O(^SD(409.75,"B",XMITPTR,PTRERR)) Q:('PTRERR) D Q:(REJ4DEMO)
.;Get pointer to error code
.S NODE=$G(^SD(409.75,PTRERR,0))
.S PTRCODE=+$P(NODE,"^",2)
.Q:('PTRCODE)
.;Determine if code is based on demographic data
.S REJ4DEMO=+$$DEMOCODE(PTRCODE)
;Done
Q REJ4DEMO
--- Routine Detail --- with STRUCTURED ROUTINE LISTING ---[H[J[2J[HSCDXUTL3 2825 printed Dec 13, 2024@02:39:41 Page 2
SCDXUTL3 ;ALB/JRP - ACRP ERROR CODE UTILITIES;08-OCT-1996
+1 ;;5.3;Scheduling;**68**;AUG 13, 1993
DEMOCODE(PTRCODE) ;Determine if NPCDB error code is related to a
+1 ; patient's demographic data or if it is related to the encounter data
+2 ;
+3 ;Input : PTRCODE - Pointer to entry in TRANSMITTED OUTPATIENT
+4 ; ENCOUNTER ERROR CODE file (#409.76)
+5 ;Output : 1 - Error is related to patient's demographic data
+6 ; 0 - Error is related to the encounter data
+7 ; 0 - Bad input
+8 ;
+9 ;Check input
+10 SET PTRCODE=+$GET(PTRCODE)
+11 if ('$DATA(^SD(409.76,PTRCODE,0)))
QUIT 0
+12 ;Declare variables
+13 NEW ERRCODE,TMP,DEMOCODE,DEMOGRP
+14 ;Convert pointer to error code
+15 SET ERRCODE=$PIECE($GET(^SD(409.76,PTRCODE,0)),"^",1)
+16 if (ERRCODE="")
QUIT 0
+17 ;Establish series of codes that relate to patient demographic data
+18 FOR TMP=200,300,400,700,800,"000","B00","C00"
SET DEMOGRP(TMP)=1
+19 ;Convert error code to it's series range and determine if that range
+20 ;relates to patient demographic data
+21 SET TMP=$EXTRACT(ERRCODE,1)_"00"
+22 SET DEMOCODE=+$GET(DEMOGRP(TMP))
+23 ;Done
+24 QUIT DEMOCODE
+25 ;
DEMOERR(PTRERR) ;Determine if error is related to a patient's demographic
+1 ; data or if it is related to the encounter data
+2 ;
+3 ;Input : PTRERR - Pointer to entry in TRANSMITTED OUTPATIENT
+4 ; ENCOUNTER ERROR file (#409.75)
+5 ;Output : 1 - Error is related to patient's demographic data
+6 ; 0 - Error is related to the encounter data
+7 ; 0 - Bad input
+8 ;
+9 ;Check input
+10 SET PTRERR=+$GET(PTRERR)
+11 if ('$DATA(^SD(409.75,PTRERR,0)))
QUIT 0
+12 ;Declare variables
+13 NEW PTRCODE,NODE
+14 ;Get pointer to TRANSMITTED OUTPATIENT ENCOUNTER ERROR CODE file
+15 SET NODE=$GET(^SD(409.75,PTRERR,0))
+16 SET PTRCODE=+$PIECE(NODE,"^",2)
+17 ;Return whether or not error code is related to demographic data
+18 QUIT $$DEMOCODE(PTRCODE)
+19 ;
REJ4DEMO(XMITPTR) ;Determine if encounter was rejected due to a
+1 ; demographic error
+2 ;
+3 ;Input : XMITPTR - Pointer to TRANSMITTED OUTPATIENT ENCOUNTER
+4 ; file (#409.73)
+5 ;Output : 1 - At least one of the error codes listed for the
+6 ; encounter is related to the patient's demographic data
+7 ; 0 - None of the error codes listed for the encounter are
+8 ; related to the patient's demographic data
+9 ; 0 - Bad input/no error codes listed
+10 ;
+11 ;Check input
+12 SET XMITPTR=+$GET(XMITPTR)
+13 if ('$DATA(^SD(409.73,XMITPTR,0)))
QUIT 0
+14 ;Declare variables
+15 NEW PTRERR,PTRCODE,NODE,REJ4DEMO
+16 SET REJ4DEMO=0
+17 ;Loop through TRANSMITTED OUTPATIENT ENCOUNTER ERROR file (#409.75)
+18 SET PTRERR=""
+19 FOR
SET PTRERR=+$ORDER(^SD(409.75,"B",XMITPTR,PTRERR))
if ('PTRERR)
QUIT
Begin DoDot:1
+20 ;Get pointer to error code
+21 SET NODE=$GET(^SD(409.75,PTRERR,0))
+22 SET PTRCODE=+$PIECE(NODE,"^",2)
+23 if ('PTRCODE)
QUIT
+24 ;Determine if code is based on demographic data
+25 SET REJ4DEMO=+$$DEMOCODE(PTRCODE)
End DoDot:1
if (REJ4DEMO)
QUIT
+26 ;Done
+27 QUIT REJ4DEMO