source: IHS-VA_UTILITIES-XB/trunk/XBFNC.m@ 808

Last change on this file since 808 was 642, checked in by Sam Habiel, 15 years ago

Modified directory structure; moved routines.

File size: 5.3 KB
Line 
1XBFNC ;IHS/SET/GTH - Field Numbering Conventions ; [ 10/29/2002 7:42 AM ]
2 ;;4.0;XB;;Jul 20, 2009;Build 2
3 ; XB*3*9 IHS/SET/GTH XB*3*9 10/29/2002
4 ;
5 ; Given an input of files, check the fields in the files
6 ; for conformance to the SAC field numbering conventions.
7 ;
8 ; Can also print conventions.
9 ;
10Q ; F = File
11 ; H = Header
12 ; I = Field
13 ; N = Node
14 ; P = Piece
15 ;
16 W !,"FileMan Field Numbering Conventions",!
17 D FNC,^XBDSET
18 Q:'$D(^UTILITY("XBDSET",$J))
19 NEW F
20 S F=0
21 F S F=$O(^UTILITY("XBDSET",$J,F)) Q:'F D FILE(F)
22 Q
23 ;
24FILE(F) ;
25 NEW I,H,N,P
26 S I=0
27 F S I=$O(^DD(F,I)) Q:'I I '($P(^(I,0),U,2)["C") D
28 . S H=0
29 . I +$P(^DD(F,I,0),U,2) D Q
30 .. I $L(I)'=4 D ERR(1)
31 .. D FILE(+$P(^DD(F,I,0),U,2))
32 ..Q
33 . S N=$P($P(^DD(F,I,0),U,4),";",1),P=$P($P(^(0),U,4),";",2)
34 . I N=0 D Q
35 .. I $E(I)'="." D ERR(2)
36 .. I P'=+$P(I,".",2)!(+$P(I,".")) D ERR(3)
37 .. I P=10 D ERR(4)
38 ..Q
39 . I $E(I)="." D ERR(5)
40 . I +N,N'=+$E(I,1,$L(N)) D ERR(6)
41 . I +N,P'=+$E(I,$L(N)+1,99) D ERR(7)
42 . I 'N,P'=I D ERR(8)
43 .Q
44 Q
45 ;
46ERR(E) ;
47 W:'H !," ",F," (",$O(^DD(F,0,"NM","")),"), ",I," (",$P(^DD(F,I,0),U,1),"), global location ",$P(^(0),U,4),$S(+P:"",1:"(Multiple)")
48 S H=1
49 W !?5,$P($T(@E),";",3),"."
50 Q
51 ;
521 ;;Field number of multiple field is not 4 digits
532 ;;Field number in 0th node should begin with '.'
543 ;;Piece number in 0th node should = +$P(fld#,".",2)
554 ;;Piece 10 of 0th node should be null
565 ;;Field begins with '.' and not in 0th node
576 ;;Field number does not begin with node location
587 ;;Piece number does not match non-nodal part of field number
598 ;;Field number and piece number do not match
60 ;
61FNC ;
62 Q:'$$DIR^XBDIR("Y","Print conventions","N")
63 D ^%ZIS
64 Q:POP
65 U IO
66 D HELP^XBHELP("TXT","XBFNC",0),^%ZISC
67 Q
68 ;
69TXT ;
70 ;;
71 ;; -------------------------------
72 ;; DATA DICTIONARY FIELD NUMBERING
73 ;; AND DATA PLACEMENT CONVENTIONS
74 ;; -------------------------------
75 ;;
76 ;;The following conventions for numbering fields, and placing data in pieces, is
77 ;;extracted from a mail message dated 25 Feb 88, and is considered to be those
78 ;;conventions referred to in the Programming Standards And Conventions paragraph
79 ;;which states "Field numbers for FileMan files will be assigned in accordance
80 ;;with established conventions."
81 ;;
82 ;; = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =
83 ;;
84 ;;1) There is a direct correlation between the field number and the node and
85 ;;piece, and for multiples, between the field number and the sub-file number.
86 ;;
87 ;;2) Fields beginning with a "." are all .01-.n and are in the 0th node. Where
88 ;;possible, files only have a 0th node. This reduces the number of disc accesses
89 ;;required. A field number must be canonic, therefore, there is no .10 field.
90 ;;It goes from .09 to .11. That means piece 10 will always be NULL.
91 ;;
92 ;;3) Where the entire entry cannot be put in one node, there are more nodes,
93 ;;generally grouped by logically related fields into field numbers within some
94 ;;range, say 1101-1116. These would be node 11 piece 1-16, and in this case
95 ;;piece 10 is allowed because it is canonic.
96 ;;
97 ;;4) Multiple fields are always 4 digits. The first two digits are the next
98 ;;higher group, using the example above, 11 would be the next higher group. The
99 ;;second two digits are always 00. The subscript for that multiple is always the
100 ;;first two digits of the multi-valued field number. 11 in this case. The
101 ;;sub-file number is always the parent file number with the first two digits of
102 ;;the multi-valued field number appended. If we were in file 9000001 in the
103 ;;above example, the sub-file for field 1100 would be 9000001.11, and the
104 ;;subscript would be 11. Now, if we added a multiple to that sub-file, as say
105 ;;field number 1500, its sub-file would be 9000001.1115 and its subscript would
106 ;;be 15. In the data global it would look like ^AUPNPAT(DA(1),11,DA,15,0). The
107 ;;assigning of sub-file numbers is important, because if you let FileMan do it,
108 ;;he will assign numbers that may fall within the number space of primary files
109 ;;using our file number assigning logic.
110 ;;
111 ;;5) There are special cases that do not follow the rules, of course. On most
112 ;;of the pointed to files, we have added a field number 9901 MNEMONIC which is
113 ;;used on a site by site basis if you have a very high percentage of your lookups
114 ;;to two or three entries, you can add data to the MNEMONIC field, say 1, 2, and
115 ;;3, and instead of responding CLAREMORE to a LOCATION lookup, you can respond 1.
116 ;;This field is in node 88 piece 1. It is 8801 so the MNEMONIC field would be
117 ;;the same number in all dictionaries, regardless of how many fields, and field
118 ;;numbers, a particular file had already.
119 ;;
120 ;;6) Computed fields, where ever possible, immediately follow the field from
121 ;;which they are computed, and the computed field number is the same as the real
122 ;;field followed by a 9. If the field above was .12 the computed field would be
123 ;;.129. If you wanted more than one computed field off of .12 they would be
124 ;;.1291 and .1292.
125 ;;
126 ;;7) There is another class of computed field. That is a computed field that
127 ;;points back to the VA PATIENT file. Those fields have a .2 following the field
128 ;;number. That indicates it is not really a computed field, but just a pointer
129 ;;back to the VA PATIENT file.
130 ;;
131 ;;********************************************
Note: See TracBrowser for help on using the repository browser.