# IE Address (ECAF)

ECAF is the Eircode Address File, which holds one record per Irish postal address. English and Irish language versions of each address are indexed separately and distinguished by `language`.

Unavailable elements are returned as an empty string, never `null`. ECAF carries no coordinates, so `longitude` and `latitude` are always empty strings - use `EcadAddress` for geolocated Irish addresses.

## Example Record

| Field                    | Example               | Type     |
| ------------------------ | --------------------- | -------- |
| `id`                     | ecaf\_1700000000\|en  | `string` |
| `dataset`                | ecaf                  | `string` |
| `country_iso`            | IRL                   | `string` |
| `country_iso_2`          | IE                    | `string` |
| `country`                | Ireland               | `string` |
| `language`               | en                    | `string` |
| `line_1`                 | Apartment 4           | `string` |
| `line_2`                 | The Mall              | `string` |
| `line_3`                 | Riverside Way         | `string` |
| `line_4`                 | Midleton              | `string` |
| `line_5`                 | Co. Cork              | `string` |
| `line_6`                 | P25 PR28              | `string` |
| `line_7`                 | Empty in this example | `string` |
| `line_8`                 | Empty in this example | `string` |
| `line_9`                 | Empty in this example | `string` |
| `ecaf_id`                | 1700000000            | `string` |
| `department`             | Empty in this example | `string` |
| `organisation`           | Empty in this example | `string` |
| `sub_building_name`      | Apartment 4           | `string` |
| `building_name`          | Empty in this example | `string` |
| `building_number`        | Empty in this example | `string` |
| `building_group`         | The Mall              | `string` |
| `primary_thoroughfare`   | Riverside Way         | `string` |
| `secondary_thoroughfare` | Empty in this example | `string` |
| `primary_locality`       | Midleton              | `string` |
| `secondary_locality`     | Empty in this example | `string` |
| `tertiary_locality`      | Empty in this example | `string` |
| `post_county`            | Cork                  | `string` |
| `eircode`                | P25 PR28              | `string` |
| `address_reference`      | 4065432740654331      | `string` |
| `longitude`              | Empty in this example | `string` |
| `latitude`               | Empty in this example | `string` |

```json
{
  "id": "ecaf_1700000000|en",
  "dataset": "ecaf",
  "country_iso": "IRL",
  "country_iso_2": "IE",
  "country": "Ireland",
  "language": "en",
  "line_1": "Apartment 4",
  "line_2": "The Mall",
  "line_3": "Riverside Way",
  "line_4": "Midleton",
  "line_5": "Co. Cork",
  "line_6": "P25 PR28",
  "line_7": "",
  "line_8": "",
  "line_9": "",
  "ecaf_id": "1700000000",
  "department": "",
  "organisation": "",
  "sub_building_name": "Apartment 4",
  "building_name": "",
  "building_number": "",
  "building_group": "The Mall",
  "primary_thoroughfare": "Riverside Way",
  "secondary_thoroughfare": "",
  "primary_locality": "Midleton",
  "secondary_locality": "",
  "tertiary_locality": "",
  "post_county": "Cork",
  "eircode": "P25 PR28",
  "address_reference": "4065432740654331",
  "longitude": "",
  "latitude": ""
}
```

Every field is documented below.

## Essential Elements

Standard Republic of Ireland Address format as reported by the Eircode ECAF file.

* `line_1` string

  Address Line One

  Address Line 1

  Example: `Apartment 4`

* `line_2` string

  Address Line Two

  Address Line 2

  Example: `The Mall`

* `eircode` string

  Eircode

  The seven character Eircode has an A65 F4E2 format. The Eircode is a mandatory address element. The last line of a Postal Address will contain the Eircode, displayed with a space. e.g. `A65 F4E2`.

  The Eircode is always the last line of a Postal Address generated within the state, e.g. if an address has four lines then the Eircode will be on its own on Address Line 5. For inbound international mail the country name IRELAND should be appended as the last line of the Postal Address.

  Example: `P25 PR28`

* `country` string

  Country

  Full country names (ISO 3166)

  Example: `Ireland`

  Enum: "Ireland"

## Multi-Line Address Format

Ready to print on envelopes and mailers

* `line_1` string

  Address Line One

  Address Line 1

  Example: `Apartment 4`

* `line_2` string

  Address Line Two

  Address Line 2

  Example: `The Mall`

* `line_3` string

  Address Line Three

  Address Line 3

  Example: `Riverside Way`

* `line_4` string

  Address Line Four

  Address Line 4

  Example: `Midleton`

* `line_5` string

  Address Line Five

  Address Line 5

  Example: `Co. Cork`

* `line_6` string

  Address Line Six

  Address Line 6

  Example: `P25 PR28`

### Address Line Seven

#### Example

* `line_7` string

  Address Line 7

  Example: Empty in this example

* `line_8` string

  Address Line Eight

  Address Line 8

  Example: Empty in this example

* `line_9` string

  Address Line Nine

  Address Line 9

  Example: Empty in this example

## Premise Details

Minute datapoints on the type of building and occupancy

