Fluid Layout - 2021

From Grooper Wiki
Jump to navigation Jump to search

Fluid Layout is one of Grooper's methods of extracting table data from documents available to Data Table objects (via the Extract Method property). This table extraction method will alternate between Tabular Layout and Flow Layout configurations from one Document Type to the next, depending on how labels are collected for the Document Type.

The Tabular Layout configuration will execute the Tabular Layout method for the document, provided Data Column labels are collected for the Document Type.

The Flow Layout configuration will execute the Row Match method for the document, provided the Data Table's Header label is collected and NO Data Column labels are collected for the Document Type.

About

FYI This article is taken from the larger Label Sets article.

The Fluid Layout method is dependent on Label Sets to function and must have a Labeling Behavior enabled to execute properly. For more information on Label Sets and the Labeling Behavior, please visit the Label Sets article.

The Fluid Layout table extraction method is designed to switch between the Tabular Layout method and the Row Match method, depending on how a Data Table's labels are configured. So, if you have a varied set of documents where Tabular Layout works well for some Document Types and Row Match works well for other Document Types, you may be able to use Fluid Layout for all of them, avoiding the need for Data Element Overrides.

Label Sets must be collected to use the Fluid Layout method. Each Document Type will use either Tabular Layout or a Row Extractor to collect table data depending on how the labels for a Data Table are collected. Therefore, you cannot utilize the Fluid Layout method without a Labeling Behavior enabled.

The Fluid Layout table extraction method is not only "Label Set aware", it is Label Set dependent.

For example, take these two versions of code descriptions from an EOB form.

Version 1 is clearly a table. It uses the labels "CODE" and "DESCRIPTION" to delineate between each column. The Tabular Layout table extraction method would handily extract this information, returning everything in the "CODE" column to one Data Column and everything in the "DESCRIPTION" column to another..

Labeling-behavior-fluid-layout-about-01.png

Version 2 is not exactly a table, but a Data Table could still use the Row Extract method to form a table from this list of information. Each bulleted item in the list could be returned as a table row. The code could be filtered into one Data Column and the description could be filtered into another.

You could not use the Tabular Layout method for this "table". There are no column labels present.

  • There is, however, a header label for the whole table "Code", which will be important for the Fluid Layout method.

Labeling-behavior-fluid-layout-about-02.png

So, we have a situation where the Tabular Layout or the Row Match method is preferable, depending on the document's layout. Next, we will review how to configure the Fluid Layout table extraction method to target both table structures.

Collect Labels

The first thing you will want to do is collect labels for your Data Table for each document type. How the labels are collected will determine which table extraction method the Fluid Layout method executes.

  • To execute the Tabular Layout method, the Data Table's Data Column Header labels must be collected.
    • Optionally, you may choose to collect a Header and/or Footer label for the Data Table.
  • To execute the Row Match method (also referred to as the Flow Layout), you must collect the Data Table's Header label. You may NOT collect labels for the Data Table's Data Column labels.
    • This will be how Grooper checks to see which extraction method is used for each Document Type. If Data Column labels are present, the Tabular Layout configuration is used. If no Data Column labels are present, but the Data Table's Header label is present, it will use the Flow Layout (i.e. Row Match) configuration is used.
    • Optionally, you may choose to collect a Footer label for the Data Table.
  1. We will use this Content Model named "The Fluid Layout Method - Model" for this exercise.
    • Its Labeling Behavior has already been enabled.
  2. We have navigated to the "Labels" tab to start collecting labels.
  3. We have selected this Batch named "The Fluid Layout - Test Batch".
  4. Notice we have two Document Types
    • "V1 - Tabular Layout" will correspond to the document whose code description is in a proper table with column headers for the "CODE" and "DESCRIPTION" columns.
    • "V2 - Row Match" will correspond to the document whose code description is in a bulleted list.
  5. The two document folders in the Batch have already been assigned the appropriate Document Type.

Labeling-behavior-fluid-layout-how-to-01.png

For Tabular Layout Document Types

The "V1" Document Type will utilize the Fluid Layout method's Tabular Layout configuration. To execute the Tabular Layout configuration, much like executing the Tabular Layout table extraction method in general, Data Column labels must be collected.

  1. We have selected the "V1 - Tabular Layout" document folder in the Batch.
  2. The Header labels for the "Code" and "Description" Data Columns have been collected.
    • CODE for the "Code" Data Column
    • DESCRIPTION for the "Description" Data Column

Labeling-behavior-fluid-layout-how-to-02.png

