Skip to main content
`Ctrl`+`K`

# ng911ok.lib.validator module

This module handles the validation functionality for the Toolkit.

At the heart of the Toolkit’s validation functionality is the `NG911Validator` class, a subclass of `NG911Session` (which is a subclass of `arcpy.EnvManager`). To perform any validation on the contents of an NG911 geodatabase, an `NG911Validator` instance is initialized with the geodatabase’s path as the first argument.

Once initialized, the validator’s validation methods or validation routines can be called to test the validity of numerous aspects of the geodatabase and its contents. All validation methods and routines return lists of instances of `ValidationErrorMessage`.

`ValidationErrorMessage` has two subclasses, one for each error table that is generated upon the calling of the validator’s `__exit__()` method:

- `GDBErrorMessage` - For validation issues with the properties of the geodatabase’s contents or the geodatabase itself (e.g., spatial reference, field type)

- `FeatureAttributeErrorMessage` - For validation issues with the attributes of the feature classes (e.g., NGUID format violations, parity inconsistencies)

See also

Validation Glossary

## Members

exception ValidationPrerequisiteError

  Bases: `RuntimeError`

  Type of error to be raised when `precheck()` generates a validation error as a result of a prerequisite validation function.

  static _arg_str(*routine_args, **routine_kwargs) → str
  _msg_str(validation_routine: ValidationRoutine, messenger: GPMessenger | None = None, *routine_args, **routine_kwargs)
  arcpy_warning(validation_routine: ValidationRoutine, messenger: GPMessenger | None = None, *routine_args, **routine_kwargs) → None

    Adds an ArcPy warning with an appropriate message.

  property warning_message: str

    Returns a warning message suitable for logging.

exception ValidationRoutineLookupError(name: str)

  Bases: `KeyError`

  Exception to be raised when `ValidationRoutine.get_routine()` is used to retrieve a routine that does not exist.

