Skip to content

Latest commit

 

History

History
139 lines (75 loc) · 9.22 KB

foldable_record_blocks.md

File metadata and controls

139 lines (75 loc) · 9.22 KB

Foldable Record Blocks

image

ICD-10 Billable-Flagged Order Codes Sample File, with folding applied.

Contents

  1. Concept
  2. Scheme
  3. Fold Structures Editor
  4. Definitions (INI File)
  5. Sample Files with Folding

Concept

The Foldable Record Blocks concept is applicable only with Mixed Record-type Fixed-width Data Files with hierarchical data. Therefore, the Foldable Record Blocks concept does NOT apply to all fixed-width files, especially Homogenous Record-type Fixed-width Data Files.

In a file with Foldable Record Blocks:

  • Record types that can be designated as block headers are folding nodes. Every record block starts with a folding node.
  • Record types that are merely members of a record block are leaf nodes. Some leaf node records can be designated as terminators of specific record blocks.

Nested Record Blocks

  • When there are folding node records with varying levels of priority (or precedence), a nested structure of record blocks will emerge.

  • A nested structure can also emerge if folding node records with equal precedence are also recursive.

    To understand this latter case better with an analogy in a programming language, consider the IF ... THEN conditional block and the DO WHILE ... iteration block. Both control blocks can be recursive. Both will also have same level of precedence. That is, an IF ... THEN block can enclose a DO WHILE ... block or the other way around, yielding many levels of nesting in multitudinous ways.

Record Block Termination

  • Multiple Block Termination (End of File): At the end of file, all record blocks are automatically terminated.

  • Multiple Block Termination (Outranking): A record block with higher precedence will terminate multiple levels of nested record blocks with lower precedence and immediately preceding it in the data file.

  • Single Block Termination (Peer & Non-Recursive): A new record block will terminate a single level of record block that immediately precedes it in the data file if that preceding block has an equal precedence while also being non-recursive.

  • Innermost Nested Block Termination (Block-ending Leaf Node Record): A leaf node record can terminate a record block for which it has been designated as a block-ending record. If a leaf node record has been designated as a block-ending record for multiple record types with differing or nested levels of precedence or recursion, only the still-open, innermost applicable block will be terminated.

    To understand this last case better with an analogy in a programming language, consider multiple levels of nested IF ... THEN blocks. The first END IF will terminate the innermost IF ... THEN block. The next END IF will terminate the enclosing, next innermost IF ...THEN block, and so on.


Scheme

A Foldable Record Scheme can be associated with a single Fixed-width File Type as defined in the File Type Metadata Editor.

With that associated File Type as the reference basis, you will then need to specify:

  1. Header Records: The Record Types that will serve as block headers i.e., folding nodes.

  2. Block Priority: A numeric value denoting the order priority for a record block. A block with lower numeric value of priority will enclose a block with higher numeric value of priority. i.e., A block with lower numeric value of priority will have a higher precedence.

  3. Block Recursiveness: This flag will specify whether specific record blocks with same priority value will nest inside each other. For most data files, record blocks will be non-recursive.

  4. Block Termination: This will be an optional list of Record Types that will terminate a specific record block.


Fold Structures Editor

image

For more information, see: Fold Structures Editor


Definitions (INI File)

The definition schemes for record blocks will reside in the new FoldStructs.ini file. Upon the first run of Notepad++ after upgrading the FWDataViz dll with the Foldable Record Blocks feature, this new file will get copied into one of the two folder locations:

  1. %APPDATA%/Notepad++/plugins/Config/FWDataViz/ (for non-portable installs of Notepad++)

    OR

  2. <Notepad++_executable_folder>/plugins/Config/FWDataViz/ (for portable installs of Notepad++)

Base section

  • In the Base section, the FoldStructCount key value should indicate the number of File Types that are being defined with folding record blocks.

File Type sections:

  • Each File Type will have its own section in the format FSnnn, starting with FS001.

  • FileType: This value must exactly match the corresponding File Type section name in the Visualizer.ini file.

  • FileLabel: This value must optionally match the corresponding FileLabel value in the Visualizer.ini file.

  • FoldLevelAuto: This value can be either Y or N. This will specify if the plugin should automatically try to do a full file scan and apply the specified folding structure for the matching File Type after a file loads in the Notepad++ editor, . Recommend setting this to N for File Types with likely large data files, when this process can take a long time.

  • HeaderRecords: A comma-separated list of Record Types (see Header Records under: Scheme). The Record Types in the list must exactly match the corresponding Record Types of associated the File Type in the Visualizer.ini file.

  • RECnnn_Priority: A numeric value (see Block Priority under: Scheme).

    Recommend using values in increments of 10, so that blocks that need to be added at a later time can be specified with intermediate values. For example, the outermost record block can have a priority of 10, the next record block that may be enclosed within it can have a priority of 20, and so on.

  • RECnnn_Recursive: This value can be either Y or N (see Block Recursiveness under: Scheme). For most data files, this value will be N.

  • RECnnn_EndRecords: An optional, comma-separated list of Record Types (see Block Termination under: Scheme). The Record Types in the list must exactly match the corresponding Record Types of associated the File Type in the Visualizer.ini file.


Sample Files with Folding

Viewing the sample files, and then reviewing their definitions in the FoldStructs.ini file will help clarify the Foldable Record Blocks concept and usage.

1. ICD-10 Billable-Flagged Order Codes [Basic Level Folding]

This file has the most basic record block folding with just two record types, and only one level of folding.

image

2. Treasury IPAC (ANSI) File [Intermediate Level Folding]

This file has three levels of hierarchical folding. Yet the structure is not too complex since there is no recursive nesting.

image

3. Ouroboros Fold Levels [Advanced Level Folding]

This sample file is named after the icon of a serpent eating its own tail. This contrived sample file has been included to showcase the full possibilities with the Foldable Record Block feature of FWDataViz.

image

  • The P3 record type has 20 fields, each 3-characters wide. P3 record type is recursive, and is terminated by the Q4 record type.

  • The Q4 record type has 15 fields, each 4-characters wide. Q4 record type is recursive, and is terminated by the R5 record type.

  • The R5 record type has 12 fields, each 5-characters wide. R5 record type is recursive, and is terminated by the S6 record type.

  • The S6 record type has 10 fields, each 6-characters wide. S6 record type is recursive, and is terminated by the P3 record type.

  • The TF record type 5 is non-recursive. The TF record type terminates all other record types: P3, Q4, R5 & S6.

💡 To gain better sense of the recursive and nested folding structure in this file, turn on the Show Calltip option on the plugin panel, and then click through lines 1 to 10. The last line within the calltip will indicate the fold level of the current line.

To illustrate the nesting of fold levels in this file, the levels are indented in the clip below.

image

See also: Extract Configuration Data | Append Configuration Data