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

PXRMICHK.m

Go to the documentation of this file.
  1. PXRMICHK ;SLC/PKR - Integrity checking routines. ;05/31/2022
  1. ;;2.0;CLINICAL REMINDERS;**18,24,26,47,45,42,65**;Feb 04, 2005;Build 438
  1. ;===============
  1. ADDTEXT(NIN,TEXT,NL,OUTPUT) ;
  1. N IND,NOUT,TEXTOUT
  1. D FORMAT^PXRMTEXT(1,80,NIN,.TEXT,.NOUT,.TEXTOUT)
  1. F IND=1:1:NOUT S NL=NL+1,OUTPUT(NL)=TEXTOUT(IND)
  1. Q
  1. ;
  1. ;===============
  1. CCRLOGIC(COHOK,FFOK,RESOK,DEFARR,NL,OUTPUT) ;Check cohort and resolution logic.
  1. N AGE,FIEVAL,FINDING,FF,FLIST,IND,JND,NUM,OCCN,PCLOG
  1. N RESLOG,RESLSTR,SEX,TEMP,TEST,TEXT
  1. N PXRMAGE,PXRMDATE,PXRMDOB,PXRMDOD,PXRMLAD,PXRMSEX,PXRMSIG
  1. S (PXRMAGE,PXRMDATE,PXRMDOB,PXRMDOD,PXRMLAD)=0
  1. S (PXRMSEX,PXRMSIG)=""
  1. ;Set all findings false.
  1. S (FIEVAL("AGE"),FIEVAL("SEX"))=0
  1. S IND=0
  1. F S IND=+$O(DEFARR(20,IND)) Q:IND=0 D
  1. . S FIEVAL(IND)=0
  1. . S OCCN=$P(DEFARR(20,IND,0),U,14)
  1. . F JND=1:1:OCCN S FIEVAL(IND,JND)=0
  1. ;If there were no problems with the function findings evaluate them
  1. ;with all findings false.
  1. I FFOK D EVAL^PXRMFF(.DEFARR,.FIEVAL)
  1. S PCLOG=DEFARR(31)
  1. I (PCLOG["FF"),('FFOK) S COHOK=0
  1. I COHOK D
  1. . S TEMP=DEFARR(32)
  1. . S NUM=+$P(TEMP,U,1)
  1. . I NUM=0 Q
  1. . S FLIST=$P(TEMP,U,2)
  1. . F IND=1:1:NUM D
  1. .. S FINDING=$P(FLIST,";",IND)
  1. .. I FINDING="AGE" S AGE=+$G(FIEVAL("AGE"))
  1. .. I FINDING="SEX" S SEX=+$G(FIEVAL("SEX"))
  1. .. I FINDING["FF" S TEMP=$P(FINDING,"FF",2),FF(TEMP)=FIEVAL(FINDING)
  1. .. E S FI(FINDING)=FIEVAL(FINDING)
  1. . I @PCLOG
  1. . S TEST=$T
  1. . I TEST D
  1. .. S TEXT(1)="WARNING: Cohort logic is true even when there are no true findings!"
  1. .. D ADDTEXT(1,.TEXT,.NL,.OUTPUT)
  1. S (RESLOG,RESLSTR)=DEFARR(35)
  1. I (RESLOG["FF"),('FFOK) S RESOK=0
  1. I RESOK D
  1. . S TEMP=DEFARR(36)
  1. . S NUM=+$P(TEMP,U,1)
  1. . I NUM=0 Q
  1. . S (RESLOG,RESLSTR)=DEFARR(35)
  1. . S FLIST=$P(TEMP,U,2)
  1. . F IND=1:1:NUM D
  1. .. S FINDING=$P(FLIST,";",IND)
  1. .. I FINDING["FF" S TEMP=$P(FINDING,"FF",2),FF(TEMP)=FIEVAL(FINDING)
  1. .. E S FI(FINDING)=FIEVAL(FINDING)
  1. . I @RESLOG
  1. . S TEST=$T
  1. . I TEST D
  1. .. S TEXT(1)="WARNING: Resolution logic is true even when there are no true findings!"
  1. .. D ADDTEXT(1,.TEXT,.NL,.OUTPUT)
  1. Q
  1. ;
  1. ;===============
  1. CFCHK(USAGE,IND,FIEN,DEFARR,TYPE,NL,OUTPUT) ;Check computed findings.
  1. N CFNAME,CFPAR,CFPREQ,CFTYPE,OK,TEXT
  1. S OK=1
  1. ;Is the Computed Finding Parameter required?
  1. S CFPREQ=$P(^PXRMD(811.4,FIEN,0),U,6)
  1. S CFNAME=$P(^PXRMD(811.4,FIEN,0),U,1)
  1. S CFPAR=$P(DEFARR(20,IND,15),U,1)
  1. I CFPREQ,CFPAR="" D
  1. . I TYPE="D" S TEXT(1)="FATAL: Finding number "_IND_" uses computed finding "_CFNAME_"."
  1. . I TYPE="T" S TEXT(1)="FATAL: Term finding number "_IND_" uses computed finding "_CFNAME_"."
  1. . S TEXT(2)="This computed finding will not work properly unless the"
  1. . S TEXT(3)="Computed Finding Parameter is defined and in this case it is not."
  1. . D ADDTEXT(3,.TEXT,.NL,.OUTPUT)
  1. . S OK=0
  1. ;If USAGE is 'L' make sure the CF is list type.
  1. S CFTYPE=$P(^PXRMD(811.4,FIEN,0),U,5)
  1. I CFTYPE="" S CFTYPE="S"
  1. I (USAGE["L"),(CFTYPE'="L") D
  1. . S CFNAME=$P(^PXRMD(811.4,FIEN,0),U,1)
  1. . K TEXT
  1. . I TYPE="D" S TEXT(1)="FATAL: Finding number "_IND_" uses computed finding "_CFNAME_"."
  1. . I TYPE="T" S TEXT(1)="FATAL: Term finding number "_IND_" uses computed finding "_CFNAME_"."
  1. . S TEXT(2)="Usage is 'L' and this computed finding's Type is "_CFTYPE_";"
  1. . S TEXT(3)="the Type must be 'L'."
  1. . D ADDTEXT(3,.TEXT,.NL,.OUTPUT)
  1. . S OK=0
  1. ;If the CF is VA-REMINDER DEFINITION do additional checks.
  1. I (CFNAME="VA-REMINDER DEFINITION") S OK=$$RDCFCHK(CFNAME,CFPAR,IND,TYPE,.NL,.OUTPUT)
  1. Q OK
  1. ;
  1. ;===============
  1. CHECKALL ;Check all definitions.
  1. N IEN,NAME,OK,OUTPUT,POP,PXRMDONE,TEXT
  1. W #!,"Check the integrity of all reminder definitions."
  1. D ^%ZIS Q:POP
  1. U IO
  1. S NAME="",PXRMDONE=0
  1. F S NAME=$O(^PXD(811.9,"B",NAME)) Q:(NAME="")!(PXRMDONE) D
  1. . S IEN=$O(^PXD(811.9,"B",NAME,""))
  1. . W !!,"Checking "_NAME_" (IEN="_IEN_")"
  1. . K OUTPUT
  1. . S OK=$$DEF^PXRMICHK(IEN,.OUTPUT,1)
  1. D ^%ZISC
  1. Q
  1. ;
  1. ;===============
  1. CHECKONE ;Check selected definitions.
  1. N DIC,DTOUT,DUOUT,IEN,OK,OUTPUT,Y
  1. S DIC="^PXD(811.9,"
  1. S DIC(0)="AEMQ"
  1. S DIC("A")="Select Reminder Definition: "
  1. GETDEF ;Get the definition to check.
  1. W !
  1. D ^DIC
  1. I ($D(DTOUT))!($D(DUOUT)) Q
  1. I Y=-1 Q
  1. S IEN=$P(Y,U,1)
  1. W #
  1. K OUTPUT
  1. S OK=$$DEF^PXRMICHK(IEN,.OUTPUT,1)
  1. G GETDEF
  1. Q
  1. ;
  1. ;===============
  1. DATECHK(FINDING,DATE,TYPE,DEFARR,NL,OUTPUT) ;Check Beginning and Ending
  1. ;Date/Times if they contain FIEVAL.
  1. N ARGS,DFI,DTYPE,OCC,OCN,OK,TEXT
  1. S OK=1
  1. S ARGS=$E(DATE,$F(DATE,"FIEVAL("),$F(DATE,"""DATE"")")-9)
  1. I ARGS="" Q OK
  1. S DFI=$P(ARGS,",",1)
  1. I '$D(DEFARR(20,DFI)) D
  1. . S DTYPE=$S(TYPE="BDT":"Beginning Date/Time",TYPE="EDT":"Ending Date/Time")
  1. . S TEXT(1)="FATAL: "_DTYPE_" for finding number "_FINDING_" uses finding number "_DFI_" which does not exist."
  1. . D ADDTEXT(1,.TEXT,.NL,.OUTPUT)
  1. . S OK=0
  1. I OK D
  1. . S OCN=$P(ARGS,",",2)
  1. . I OCN="" Q
  1. . S OCC=+$P(DEFARR(20,DFI,0),U,14)
  1. . S OCC=$S(OCC=0:1,OCC>0:OCC,1:-OCC)
  1. . I OCN>OCC D
  1. .. S DTYPE=$S(TYPE="BDT":"Beginning Date/Time",TYPE="EDT":"Ending Date/Time")
  1. .. S TEXT(1)="FATAL: "_DTYPE_" for finding number "_FINDING_" uses occurrence "_OCN_" of finding number "_DFI_";"
  1. .. S TEXT(2)="the Occurrence Count for finding "_DFI_" is "_OCC_"."
  1. .. D ADDTEXT(2,.TEXT,.NL,.OUTPUT)
  1. .. S OK=0
  1. Q OK
  1. ;
  1. ;===============
  1. DEF(IEN,OUTPUT,WRITE) ;Definition integrity check. 0 is returned if the
  1. ;definition has fatal errors, otherwise 1 is returned.
  1. ;Warning and error text is stored in the OUTPUT array. If WRITE=1 then
  1. ;the contents of OUTPUT will be written out.
  1. N ARGTYPE,BDT,C1,COHOK,DEF,DEFARR,EDT,FFOK
  1. N FFNUM,FI,FIEN,FLIST,FNUM,FUNCTION,GBL,IND,JND,KND
  1. N LOGCHK,LOGINTR,LOGSTR,NBFREQ,NFI,NFFREQ,NL
  1. N OCC,OCN,OK,RESOK
  1. N TEXT,USAGE,ZNODE
  1. S NL=0,OK=1
  1. ;Check usage.
  1. S ZNODE=^PXD(811.9,IEN,100)
  1. S USAGE=$P(ZNODE,U,4)
  1. I $P(ZNODE,U,1)'="N",USAGE["P" D
  1. . K TEXT
  1. . S TEXT(1)="WARNING: Usage field contains a ""P"" and this is not a national reminder definition."
  1. . D ADDTEXT(1,.TEXT,.NL,.OUTPUT)
  1. ;
  1. D DEF^PXRMLDR(IEN,.DEFARR)
  1. S DEF=$P(DEFARR(0),U,1)
  1. ;
  1. ;Check findings and finding modifiers.
  1. S IND=0
  1. F S IND=+$O(DEFARR(20,IND)) Q:IND=0 D
  1. . S ZNODE=DEFARR(20,IND,0)
  1. . S FI=$P(ZNODE,U,1)
  1. . S FIEN=$P(FI,";",1)
  1. . S GBL=$P(FI,";",2)
  1. . I (FIEN'=+FIEN)!(GBL="") D Q
  1. .. K TEXT
  1. .. S TEXT(1)="FATAL: Finding number "_IND_" is invalid."
  1. .. D ADDTEXT(1,.TEXT,.NL,.OUTPUT)
  1. .. S OK=0
  1. . S FNUM=$$GETFNUM^PXRMEXPS(GBL)
  1. . I '$$FIND1^DIC(FNUM,"","XU","`"_FIEN) D
  1. .. K TEXT
  1. .. S TEXT(1)="FATAL: Finding number "_IND_", does not exist! It is entry number "_FIEN_" in file #"_FNUM_"."
  1. .. D ADDTEXT(1,.TEXT,.NL,.OUTPUT)
  1. .. S OK=0
  1. . S BDT=$P(ZNODE,U,8)
  1. . I BDT["FIEVAL",'$$DATECHK(IND,BDT,"BDT",.DEFARR,.NL,.OUTPUT) S OK=0
  1. . S EDT=$P(ZNODE,U,11)
  1. . I EDT["FIEVAL",'$$DATECHK(IND,EDT,"EDT",.DEFARR,.NL,.OUTPUT) S OK=0
  1. .;Check computed findings.
  1. . I (GBL="PXRMD(811.4,"),'$$CFCHK(USAGE,IND,FIEN,.DEFARR,"D",.NL,.OUTPUT) S OK=0
  1. .;Check terms.
  1. . I (GBL="PXRMD(811.5,"),'$$TERMCHK^PXRMICK1(USAGE,FIEN,.NL,.OUTPUT) S OK=0
  1. ;
  1. ;Check for recursion.
  1. I $$RECCHK(IEN,.NL,.OUTPUT) S OK=0
  1. ;
  1. ;Check function findings.
  1. S FFNUM="FF",FFOK=1
  1. F S FFNUM=$O(DEFARR(25,FFNUM)) Q:FFNUM="" D
  1. . S IND=$P(FFNUM,"FF",2)
  1. .;Check for an invalid function string.
  1. . I $L($G(DEFARR(25,FFNUM,3)))<2 D Q
  1. .. K TEXT
  1. .. S TEXT(1)="FATAL: Function finding number "_IND_" has an invalid function string."
  1. .. D ADDTEXT(1,.TEXT,.NL,.OUTPUT)
  1. .. S (FFOK,OK)=0
  1. . S JND=0
  1. . F S JND=+$O(DEFARR(25,FFNUM,5,JND)) Q:JND=0 D
  1. .. S FUNCTION=$P(DEFARR(25,FFNUM,5,JND,0),U,2)
  1. .. S FUNCTION=$P(^PXRMD(802.4,FUNCTION,0),U,1)
  1. .. S KND=0
  1. .. F S KND=+$O(DEFARR(25,FFNUM,5,JND,20,KND)) Q:KND=0 D
  1. ... S ARGTYPE=$$ARGTYPE^PXRMFFAT(FUNCTION,KND)
  1. ... I ARGTYPE="F" D
  1. .... S FI=DEFARR(25,FFNUM,5,JND,20,KND,0)
  1. .... S C1=$E(FI,1)
  1. .... I (C1="C")!(C1="R") S FI=$E(FI,2,15)
  1. .... I '$D(DEFARR(20,FI,0)) D
  1. ..... K TEXT
  1. ..... S TEXT(1)="FATAL: Function finding number "_IND_" depends on finding number "_FI_" which does not exist."
  1. ..... D ADDTEXT(1,.TEXT,.NL,.OUTPUT)
  1. ..... S (FFOK,OK)=0
  1. ... I FFOK,ARGTYPE="N" D
  1. .... S OCN=DEFARR(25,FFNUM,5,JND,20,KND,0)
  1. .... S OCC=+$P(DEFARR(20,FI,0),U,14)
  1. .... S OCC=$S(OCC=0:1,OCC>0:OCC,1:-OCC)
  1. .... ;Ignore Occurrence Count check for contraindication and refusal findings.
  1. .... I (C1="C")!(C1="R") S OCN=OCC
  1. .... I OCN>OCC D
  1. ..... K TEXT
  1. ..... S TEXT(1)="FATAL: Function finding number "_IND_" uses occurrence number "_OCN
  1. ..... S TEXT(2)="of finding number "_FI_"."
  1. ..... S TEXT(3)="The Occurrence Count for finding "_FI_" is "_OCC_"."
  1. ..... D ADDTEXT(3,.TEXT,.NL,.OUTPUT)
  1. ..... S (FFOK,OK)=0
  1. ;
  1. ;Check custom date due.
  1. S IND=0
  1. F S IND=+$O(DEFARR(47,IND)) Q:IND=0 D
  1. . S FI=$P(DEFARR(47,IND,0),U,1)
  1. . I '$D(DEFARR(20,FI,0)) D
  1. .. K TEXT
  1. .. S TEXT(1)="FATAL: Custom Date Due depends on finding number "_FI_" which does not exist."
  1. .. D ADDTEXT(1,.TEXT,.NL,.OUTPUT)
  1. .. S OK=0
  1. ;
  1. ;Check cohort logic structure and dependencies.
  1. S LOGSTR=$G(DEFARR(31))
  1. ;Run the input transform.
  1. S LOGINTR=$S(LOGSTR'="":$$VALID^PXRMLOG(LOGSTR,IEN,3,512),1:1)
  1. S NFI=+$P($G(DEFARR(32)),U,1)
  1. S FLIST=$P($G(DEFARR(32)),U,2)
  1. S LOGCHK=$$LOGCHECK(NFI,FLIST,LOGSTR,"Patient Cohort",.DEFARR,.NL,.OUTPUT)
  1. S COHOK=LOGINTR&LOGCHK
  1. I 'COHOK D
  1. . S TEXT(1)="FATAL: Definition has invalid cohort logic.\\"
  1. . S TEXT(2)=" "_LOGSTR
  1. . D ADDTEXT(2,.TEXT,.NL,.OUTPUT)
  1. . S OK=0
  1. ;
  1. ;If the USAGE is List, check the cohort logic to make sure it
  1. ;meets the special requirements.
  1. I USAGE["L",COHOK S COHOK=$$LCOHORTC(.DEFARR,.NL,.OUTPUT)
  1. I 'COHOK S OK=0
  1. ;
  1. ;Check resolution structure and dependencies.
  1. S LOGSTR=$G(DEFARR(35))
  1. ;Run the input transform.
  1. S LOGINTR=$S(LOGSTR'="":$$VALIDR^PXRMLOG(LOGSTR,IEN,5,512),1:1)
  1. S NFI=+$P($G(DEFARR(36)),U,1)
  1. S FLIST=$P($G(DEFARR(36)),U,2)
  1. S LOGCHK=$$LOGCHECK(NFI,FLIST,LOGSTR,"Resolution",.DEFARR,.NL,.OUTPUT)
  1. S RESOK=LOGINTR&LOGCHK
  1. I 'RESOK D
  1. . S TEXT(1)="FATAL: Definition has invalid resolution logic.\\"
  1. . S TEXT(2)=" "_LOGSTR
  1. . D ADDTEXT(2,.TEXT,.NL,.OUTPUT)
  1. . S OK=0
  1. ;
  1. ;Make other checks for bad cohort and resolution logic; these are
  1. ;all just warnings.
  1. D CCRLOGIC(COHOK,FFOK,RESOK,.DEFARR,.NL,.OUTPUT)
  1. ;
  1. ;Check for frequencies, a frequency is required if there is resolution
  1. ;logic.
  1. S (IND,NBFREQ,NFFREQ)=0
  1. F S IND=+$O(DEFARR(7,IND)) Q:IND=0 S NBFREQ=NBFREQ+1
  1. I NBFREQ=0 D
  1. . K TEXT
  1. . S TEXT(1)="WARNING: No baseline frequencies are defined."
  1. . D ADDTEXT(1,.TEXT,.NL,.OUTPUT)
  1. I NBFREQ=0 D
  1. . S IND=0
  1. . F S IND=+$O(DEFARR(20,IND)) Q:IND=0 I $P(DEFARR(20,IND,0),U,4)'="" S NFFREQ=NFFREQ+1
  1. . S IND="FF"
  1. . F S IND=$O(DEFARR(25,IND)) Q:IND="" I $P(DEFARR(25,IND,0),U,4)'="" S NFFREQ=NFFREQ+1
  1. I (NBFREQ=0),(NFFREQ=0),(DEFARR(35)'="") D
  1. . K TEXT
  1. . S TEXT(1)="FATAL: Definition has resolution logic but no baseline frequencies."
  1. . S TEXT(2)="Also there are no findings or function findings that set a frequency."
  1. . D ADDTEXT(2,.TEXT,.NL,.OUTPUT)
  1. . S OK=0
  1. . I (NBFREQ=0),(NFFREQ>0),(DEFARR(35)'="") D
  1. . K TEXT
  1. . S TEXT(1)="WARNING: Definition has resolution logic but no baseline frequencies."
  1. . S TEXT(2)="There are findings that set a frequency but if they are all false there will not be a frequency."
  1. . D ADDTEXT(2,.TEXT,.NL,.OUTPUT)
  1. K TEXT
  1. I OK S TEXT(1)="No fatal reminder definition errors were found."
  1. E S TEXT(1)="This reminder definition has fatal errors and it will not work!"
  1. D ADDTEXT(1,.TEXT,.NL,.OUTPUT)
  1. I WRITE=1 D OUTPUT^PXRMICK1(NL,.OUTPUT)
  1. Q OK
  1. ;
  1. ;===============
  1. LCOHORTC(DEFARR,NL,OUTPUT) ;Check list type reminder cohort logic for special
  1. ;requirements.
  1. N IND,MAXAGE,MINAGE,NL,OK,PCLOG,TEXT
  1. S (OK,NL)=1
  1. S PCLOG=DEFARR(31)
  1. ;The cohort logic cannot start with a logical not.
  1. I $E(PCLOG,1)="'" D
  1. . S NL=NL+1
  1. . S TEXT(NL)="The cohort logic cannot start with a logical not.\\"
  1. . S OK=0
  1. I PCLOG["!'" D
  1. . S NL=NL+1
  1. . S TEXT(NL)="The cohort logic cannot contain !' (OR NOT).\\"
  1. . S OK=0
  1. I PCLOG["AGE" D
  1. .;Make sure a baseline age range is defined.
  1. . S IND=0 F S IND=$O(DEFARR(7,IND)) Q:(IND="") Q:(DEFARR(7,IND,0)'="")
  1. . S MINAGE=$S(IND="":0,1:+$P($G(DEFARR(7,IND,0)),U,2))
  1. . S MAXAGE=$S(IND="":0,1:+$P($G(DEFARR(7,IND,0)),U,3))
  1. . I (MINAGE=0),(MAXAGE=0) D
  1. .. S NL=NL+1
  1. .. S TEXT(NL)="The cohort logic contains AGE but no baseline age range is defined.\\"
  1. .. S OK=0
  1. I PCLOG["SEX" D
  1. . I $P(DEFARR(0),U,9)="" D
  1. .. S NL=NL+1
  1. .. S TEXT(NL)="The cohort logic contains SEX but the SEX SPECIFIC field is not defined.\\"
  1. .. S OK=0
  1. I PCLOG["SEX" D
  1. . N PFSTACK
  1. . D POSTFIX^PXRMSTAC(PCLOG,"!&",.PFSTACK)
  1. . I PFSTACK(1)'="SEX" Q
  1. . I (PFSTACK(2)'="AGE")!(PFSTACK(3)'="&") D
  1. .. S NL=NL+1
  1. .. S TEXT(NL)="The cohort logic starts with SEX but SEX is not logically ANDED with AGE.\\"
  1. .. S OK=0
  1. I 'OK D
  1. . S TEXT(1)="FATAL: List type definitions have the following restrictions:\\"
  1. . D ADDTEXT(NL,.TEXT,.NL,.OUTPUT)
  1. Q OK
  1. ;
  1. ;===============
  1. LOGCHECK(NFI,FLIST,LOGSTR,TYPE,DEFARR,NL,OUTPUT) ;Verify logic strings.
  1. ;Make sure the findings exist and the syntax is correct.
  1. N FFNUM,FI,IND,OK,TEXT,X
  1. S OK=1
  1. I NFI=0 D Q OK
  1. . S TEXT(1)="WARNING: There is no "_TYPE_" logic."
  1. . D ADDTEXT(1,.TEXT,.NL,.OUTPUT)
  1. F IND=1:1:NFI D
  1. . S FI=$P(FLIST,";",IND)
  1. . I FI=+FI D
  1. .. I '$D(DEFARR(20,FI,0)) D
  1. ... S TEXT(1)="FATAL: "_TYPE_" logic uses finding "_FI_" which does not exist."
  1. ... D ADDTEXT(1,.TEXT,.NL,.OUTPUT)
  1. ... S OK=0
  1. . I FI["FF" D
  1. .. I '$D(DEFARR(25,FI,0)) D
  1. ... S FFNUM=$P(FI,"FF",2)
  1. ... S TEXT(1)="Fatal :"_TYPE_" logic uses function finding "_FFNUM_" which does not exist."
  1. ... D ADDTEXT(1,.TEXT,.NL,.OUTPUT)
  1. ... S OK=0
  1. S X="S Y="_LOGSTR
  1. D ^DIM
  1. I '$D(X) D
  1. . S TEXT(1)="FATAL: "_TYPE_" logic syntax is invalid."
  1. . D ADDTEXT(1,.TEXT,.NL,.OUTPUT)
  1. . S OK=0
  1. Q OK
  1. ;
  1. ;===============
  1. RDCFCHK(CFNAME,CFPAR,IND,TYPE,NL,OUTPUT) ;Additional checks when the computed
  1. ;finding is VA-REMINDER DEFINTION.
  1. ;A blank Computed Finding Parameter has already been checked for.
  1. I CFPAR="" Q 0
  1. N NDEFIEN,RECUR,TEXT
  1. S NDEFIEN=$S(+CFPAR=CFPAR:+CFPAR,1:$O(^PXD(811.9,"B",CFPAR,"")))
  1. I NDEFIEN="" D Q 0
  1. . I TYPE="D" S TEXT(1)="FATAL: Finding number "_IND_" uses computed finding "_CFNAME_"."
  1. . I TYPE="T" S TEXT(1)="FATAL: Term finding number "_IND_" uses computed finding "_CFNAME_"."
  1. . S TEXT(2)="The Computed Finding Parameter is set to "_CFPAR_", that reminder does not exist."
  1. . D ADDTEXT(2,.TEXT,.NL,.OUTPUT)
  1. ;Usage check.
  1. S USAGE=$P(^PXD(811.9,NDEFIEN,100),U,4)
  1. I USAGE["L" D Q 0
  1. . I TYPE="D" S TEXT(1)="FATAL: Finding number "_IND_" uses computed finding "_CFNAME_"."
  1. . I TYPE="T" S TEXT(1)="FATAL: Term finding number "_IND_" uses computed finding "_CFNAME_"."
  1. . S TEXT(2)="The Computed Finding Parameter is set to "_CFPAR_", the Usage for that reminder contains L."
  1. . S TEXT(3)="List type reminders cannot be used with VA-REMINDER DEFINITION."
  1. . D ADDTEXT(3,.TEXT,.NL,.OUTPUT)
  1. Q 1
  1. ;
  1. ;===============
  1. RECCHK(DEFIEN,NL,OUTPUT) ;Check for recursion
  1. N RECUR,P1,P2,P3,TEXT,TYPE
  1. S RECUR=$$RECCHK^PXRMRCUR(DEFIEN)
  1. S P1=$P(RECUR,U,1)
  1. I P1 D
  1. . N DEFNAME
  1. . S DEFNAME=$P(^PXD(811.9,DEFIEN,0),U,1)
  1. . S P2=$P(RECUR,U,2)
  1. . S P3=$P(RECUR,U,3)
  1. . S TYPE=$S(P3'="":"T",1:"D")
  1. . I TYPE="D" D
  1. .. S TEXT(1)="FATAL: Finding number "_$P(P2,";",3)_" uses CF.VA-REMINDER DEFINITION."
  1. .. S TEXT(2)="It is recursively calling definition "_DEFNAME_"."
  1. . I TYPE="T" D
  1. .. N TNAME
  1. .. S TNAME=$P(^PXRMD(811.5,$P(P3,";",2),0),U,1)
  1. .. S TEXT(1)="FATAL: Finding number "_$P(P2,";",3)_" uses term "_TNAME_"."
  1. .. S TEXT(2)="This term is recursively calling definition "_DEFNAME_"."
  1. . D ADDTEXT(2,.TEXT,.NL,.OUTPUT)
  1. Q P1
  1. ;