class NG911Validator(workspace: PathLike[str] | str, respect_submit: bool, use_edit_session: bool = False, messenger: GPMessenger | None = None, export: bool = True, overwrite_error_tables: bool = False, **env_kwargs)

  Bases: `NG911Session`

  This class exists to encapsulate the logic of validation against the Standards.

  ## Conventions

  Most validation functions follow the conventions outlined here.

  ### Naming

  validation functions should be instance methods whose names start with `check_`. Validation helper functions should be static or instance methods whose names should start with `_check_`.

  ### Caching

  Certain validation functions that are called often, such as when their results are passed to `_precheck()`, should be decorated with `@cache`. All methods decorated as such shall have a call to `cache_clear()` in this class’s `_clear_method_caches()`.

  ### Prerequisite Validations

  The `_precheck()` method is intended to run prerequisite validations. It should be called by validation functions and routines to mandate that certain aspects of the data be valid prior to running a validation. For example, `check_unique_id_format()` requires that the input feature class has a unique ID field, and enforces this prerequisite by passing the results of a call to `check_fields_exist()` to `_precheck()` to ensure the presence of that field. Should the call return any errors, `_precheck()` raises a `ValidationPrerequisiteError`.

  ### Validation Function Parameters

  Validation functions may take an `NG911FeatureClass` object and/or a sequence of `NG911Field` objects. On occasion, other arguments may be appropriate, but never should a validation function take the string role or name of a feature class or field as an argument.

  Validation functions should never take a geodatabase as an argument. Since `NG911Validator` is a subclass of `NG911Session` (and, therefore, of `arcpy.EnvManager`), its methods can get the path to the current workspace from `arcpy.env.workspace`, or, preferably, from the property `gdb`.

  Validation helper functions should be static methods, or, if necessary, class methods. They should therefore never modify an instance’s `_validation_issues`. They may take any arguments and return any type of data.

  ### Validation Function Return Values

  Every validation function should return a `list` of either `validation.ValidationErrorMessage` or a subclass thereof, e.g., `list[ValidationErrorMessage]` or `list[FeatureAttributeErrorMessage]`.

  static _check_coded_value_domain(gdb_domain: Workspace Domain object, expected_domain: ~ng911ok.lib.config_dataclasses.NG911Domain) → list[ValidationErrorMessage]

    Validation helper that, given an existing domain from a geodatabase and a reference domain from `config`, checks the description of the domain and its coded values and descriptions. Does not check the name of the domain.

  static _check_esn_format(feature_class: NG911FeatureClass, column: Series)
  static _check_field_against_domain(column: Series, field_name: str) → Series
  static _check_field_configuration(feature_class_name: str, actual_field: Field, reference_field: NG911Field) → list[ValidationErrorMessage]

    Checks the type, length, and domain of a field against reference data.

  static _check_item_spatial_reference(item: str, expected_sr: SpatialReference | None = None) → list[ValidationErrorMessage]
  static _check_line_segments(line: Polyline | Polyline, min_degrees: float = 55.0, min_segment_length_meters: float = 5.0) → Series

    Returned `Series` will have two `float`s, the first representing whether a cutback was detected, and the second whether a short segment was detected.

  static _check_msagcomm_consistency(df: DataFrame, msagcomm_field: NG911Field, city_field: NG911Field, county_field: NG911Field) → list[ValidationErrorMessage]
  static _check_range_domain(gdb_domain: Workspace Domain object, expected_domain: ~ng911ok.lib.config_dataclasses.NG911Domain) → list[ValidationErrorMessage]

    There are no range domains prescribed by the Standards, so this method has not yet been implemented.

  static _check_single_road_address_ranges(group: DataFrame) → list[FeatureAttributeErrorMessage]
  static _check_single_unique_id(nguid_string: str | NAType, feature_class: NG911FeatureClass, object_id: int) → FeatureAttributeErrorMessage | NAType
  static _get_parity_indexer(df: DataFrame, parity: Parity, side: Literal['L', 'R']) → tuple[Series, list[str]]

    Returns an indexer (2-tuple to be used with `DataFrame.loc`) for a `DataFrame` of road centerline attributes. Rows are filtered down to those where the Parity_* field is equivalent to parity, and the included columns are the From-Address and To-Address columns that correspond to side.

  static _has_dangles(df: DataFrame, honor_exceptions: bool = True) → Series
  static _precheck(errors: list[ValidationErrorMessage], fail_on_error: bool = True) → bool

    This method allows a validation function to require that another validation be successfully passed as a prerequisite. It is intended to be called with a call to the prerequisite validation function as the argument to the errors parameter, such as:

        self._precheck(self.check_gdb_config())

    If fail_on_error is `True` (the default), a `ValidationPrerequisiteError` will be raised in the event that errors contains any error messages with `severity` of `Error`. If fail_on_error is `False`, then `False` will be returned in such a case.

    Otherwise, `True` will be returned, indicating that the prerequisite is satisfied.

    Parameters:

      - errors (list[ValidationErrorMessage]) – A list of validation error messages (in practice, a call to a validation function; see above)

      - fail_on_error (bool) – Whether a `ValidationPrerequisiteError` should be raised if `errors` is truthy

    Returns:

      Whether the prerequisite was satisfied

    Return type:

      bool

  _add_issues(issues: list[ValidationErrorMessage_co]) → list[ValidationErrorMessage_co]

    Adds `issues` to `self._validation_issues` and returns the added issues (and only the added issues). This is to facilitate the following pattern at the end of validation functions:

        return self._add_issues(issues)

    Instead of:

        self._validation_issues += issues
        return issues

  _check_for_empty_df(df: DataFrame) → list[GDBErrorMessage]
  _check_spatial_attribute_consistency(left_feature_class: NG911FeatureClass, relationship: Literal['intersects', 'within', 'contains'], right_feature_class: NG911FeatureClass, fields: list[NG911Field], error_severity: Literal['Notice', 'Warning', 'Error'], error_code: Literal['ERROR:DOMAIN:INVALID_VALUE', 'ERROR:GENERAL:INVALID_VALUE', 'ERROR:GENERAL:MANDATORY_IS_NULL', 'ERROR:GENERAL:MANDATORY_IS_BLANK', 'ERROR:GENERAL:NOT_UPPERCASE', 'ERROR:GENERAL:UNIQUENESS', 'WARNING:GENERAL:LEADING_TRAILING_SPACE', 'ERROR:NGUID:FORMAT', 'ERROR:NGUID:V2_FORMAT', 'ERROR:NGUID:AGENCY', 'ERROR:NGUID:LAYER', 'ERROR:NGUID:DUPLICATE', 'ERROR:ADDRESS:DUPLICATE', 'ERROR:ADDRESS_RANGE:OVERLAP', 'ERROR:ADDRESS_RANGE:DECREASING', 'ERROR:ROAD_ESN:DEVIATION', 'ERROR:ROAD_ESN:CROSSING', 'ERROR:ROAD_ESN:OUT_OF_BOUNDS', 'ERROR:PARITY:EXPECTED_ZERO', 'ERROR:PARITY:EXPECTED_NONZERO', 'ERROR:PARITY:MISMATCH', 'ERROR:PARITY:INVALID', 'ERROR:PARITY:NULL', 'ERROR:LEGACY:MISMATCH', 'ERROR:GEOCODE:UNKNOWN_MATCH', 'ERROR:GEOCODE:WRONG_SIDE', 'ERROR:GEOCODE:BOTH_SIDES', 'ERROR:GEOCODE:WRONG_COMMUNITY', 'ERROR:GEOCODE:OUT_OF_RANGE', 'ERROR:GEOCODE:NAME_MISMATCH', 'WARNING:GEOCODE:NO_MATCH', 'ERROR:CONSISTENCY:ADDRESS_ESN', 'ERROR:CONSISTENCY:ROAD_ESN', 'ERROR:CONSISTENCY:COMMUNITY', 'WARNING:CONSISTENCY:ROAD_LEVEL', 'ERROR:GEOMETRY:TOPOLOGY', 'WARNING:GEOMETRY:CUTBACK', 'WARNING:GEOMETRY:SHORT_SEGMENT', 'NOTICE:CONSISTENCY:ROAD_ESN'], error_message: str | Callable[[FeatureAttributeErrorMessage], str], left_df: DataFrame | None = None, right_df: DataFrame | None = None) → list[FeatureAttributeErrorMessage]
  _clear_method_caches() → None

    Clears the caches of methods that use the `@cache` decorator.

  check_address_frequency() → list[ValidationErrorMessage]
  check_address_msagcomm_consistency() → list[ValidationErrorMessage]
  check_address_point_esn() → list[ValidationErrorMessage]
  check_address_range_directionality() → list[ValidationErrorMessage]

    Detects road centerline features with from-address attributes that are higher than their corresponding to-address attributes. Accounts for the circular addressing exception described in Issue #10.

  check_address_range_overlaps() → list[ValidationErrorMessage]

    Detects overlapping address ranges in the road centerline feature class.

  check_address_uniqueness(feature_class: NG911FeatureClass) → list[ValidationErrorMessage]

    Checks that certain address-related attribute combinations of `
    ADDRESS_POINT` or `
    ROAD_CENTERLINE` are unique.

    Parameters:

      feature_class (NG911FeatureClass) – Either `
      ADDRESS_POINT` or `
      ROAD_CENTERLINE`

    Returns:

      list[ValidationErrorMessage]

    Added in version 3.2.0: Previously known as `check_uniqueness`, but renamed for clarity.

  check_addresses_against_roads() → list[ValidationErrorMessage]

    Joins road centerline to address point based on AP’s RCLMatch attribute, then checks if each of the following is true:

    1. RCLMatch corresponds to existing NGUID_RDCL

    2. RCLSide and address parity are consistent with exactly one side of

         matching road

    3. * DISABLED * Each road which corresponds to an AP’s RCLMatch has a GeoMSAG value

         of `N` w.r.t. AP’s RCLSide

    4. AP’s MSAG Community corresponds to road’s MSAG Community w.r.t.

         AP’s RCLSide

    5. AP’s street name fields correspond to those of matching road

    6. AP’s address number is within matching road’s range (w.r.t. RCLSide)

  check_attributes(feature_class: NG911FeatureClass) → list[ValidationErrorMessage]
  check_dataset_spatial_reference(feature_dataset: str) → list[ValidationErrorMessage]
  check_feature_class_configuration(feature_class: NG911FeatureClass) → list[ValidationErrorMessage]
  check_feature_class_exists(feature_class: NG911FeatureClass) → list[ValidationErrorMessage]
  check_feature_dataset_exists(feature_dataset_name: str) → list[ValidationErrorMessage]
  check_feature_locations(feature_class: NG911FeatureClass) → list[ValidationErrorMessage]
  check_fields_against_domains(feature_class: NG911FeatureClass, fields: list[NG911Field] | None = None) → list[ValidationErrorMessage]
  check_fields_exist(feature_class: NG911FeatureClass, fields: Sequence[NG911Field]) → list[ValidationErrorMessage]
  check_gdb_domains() → list[ValidationErrorMessage]
  check_geodatabase_for_extra_items() → list[ValidationErrorMessage]

    Checks that there are not any extra items in the geodatabase that are not prescribed by the Standards.

  check_next_gen_against_legacy() → list[ValidationErrorMessage]
  check_parities() → list[ValidationErrorMessage]
  check_road_esn() → list[ValidationErrorMessage]
  check_road_geometry() → list[ValidationErrorMessage]

    Checks road centerline segments for sharp angles (cutbacks) and exceptionally short segments.

  check_road_level() → list[ValidationErrorMessage]

    Checks road centerline features’ from- and to-level attributes.

  check_road_msagcomm_consistency() → list[ValidationErrorMessage]
  check_service_field_uniqueness(feature_class: NG911FeatureClass[NG911DiscrepancyagencyBoundaryFieldNamespace | NG911EszBoundaryFieldNamespace | NG911PsapBoundaryFieldNamespace]) → list[ValidationErrorMessage]

    Checks the identifying field of a jurisdiction boundary feature class, such as the `
    Agency_ID` field of `
    PSAP_BOUNDARY`, to ensure uniqueness.

    Added in version 3.2.0: Replaces `check_esz_esn_uniqueness` introduced in an earlier commit

  check_submission_counts(feature_class: NG911FeatureClass) → list[ValidationErrorMessage]
  check_topology() → list[ValidationErrorMessage]

    Exports topology errors to `memory` and evaluates results with respect to `TopoExcept`.

  check_unique_id_format(feature_class: NG911FeatureClass) → list[ValidationErrorMessage]
  check_unique_id_frequency(feature_class: NG911FeatureClass) → list[ValidationErrorMessage]
  export_fa_error_table() → tuple[bool, bool]

    Exports feature attribute (FA) issues, if applicable. If `self.overwrite` is `True`, this will delete the current FA issue table if it exists, regardless of whether there are new issues to export. If `self.overwrite` is `False` and a GDB issue table already exists, new issues will be appended to the existing table.

    Returns:

      Whether an existing table was deleted and whether any new output was written, respectively

    Return type:

      tuple[bool, bool]

  export_gdb_error_table() → tuple[bool, bool]

    Exports GDB issues, if applicable. If `self.overwrite` is `True`, this will delete the current GDB issue table if it exists, regardless of whether there are new issues to export. If `self.overwrite` is `False` and a GDB issue table already exists, new issues will be appended to the existing table.

    Returns:

      Whether an existing table was deleted and whether any new output was written, respectively

    Return type:

      tuple[bool, bool]

  load_df(feature_class: NG911FeatureClass, fields: Sequence[NG911Field | str] | None = None, respect_submit: bool | None = None, error_if_empty: bool = True, **kwargs: Any) → DataFrame

    Equivalent to `NG911Session.load_df()`, but with an additional parameter `error_if_empty`.

    Parameters:

      - feature_class (NG911FeatureClass) – The feature class to load

      - fields (Optional[list[Union[NG911Field, str]]]) – The fields to include, as either `NG911Field` objects or field names

      - respect_submit (Optional[bool]) – Whether to only return features where the `SUBMIT` attribute is `"Y"`, defaults to `self._respect_submit`

      - error_if_empty (bool) – Whether to raise a `ValidationPrerequisiteError` if the loaded `DataFrame` has no rows, default `True`

      - kwargs (Any) – Additional keyword arguments to pass to `pandas.DataFrame.spatial.from_featureclass()`

    Returns:

      The feature class data in a `pandas.DataFrame`

    Return type:

      pandas.DataFrame

  run_all_routines() → bool

    Runs all registered routines. Routines that take a feature class argument are run once for each and every required and optional feature class. If this method returns `True`, the geodatabase has passed validation.

    Returns:

      Whether all validations were passed

    Return type:

      bool

  _abc_impl = <_abc._abc_data object>
  _validation_issues: list[ValidationErrorMessage]
  check_address_range_directionality_routine

    Callable representation of a validation routine. Instantiation of this class registers the instance in the `_registered_routines` class attribute. The instances registered in `_registered_routines` are used to populate the validation routine selection parameters in the `Validate Geodatabase` tool.

    In addition to using `__init__()`, instances of this class can be created with the `routine()` decorator, which uses the decorated function as the new instance’s `routine_function`.

    When an instance of this class is accessed as a descriptor from an instance of `NG911Validator`, an instance of `_ValidationRoutineProxy` is returned. The proxy object has access to all attributes of the actual `ValidationRoutine` instance and is callable; calling the proxy instance ensures that the `NG911Validator` instance is passed as an argument to `routine_function`.

    This class also contains class methods to help generate and manage `arcpy.Parameter` objects involving validation routines.

  check_address_ranges_routine

    Callable representation of a validation routine. Instantiation of this class registers the instance in the `_registered_routines` class attribute. The instances registered in `_registered_routines` are used to populate the validation routine selection parameters in the `Validate Geodatabase` tool.

    In addition to using `__init__()`, instances of this class can be created with the `routine()` decorator, which uses the decorated function as the new instance’s `routine_function`.

    When an instance of this class is accessed as a descriptor from an instance of `NG911Validator`, an instance of `_ValidationRoutineProxy` is returned. The proxy object has access to all attributes of the actual `ValidationRoutine` instance and is callable; calling the proxy instance ensures that the `NG911Validator` instance is passed as an argument to `routine_function`.

    This class also contains class methods to help generate and manage `arcpy.Parameter` objects involving validation routines.

  check_attributes_against_domains_routine

    Callable representation of a validation routine. Instantiation of this class registers the instance in the `_registered_routines` class attribute. The instances registered in `_registered_routines` are used to populate the validation routine selection parameters in the `Validate Geodatabase` tool.

    In addition to using `__init__()`, instances of this class can be created with the `routine()` decorator, which uses the decorated function as the new instance’s `routine_function`.

    When an instance of this class is accessed as a descriptor from an instance of `NG911Validator`, an instance of `_ValidationRoutineProxy` is returned. The proxy object has access to all attributes of the actual `ValidationRoutine` instance and is callable; calling the proxy instance ensures that the `NG911Validator` instance is passed as an argument to `routine_function`.

    This class also contains class methods to help generate and manage `arcpy.Parameter` objects involving validation routines.

  check_esn_attribute_address_point_routine

    Callable representation of a validation routine. Instantiation of this class registers the instance in the `_registered_routines` class attribute. The instances registered in `_registered_routines` are used to populate the validation routine selection parameters in the `Validate Geodatabase` tool.

    In addition to using `__init__()`, instances of this class can be created with the `routine()` decorator, which uses the decorated function as the new instance’s `routine_function`.

    When an instance of this class is accessed as a descriptor from an instance of `NG911Validator`, an instance of `_ValidationRoutineProxy` is returned. The proxy object has access to all attributes of the actual `ValidationRoutine` instance and is callable; calling the proxy instance ensures that the `NG911Validator` instance is passed as an argument to `routine_function`.

    This class also contains class methods to help generate and manage `arcpy.Parameter` objects involving validation routines.

  check_esn_attribute_road_centerline_routine

    Callable representation of a validation routine. Instantiation of this class registers the instance in the `_registered_routines` class attribute. The instances registered in `_registered_routines` are used to populate the validation routine selection parameters in the `Validate Geodatabase` tool.

    In addition to using `__init__()`, instances of this class can be created with the `routine()` decorator, which uses the decorated function as the new instance’s `routine_function`.

    When an instance of this class is accessed as a descriptor from an instance of `NG911Validator`, an instance of `_ValidationRoutineProxy` is returned. The proxy object has access to all attributes of the actual `ValidationRoutine` instance and is callable; calling the proxy instance ensures that the `NG911Validator` instance is passed as an argument to `routine_function`.

    This class also contains class methods to help generate and manage `arcpy.Parameter` objects involving validation routines.

  check_feature_class_configuration_routine

    Callable representation of a validation routine. Instantiation of this class registers the instance in the `_registered_routines` class attribute. The instances registered in `_registered_routines` are used to populate the validation routine selection parameters in the `Validate Geodatabase` tool.

    In addition to using `__init__()`, instances of this class can be created with the `routine()` decorator, which uses the decorated function as the new instance’s `routine_function`.

    When an instance of this class is accessed as a descriptor from an instance of `NG911Validator`, an instance of `_ValidationRoutineProxy` is returned. The proxy object has access to all attributes of the actual `ValidationRoutine` instance and is callable; calling the proxy instance ensures that the `NG911Validator` instance is passed as an argument to `routine_function`.

    This class also contains class methods to help generate and manage `arcpy.Parameter` objects involving validation routines.

  check_feature_class_list_routine

    Callable representation of a validation routine. Instantiation of this class registers the instance in the `_registered_routines` class attribute. The instances registered in `_registered_routines` are used to populate the validation routine selection parameters in the `Validate Geodatabase` tool.

    In addition to using `__init__()`, instances of this class can be created with the `routine()` decorator, which uses the decorated function as the new instance’s `routine_function`.

    When an instance of this class is accessed as a descriptor from an instance of `NG911Validator`, an instance of `_ValidationRoutineProxy` is returned. The proxy object has access to all attributes of the actual `ValidationRoutine` instance and is callable; calling the proxy instance ensures that the `NG911Validator` instance is passed as an argument to `routine_function`.

    This class also contains class methods to help generate and manage `arcpy.Parameter` objects involving validation routines.

  check_geodatabase_domains_routine

    Callable representation of a validation routine. Instantiation of this class registers the instance in the `_registered_routines` class attribute. The instances registered in `_registered_routines` are used to populate the validation routine selection parameters in the `Validate Geodatabase` tool.

    In addition to using `__init__()`, instances of this class can be created with the `routine()` decorator, which uses the decorated function as the new instance’s `routine_function`.

    When an instance of this class is accessed as a descriptor from an instance of `NG911Validator`, an instance of `_ValidationRoutineProxy` is returned. The proxy object has access to all attributes of the actual `ValidationRoutine` instance and is callable; calling the proxy instance ensures that the `NG911Validator` instance is passed as an argument to `routine_function`.

    This class also contains class methods to help generate and manage `arcpy.Parameter` objects involving validation routines.

  check_next_gen_against_legacy_fields_routine

    Callable representation of a validation routine. Instantiation of this class registers the instance in the `_registered_routines` class attribute. The instances registered in `_registered_routines` are used to populate the validation routine selection parameters in the `Validate Geodatabase` tool.

    In addition to using `__init__()`, instances of this class can be created with the `routine()` decorator, which uses the decorated function as the new instance’s `routine_function`.

    When an instance of this class is accessed as a descriptor from an instance of `NG911Validator`, an instance of `_ValidationRoutineProxy` is returned. The proxy object has access to all attributes of the actual `ValidationRoutine` instance and is callable; calling the proxy instance ensures that the `NG911Validator` instance is passed as an argument to `routine_function`.

    This class also contains class methods to help generate and manage `arcpy.Parameter` objects involving validation routines.

  check_parities_routine

    Callable representation of a validation routine. Instantiation of this class registers the instance in the `_registered_routines` class attribute. The instances registered in `_registered_routines` are used to populate the validation routine selection parameters in the `Validate Geodatabase` tool.

    In addition to using `__init__()`, instances of this class can be created with the `routine()` decorator, which uses the decorated function as the new instance’s `routine_function`.

    When an instance of this class is accessed as a descriptor from an instance of `NG911Validator`, an instance of `_ValidationRoutineProxy` is returned. The proxy object has access to all attributes of the actual `ValidationRoutine` instance and is callable; calling the proxy instance ensures that the `NG911Validator` instance is passed as an argument to `routine_function`.

    This class also contains class methods to help generate and manage `arcpy.Parameter` objects involving validation routines.

  check_rclmatch_routine

    Callable representation of a validation routine. Instantiation of this class registers the instance in the `_registered_routines` class attribute. The instances registered in `_registered_routines` are used to populate the validation routine selection parameters in the `Validate Geodatabase` tool.

    In addition to using `__init__()`, instances of this class can be created with the `routine()` decorator, which uses the decorated function as the new instance’s `routine_function`.

    When an instance of this class is accessed as a descriptor from an instance of `NG911Validator`, an instance of `_ValidationRoutineProxy` is returned. The proxy object has access to all attributes of the actual `ValidationRoutine` instance and is callable; calling the proxy instance ensures that the `NG911Validator` instance is passed as an argument to `routine_function`.

    This class also contains class methods to help generate and manage `arcpy.Parameter` objects involving validation routines.

  check_required_field_attributes_routine

    Callable representation of a validation routine. Instantiation of this class registers the instance in the `_registered_routines` class attribute. The instances registered in `_registered_routines` are used to populate the validation routine selection parameters in the `Validate Geodatabase` tool.

    In addition to using `__init__()`, instances of this class can be created with the `routine()` decorator, which uses the decorated function as the new instance’s `routine_function`.

    When an instance of this class is accessed as a descriptor from an instance of `NG911Validator`, an instance of `_ValidationRoutineProxy` is returned. The proxy object has access to all attributes of the actual `ValidationRoutine` instance and is callable; calling the proxy instance ensures that the `NG911Validator` instance is passed as an argument to `routine_function`.

    This class also contains class methods to help generate and manage `arcpy.Parameter` objects involving validation routines.

  check_spatial_reference_routine

    Callable representation of a validation routine. Instantiation of this class registers the instance in the `_registered_routines` class attribute. The instances registered in `_registered_routines` are used to populate the validation routine selection parameters in the `Validate Geodatabase` tool.

    In addition to using `__init__()`, instances of this class can be created with the `routine()` decorator, which uses the decorated function as the new instance’s `routine_function`.

    When an instance of this class is accessed as a descriptor from an instance of `NG911Validator`, an instance of `_ValidationRoutineProxy` is returned. The proxy object has access to all attributes of the actual `ValidationRoutine` instance and is callable; calling the proxy instance ensures that the `NG911Validator` instance is passed as an argument to `routine_function`.

    This class also contains class methods to help generate and manage `arcpy.Parameter` objects involving validation routines.

  check_submission_counts_routine

    Callable representation of a validation routine. Instantiation of this class registers the instance in the `_registered_routines` class attribute. The instances registered in `_registered_routines` are used to populate the validation routine selection parameters in the `Validate Geodatabase` tool.

    In addition to using `__init__()`, instances of this class can be created with the `routine()` decorator, which uses the decorated function as the new instance’s `routine_function`.

    When an instance of this class is accessed as a descriptor from an instance of `NG911Validator`, an instance of `_ValidationRoutineProxy` is returned. The proxy object has access to all attributes of the actual `ValidationRoutine` instance and is callable; calling the proxy instance ensures that the `NG911Validator` instance is passed as an argument to `routine_function`.

    This class also contains class methods to help generate and manage `arcpy.Parameter` objects involving validation routines.

  check_topology_routine

    Callable representation of a validation routine. Instantiation of this class registers the instance in the `_registered_routines` class attribute. The instances registered in `_registered_routines` are used to populate the validation routine selection parameters in the `Validate Geodatabase` tool.

    In addition to using `__init__()`, instances of this class can be created with the `routine()` decorator, which uses the decorated function as the new instance’s `routine_function`.

    When an instance of this class is accessed as a descriptor from an instance of `NG911Validator`, an instance of `_ValidationRoutineProxy` is returned. The proxy object has access to all attributes of the actual `ValidationRoutine` instance and is callable; calling the proxy instance ensures that the `NG911Validator` instance is passed as an argument to `routine_function`.

    This class also contains class methods to help generate and manage `arcpy.Parameter` objects involving validation routines.

  check_unique_id_format_routine

    Callable representation of a validation routine. Instantiation of this class registers the instance in the `_registered_routines` class attribute. The instances registered in `_registered_routines` are used to populate the validation routine selection parameters in the `Validate Geodatabase` tool.

    In addition to using `__init__()`, instances of this class can be created with the `routine()` decorator, which uses the decorated function as the new instance’s `routine_function`.

    When an instance of this class is accessed as a descriptor from an instance of `NG911Validator`, an instance of `_ValidationRoutineProxy` is returned. The proxy object has access to all attributes of the actual `ValidationRoutine` instance and is callable; calling the proxy instance ensures that the `NG911Validator` instance is passed as an argument to `routine_function`.

    This class also contains class methods to help generate and manage `arcpy.Parameter` objects involving validation routines.

  check_unique_id_frequency_routine

    Callable representation of a validation routine. Instantiation of this class registers the instance in the `_registered_routines` class attribute. The instances registered in `_registered_routines` are used to populate the validation routine selection parameters in the `Validate Geodatabase` tool.

    In addition to using `__init__()`, instances of this class can be created with the `routine()` decorator, which uses the decorated function as the new instance’s `routine_function`.

    When an instance of this class is accessed as a descriptor from an instance of `NG911Validator`, an instance of `_ValidationRoutineProxy` is returned. The proxy object has access to all attributes of the actual `ValidationRoutine` instance and is callable; calling the proxy instance ensures that the `NG911Validator` instance is passed as an argument to `routine_function`.

    This class also contains class methods to help generate and manage `arcpy.Parameter` objects involving validation routines.

  check_uniqueness_address_point_routine

    Callable representation of a validation routine. Instantiation of this class registers the instance in the `_registered_routines` class attribute. The instances registered in `_registered_routines` are used to populate the validation routine selection parameters in the `Validate Geodatabase` tool.

    In addition to using `__init__()`, instances of this class can be created with the `routine()` decorator, which uses the decorated function as the new instance’s `routine_function`.

    When an instance of this class is accessed as a descriptor from an instance of `NG911Validator`, an instance of `_ValidationRoutineProxy` is returned. The proxy object has access to all attributes of the actual `ValidationRoutine` instance and is callable; calling the proxy instance ensures that the `NG911Validator` instance is passed as an argument to `routine_function`.

    This class also contains class methods to help generate and manage `arcpy.Parameter` objects involving validation routines.

  check_uniqueness_road_centerline_routine

    Callable representation of a validation routine. Instantiation of this class registers the instance in the `_registered_routines` class attribute. The instances registered in `_registered_routines` are used to populate the validation routine selection parameters in the `Validate Geodatabase` tool.

    In addition to using `__init__()`, instances of this class can be created with the `routine()` decorator, which uses the decorated function as the new instance’s `routine_function`.

    When an instance of this class is accessed as a descriptor from an instance of `NG911Validator`, an instance of `_ValidationRoutineProxy` is returned. The proxy object has access to all attributes of the actual `ValidationRoutine` instance and is callable; calling the proxy instance ensures that the `NG911Validator` instance is passed as an argument to `routine_function`.

    This class also contains class methods to help generate and manage `arcpy.Parameter` objects involving validation routines.

  property error_count: int

    Returns the number of validation errors logged by the instance.

    Changed in version 3.1.0: Now returns only the number of validation issues with a severity of `Error`.

  export: bool
  property fa_error_table: str

    Returns the path to the Feature Attribute Error Table as a string.

  property fa_error_table_path: Path

    Returns the path to the Feature Attribute Error Table.

  property feature_attribute_errors: FrozenList[FeatureAttributeErrorMessage]

    Of all `FeatureAttributeErrorMessage`s logged by the instance, returns those with a `severity` of `Error` as a `FrozenList`.

    Changed in version 3.1.0: Now only returns obejcts with a severity of `Error`.

  property feature_attribute_issue_df: DataFrame

    Returns data from the `FeatureAttributeErrorMessage`s logged by the instance as a data frame.

  property feature_attribute_issues: FrozenList[FeatureAttributeErrorMessage]

    Returns all `FeatureAttributeErrorMessage`s logged by the instance as a `FrozenList`.

  property gdb_error_table: str

    Returns the path to the GDB Error Table as a string.

  property gdb_error_table_path: Path

    Returns the path to the GDB Error Table.

  property gdb_errors: FrozenList[GDBErrorMessage]

    Of all `GDBErrorMessage`s logged by the instance, returns those with a `severity` of `Error` as a `FrozenList`.

    Changed in version 3.1.0: Now only returns obejcts with a severity of `Error`.

  property gdb_issue_df: DataFrame

    Returns data from the `GDBErrorMessage`s logged by the instance as a data frame.

  property gdb_issues: FrozenList[GDBErrorMessage]

    Returns all `GDBErrorMessage`s logged by the instance as a `FrozenList`.

  property has_errors: bool

    Returns `True` if any validation errors have been logged by the instance, or `False` otherwise.

    Changed in version 3.1.0: Now returns `True` only if any validation issues have a severity of `Error`.

  property has_issues: bool

    Returns `True` if any validation issues have been logged by the instance, or `False` otherwise.

  property issue_count: int

    Returns the number of validation issues logged by the instance, regardless of severity.

  property issue_summary: dict[Literal['ERROR:PYTHON:EXCEPTION', 'ERROR:GDB:MISSING_REQUIRED_DATASET', 'ERROR:GDB:MISSING_REQUIRED_FEATURE_CLASS', 'ERROR:GDB:EXTRA_ITEM', 'ERROR:GDB:MISSING_DOMAIN', 'ERROR:GDB:EXTRA_DOMAIN', 'ERROR:GDB:INCORRECT_DOMAIN_TYPE', 'ERROR:GDB:DOMAIN_MISSING_CODE', 'ERROR:GDB:DOMAIN_EXTRA_CODE', 'ERROR:GDB:DOMAIN_CODE_VALUE_MISMATCH', 'ERROR:GDB:INCORRECT_DOMAIN_DESCRIPTION', 'ERROR:DATASET:INCORRECT_SPATIAL_REFERENCE', 'ERROR:DATASET:MISSING_TOPOLOGY', 'ERROR:DATASET:INCORRECT_TOPOLOGY', 'ERROR:DATASET:TOPOLOGY_VIOLATION', 'ERROR:FEATURE_CLASS:MISSING_REQUIRED_FIELD', 'ERROR:FEATURE_CLASS:EXTRA_FIELD', 'ERROR:FEATURE_CLASS:INCORRECT_SPATIAL_REFERENCE', 'ERROR:FEATURE_CLASS:INCORRECT_GEOMETRY_TYPE', 'ERROR:FEATURE_CLASS:INCORRECT_FEATURE_TYPE', 'ERROR:FEATURE_CLASS:EMPTY', 'ERROR:FEATURE_CLASS:EMPTY_SUBMISSION', 'ERROR:FIELD:INCORRECT_FIELD_TYPE', 'ERROR:FIELD:INCORRECT_FIELD_LENGTH', 'ERROR:FIELD:INCORRECT_FIELD_DOMAIN', 'NOTICE:GDB:MISSING_OPTIONAL_DATASET', 'NOTICE:GDB:MISSING_OPTIONAL_FEATURE_CLASS', 'ERROR:DOMAIN:INVALID_VALUE', 'ERROR:GENERAL:INVALID_VALUE', 'ERROR:GENERAL:MANDATORY_IS_NULL', 'ERROR:GENERAL:MANDATORY_IS_BLANK', 'ERROR:GENERAL:NOT_UPPERCASE', 'ERROR:GENERAL:UNIQUENESS', 'WARNING:GENERAL:LEADING_TRAILING_SPACE', 'ERROR:NGUID:FORMAT', 'ERROR:NGUID:V2_FORMAT', 'ERROR:NGUID:AGENCY', 'ERROR:NGUID:LAYER', 'ERROR:NGUID:DUPLICATE', 'ERROR:ADDRESS:DUPLICATE', 'ERROR:ADDRESS_RANGE:OVERLAP', 'ERROR:ADDRESS_RANGE:DECREASING', 'ERROR:ROAD_ESN:DEVIATION', 'ERROR:ROAD_ESN:CROSSING', 'ERROR:ROAD_ESN:OUT_OF_BOUNDS', 'ERROR:PARITY:EXPECTED_ZERO', 'ERROR:PARITY:EXPECTED_NONZERO', 'ERROR:PARITY:MISMATCH', 'ERROR:PARITY:INVALID', 'ERROR:PARITY:NULL', 'ERROR:LEGACY:MISMATCH', 'ERROR:GEOCODE:UNKNOWN_MATCH', 'ERROR:GEOCODE:WRONG_SIDE', 'ERROR:GEOCODE:BOTH_SIDES', 'ERROR:GEOCODE:WRONG_COMMUNITY', 'ERROR:GEOCODE:OUT_OF_RANGE', 'ERROR:GEOCODE:NAME_MISMATCH', 'WARNING:GEOCODE:NO_MATCH', 'ERROR:CONSISTENCY:ADDRESS_ESN', 'ERROR:CONSISTENCY:ROAD_ESN', 'ERROR:CONSISTENCY:COMMUNITY', 'WARNING:CONSISTENCY:ROAD_LEVEL', 'ERROR:GEOMETRY:TOPOLOGY', 'WARNING:GEOMETRY:CUTBACK', 'WARNING:GEOMETRY:SHORT_SEGMENT', 'NOTICE:CONSISTENCY:ROAD_ESN'], int]

    Returns a `dict` mapping issue codes to the number of occurrences of each code stored by the validator instance.

  overwrite: bool
  property validation_errors: FrozenList[ValidationErrorMessage]

    Returns all validation errors logged by the instance as a `FrozenList`.

    Changed in version 3.1.0: Now only returns obejcts with a severity of `Error`.

  property validation_issues: FrozenList[ValidationErrorMessage]

    Returns all validation issues logged by the instance as a `FrozenList`.