* `building_name` string

  Building Name

  The name given to the building, e.g. `Rose Cottage`. Prepended by sub building, if any, when the sub building does not appear on a line to itself. The building name is omitted if it is the same as either the Organisation or Building Group.

  Example: Empty in this example

* `sub_building_name` string

  Sub-Building Name

  The sub-building refers to an apartment, flat or unit within a building, e.g. `Flat 1`.

  Example: `Apartment 4`

* `building_number` string

  Building Number

  A number associated with the whole building. The building number may have a numeric and an alphanumeric component, which are concatenated e.g. 2A, or alternatively will have a simple building number or a complex building number. The building number always relates to the whole building and not a sub-unit within it. A complex building number may be one of the following:

  * Dual. Two numbers separated by '/' e.g. 63/64 = 63, 64
  * Sequence. An odd or even sequence of numbers with lower and upper bound separated by an underscore '\_' e.g. `1_5` = 1,3,5 and `2_6` = 2,4,6
  * Range. A range of consecutive numbers with lower and upper bound separated by a dash '-' e.g. `63-66` = 63, 64, 65, 66 The building number never appears on a line by itself and can prepend Building Group, Primary Thoroughfare or Primary Locality.

  Example: Empty in this example

* `building_group` string

  Building Group

  A building group is a collection of buildings with a collective name, located on or near the same thoroughfare, e.g. `Marrian Terrace`.

  Example: `The Mall`

## Organisation information

Extract commercial information attached to a property

* `organisation` string

  Organisation

  Organisation name, e.g. `Oak Tree Limited`.

  Example: Empty in this example

* `department` string

  Department

  The department or division within an organisation, e.g. `Accounts Department`. If the department element exists, then the organisation must also exist.

  Example: Empty in this example

## Locality information

* `primary_thoroughfare` string

  Primary Thoroughfare

  The name of the thoroughfare on which premises are located, e.g. `Griffith Road`. It may appear on a line by itself or be appended to either a sub building or building number.

  Addresses with thoroughfares can sometimes have the thoroughfare excluded where a Building Group exists, such as a Retail Centre or Business Park, and the thoroughfare is not part of the Postal Address.

  Example: `Riverside Way`

* `secondary_thoroughfare` string

  Secondary Thoroughfare

  It is never present without a primary thoroughfare. The primary thoroughfare is dependent on the secondary thoroughfare and appears before the secondary thoroughfare in any address.

  Secondary thoroughfare are generally used to assist locating a primary thoroughfare.

  Example: Empty in this example

* `primary_locality` string

  Primary Locality

  First locality elements which can refer to areas, districts, industrial estates, towns, etc.

  The primary locality refers to the specific place the address is.

  In urban areas, the primary locality can be required to distinguish between two thoroughfares of the same name in the same district or town. Industrial estates with named thoroughfares are also held as localities. In rural areas the primary locality is generally a townland name.

  Example: `Midleton`

* `secondary_locality` string

  Secondary Locality

  Never present without a primary locality. The secondary locality has a wider geographic scope than the primary locality.

  It is the secondary locality therefore which differentiates addresses with the same primary locality name within the same county.

  Secondary localities are more likely to be required for rural addresses.

  Second locality elements which can refer to areas, districts, industrial estates, towns, etc

  The secondary locality helps identify where the primary locality is located.

  Example: Empty in this example

* `tertiary_locality` string

  Tertiary Locality

  Also known as the Post Town.

  The name of the post town associated with the premises for postal delivery purposes. This includes Dublin Postal Districts "Dublin 1" to "Dublin 24".

  The post town is a significant element of the Postal Address, however it is not always populated in an address. The official post office guide, Eolaí an Phoist, describes post towns in the following manner:

  "A provincial postal address may include the name of a town or village several miles distant, with which the addressee has little or no connection, and, in some places, especially if this residence happens to be near a county boundary, the name of the neighbouring county instead of the county in which he actually resides. The explanation is that the main mail despatches have to be sent for more detailed sub division to certain centres known as POST TOWNS, chosen because of their accessibility and convenience."

  Example: Empty in this example

## Unique Identifiers

ID numbers to consistently and accurately reference property

* `address_reference` string

  Address Reference

  The address reference is the An Post GeoDirectory address reference identifier used by the Universal Service Provider.

  Example: `4065432740654331`

* `ecaf_id` string

  ECAF ID

  The unique identifier in the ECAF is the `ecaf_id`. This unique identifier allows each address in the ECAF to be uniquely identified. It can also be used as index once the data has been imported into a relational database. This is a numeric field that can store values from 0 to 2,147,483,647. It is represented as a number up to 10 digits long. All other fields in ECAF are alphanumeric.

  Example: `1700000000`

* `dataset` string

  Dataset

  Source of address

  Example: `ecaf`

## Miscellaneous

* `country_iso` string

  Country ISO

  3 letter country code (ISO 3166-1)

  Example: `IRL`

  Enum: "IRL"

* `country_iso_2` string

  Country ISO 2

  2 letter country code (ISO 3166-1)

  Example: `IE`

  Enum: "IE"

* `language` string

  Language

  Language represented by 2 letter ISO Code (639-1)

  Example: `en`

  Enum: "en", "ga"
