TIUFLF3 ; SLC/MAM - Library; File 8925.1 Related: CHECK(FILEDA,PFILEDA,DETAILS,MSGARRAY), DESCCK(FILEDA), OBJECT 8/28/97 18:20
;;1.0;TEXT INTEGRATION UTILITIES;**2,5,12,13,17**;Jun 20, 1997
;
CHECK(FILEDA,PFILEDA,DETAILS,MSGARRAY) ; Module Checks Docmt Def FILEDA for completeness/correctness.
; If FILEDA is a TITLE, check includes completeness/correctness check of DESCENDANT COMPONENTS.
; If FILEDA is a TITLE or COMPONENT, check includes check of BOILERPLATE TEXT of entry/Descendants.
; Requires FILEDA.
; If FILEDA has an actual or prospective parent (as in Create, Add
;Items), requires PFILEDA to check if entry Type is right, given
;parent, to NOT set Orphan if it has a prospective parent, to check
;inheritance, etc.
; Sets MSGARRAY
; MSGARRAY=1 if OK;
; 0[^First Reason Whynot] if Not OK - Used in msgs like 'Can't Add Item:','Status limited to I:'
; If +MSGARRAY=0 then MSGARRAY(subscript)=WHYNOT as in CHECK("F") etc.
; Requires DETAILS:
; = 1 for yes if want all the subscripted problem msgs
; 0 for no if want only to know if good or bad ie first msg is enough
;
; NOTE: if you add a new subscript here, be sure to add it also in
;rtn TIUFHA6, which writes it out when user TRIES entry.
;
N NODE0,WHYNOT,TYPE,POSSTYPE,LP,LC,POSSSTAT,PARENT,MSG,NODE6,NODE61
N ICUSTOM,TIUFI,MISSITEM,CHECK,SHARED,VALUE
S CHECK("F")="Does not Exist in File"
S CHECK("I")="Has Nonexistent Item; See IRM"
S CHECK("T")="No Type/Wrong Type"
S CHECK("C")="Shared; Not Component"
S CHECK("B")="Personal AND Class Owners"
S CHECK("O")="No Owner"
S CHECK("S")="No Status/Wrong Status for Type" ;For nonshared entries
S CHECK("J")="No Object Method"
F LETTER="N","A","P" S CHECK("J"_LETTER)="Ambiguous. Object "_$S(LETTER="N":"Name",LETTER="A":"Abbreviation",1:"Print Name")_" could be any of several objects."
S CHECK("P")="Orphan"
S CHECK("M")="Multiple Parents" ;For nonshared entries
S CHECK("U")="Unshared, with Shared Parent"
; For subscripts OBJ and OBJINACT see rtn TIUFLX.
S CHECK("A")="Natl with NonNatl Ancestor" ;For nonshared entries
S CHECK("E")="No Edit Template" ; Set only if entry is Title, is/will be in hierarchy, has no explicit value, has/will have no inherited value.
S CHECK("R")="No Print Method" ; see E
S CHECK("V")="No Visit Linkage Method" ; see E
S CHECK("D")="No Validation Method" ; see E
S CHECK("H")="No Print Form Header" ; Set only if entry is Title, is/will be in hierarchy, has no explicit value, has/will have no inherited value, and if entry's DC allows Custom Form Headers.
S CHECK("N")="No Print Form Number" ; see H
S CHECK("G")="No Print Group" ; see H
; For subscript DESC see DESCCK
S NODE0=$G(^TIU(8925.1,+FILEDA,0)) I NODE0="" D SET("F") G CHECX
S MISSITEM=$$MISSITEM^TIUFLF4(FILEDA)
I MISSITEM D SET("I") Q:'DETAILS
S PFILEDA=+$G(PFILEDA) S POSSTYPE=$$POSSTYPE^TIUFLF7(PFILEDA) G:$D(DTOUT) CHECX
S TYPE=$P(NODE0,U,4) I TYPE=""!(POSSTYPE'[(U_TYPE_U)) D SET("T") Q:'DETAILS
S SHARED=$P(NODE0,U,10) I SHARED,TYPE'="CO" D SET("C") Q:'DETAILS
S LP=$L($P(NODE0,U,5)),LC=$L($P(NODE0,U,6))
I LP&LC D SET("B") Q:'DETAILS
I 'LP&'LC D SET("O") Q:'DETAILS
I '$P(NODE0,U,7),'$P(NODE0,U,10) D SET("S") Q:'DETAILS
I $P(NODE0,U,7),'$P(NODE0,U,10) S POSSSTAT=$$POSSSTAT^TIUFLF5(TYPE) I POSSSTAT'[$E($$STATWORD^TIUFLF5($P(NODE0,U,7))) D SET("S") Q:'DETAILS
I TYPE="O" D OBJECT G CHECX
I 'PFILEDA!$P(NODE0,U,13) N ANCESTOR D ANCESTOR^TIUFLF4(FILEDA,NODE0,.ANCESTOR)
I 'PFILEDA,$$ORPHAN^TIUFLF4(FILEDA,NODE0)="YES" D SET("P") Q:'DETAILS
S PARENT=+$O(^TIU(8925.1,"AD",FILEDA,0))
I $O(^TIU(8925.1,"AD",FILEDA,PARENT)),'$P(NODE0,U,10) D SET("M") Q:'DETAILS
I '$P(NODE0,U,10),$P($G(^TIU(8925.1,PARENT,0)),U,10) D SET("U") Q:'DETAILS
; Check Btext. If problem, set MSGARRAY("OBJ"). If FIRST problem, set
;MSGARRAY=0^Bad/Inactive Object in Boilerplate Text:
I $$HASBOIL^TIUFLF(FILEDA,NODE0) D XCHECK^TIUFLX(FILEDA,1,DETAILS,.MSGARRAY),DCHECK^TIUFLX(FILEDA,1,DETAILS,.MSGARRAY) I 'DETAILS,$D(MSGARRAY) G CHECX
I $P(NODE0,U,13),'$P(NODE0,U,10) D I 'DETAILS,$D(MSGARRAY) G CHECX
. S TIUFI=0
. F S TIUFI=$O(ANCESTOR(TIUFI)) Q:'TIUFI I '$P(^TIU(8925.1,ANCESTOR(TIUFI),0),U,13) D SET("A") Q
; If Title, NOT an ADDENDUM, must have flds 5-8. Ignore for entries remaining orphans:
I TYPE="DOC",FILEDA'=81,'$D(MSGARRAY("P")) D
. I $G(^TIU(8925.1,FILEDA,5))="" D INHERIT^TIUFLD(FILEDA,PFILEDA,5,"","","",.VALUE) I VALUE="" D SET("E") Q:'DETAILS
. I $G(^TIU(8925.1,FILEDA,6))="" D INHERIT^TIUFLD(FILEDA,PFILEDA,6,"","","",.VALUE) I VALUE="" D SET("R") Q:'DETAILS
. I $G(^TIU(8925.1,FILEDA,7))="" D INHERIT^TIUFLD(FILEDA,PFILEDA,7,"","","",.VALUE) I VALUE="" D SET("V") Q:'DETAILS
. I $G(^TIU(8925.1,FILEDA,8))="" D INHERIT^TIUFLD(FILEDA,PFILEDA,8,"","","",.VALUE) I VALUE="" D SET("D") Q:'DETAILS
. ; If TL, NOT Addendum, check for flds 6.1, 6.12, 6.13;
. ;6.14 will be there, it's set to 1 for Clinical Documents.
. S NODE61=$G(^TIU(8925.1,FILEDA,6.1))
. D INHERIT^TIUFLD(FILEDA,PFILEDA,6.14,"","","",.ICUSTOM)
. ; If parent Allows Custom Hdrs, then Require 6.1/6.12/6.13 (can be inherited):
. Q:'ICUSTOM
. I $P(NODE61,U)="" D INHERIT^TIUFLD(FILEDA,PFILEDA,6.1,"","","",.VALUE) I VALUE="" D SET("H") Q:'DETAILS
. I $P(NODE61,U,2)="" D INHERIT^TIUFLD(FILEDA,PFILEDA,6.12,"","","",.VALUE) I VALUE="" D SET("N") Q:'DETAILS
. I $P(NODE61,U,3)="" D INHERIT^TIUFLD(FILEDA,PFILEDA,6.13,"","","",.VALUE) I VALUE="" D SET("G") Q:'DETAILS
CHECX Q:$D(DTOUT)
I $D(MSGARRAY) Q ;bad entry or bad descendant or bad btext
I TYPE="DOC"!(TYPE="CO") D DESCCK(FILEDA,.MSGARRAY) I $D(MSGARRAY) Q
S MSGARRAY=1
Q
;
DESCCK(FILEDA,MSGARRAY) ; Module Checks FILEDA Components for correctness/completeness.
; Requires FILEDA, MSGARRAY from CHECK.
; If some descendant has problem, sets MSGARRAY("DESC"), and MSGARRAY=
;0^Entry has Faulty Descendant.
; Ignores descendant boilerplate text problems since they are already
;caught for original entry.
N TIUI,IFILEDA,DESCCK
S TIUI=0
F S TIUI=$O(^TIU(8925.1,FILEDA,10,TIUI)) Q:'TIUI D Q:'DESCCK
. S IFILEDA=+^TIU(8925.1,FILEDA,10,TIUI,0)
. D CHECK(IFILEDA,FILEDA,0,.DESCCK)
. I 'DESCCK S MSGARRAY("DESC")="Entry has Faulty Descendant",MSGARRAY="0^"_MSGARRAY("DESC") I "MN"[TIUFWHO S MSGARRAY("DESC")=MSGARRAY("DESC")_" IFN "_IFILEDA
Q
;
OBJECT ; Set MSGARRAY for objects (subscripts J; JN,JA,JP if DETAILS)
; Needs variables from CHECK
N TIUFI,NAP,LETTER,XREF,OFILEDA ; NAP is for NAME/ABBREV/PRINTNAME
I $G(^TIU(8925.1,FILEDA,9))="" D SET("J")
I 'DETAILS Q ;Ignore ambiguity here, ambiguity done in TIUFLX
F TIUFI=1:1:3 S NAP=$P(NODE0,U,TIUFI) Q:NAP="" D
. S LETTER=$S(TIUFI=1:"N",TIUFI=2:"A",1:"P")
. F XREF="B","C","D" D
. . S OFILEDA=0 F S OFILEDA=$O(^TIU(8925.1,XREF,NAP,OFILEDA)) Q:'OFILEDA D Q:$D(MSGARRAY("J"_LETTER))
. . . Q:'$D(^TIU(8925.1,"AT","O",OFILEDA))
. . . I OFILEDA'=FILEDA D SET("J"_LETTER)
Q
;
SET(SUBS) ; Sets MSGARRAY
; Requires vars from CHECK
S MSGARRAY(SUBS)=CHECK(SUBS) I $G(MSGARRAY)="" S MSGARRAY=0_U_MSGARRAY(SUBS)
Q
--- Routine Detail --- with STRUCTURED ROUTINE LISTING ---[H[J[2J[HTIUFLF3 7130 printed Nov 22, 2024@17:51:04 Page 2
TIUFLF3 ; SLC/MAM - Library; File 8925.1 Related: CHECK(FILEDA,PFILEDA,DETAILS,MSGARRAY), DESCCK(FILEDA), OBJECT 8/28/97 18:20
+1 ;;1.0;TEXT INTEGRATION UTILITIES;**2,5,12,13,17**;Jun 20, 1997
+2 ;
CHECK(FILEDA,PFILEDA,DETAILS,MSGARRAY) ; Module Checks Docmt Def FILEDA for completeness/correctness.
+1 ; If FILEDA is a TITLE, check includes completeness/correctness check of DESCENDANT COMPONENTS.
+2 ; If FILEDA is a TITLE or COMPONENT, check includes check of BOILERPLATE TEXT of entry/Descendants.
+3 ; Requires FILEDA.
+4 ; If FILEDA has an actual or prospective parent (as in Create, Add
+5 ;Items), requires PFILEDA to check if entry Type is right, given
+6 ;parent, to NOT set Orphan if it has a prospective parent, to check
+7 ;inheritance, etc.
+8 ; Sets MSGARRAY
+9 ; MSGARRAY=1 if OK;
+10 ; 0[^First Reason Whynot] if Not OK - Used in msgs like 'Can't Add Item:','Status limited to I:'
+11 ; If +MSGARRAY=0 then MSGARRAY(subscript)=WHYNOT as in CHECK("F") etc.
+12 ; Requires DETAILS:
+13 ; = 1 for yes if want all the subscripted problem msgs
+14 ; 0 for no if want only to know if good or bad ie first msg is enough
+15 ;
+16 ; NOTE: if you add a new subscript here, be sure to add it also in
+17 ;rtn TIUFHA6, which writes it out when user TRIES entry.
+18 ;
+19 NEW NODE0,WHYNOT,TYPE,POSSTYPE,LP,LC,POSSSTAT,PARENT,MSG,NODE6,NODE61
+20 NEW ICUSTOM,TIUFI,MISSITEM,CHECK,SHARED,VALUE
+21 SET CHECK("F")="Does not Exist in File"
+22 SET CHECK("I")="Has Nonexistent Item; See IRM"
+23 SET CHECK("T")="No Type/Wrong Type"
+24 SET CHECK("C")="Shared; Not Component"
+25 SET CHECK("B")="Personal AND Class Owners"
+26 SET CHECK("O")="No Owner"
+27 ;For nonshared entries
SET CHECK("S")="No Status/Wrong Status for Type"
+28 SET CHECK("J")="No Object Method"
+29 FOR LETTER="N","A","P"
SET CHECK("J"_LETTER)="Ambiguous. Object "_$SELECT(LETTER="N":"Name",LETTER="A":"Abbreviation",1:"Print Name")_" could be any of several objects."
+30 SET CHECK("P")="Orphan"
+31 ;For nonshared entries
SET CHECK("M")="Multiple Parents"
+32 SET CHECK("U")="Unshared, with Shared Parent"
+33 ; For subscripts OBJ and OBJINACT see rtn TIUFLX.
+34 ;For nonshared entries
SET CHECK("A")="Natl with NonNatl Ancestor"
+35 ; Set only if entry is Title, is/will be in hierarchy, has no explicit value, has/will have no inherited value.
SET CHECK("E")="No Edit Template"
+36 ; see E
SET CHECK("R")="No Print Method"
+37 ; see E
SET CHECK("V")="No Visit Linkage Method"
+38 ; see E
SET CHECK("D")="No Validation Method"
+39 ; Set only if entry is Title, is/will be in hierarchy, has no explicit value, has/will have no inherited value, and if entry's DC allows Custom Form Headers.
SET CHECK("H")="No Print Form Header"
+40 ; see H
SET CHECK("N")="No Print Form Number"
+41 ; see H
SET CHECK("G")="No Print Group"
+42 ; For subscript DESC see DESCCK
+43 SET NODE0=$GET(^TIU(8925.1,+FILEDA,0))
IF NODE0=""
DO SET("F")
GOTO CHECX
+44 SET MISSITEM=$$MISSITEM^TIUFLF4(FILEDA)
+45 IF MISSITEM
DO SET("I")
if 'DETAILS
QUIT
+46 SET PFILEDA=+$GET(PFILEDA)
SET POSSTYPE=$$POSSTYPE^TIUFLF7(PFILEDA)
if $DATA(DTOUT)
GOTO CHECX
+47 SET TYPE=$PIECE(NODE0,U,4)
IF TYPE=""!(POSSTYPE'[(U_TYPE_U))
DO SET("T")
if 'DETAILS
QUIT
+48 SET SHARED=$PIECE(NODE0,U,10)
IF SHARED
IF TYPE'="CO"
DO SET("C")
if 'DETAILS
QUIT
+49 SET LP=$LENGTH($PIECE(NODE0,U,5))
SET LC=$LENGTH($PIECE(NODE0,U,6))
+50 IF LP&LC
DO SET("B")
if 'DETAILS
QUIT
+51 IF 'LP&'LC
DO SET("O")
if 'DETAILS
QUIT
+52 IF '$PIECE(NODE0,U,7)
IF '$PIECE(NODE0,U,10)
DO SET("S")
if 'DETAILS
QUIT
+53 IF $PIECE(NODE0,U,7)
IF '$PIECE(NODE0,U,10)
SET POSSSTAT=$$POSSSTAT^TIUFLF5(TYPE)
IF POSSSTAT'[$EXTRACT($$STATWORD^TIUFLF5($PIECE(NODE0,U,7)))
DO SET("S")
if 'DETAILS
QUIT
+54 IF TYPE="O"
DO OBJECT
GOTO CHECX
+55 IF 'PFILEDA!$PIECE(NODE0,U,13)
NEW ANCESTOR
DO ANCESTOR^TIUFLF4(FILEDA,NODE0,.ANCESTOR)
+56 IF 'PFILEDA
IF $$ORPHAN^TIUFLF4(FILEDA,NODE0)="YES"
DO SET("P")
if 'DETAILS
QUIT
+57 SET PARENT=+$ORDER(^TIU(8925.1,"AD",FILEDA,0))
+58 IF $ORDER(^TIU(8925.1,"AD",FILEDA,PARENT))
IF '$PIECE(NODE0,U,10)
DO SET("M")
if 'DETAILS
QUIT
+59 IF '$PIECE(NODE0,U,10)
IF $PIECE($GET(^TIU(8925.1,PARENT,0)),U,10)
DO SET("U")
if 'DETAILS
QUIT
+60 ; Check Btext. If problem, set MSGARRAY("OBJ"). If FIRST problem, set
+61 ;MSGARRAY=0^Bad/Inactive Object in Boilerplate Text:
+62 IF $$HASBOIL^TIUFLF(FILEDA,NODE0)
DO XCHECK^TIUFLX(FILEDA,1,DETAILS,.MSGARRAY)
DO DCHECK^TIUFLX(FILEDA,1,DETAILS,.MSGARRAY)
IF 'DETAILS
IF $DATA(MSGARRAY)
GOTO CHECX
+63 IF $PIECE(NODE0,U,13)
IF '$PIECE(NODE0,U,10)
Begin DoDot:1
+64 SET TIUFI=0
+65 FOR
SET TIUFI=$ORDER(ANCESTOR(TIUFI))
if 'TIUFI
QUIT
IF '$PIECE(^TIU(8925.1,ANCESTOR(TIUFI),0),U,13)
DO SET("A")
QUIT
End DoDot:1
IF 'DETAILS
IF $DATA(MSGARRAY)
GOTO CHECX
+66 ; If Title, NOT an ADDENDUM, must have flds 5-8. Ignore for entries remaining orphans:
+67 IF TYPE="DOC"
IF FILEDA'=81
IF '$DATA(MSGARRAY("P"))
Begin DoDot:1
+68 IF $GET(^TIU(8925.1,FILEDA,5))=""
DO INHERIT^TIUFLD(FILEDA,PFILEDA,5,"","","",.VALUE)
IF VALUE=""
DO SET("E")
if 'DETAILS
QUIT
+69 IF $GET(^TIU(8925.1,FILEDA,6))=""
DO INHERIT^TIUFLD(FILEDA,PFILEDA,6,"","","",.VALUE)
IF VALUE=""
DO SET("R")
if 'DETAILS
QUIT
+70 IF $GET(^TIU(8925.1,FILEDA,7))=""
DO INHERIT^TIUFLD(FILEDA,PFILEDA,7,"","","",.VALUE)
IF VALUE=""
DO SET("V")
if 'DETAILS
QUIT
+71 IF $GET(^TIU(8925.1,FILEDA,8))=""
DO INHERIT^TIUFLD(FILEDA,PFILEDA,8,"","","",.VALUE)
IF VALUE=""
DO SET("D")
if 'DETAILS
QUIT
+72 ; If TL, NOT Addendum, check for flds 6.1, 6.12, 6.13;
+73 ;6.14 will be there, it's set to 1 for Clinical Documents.
+74 SET NODE61=$GET(^TIU(8925.1,FILEDA,6.1))
+75 DO INHERIT^TIUFLD(FILEDA,PFILEDA,6.14,"","","",.ICUSTOM)
+76 ; If parent Allows Custom Hdrs, then Require 6.1/6.12/6.13 (can be inherited):
+77 if 'ICUSTOM
QUIT
+78 IF $PIECE(NODE61,U)=""
DO INHERIT^TIUFLD(FILEDA,PFILEDA,6.1,"","","",.VALUE)
IF VALUE=""
DO SET("H")
if 'DETAILS
QUIT
+79 IF $PIECE(NODE61,U,2)=""
DO INHERIT^TIUFLD(FILEDA,PFILEDA,6.12,"","","",.VALUE)
IF VALUE=""
DO SET("N")
if 'DETAILS
QUIT
+80 IF $PIECE(NODE61,U,3)=""
DO INHERIT^TIUFLD(FILEDA,PFILEDA,6.13,"","","",.VALUE)
IF VALUE=""
DO SET("G")
if 'DETAILS
QUIT
End DoDot:1
CHECX if $DATA(DTOUT)
QUIT
+1 ;bad entry or bad descendant or bad btext
IF $DATA(MSGARRAY)
QUIT
+2 IF TYPE="DOC"!(TYPE="CO")
DO DESCCK(FILEDA,.MSGARRAY)
IF $DATA(MSGARRAY)
QUIT
+3 SET MSGARRAY=1
+4 QUIT
+5 ;
DESCCK(FILEDA,MSGARRAY) ; Module Checks FILEDA Components for correctness/completeness.
+1 ; Requires FILEDA, MSGARRAY from CHECK.
+2 ; If some descendant has problem, sets MSGARRAY("DESC"), and MSGARRAY=
+3 ;0^Entry has Faulty Descendant.
+4 ; Ignores descendant boilerplate text problems since they are already
+5 ;caught for original entry.
+6 NEW TIUI,IFILEDA,DESCCK
+7 SET TIUI=0
+8 FOR
SET TIUI=$ORDER(^TIU(8925.1,FILEDA,10,TIUI))
if 'TIUI
QUIT
Begin DoDot:1
+9 SET IFILEDA=+^TIU(8925.1,FILEDA,10,TIUI,0)
+10 DO CHECK(IFILEDA,FILEDA,0,.DESCCK)
+11 IF 'DESCCK
SET MSGARRAY("DESC")="Entry has Faulty Descendant"
SET MSGARRAY="0^"_MSGARRAY("DESC")
IF "MN"[TIUFWHO
SET MSGARRAY("DESC")=MSGARRAY("DESC")_" IFN "_IFILEDA
End DoDot:1
if 'DESCCK
QUIT
+12 QUIT
+13 ;
OBJECT ; Set MSGARRAY for objects (subscripts J; JN,JA,JP if DETAILS)
+1 ; Needs variables from CHECK
+2 ; NAP is for NAME/ABBREV/PRINTNAME
NEW TIUFI,NAP,LETTER,XREF,OFILEDA
+3 IF $GET(^TIU(8925.1,FILEDA,9))=""
DO SET("J")
+4 ;Ignore ambiguity here, ambiguity done in TIUFLX
IF 'DETAILS
QUIT
+5 FOR TIUFI=1:1:3
SET NAP=$PIECE(NODE0,U,TIUFI)
if NAP=""
QUIT
Begin DoDot:1
+6 SET LETTER=$SELECT(TIUFI=1:"N",TIUFI=2:"A",1:"P")
+7 FOR XREF="B","C","D"
Begin DoDot:2
+8 SET OFILEDA=0
FOR
SET OFILEDA=$ORDER(^TIU(8925.1,XREF,NAP,OFILEDA))
if 'OFILEDA
QUIT
Begin DoDot:3
+9 if '$DATA(^TIU(8925.1,"AT","O",OFILEDA))
QUIT
+10 IF OFILEDA'=FILEDA
DO SET("J"_LETTER)
End DoDot:3
if $DATA(MSGARRAY("J"_LETTER))
QUIT
End DoDot:2
End DoDot:1
+11 QUIT
+12 ;
SET(SUBS) ; Sets MSGARRAY
+1 ; Requires vars from CHECK
+2 SET MSGARRAY(SUBS)=CHECK(SUBS)
IF $GET(MSGARRAY)=""
SET MSGARRAY=0_U_MSGARRAY(SUBS)
+3 QUIT