class ValidationRoutine(name: str, category: ValidationCategory, routine_function: AnyValidationRoutineFunction, takes_feature_class_argument: bool, required_feature_classes=NOTHING)

  Bases: `object`

  Callable representation of a validation routine. Instantiation of this class registers the instance in the `_registered_routines` class attribute. The instances registered in `_registered_routines` are used to populate the validation routine selection parameters in the `Validate Geodatabase` tool.

  In addition to using `__init__()`, instances of this class can be created with the `routine()` decorator, which uses the decorated function as the new instance’s `routine_function`.

  When an instance of this class is accessed as a descriptor from an instance of `NG911Validator`, an instance of `_ValidationRoutineProxy` is returned. The proxy object has access to all attributes of the actual `ValidationRoutine` instance and is callable; calling the proxy instance ensures that the `NG911Validator` instance is passed as an argument to `routine_function`.

  This class also contains class methods to help generate and manage `arcpy.Parameter` objects involving validation routines.

  classmethod _parameter_names_for_all_categories() → set[str]
  classmethod _register(instance: Self) → None
  classmethod get_category(category: Literal['Geodatabase', 'General Feature Class', 'Address Point', 'Road Centerline']) → FrozenList[Self]

    Returns all registered instances of `ValidationRoutine` with a `category` attribute set to the argument provided for category.

  classmethod get_category_from_parameter(parameter: Parameter) → Literal['Geodatabase', 'General Feature Class', 'Address Point', 'Road Centerline']

    Given a parameter, returns the `ValidationCategory` it represents.

  classmethod get_routine(name: str) → Self

    Returns the routine named name.

  classmethod get_routine_names() → FrozenList[str]

    Returns the names of all registered instances of `ValidationRoutine`.

  classmethod get_routines() → FrozenList[Self]

    Returns all registered instances of `ValidationRoutine`.

    Changed in version 3.1.0: Now returns routine instances in accordance with the hinted return type instead of routine names.

  classmethod get_selected_from_parameter(routine_parameter: Parameter) → list[Self]

    Returns a list containing the `ValidationRoutine` objects corresponding to the options that are selected.

  classmethod is_routine_parameter_name(parameter_name: str) → bool

    Given the name of an instance of `arcpy.Parameter`, returns whether it could be the name of a routine parameter (i.e., whether the name could be returned by `parameter_name_for_category()`).

  classmethod parameter_for_category(category: Literal['Geodatabase', 'General Feature Class', 'Address Point', 'Road Centerline']) → Parameter

    Creates an instance of `arcpy.Parameter` containing options for each routine in a given validation category.

  classmethod parameter_name_for_category(category: Literal['Geodatabase', 'General Feature Class', 'Address Point', 'Road Centerline']) → str

    Generates a name for a geoprocessing parameter for category.

  classmethod parameters_for_all_categories() → list[Parameter]

    Generates geoprocessing parameters for all values of `ValidationCategory`.

  classmethod populate_parameter_value_table(routine_parameter: Parameter, select_all: bool = False) → None

    Given a parameter, populates its value table. The value table will have one row for each routine in the parameter’s category. Each row will contain:

    - [0] - The name of the routine

    - [1] - The argument provided for select_all

  _registered_routines: ClassVar[dict[str, Self]] = {'Check Address Range Directionality': ValidationRoutine(name='Check Address Range Directionality', category='Road Centerline', routine_function=<function NG911Validator.check_address_range_directionality_routine>, takes_feature_class_argument=False, required_feature_classes=frozenset({<NG911FeatureClass 'road_centerline'>})), 'Check Address Ranges': ValidationRoutine(name='Check Address Ranges', category='Road Centerline', routine_function=<function NG911Validator.check_address_ranges_routine>, takes_feature_class_argument=False, required_feature_classes=frozenset({<NG911FeatureClass 'road_centerline'>})), 'Check Attributes Against Domains': ValidationRoutine(name='Check Attributes Against Domains', category='General Feature Class', routine_function=<function NG911Validator.check_attributes_against_domains_routine>, takes_feature_class_argument=True, required_feature_classes=frozenset()), 'Check ESN Attribute (Address Point)': ValidationRoutine(name='Check ESN Attribute (Address Point)', category='Address Point', routine_function=<function NG911Validator.check_esn_attribute_address_point_routine>, takes_feature_class_argument=False, required_feature_classes=frozenset({<NG911FeatureClass 'address_point'>, <NG911FeatureClass 'esz_boundary'>})), 'Check ESN Attribute (Road Centerline)': ValidationRoutine(name='Check ESN Attribute (Road Centerline)', category='Road Centerline', routine_function=<function NG911Validator.check_esn_attribute_road_centerline_routine>, takes_feature_class_argument=False, required_feature_classes=frozenset({<NG911FeatureClass 'esz_boundary'>, <NG911FeatureClass 'road_centerline'>})), 'Check Feature Class Configuration': ValidationRoutine(name='Check Feature Class Configuration', category='Geodatabase', routine_function=<function NG911Validator.check_feature_class_configuration_routine>, takes_feature_class_argument=False, required_feature_classes=frozenset()), 'Check Feature Class List': ValidationRoutine(name='Check Feature Class List', category='Geodatabase', routine_function=<function NG911Validator.check_feature_class_list_routine>, takes_feature_class_argument=False, required_feature_classes=frozenset()), 'Check Geodatabase Domains': ValidationRoutine(name='Check Geodatabase Domains', category='Geodatabase', routine_function=<function NG911Validator.check_geodatabase_domains_routine>, takes_feature_class_argument=False, required_feature_classes=frozenset()), 'Check Next-Gen Against Legacy Fields': ValidationRoutine(name='Check Next-Gen Against Legacy Fields', category='General Feature Class', routine_function=<function NG911Validator.check_next_gen_against_legacy_fields_routine>, takes_feature_class_argument=False, required_feature_classes=frozenset()), 'Check Parities': ValidationRoutine(name='Check Parities', category='Road Centerline', routine_function=<function NG911Validator.check_parities_routine>, takes_feature_class_argument=False, required_feature_classes=frozenset({<NG911FeatureClass 'road_centerline'>})), 'Check RCLMatch': ValidationRoutine(name='Check RCLMatch', category='Address Point', routine_function=<function NG911Validator.check_rclmatch_routine>, takes_feature_class_argument=False, required_feature_classes=frozenset({<NG911FeatureClass 'address_point'>, <NG911FeatureClass 'road_centerline'>})), 'Check Required Field Attributes': ValidationRoutine(name='Check Required Field Attributes', category='General Feature Class', routine_function=<function NG911Validator.check_required_field_attributes_routine>, takes_feature_class_argument=True, required_feature_classes=frozenset()), 'Check Spatial Reference': ValidationRoutine(name='Check Spatial Reference', category='Geodatabase', routine_function=<function NG911Validator.check_spatial_reference_routine>, takes_feature_class_argument=False, required_feature_classes=frozenset()), 'Check Submission Counts': ValidationRoutine(name='Check Submission Counts', category='General Feature Class', routine_function=<function NG911Validator.check_submission_counts_routine>, takes_feature_class_argument=True, required_feature_classes=frozenset()), 'Check Topology': ValidationRoutine(name='Check Topology', category='Geodatabase', routine_function=<function NG911Validator.check_topology_routine>, takes_feature_class_argument=False, required_feature_classes=frozenset()), 'Check Unique ID Format': ValidationRoutine(name='Check Unique ID Format', category='General Feature Class', routine_function=<function NG911Validator.check_unique_id_format_routine>, takes_feature_class_argument=True, required_feature_classes=frozenset()), 'Check Unique ID Frequency': ValidationRoutine(name='Check Unique ID Frequency', category='General Feature Class', routine_function=<function NG911Validator.check_unique_id_frequency_routine>, takes_feature_class_argument=True, required_feature_classes=frozenset()), 'Check Uniqueness (Address Point)': ValidationRoutine(name='Check Uniqueness (Address Point)', category='Address Point', routine_function=<function NG911Validator.check_uniqueness_address_point_routine>, takes_feature_class_argument=False, required_feature_classes=frozenset({<NG911FeatureClass 'address_point'>})), 'Check Uniqueness (Road Centerline)': ValidationRoutine(name='Check Uniqueness (Road Centerline)', category='Road Centerline', routine_function=<function NG911Validator.check_uniqueness_road_centerline_routine>, takes_feature_class_argument=False, required_feature_classes=frozenset({<NG911FeatureClass 'road_centerline'>}))}

    Registry of instances of this class.

  category: Literal['Geodatabase', 'General Feature Class', 'Address Point', 'Road Centerline']

    The category under which the routine should be listed in the geoprocessing tool.

  name: str

    Name of the routine. This is the text that appears in the routine selection box in the geoprocessing tool.

  required_feature_classes: frozenset[NG911FeatureClass]

    The feature classes (as `NG911FeatureClass` instances) that are required to be present in order to successfully execute the routine.

  routine_function: Callable[[NG911Validator], list[ValidationErrorMessage]] | Callable[[NG911Validator, str], list[ValidationErrorMessage]]

    Function that performs the logic for this routine.

  takes_feature_class_argument: bool

    Whether an instance of `NG911FeatureClass` is expected as an argument to `routine_function`.

