# Feed validation tool

We maintain an
[open-source feed validator](https://github.com/google/civics_cdf_validator)
designed to provide specific, actionable feedback beyond simple XML validation.
The validator is available through the
[standard Python package management tool](https://pypi.org/project/civics-cdf-validator/):

    bash:~$ pip install civics_cdf_validator

The following example shows how to use it:

    bash:~$ civics_cdf_validator validate your_feed.xml --xsd civics_cdf_specx.xsd --rule_set=RULE_SET

For a list of common commands, see
[README](https://github.com/google/civics_cdf_validator/blob/master/README.md).

## Supported feed types

The validator supports the following feed types:

- Pre-election data
- Election results
- Officeholder

To make sure you don't miss some validation rules, specify your feed type with
`RULE_SET`:

| Feed type | `RULE_SET` value |
|---|---|
| Officeholder | `OFFICEHOLDER` |
| Pre-election data / Election results | `ELECTION` |

## Levels of validation checks

The feed validation tool runs three classes of checks:

- **Error:** If you see *any* errors, Google can't parse the file. Eliminate
  *all* error messages from your feeds before you send your data. If you need
  assistance to address your error messages, file a bug in your component.

- **Warning:** Warnings flag scenarios that aren't supposed to happen, aren't
  great user experiences, or are *likely* errors that need to be fixed. For
  example, a warning is given if you provide candidate names in ALL CAPITAL
  LETTERS. Try to fix all of the warnings given, and expect for us to ask
  follow-up questions if the validator identifies warnings in a feed.

- **Info:** Info messages indicate scenarios that don't affect the automated
  ingestion of a feed or the user experience but that help someone read and
  understand the layout of your data. Fixing info messages is optional.

> [!NOTE]
> **Note:** The feed validator is the most effective and efficient way to prepare your feed for ingestion. We recommend that you install and run it on your feeds before you send them to Google.