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

XBFNC.m

Go to the documentation of this file.
  1. XBFNC ;IHS/SET/GTH - Field Numbering Conventions ; [ 10/29/2002 7:42 AM ]
  1. ;;3.0;IHS/VA UTILITIES;**9**;FEB 07, 1997
  1. ; XB*3*9 IHS/SET/GTH XB*3*9 10/29/2002
  1. ;
  1. ; Given an input of files, check the fields in the files
  1. ; for conformance to the SAC field numbering conventions.
  1. ;
  1. ; Can also print conventions.
  1. ;
  1. Q ; F = File
  1. ; H = Header
  1. ; I = Field
  1. ; N = Node
  1. ; P = Piece
  1. ;
  1. W !,"FileMan Field Numbering Conventions",!
  1. D FNC,^XBDSET
  1. Q:'$D(^UTILITY("XBDSET",$J))
  1. NEW F
  1. S F=0
  1. F S F=$O(^UTILITY("XBDSET",$J,F)) Q:'F D FILE(F)
  1. Q
  1. ;
  1. FILE(F) ;
  1. NEW I,H,N,P
  1. S I=0
  1. F S I=$O(^DD(F,I)) Q:'I I '($P(^(I,0),U,2)["C") D
  1. . S H=0
  1. . I +$P(^DD(F,I,0),U,2) D Q
  1. .. I $L(I)'=4 D ERR(1)
  1. .. D FILE(+$P(^DD(F,I,0),U,2))
  1. ..Q
  1. . S N=$P($P(^DD(F,I,0),U,4),";",1),P=$P($P(^(0),U,4),";",2)
  1. . I N=0 D Q
  1. .. I $E(I)'="." D ERR(2)
  1. .. I P'=+$P(I,".",2)!(+$P(I,".")) D ERR(3)
  1. .. I P=10 D ERR(4)
  1. ..Q
  1. . I $E(I)="." D ERR(5)
  1. . I +N,N'=+$E(I,1,$L(N)) D ERR(6)
  1. . I +N,P'=+$E(I,$L(N)+1,99) D ERR(7)
  1. . I 'N,P'=I D ERR(8)
  1. .Q
  1. Q
  1. ;
  1. ERR(E) ;
  1. 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)")
  1. S H=1
  1. W !?5,$P($T(@E),";",3),"."
  1. Q
  1. ;
  1. 1 ;;Field number of multiple field is not 4 digits
  1. 2 ;;Field number in 0th node should begin with '.'
  1. 3 ;;Piece number in 0th node should = +$P(fld#,".",2)
  1. 4 ;;Piece 10 of 0th node should be null
  1. 5 ;;Field begins with '.' and not in 0th node
  1. 6 ;;Field number does not begin with node location
  1. 7 ;;Piece number does not match non-nodal part of field number
  1. 8 ;;Field number and piece number do not match
  1. ;
  1. FNC ;
  1. Q:'$$DIR^XBDIR("Y","Print conventions","N")
  1. D ^%ZIS
  1. Q:POP
  1. U IO
  1. D HELP^XBHELP("TXT","XBFNC",0),^%ZISC
  1. Q
  1. ;
  1. TXT ;
  1. ;;
  1. ;; -------------------------------
  1. ;; DATA DICTIONARY FIELD NUMBERING
  1. ;; AND DATA PLACEMENT CONVENTIONS
  1. ;; -------------------------------
  1. ;;
  1. ;;The following conventions for numbering fields, and placing data in pieces, is
  1. ;;extracted from a mail message dated 25 Feb 88, and is considered to be those
  1. ;;conventions referred to in the Programming Standards And Conventions paragraph
  1. ;;which states "Field numbers for FileMan files will be assigned in accordance
  1. ;;with established conventions."
  1. ;;
  1. ;; = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =
  1. ;;
  1. ;;1) There is a direct correlation between the field number and the node and
  1. ;;piece, and for multiples, between the field number and the sub-file number.
  1. ;;
  1. ;;2) Fields beginning with a "." are all .01-.n and are in the 0th node. Where
  1. ;;possible, files only have a 0th node. This reduces the number of disc accesses
  1. ;;required. A field number must be canonic, therefore, there is no .10 field.
  1. ;;It goes from .09 to .11. That means piece 10 will always be NULL.
  1. ;;
  1. ;;3) Where the entire entry cannot be put in one node, there are more nodes,
  1. ;;generally grouped by logically related fields into field numbers within some
  1. ;;range, say 1101-1116. These would be node 11 piece 1-16, and in this case
  1. ;;piece 10 is allowed because it is canonic.
  1. ;;
  1. ;;4) Multiple fields are always 4 digits. The first two digits are the next
  1. ;;higher group, using the example above, 11 would be the next higher group. The
  1. ;;second two digits are always 00. The subscript for that multiple is always the
  1. ;;first two digits of the multi-valued field number. 11 in this case. The
  1. ;;sub-file number is always the parent file number with the first two digits of
  1. ;;the multi-valued field number appended. If we were in file 9000001 in the
  1. ;;above example, the sub-file for field 1100 would be 9000001.11, and the
  1. ;;subscript would be 11. Now, if we added a multiple to that sub-file, as say
  1. ;;field number 1500, its sub-file would be 9000001.1115 and its subscript would
  1. ;;be 15. In the data global it would look like ^AUPNPAT(DA(1),11,DA,15,0). The
  1. ;;assigning of sub-file numbers is important, because if you let FileMan do it,
  1. ;;he will assign numbers that may fall within the number space of primary files
  1. ;;using our file number assigning logic.
  1. ;;
  1. ;;5) There are special cases that do not follow the rules, of course. On most
  1. ;;of the pointed to files, we have added a field number 9901 MNEMONIC which is
  1. ;;used on a site by site basis if you have a very high percentage of your lookups
  1. ;;to two or three entries, you can add data to the MNEMONIC field, say 1, 2, and
  1. ;;3, and instead of responding CLAREMORE to a LOCATION lookup, you can respond 1.
  1. ;;This field is in node 88 piece 1. It is 8801 so the MNEMONIC field would be
  1. ;;the same number in all dictionaries, regardless of how many fields, and field
  1. ;;numbers, a particular file had already.
  1. ;;
  1. ;;6) Computed fields, where ever possible, immediately follow the field from
  1. ;;which they are computed, and the computed field number is the same as the real
  1. ;;field followed by a 9. If the field above was .12 the computed field would be
  1. ;;.129. If you wanted more than one computed field off of .12 they would be
  1. ;;.1291 and .1292.
  1. ;;
  1. ;;7) There is another class of computed field. That is a computed field that
  1. ;;points back to the VA PATIENT file. Those fields have a .2 following the field
  1. ;;number. That indicates it is not really a computed field, but just a pointer
  1. ;;back to the VA PATIENT file.
  1. ;;
  1. ;;********************************************