Skip to main content

Ingestion Rules

Ingestion Rules allow you to automatically validate, transform, skip, or reject data during the file upload process. They give you fine-grained control over data quality without requiring manual intervention on every upload.

When Are Ingestion Rules Applied?

Ingestion rules are applied after the spreadsheet has been cleaned and mapped to your Table schema, but before the data is written to the database. This means:

  1. ✅ The spreadsheet structure has been detected (headers, body rows)
  2. ✅ Column mapping has been completed (your approvals applied)
  3. ✅ Data has been transformed to match your Table columns
  4. → Ingestion rules are applied here
  5. ❌ Data has NOT yet been written to BigQuery

This timing is important: rules operate on the cleaned, mapped data using your Table's column names (like Policy_Number or month.Gross_Premium), not the original spreadsheet column names.


Two Types of Rules

Decode supports two types of ingestion rules that address different use cases:

Row-Level Rules

Row-level rules evaluate conditions across one or more columns and then perform an action that typically affects the entire row.

Use cases:

  • Skip rows where multiple columns are empty
  • Set a default value when a condition is met across columns
  • Validate that related fields are consistent

Cell-Level Rules

Cell-level rules target a specific column and evaluate each cell in that column individually.

Use cases:

  • Clean up formatting in a specific column (remove spaces, trim whitespace)
  • Transform values that meet certain criteria (prepend IDs, pad with zeros)
  • Validate individual cell values

Creating Ingestion Rules

Accessing the Rules Builder

  1. Navigate to Data → Select your Table → Settings
  2. Expand the Ingestion Rules accordion
  3. Click Add Row Rule or Add Cell Rule

Rule Components

Every rule has these common components:

ComponentDescription
NameA descriptive name for the rule (e.g., "Skip empty premium rows")
EnabledToggle to activate/deactivate the rule without deleting it
LevelRow or Cell
ConditionsThe criteria that must be met for the rule to trigger
ActionWhat happens when conditions are met

Rule Ordering

Rules are executed in the order they appear in the list. You can drag and drop rules to reorder them. This is important because:

  • Earlier rules may modify data that later rules depend on
  • A "skip row" rule that runs first will prevent later rules from seeing that row

Row-Level Rules

Conditions

Row-level rules use conditions that evaluate column values. Multiple conditions can be combined with AND or OR logic.

Available Operators

CategoryOperatorDescriptionValue Required
ExistenceIs EmptyCell is null or blankNo
Is Not EmptyCell has a valueNo
ComparisonEqualsExact matchYes
Not EqualsDoes not matchYes
TextContainsText includes substringYes
Not ContainsText excludes substringYes
NumericGreater ThanNumeric comparisonYes
Less ThanNumeric comparisonYes
Greater or EqualNumeric comparisonYes
Less or EqualNumeric comparisonYes
BetweenValue in rangeTwo values
Data TypeIs Valid DateCan be parsed as dateNo
Is NumberCan be parsed as numberNo
Is TextHas any valueNo
Is BooleanTrue/false/yes/no/1/0No
StringLength EqualsCharacter count matchesYes
Length Greater ThanCharacter count exceedsYes
Length Less ThanCharacter count belowYes
Starts WithText begins withYes
Ends WithText ends withYes
Matches PatternRegex matchPattern

Negation

Any condition can be negated using the NOT checkbox. This inverts the condition's result.

Example: Combining Conditions

Condition 1: month.Gross_Premium IS EMPTY
Condition 2: month IS EMPTY
Logic: AND

Result: Rule triggers only when BOTH Gross_Premium and month are empty

Row-Level Actions

ActionDescriptionOptions
Skip RowRemove the row from the data being ingestedNone
Fail RowStop processing and show an errorCustom error message
Set ValueSet a column to a specific valueStatic value or copy from another column
ConcatenateCombine multiple columns into oneSource columns, separator, optional transform
TransformModify a column's valuesUppercase, lowercase, trim, replace, format date, round number

Cell-Level Rules

Cell-level rules operate on a target column and can use either simple cell conditions or advanced conditions.

Target Column

Select which column this rule applies to. The rule will evaluate and potentially modify cells in this column.

Cell Conditions

Cell conditions evaluate individual cell values:

ConditionDescriptionValue Required
AlwaysAlways triggersNo
Is EmptyCell is null or blankNo
Content LengthCharacter count comparisonOperator + number
Content TypeValue type checkdate/number/text
ContainsText includes substringText to find
Is Contained InValue is in allowed listList of values
Numeric ComparisonNumeric evaluationOperator + number