FYI

Just as is the case with the Tabular Layout table extraction method as a "stand alone" extraction method, when used with Fluid Layout, collecting a Data Table's Header label is optional.

That said, it is still generally considered best practice to collect a row of header labels using the Data Table's Header label, if possible.

  1. Here, we've collected a Header Label for the "Code Remarks" Data Table.

Labeling-behavior-fluid-layout-how-to-03.png

For Flow Layout Document Types

The "V2" Document Type will utilize the Fluid Layout method's Flow Layout configuration. This will utilize the Row Match method to return table data. To execute the Flow Layout configuration ONLY the Data Table's label must be collected.

  1. We have selected the "V2 - Row Match" document folder in the Batch.
  2. The Header label for the "Code Remarks" Data Table has been collected.
  3. DO NOT collect Data Column labels for Document Types you wish to utilize the Row Match method to collect data.

Labeling-behavior-fluid-layout-how-to-04.png

Configure Fluid Layout

Now that the labels are collected for our Document Types we can configure the Fluid Layout extraction method for our Data Table.

  1. Select the Data Table in the Node Tree Viewer.
    • We've selected our "Code Remarks" Data Table.
  2. Select the Extract Method property.
  3. Using the dropdown menu, select Fluid Layout.

Labeling-behavior-fluid-layout-how-to-05.png

Expanding the Fluid Layout sub-properties, you can see there are two Layout configurations.

  1. The Tabular Layout configuration will be applied to Document Types whose Data Column labels have been collected.
  2. The Flow Layout configuration will be applied to Document Types whose Data Column labels have NOT been collected, as long as the Data Table's Header label is present.

Labeling-behavior-fluid-layout-how-to-08.png

By expanding the Tabular Layout and Flow Layout properties, you can see their property panels are identical to the Tabular Layout and Row Match table extraction methods respectively.

  1. The properties you see here are the same set of properties you configure for the Tabular Layout method.
  2. The properties you see here are the same set of properties you configure for the Row Match method.

All that's left is to configure extraction logic for each of the Layouts.

Labeling-behavior-fluid-layout-how-to-06.png

Configure Flow Layout

The Flow Layout configuration extracts table data using the Row Match method. What do you need in order for Row Match to collect table data? A Row Extractor.

  1. In our Local Resources folder, we already have a Data Type that will return rows properly for our "V2" Document Type.
  2. Using the Row Extractor property, we've referenced the aforementioned Data Type.

For our purposes, that's all we need to do. For the "V2 - Row Match" Document Types this extractor will properly return each row and collect each columns data. We have no need to configure any of the other Row Match properties.

Labeling-behavior-fluid-layout-how-to-07.png

Configure Tabular Layout

The Tabular Layout configuration extracts table data using the Tabular Layout method. What do you need in order for Tabular Layout to collect table data? At least one Data Column's Value Extractor must be configured in order to detect each row in the table.

  1. We've selected the "Code" Data Column to configure.
  2. For its Value Extractor we've used a Pattern Match extractor.
  3. The Pattern Match extractor's Value Pattern is set to the regex \w+ and its Prefix Pattern is set to the regex \n.
  4. This will return one result for each row of the "CODE" column, effectively detecting all four rows present.

This is a fairly simple table with only two columns. Just configuring one Data Column's Value Extractor will be sufficient for our needs.

Labeling-behavior-fluid-layout-how-to-09.png

  1. If you need to configure any additional Tabular Layout settings, you can do so by selecting the Data Table in the Node Tree Viewer.
  2. Expand out the Tabular Layout properties and configure them as needed.
    • Again, this is a simple table with simple configuration needs. These default property configurations should be adequate to collect table data for the "V1 - Tabular Layout" Document Types.

Labeling-behavior-fluid-layout-how-to-10.png

Test Extraction

Now that extraction is configured for both the 'Tabular Layout and Flow Layout for our documents, Grooper will switch between the Tabular Layout table extraction method and the Row Match table extraction methods, depending on the Document Type.

For the "V1 - Tabular Layout" Document Type, Data Column labels were collected.

Therefore Grooper extracts the table using the Tabular Layout configuration.

Labeling-behavior-fluid-layout-how-to-11.png

For the "V2 - Row Match" Document Type, only the Data Table's Header label was collected, and no Data Column labels were collected.

Therefore, Grooper extracts the table using the Flow Layout configuration (using the Row Match method).

Labeling-behavior-fluid-layout-how-to-12.png

Click me to return to the top