source: FOIAVistA/trunk/r/TEXT_INTEGRATION_UTILITIES-GMRP-TIU/TIUFLF3.m@ 1162

Last change on this file since 1162 was 628, checked in by George Lilly, 15 years ago

initial load of FOIAVistA 6/30/08 version

File size: 6.8 KB
Line 
1TIUFLF3 ; SLC/MAM - Library; File 8925.1 Related: CHECK(FILEDA,PFILEDA,DETAILS,MSGARRAY), DESCCK(FILEDA), OBJECT 8/28/97 18:20
2 ;;1.0;TEXT INTEGRATION UTILITIES;**2,5,12,13,17**;Jun 20, 1997
3 ;
4CHECK(FILEDA,PFILEDA,DETAILS,MSGARRAY) ; Module Checks Docmt Def FILEDA for completeness/correctness.
5 ; If FILEDA is a TITLE, check includes completeness/correctness check of DESCENDANT COMPONENTS.
6 ; If FILEDA is a TITLE or COMPONENT, check includes check of BOILERPLATE TEXT of entry/Descendants.
7 ; Requires FILEDA.
8 ; If FILEDA has an actual or prospective parent (as in Create, Add
9 ;Items), requires PFILEDA to check if entry Type is right, given
10 ;parent, to NOT set Orphan if it has a prospective parent, to check
11 ;inheritance, etc.
12 ; Sets MSGARRAY
13 ; MSGARRAY=1 if OK;
14 ; 0[^First Reason Whynot] if Not OK - Used in msgs like 'Can't Add Item:','Status limited to I:'
15 ; If +MSGARRAY=0 then MSGARRAY(subscript)=WHYNOT as in CHECK("F") etc.
16 ; Requires DETAILS:
17 ; = 1 for yes if want all the subscripted problem msgs
18 ; 0 for no if want only to know if good or bad ie first msg is enough
19 ;
20 ; NOTE: if you add a new subscript here, be sure to add it also in
21 ;rtn TIUFHA6, which writes it out when user TRIES entry.
22 ;
23 N NODE0,WHYNOT,TYPE,POSSTYPE,LP,LC,POSSSTAT,PARENT,MSG,NODE6,NODE61
24 N ICUSTOM,TIUFI,MISSITEM,CHECK,SHARED,VALUE
25 S CHECK("F")="Does not Exist in File"
26 S CHECK("I")="Has Nonexistent Item; See IRM"
27 S CHECK("T")="No Type/Wrong Type"
28 S CHECK("C")="Shared; Not Component"
29 S CHECK("B")="Personal AND Class Owners"
30 S CHECK("O")="No Owner"
31 S CHECK("S")="No Status/Wrong Status for Type" ;For nonshared entries
32 S CHECK("J")="No Object Method"
33 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."
34 S CHECK("P")="Orphan"
35 S CHECK("M")="Multiple Parents" ;For nonshared entries
36 S CHECK("U")="Unshared, with Shared Parent"
37 ; For subscripts OBJ and OBJINACT see rtn TIUFLX.
38 S CHECK("A")="Natl with NonNatl Ancestor" ;For nonshared entries
39 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.
40 S CHECK("R")="No Print Method" ; see E
41 S CHECK("V")="No Visit Linkage Method" ; see E
42 S CHECK("D")="No Validation Method" ; see E
43 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.
44 S CHECK("N")="No Print Form Number" ; see H
45 S CHECK("G")="No Print Group" ; see H
46 ; For subscript DESC see DESCCK
47 S NODE0=$G(^TIU(8925.1,+FILEDA,0)) I NODE0="" D SET("F") G CHECX
48 S MISSITEM=$$MISSITEM^TIUFLF4(FILEDA)
49 I MISSITEM D SET("I") Q:'DETAILS
50 S PFILEDA=+$G(PFILEDA) S POSSTYPE=$$POSSTYPE^TIUFLF7(PFILEDA) G:$D(DTOUT) CHECX
51 S TYPE=$P(NODE0,U,4) I TYPE=""!(POSSTYPE'[(U_TYPE_U)) D SET("T") Q:'DETAILS
52 S SHARED=$P(NODE0,U,10) I SHARED,TYPE'="CO" D SET("C") Q:'DETAILS
53 S LP=$L($P(NODE0,U,5)),LC=$L($P(NODE0,U,6))
54 I LP&LC D SET("B") Q:'DETAILS
55 I 'LP&'LC D SET("O") Q:'DETAILS
56 I '$P(NODE0,U,7),'$P(NODE0,U,10) D SET("S") Q:'DETAILS
57 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
58 I TYPE="O" D OBJECT G CHECX
59 I 'PFILEDA!$P(NODE0,U,13) N ANCESTOR D ANCESTOR^TIUFLF4(FILEDA,NODE0,.ANCESTOR)
60 I 'PFILEDA,$$ORPHAN^TIUFLF4(FILEDA,NODE0)="YES" D SET("P") Q:'DETAILS
61 S PARENT=+$O(^TIU(8925.1,"AD",FILEDA,0))
62 I $O(^TIU(8925.1,"AD",FILEDA,PARENT)),'$P(NODE0,U,10) D SET("M") Q:'DETAILS
63 I '$P(NODE0,U,10),$P($G(^TIU(8925.1,PARENT,0)),U,10) D SET("U") Q:'DETAILS
64 ; Check Btext. If problem, set MSGARRAY("OBJ"). If FIRST problem, set
65 ;MSGARRAY=0^Bad/Inactive Object in Boilerplate Text:
66 I $$HASBOIL^TIUFLF(FILEDA,NODE0) D XCHECK^TIUFLX(FILEDA,1,DETAILS,.MSGARRAY),DCHECK^TIUFLX(FILEDA,1,DETAILS,.MSGARRAY) I 'DETAILS,$D(MSGARRAY) G CHECX
67 I $P(NODE0,U,13),'$P(NODE0,U,10) D I 'DETAILS,$D(MSGARRAY) G CHECX
68 . S TIUFI=0
69 . F S TIUFI=$O(ANCESTOR(TIUFI)) Q:'TIUFI I '$P(^TIU(8925.1,ANCESTOR(TIUFI),0),U,13) D SET("A") Q
70 ; If Title, NOT an ADDENDUM, must have flds 5-8. Ignore for entries remaining orphans:
71 I TYPE="DOC",FILEDA'=81,'$D(MSGARRAY("P")) D
72 . I $G(^TIU(8925.1,FILEDA,5))="" D INHERIT^TIUFLD(FILEDA,PFILEDA,5,"","","",.VALUE) I VALUE="" D SET("E") Q:'DETAILS
73 . I $G(^TIU(8925.1,FILEDA,6))="" D INHERIT^TIUFLD(FILEDA,PFILEDA,6,"","","",.VALUE) I VALUE="" D SET("R") Q:'DETAILS
74 . I $G(^TIU(8925.1,FILEDA,7))="" D INHERIT^TIUFLD(FILEDA,PFILEDA,7,"","","",.VALUE) I VALUE="" D SET("V") Q:'DETAILS
75 . I $G(^TIU(8925.1,FILEDA,8))="" D INHERIT^TIUFLD(FILEDA,PFILEDA,8,"","","",.VALUE) I VALUE="" D SET("D") Q:'DETAILS
76 . ; If TL, NOT Addendum, check for flds 6.1, 6.12, 6.13;
77 . ;6.14 will be there, it's set to 1 for Clinical Documents.
78 . S NODE61=$G(^TIU(8925.1,FILEDA,6.1))
79 . D INHERIT^TIUFLD(FILEDA,PFILEDA,6.14,"","","",.ICUSTOM)
80 . ; If parent Allows Custom Hdrs, then Require 6.1/6.12/6.13 (can be inherited):
81 . Q:'ICUSTOM
82 . I $P(NODE61,U)="" D INHERIT^TIUFLD(FILEDA,PFILEDA,6.1,"","","",.VALUE) I VALUE="" D SET("H") Q:'DETAILS
83 . I $P(NODE61,U,2)="" D INHERIT^TIUFLD(FILEDA,PFILEDA,6.12,"","","",.VALUE) I VALUE="" D SET("N") Q:'DETAILS
84 . I $P(NODE61,U,3)="" D INHERIT^TIUFLD(FILEDA,PFILEDA,6.13,"","","",.VALUE) I VALUE="" D SET("G") Q:'DETAILS
85CHECX Q:$D(DTOUT)
86 I $D(MSGARRAY) Q ;bad entry or bad descendant or bad btext
87 I TYPE="DOC"!(TYPE="CO") D DESCCK(FILEDA,.MSGARRAY) I $D(MSGARRAY) Q
88 S MSGARRAY=1
89 Q
90 ;
91DESCCK(FILEDA,MSGARRAY) ; Module Checks FILEDA Components for correctness/completeness.
92 ; Requires FILEDA, MSGARRAY from CHECK.
93 ; If some descendant has problem, sets MSGARRAY("DESC"), and MSGARRAY=
94 ;0^Entry has Faulty Descendant.
95 ; Ignores descendant boilerplate text problems since they are already
96 ;caught for original entry.
97 N TIUI,IFILEDA,DESCCK
98 S TIUI=0
99 F S TIUI=$O(^TIU(8925.1,FILEDA,10,TIUI)) Q:'TIUI D Q:'DESCCK
100 . S IFILEDA=+^TIU(8925.1,FILEDA,10,TIUI,0)
101 . D CHECK(IFILEDA,FILEDA,0,.DESCCK)
102 . I 'DESCCK S MSGARRAY("DESC")="Entry has Faulty Descendant",MSGARRAY="0^"_MSGARRAY("DESC") I "MN"[TIUFWHO S MSGARRAY("DESC")=MSGARRAY("DESC")_" IFN "_IFILEDA
103 Q
104 ;
105OBJECT ; Set MSGARRAY for objects (subscripts J; JN,JA,JP if DETAILS)
106 ; Needs variables from CHECK
107 N TIUFI,NAP,LETTER,XREF,OFILEDA ; NAP is for NAME/ABBREV/PRINTNAME
108 I $G(^TIU(8925.1,FILEDA,9))="" D SET("J")
109 I 'DETAILS Q ;Ignore ambiguity here, ambiguity done in TIUFLX
110 F TIUFI=1:1:3 S NAP=$P(NODE0,U,TIUFI) Q:NAP="" D
111 . S LETTER=$S(TIUFI=1:"N",TIUFI=2:"A",1:"P")
112 . F XREF="B","C","D" D
113 . . S OFILEDA=0 F S OFILEDA=$O(^TIU(8925.1,XREF,NAP,OFILEDA)) Q:'OFILEDA D Q:$D(MSGARRAY("J"_LETTER))
114 . . . Q:'$D(^TIU(8925.1,"AT","O",OFILEDA))
115 . . . I OFILEDA'=FILEDA D SET("J"_LETTER)
116 Q
117 ;
118SET(SUBS) ; Sets MSGARRAY
119 ; Requires vars from CHECK
120 S MSGARRAY(SUBS)=CHECK(SUBS) I $G(MSGARRAY)="" S MSGARRAY=0_U_MSGARRAY(SUBS)
121 Q
Note: See TracBrowser for help on using the repository browser.