Content Length Example

Condition: Content Length < 5
Target: Policy_Number

Result: Triggers for policy numbers shorter than 5 characters

Advanced Conditions

Toggle Use advanced conditions to access the same powerful condition builder used in row-level rules. This allows you to trigger cell actions based on conditions in other columns.

Cell-Level Actions

ActionDescriptionOptions
Skip RowRemove the entire rowNone
Fail RowStop with errorCustom message
TrimRemove leading/trailing whitespaceNone
Remove SpacesRemove all spacesNone
Set ValueReplace the cell valueStatic, prepend, append, arithmetic, conditional
TransformApply transformationsSee transformation options

Transformation Options

TransformDescriptionParameters
UppercaseConvert to uppercaseNone
LowercaseConvert to lowercaseNone
Trim WhitespaceRemove leading/trailing spacesNone
Remove SpacesRemove all spacesNone
Strip Leading ZerosRemove leading 0s (keeps at least one)None
Keep Digits OnlyRemove all non-numeric charactersNone
Remove CharactersRemove specific charactersCharacters to remove
Left (first N)Keep first N charactersCount
Right (last N)Keep last N charactersCount
SubstringExtract portion of textStart position, length
Find & ReplaceReplace textFind text, replace with
Pad LeftAdd characters to startTarget length, pad character
Pad RightAdd characters to endTarget length, pad character
Drop PrefixRemove text from startText to drop
Drop SuffixRemove text from endText to drop
Cast to Number StringConvert number to clean textNone

Set Value Formulas

Cell-level "Set Value" actions support several formula types:

Prepend from Column

Adds another column's value before the current value.

Source Column: Contract_ID
Separator: -
Result: "ABC123-POL001" (Contract_ID + separator + Policy_Number)

Append from Column

Adds another column's value after the current value.

Arithmetic Operation

Perform math on numeric values:

  • Multiply by
  • Divide by
  • Add
  • Subtract

Real-World Examples

Here are some common ingestion rule patterns:

Example 1: Remove Whitespace from Policy Numbers

Type: Cell-level
Target Column: Policy_Number
Condition: Contains (value: " " - a space)
Action: Remove Spaces

This cleans up policy numbers that accidentally contain spaces.

Example 2: Prepend Contract ID to Short Policy Numbers

Type: Cell-level
Target Column: Policy_Number
Condition: Content Length < 5
Action: Set Value → Formula → Prepend
Formula Config: Source Column = Contract_ID, Separator = "-"

When policy numbers are too short to be unique, this prepends the contract ID to create a unique identifier.

Example 3: Skip Rows with Empty Key Fields

Type: Row-level
Conditions:

  • month.Gross_Premium IS EMPTY
  • month IS EMPTY
    Logic: AND
    Action: Skip Row

This removes rows that have no premium data and no reporting month (likely blank rows in the source spreadsheet).

Example 4: Set Default Value When Field is Empty

Type: Row-level
Conditions:

  • Coverholder_Commission_Percentage IS EMPTY
  • OR Coverholder_Commission_Percentage EQUALS "0"
  • OR Coverholder_Commission_Percentage MATCHES REGEX "^\s0(.0+)?\s%?\s*$"
    Logic: OR
    Action: Set Value
    Target Column: month.Net_Premium_Less_Brokerage
    Value Type: From Column
    Source Column: month.Net_Premium

When commission is zero or empty, copy Net Premium to Net Premium Less Brokerage (since they're equivalent).


Tips and Best Practices

Order Matters

  • Put "skip row" rules early to avoid processing rows you'll discard
  • Put data cleaning rules (trim, remove spaces) before validation rules
  • Put transformation rules in logical sequence (clean → validate → transform)

Use Descriptive Names

Name your rules clearly so you can understand their purpose at a glance:

  • ✅ "Skip rows with empty gross premium and month"
  • ❌ "Rule 1"

Test with Preview

After creating rules, upload a test file and review the preview carefully to ensure rules are working as expected before processing production data.

Disable vs Delete

If a rule isn't working correctly, disable it rather than deleting it. This lets you troubleshoot without losing your configuration.

Regular Expressions

For complex pattern matching, use the Matches Pattern operator with regex. Common patterns:

  • ^[A-Z]{2}\d{4}$ - Two letters followed by four digits
  • ^\s*$ - Empty or whitespace only
  • ^\d+\.?\d*$ - Numeric values (with optional decimal)