Validation Toolset
==================

The Validation Toolset is currently comprised of only one tool, :ng911tool:`Validate Geodatabase`.

.. important::

   Several important terms with entries in :ref:`validation-glossary` are used throughout this section.

Validate Geodatabase
--------------------

The goal this tool is to determine whether the :term:`NG911 geodatabase` and its contents conform to the Standard. The tool allows the selection of :term:`validation routine`\ s, each of which evaluates some aspect of the geodatabase for compliance. In the Geoprocessing pane, the tool groups the :term:`validation routine`\ s into :term:`validation categories <validation category>`.

Usage
+++++

The tool's interface is highly dynamic, responding to the inputs provided. At first, only three parameters are visible: :bdg-contrast-line:`Input Geodatabase`, :bdg-contrast-line:`Overwrite Error Tables`, and :bdg-contrast-line:`Respect SUBMIT`.

Selecting :bdg-contrast-line:`Overwrite Error Tables` will delete |FVCR| and |TCR| if present, and each will be recreated with only new :term:`validation issue`\ s if any are found.

Selecting :bdg-contrast-line:`Respect SUBMIT` (which is activated by default) will cause only features marked for submission to be validated. This means that issues with data *not* marked for submission will not be evaluated for compliance with the Standard.

.. figure:: /images/UserManual/ValidationTool/CropInitialOpen.png
   :figclass: tool-screenshot
   :figwidth: 320px

   The tool as it appears when first opened.

Upon providing a geodatabase, the :bdg-contrast-line:`Feature Classes to Check` parameter appears and is populated with the NG911 feature classes present in the geodatabase. The :bdg-contrast-line:`Geodatabase Validations` parameter also appears. Running geodatabase validation routines does not require selecting any feature classes.

.. figure:: /images/UserManual/ValidationTool/CropAddedGDB.png
   :figclass: tool-screenshot
   :figwidth: 320px

   The parameters :bdg-contrast-line:`Feature Classes to Check` and :bdg-contrast-line:`Geodatabase Validations` are available once a geodatabase is provided.

Selecting feature classes in :bdg-contrast-line:`Feature Classes to Check` makes the :bdg-contrast-line:`General Feature Class Validations` parameter available. These routines are run on each **selected** feature class.

.. figure:: /images/UserManual/ValidationTool/CropAddedFCs.png
   :figclass: tool-screenshot
   :figwidth: 320px

   Adding feature classes unlocks the :bdg-contrast-line:`General Feature Class Validations` parameter.

The feature classes :ng911fc:`address_point` and :ng911fc:`road_centerline` each have several routines specific to them. Selecting :ng911fc:`address_point` will make the :bdg-contrast-line:`Address Point Validations` parameter available, and selecting :ng911fc:`road_centerline` will make the :bdg-contrast-line:`Road Centerline Validations` parameter available.

.. figure:: /images/UserManual/ValidationTool/AddedAPRCL.png
   :figclass: tool-screenshot
   :figwidth: 320px

   Adding :ng911fc:`address_point` and :ng911fc:`road_centerline` unlocks the :bdg-contrast-line:`Address Point Validations` and :bdg-contrast-line:`Road Centerline Validations` parameters, respectively.

Some routines involve multiple feature classes. To run such a routine, all feature classes it requires must be selected, or an error message will appear stating the other required feature class(es).

.. figure:: /images/UserManual/ValidationTool/CropRequiresMultipleFCs.png
   :figclass: tool-screenshot
   :figwidth: 320px

   Some :term:`validation routine`\ s require that multiple feature classes be selected.

.. figure:: /images/UserManual/ValidationTool/ESZRequiredMessage.png
   :figclass: tool-screenshot
   :figwidth: 320px

   Example of a message warning that a routine requires that an additional feature class be selected.

The parameter's error message will be dismissed once all feature classes required by the routine are selected or when that particular routine is unselected.

.. figure:: /images/UserManual/ValidationTool/ESZProvided.png
   :figclass: tool-screenshot
   :figwidth: 320px

   The error is dismissed when the other required feature class is selected.

The parameter :bdg-contrast-line:`Run All Available Validations` is provided for convenience. When selected, all NG911 feature classes present in the geodatabase are selected, and all routines that can be run with those feature classes are selected.

While it is never required, selecting :bdg-contrast-line:`Overwrite Error Tables` may be particularly helpful when running all available validations.

.. figure:: /images/UserManual/ValidationTool/OverwriteAndRunAll.png
   :figclass: tool-screenshot
   :figwidth: 320px

   Selecting :bdg-contrast-line:`Run All Available Validations` will automatically select all available feature classes and routines. When doing so, selecting :bdg-contrast-line:`Overwrite Error Tables` is recommended.

Once all options are configured, run the tool.

Viewing and Interpreting the Results
++++++++++++++++++++++++++++++++++++

Where Results are Stored
************************

The **Validation Tools** in the NG9-1-1 GIS Toolkit output their results to two tables:

- |FVCR|
- |TCR|

These tables store :term:`validation issue`\ s to help:

- Identify anomalies and their :term:`severities <severity>` in GIS data
- Locate where the anomaly occurred
- Determine which validation routine detected the issue

.. important::

   The result tables |FVCR| and |TCR| only get created if the tool identifies validation issues. If there are no :term:`feature attribute issue`\ s, |FVCR| will not be created. If there are no :term:`geodatabase issue`\ s, |TCR| will not be created.

Understanding the Results
*************************

To view the validation issues:

1. In the **Catalog pane**, expand the NG911 geodatabase, and add |FVCR| and/or |TCR| to a map.
2. In the **Table of Contents pane**, right-click the table and click :bdg-contrast-line:`Open`.

Every validation issue has an **issue code** in the ``Code`` field. The ``Message`` field elaborates on the particular error, and looking up the code in the :doc:`/validation-issues` may provide additional insight.

.. note::

   All validation issues flagged during a **single run** of the tool will have the **same date and time** in the ``Timestamp`` field.

Using *FieldValuesCheckResults*
*******************************

A row in |FVCR| typically indicates an issue with one attribute of one feature. Some routines add rows with ``Field1`` and/or ``Field2`` values that start with ``$``. This indicates a computed value rather than any specific field.

1. **Open** the |FVCR| table to examine any issues flagged by the tool.
2. **Join** the table to a feature class on either the ``NGUID1`` or ``NGUID2`` field to view features with issues.

.. tip::

   Once you have finished reviewing the results, it may be helpful to **delete** the table to prevent confusion after later runs. If the table is not deleted, any new issues will we **appended** to it the next time a Validation tool is run.


.. |FVCR| replace:: :bdg-contrast:`FieldValuesCheckResults`
.. |TCR| replace:: :bdg-contrast:`TemplateCheckResults`