class _ValidationRoutineProxy(real_routine: ValidationRoutine, validator: NG911Validator)

  Bases: `object`

  Proxy object returned when an instance of `ValidationRoutine` is accessed as a descriptor. Each instance has access to the attributes of the underlying `ValidationRoutine` instance. When called, the proxy calls the underlying `ValidationRoutine` instance with the `NG911Validator` instance to which it is bound as an argument.

  Note

  This class should only ever be instantiated by `ValidationRoutine.__get__()`.

  Changed in version 3.1.0: This class was renamed from `ValidationRoutineProxy`.

  _routine

    Reference to the actual routine instance.

  _validator

    Reference to the validator instance calling the routine.

routine(name: str, category: Literal['Geodatabase', 'General Feature Class', 'Address Point', 'Road Centerline'], takes_feature_class_argument: bool = False, required_feature_classes: Iterable[NG911FeatureClass | str] | None = None) → Callable[[Callable[[NG911Validator], list[ValidationErrorMessage]] | Callable[[NG911Validator, str], list[ValidationErrorMessage]]], ValidationRoutine]

  Decorator factory for generating decorators to be used on instance methods of `NG911Validator` that represent validation routines. This factory function returns a `functools.partial` object that, when used as a decorator, results in an instance of `ValidationRoutine`.

  See also

  The documentation for the attributes of `ValidationRoutine`.

  Parameters:

    - name (str) – Name of the routine

    - category (ValidationCategory) – Category of the routine

    - takes_feature_class_argument (bool) – Whether the routine takes a feature class as an argument

    - required_feature_classes (Iterable[Union[NG911FeatureClass, str]]) – Feature classes (or `role` attribute values thereof) required for the routine to run

  Returns:

    Decorator for a validation routine function

  Return type:

    functools.partial

ALLOW_DUPLICATE_ESN_ATTRIBUTES: Final[bool] = False

  Whether to allow multiple `
  ESZ_BOUNDARY` polygons to have identical `
  ESN` attributes. If this is `True`, then `NG911Validator.check_address_point_esn()` and `NG911Validator.check_road_esn()` will treat `NG911Validator.check_service_field_uniqueness()` as a prerequisite validation.