Skip to main content
`Ctrl`+`K`

# `legacy.yml`

YAML File | `legacy.yml`
Schema File | `legacyschema.json`
Loader Class | `yaml.SafeLoader`
Python Module | `ng911ok.lib.legacy`
Python Class | `LegacyFieldInfo`

## YAML Structure

The root object is a mapping with the no tag applied.

### Top-Level Keys

`directions` | Mapping of next-gen (unabbreviated) directions to legacy (abbreviated) directions.
`street_types` | Mapping of next-gen (unabbreviated) street types to legacy (abbreviated) street types. The keys (next-gen) are unique, but the values (legacy) may by duplicated.
`fields` | Sequence of mappings, each representing a legacy/next-gen field pair. Each mapping should have `next_gen` and `legacy` keys set to the `role` attributes of the relevant fields, a `concatenation` key indicating whether the fields are intended to be contatenations of other fields, an `equal` key indicating whether the values of the two fields should be equal, and, if relevant, a `value_map` key referencing the `directions` or `street_types` top-level keys via anchor.

### Tags

No tags are used in `legacy.yml`.

### Anchors

`&directions_value_map` | Reference to the `directions` top-level key. Intended for use in the `value_map` keys of mappings under the `fields` top-level key.
`&street_types_value_map` | Reference to the `street_types` top-level key. Intended for use in the `value_map` keys of mappings under the `fields` top-level key.

## Python Implementation

### The `LegacyFieldInfo` Class

The data from the YAML file can be obtained by calling `LegacyFieldInfo.load()`, which will return a `list` of `LegacyFieldInfo` objects. Alternatively, data for a specific field can be obtained via `LegacyFieldInfo.for_field()`.