Home   Package List   Routine Alphabetical List   Global Alphabetical List   FileMan Files List   FileMan Sub-Files List   Package Component Lists   Package-Namespace Mapping  
Routine: PXPNARR

PXPNARR.m

Go to the documentation of this file.
  1. PXPNARR ;SLC/PKR - Utilities for Provider Narrative fields in V CPT and V POV ;01/28/2021
  1. ;;1.0;PCE PATIENT CARE ENCOUNTER;**211**;Aug 12, 1996;Build 454
  1. Q
  1. ;
  1. ;===============
  1. ONEVCPT(VISITIEN,VCPTIEN,ENTRY) ;Repair a single V CPT entry.
  1. N CPT,EVENTDT,NARR,NODE,PNARR,PNARRP,SUBJECT
  1. S EVENTDT=$P($G(^AUPNVCPT(VCPTIEN,12)),U,1)
  1. I EVENTDT="" S EVENTDT=$P(^AUPNVSIT(VISITIEN,0),U,1)
  1. S CPT=$P(^AUPNVCPT(VCPTIEN,0),U,1)
  1. S NARR=$P($$CPT^ICPTCOD(CPT,EVENTDT),U,3)
  1. ;Get the Provider Narrative pointer.
  1. S PNARR=$$PROVNARR^PXAPI(NARR,9000010.18)
  1. S PNARRP=+$P(PNARR,U,1)
  1. I PNARRP'>0 Q
  1. S $P(^AUPNVCPT(IEN,0),U,4)=PNARRP
  1. S $P(ENTRY(0),U,4)=PNARRP
  1. S NODE="PXXMZ"
  1. S SUBJECT="V CPT Provider Narrative Repair"
  1. K ^TMP(NODE,$J)
  1. S ^TMP(NODE,$J,1,0)="Provider Narrative set to CPT short description for V CPT IEN="_VCPTIEN_"."
  1. S ^TMP(NODE,$J,2,0)="No further action is needed."
  1. D SEND^PXMSG(NODE,SUBJECT)
  1. K ^TMP(NODE,$J)
  1. Q
  1. ;
  1. ;===============
  1. ONEVPOV(VISITIEN,VPOVIEN,ENTRY) ;Repair a single V POV entry.
  1. N DIAG,EVENTDT,NARR,NODE,PNARR,PNARRP,SUBJECT
  1. S EVENTDT=$P($G(^AUPNVPOV(VPOVIEN,12)),U,1)
  1. I EVENTDT="" S EVENTDT=$P(^AUPNVSIT(VISITIEN,0),U,1)
  1. S DIAG=$P(^AUPNVPOV(VPOVIEN,0),U,1)
  1. S NARR=$$LD^ICDEX(80,DIAG,EVENTDT,.NARR,245)
  1. ;Get the Provider Narrative pointer.
  1. S PNARR=$$PROVNARR^PXAPI(NARR,9000010.07)
  1. S PNARRP=+$P(PNARR,U,1)
  1. I PNARRP'>0 Q
  1. S $P(^AUPNVPOV(IEN,0),U,4)=PNARRP
  1. S $P(ENTRY(0),U,4)=PNARRP
  1. S NODE="PXXMZ"
  1. S SUBJECT="V POV Provider Narrative Repair"
  1. K ^TMP(NODE,$J)
  1. S ^TMP(NODE,$J,1,0)="Provider Narrative set to ICD long description for V POV IEN="_VPOVIEN_"."
  1. S ^TMP(NODE,$J,2,0)="No further action is needed."
  1. D SEND^PXMSG(NODE,SUBJECT)
  1. K ^TMP(NODE,$J)
  1. Q
  1. ;
  1. ;===============
  1. TASKBOTH ;Task the V CPT and V POV Provider Narrative check/repair.
  1. D TASKVCPT^PXPNARR
  1. D MES^XPDUTL("")
  1. D TASKVPOV^PXPNARR
  1. Q
  1. ;
  1. ;===============
  1. TASKVCPT ;Task the V CPT Provider Narraative Check/Repair.
  1. S ZTDESC="V CPT Provider Narrative and Narrative Category Check/Repair"
  1. S ZTDTH=$H
  1. S ZTIO=""
  1. S ZTREQ="@"
  1. S ZTRTN="VCPT^PXPNARR"
  1. D MES^XPDUTL(ZTDESC)
  1. D ^%ZTLOAD
  1. D MES^XPDUTL("Task Number "_ZTSK_" started.")
  1. Q
  1. ;
  1. ;===============
  1. TASKVPOV ;Task the V POV Provider Narrative Check/Repair.
  1. S ZTDESC="V POV Provider Narrative and Narrative Category Check/Repair"
  1. S ZTDTH=$H
  1. S ZTIO=""
  1. S ZTREQ="@"
  1. S ZTRTN="VPOV^PXPNARR"
  1. D MES^XPDUTL(ZTDESC)
  1. D ^%ZTLOAD
  1. D MES^XPDUTL("Task Number "_ZTSK_" started.")
  1. Q
  1. ;
  1. ;===============
  1. VCPT ;V CPT Provider Narrative and Provider Narrative Category check/repair.
  1. N CPT,EVENTDT,IEN,IND,NARR,NL,NODE,NPNARR,NPNARRC,NVT,PNARR,PNARRC
  1. N PNARRP,SUBJECT,TEMP,TEXT,VALID,VISITIEN,VTEXT
  1. S NL=4
  1. S (IEN,NPNARR,NPNARRC,NVT)=0
  1. F S IEN=+$O(^AUPNVCPT(IEN)) Q:IEN=0 D
  1. .;Check for a corrupted entry.
  1. . I '$D(^AUPNVCPT(IEN,0)) Q
  1. .;Is the Provider Narrative pointer valid?
  1. . S PNARR=+$P(^AUPNVCPT(IEN,0),U,4)
  1. . S VALID=$S(PNARR'>0:0,1:$D(^AUTNPOV(PNARR)))
  1. . I 'VALID D
  1. ..;When the pointer is missing or invalid use the default, which is
  1. ..;the CPT short description.
  1. .. S TEMP=^AUPNVCPT(IEN,0)
  1. .. S VISITIEN=+$P(TEMP,U,3)
  1. ..;If the Visit is not valid quit.
  1. ..;Save info about bad Visit.
  1. .. I VISITIEN'>0 D Q
  1. ... S NVT=NVT+1,VTEXT(NVT)="V CPT IEN="_IEN_", visit pointer is missing."
  1. .. I (VISITIEN>0),'$D(^AUPNVSIT(VISITIEN)) D Q
  1. ... S NVT=NVT+1,VTEXT(NVT)="V CPT IEN="_IEN_", visit pointer points to a non-existent Visit."
  1. .. S EVENTDT=$P($G(^AUPNVCPT(IEN,12)),U,1)
  1. .. I (EVENTDT=""),(VISITIEN'>0) S EVENTDT=DT
  1. .. I EVENTDT="" S EVENTDT=$P(^AUPNVSIT(VISITIEN,0),U,1)
  1. .. S CPT=$P(TEMP,U,1)
  1. .. S NARR=$P($$CPT^ICPTCOD(CPT,EVENTDT),U,3)
  1. ..;Get the Provider Narrative pointer.
  1. .. S PNARR=$$PROVNARR^PXAPI(NARR,9000010.18)
  1. .. S PNARRP=+$P(PNARR,U,1)
  1. .. S $P(^AUPNVCPT(IEN,0),U,4)=PNARRP
  1. .. I PNARRP>0 D
  1. ... S NPNARR=NPNARR+1
  1. ... S NL=NL+1,TEXT(NL)="Provider Narrative set to CPT short description for IEN="_IEN_"."
  1. .. E S NL=NL+1,TEXT(NL)="Provider Narrative pointer is: "_PNARRP_" for IEN="_IEN_"."
  1. .;
  1. .;Is the Provider Narrative Category pointer valid?
  1. . S PNARRC=$P($G(^AUPNVCPT(IEN,802)),U,1)
  1. . S VALID=$S(PNARRC="":1,1:$D(^AUTNPOV(PNARRC)))
  1. .;Provider Narrative Category is not a required field, when the pointer
  1. .;is not valid delete it.
  1. . I 'VALID D
  1. .. S $P(^AUPNVCPT(IEN,802),U,1)=""
  1. .. S NPNARRC=NPNARRC+1
  1. .. S NL=NL+1,TEXT(NL)="Provider Narrative Category set to NULL for IEN="_IEN_"."
  1. S TEXT(1)="V CPT Provider Narrative and Provider Narrative Category check/repair results:"
  1. I NPNARR=0 S TEXT(2)="No problems were found for Provider Narrative."
  1. E S TEXT(2)=NPNARR_" Provider Narratives were set to the default."
  1. I NPNARRC=0 S TEXT(3)="No problems were found for Provider Narrative Category."
  1. E S TEXT(3)=NPNARRC_" Provider Narrative Categories were set to NULL."
  1. S TEXT(4)=$S((NPNARR+NPNARRC)>0:"The following changes were made:",1:"")
  1. ;Setup ^TMP for sending a MailMan message.
  1. S NODE="PXXMZ"
  1. S SUBJECT="V CPT Provider Narrative and Narrative Category Check/Repair"
  1. K ^TMP(NODE,$J)
  1. S (IND,NL)=0
  1. F S IND=+$O(TEXT(IND)) Q:IND=0 S NL=NL+1,^TMP(NODE,$J,NL,0)=TEXT(IND)
  1. I NVT>0 D
  1. . S NL=NL+1,^TMP(NODE,$J,NL,0)=""
  1. . S NL=NL+1,^TMP(NODE,$J,NL,0)="Additional issues that were found:"
  1. . S IND=0
  1. . F S IND=+$O(VTEXT(IND)) Q:IND=0 S NL=NL+1,^TMP(NODE,$J,NL,0)=VTEXT(IND)
  1. D SEND^PXMSG(NODE,SUBJECT)
  1. Q
  1. ;
  1. ;===============
  1. VPNARR(PNARR) ;Check for a valid provider narrative.
  1. ;The provder narrative is free text, but do not allow control characters.
  1. N CHAR,CTRLFOUND,DONE,IND,LEN
  1. S LEN=$L(PNARR)
  1. S (CTRLFOUND,DONE,IND)=0
  1. F Q:DONE D
  1. . S IND=IND+1
  1. . S CHAR=$E(PNARR,IND)
  1. . I CHAR?1C S (CTRLFOUND,DONE)=1 Q
  1. . I IND=LEN S DONE=1
  1. Q $S(CTRLFOUND=1:0,1:1)
  1. ;
  1. ;===============
  1. VPOV ;V POV Provider Narrative and Provider Narrative Category check/repair.
  1. N DIAG,EVENTDT,IEN,IND,NARR,NL,NODE,NPNARR,NPNARRC,NVT,PNARR,PNARRC
  1. N PNARRP,SUBJECT,TEMP,TEXT,VALID,VISITIEN,VTEXT
  1. S NL=4
  1. S (IEN,NPNARR,NPNARRC,NVT)=0
  1. F S IEN=+$O(^AUPNVPOV(IEN)) Q:IEN=0 D
  1. .;Check for a corrupted entry.
  1. . I '$D(^AUPNVPOV(IEN,0)) Q
  1. .;Is the Provider Narrative pointer valid?
  1. . S PNARR=+$P(^AUPNVPOV(IEN,0),U,4)
  1. . S VALID=$S(PNARR'>0:0,1:$D(^AUTNPOV(PNARR)))
  1. . I 'VALID D
  1. ..;When the pointer is missing or invalid use the default, which is
  1. ..;the ICD description.
  1. .. S TEMP=^AUPNVPOV(IEN,0)
  1. .. S VISITIEN=+$P(TEMP,U,3)
  1. ..;If the Visit is not valid quit.
  1. ..;Save info about bad Visit.
  1. .. I VISITIEN'>0 D Q
  1. ... S NVT=NVT+1,VTEXT(NVT)="V POV IEN="_IEN_", visit pointer is missing."
  1. .. I (VISITIEN>0),'$D(^AUPNVSIT(VISITIEN)) D Q
  1. ... S NVT=NVT+1,VTEXT(NVT)="V POV IEN="_IEN_", visit pointer points to a non-existent Visit."
  1. .. S EVENTDT=$P($G(^AUPNVPOV(IEN,12)),U,1)
  1. .. I (EVENTDT=""),(VISITIEN'>0) S EVENTDT=DT
  1. .. I EVENTDT="" S EVENTDT=$P(^AUPNVSIT(VISITIEN,0),U,1)
  1. .. S DIAG=$P(TEMP,U,1)
  1. .. S NARR=$$LD^ICDEX(80,DIAG,EVENTDT,.NARR,245)
  1. ..;Get the Provider Narrative pointer.
  1. .. S PNARR=$$PROVNARR^PXAPI(NARR,9000010.07)
  1. .. S PNARRP=+$P(PNARR,U,1)
  1. .. S $P(^AUPNVPOV(IEN,0),U,4)=PNARRP
  1. .. I PNARRP>0 D
  1. ... S NPNARR=NPNARR+1
  1. ... S NL=NL+1,TEXT(NL)="Provider Narrative set to ICD long description for IEN="_IEN_"."
  1. .. E S NL=NL+1,TEXT(NL)="Provider Narrative pointer is: "_PNARRP_" for IEN="_IEN_"."
  1. .;
  1. .;Is the Provider Narrative Category pointer valid?
  1. . S PNARRC=$P($G(^AUPNVPOV(IEN,802)),U,1)
  1. . S VALID=$S(PNARRC="":1,1:$D(^AUTNPOV(PNARRC)))
  1. .;Provider Narrative Category is not a required field, when the pointer
  1. .;is not valid delete it.
  1. . I 'VALID D
  1. .. S $P(^AUPNVPOV(IEN,802),U,1)=""
  1. .. S NPNARRC=NPNARRC+1
  1. .. S NL=NL+1,TEXT(NL)="Provider Narrative Category set to NULL for IEN="_IEN_"."
  1. S TEXT(1)="V POV Provider Narrative and Provider Narrative Category check/repair results:"
  1. I NPNARR=0 S TEXT(2)="No problems were found for Provider Narrative."
  1. E S TEXT(2)=NPNARR_" Provider Narratives were set to the default."
  1. I NPNARRC=0 S TEXT(3)="No problems were found for Provider Narrative Category."
  1. E S TEXT(3)=NPNARRC_" Provider Narrative Categories were set to NULL."
  1. S TEXT(4)=$S((NPNARR+NPNARRC)>0:"The following changes were made:",1:"")
  1. ;Setup ^TMP for sending a MailMan message.
  1. S NODE="PXXMZ"
  1. S SUBJECT="V POV Provider Narrative and Narrative Category Check/Repair"
  1. K ^TMP(NODE,$J)
  1. S (IND,NL)=0
  1. F S IND=+$O(TEXT(IND)) Q:IND=0 S NL=NL+1,^TMP(NODE,$J,NL,0)=TEXT(IND)
  1. I NVT>0 D
  1. . S NL=NL+1,^TMP(NODE,$J,NL,0)=""
  1. . S NL=NL+1,^TMP(NODE,$J,NL,0)="Additional issues that were found:"
  1. . S IND=0
  1. . F S IND=+$O(VTEXT(IND)) Q:IND=0 S NL=NL+1,^TMP(NODE,$J,NL,0)=VTEXT(IND)
  1. D SEND^PXMSG(NODE,SUBJECT)
  1. Q
  1. ;