-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #68 from DFE-Digital/elliotcm/add-docs
Add docs for countries/territories and HESA domiciles
- Loading branch information
Showing
4 changed files
with
145 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
## Countries and territories | ||
|
||
- A mapping of ISO country/territory codes to country/territory names. | ||
- Postcode prefixes for the UK and Channel Islands grouped by country/territory. | ||
|
||
### `DfE::ReferenceData::CountriesAndTerritories::COUNTRIES_AND_TERRITORIES` | ||
|
||
```ruby | ||
require 'dfe/reference_data/countries_and_territories' | ||
``` | ||
|
||
A mapping of ISO country/territory codes to country/territory names. | ||
|
||
Owner: Apply team. | ||
|
||
Users: Apply team. | ||
|
||
Source: | ||
https://github.com/DFE-Digital/apply-for-teacher-training/blob/78c9421d8582f63cfdec564b5c0677bfd787552c/config/initializers/countries_and_territories.rb | ||
https://github.com/alphagov/govuk-country-and-territory-autocomplete/blob/5214c44/dist/location-autocomplete-canonical-list.json | ||
|
||
Quality: Manually updated on an ad-hoc basis. Please submit a pull request if inaccuracies or omissions are found. | ||
|
||
This list is [autocomplete compatible](autocomplete_compatability.md). | ||
|
||
| Field | Type | Purpose | | ||
| ------ | ------ | --------------------------------------------------- | | ||
| `id` | string | The country or territory's ISO code | | ||
| `name` | string | The human-readable name of the country or territory | | ||
|
||
### `DfE::ReferenceData::CountriesAndTerritories::UK_AND_CI_POSTCODE_PREFIX_COUNTRIES` | ||
|
||
```ruby | ||
require 'dfe/reference_data/countries_and_territories' | ||
``` | ||
|
||
Postcode prefixes for the UK and Channel Islands grouped by country/territory. | ||
|
||
Owner: Apply team. | ||
|
||
Users: Apply team. | ||
|
||
Source: https://github.com/DFE-Digital/apply-for-teacher-training/blob/78c9421d8582f63cfdec564b5c0677bfd787552c/app/lib/domicile_resolver.rb#L47-L59 | ||
|
||
Quality: Manually updated on an ad-hoc basis. Please submit a pull request if inaccuracies or omissions are found. | ||
|
||
This list is NOT [autocomplete compatible](autocomplete_compatability.md). | ||
|
||
| Field | Type | Purpose | | ||
| ---------- | ------------ | ------------------------------------------ | | ||
| `id` | string | The human readable country/territory name | | ||
| `prefixes` | string array | A list of postcode prefixes (letters only) | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,75 @@ | ||
## HESA domicile data | ||
|
||
- HESA-specific overrides for the countries and territories list. | ||
- HESA-specific overrides for ISO country/territory codes. | ||
- HESA codes for UK and Channel Islands countries/territories. | ||
|
||
### `DfE::ReferenceData::HESA::Domiciles::COUNTRIES_AND_TERRITORIES` | ||
|
||
```ruby | ||
require 'dfe/reference_data/hesa/domiciles' | ||
``` | ||
|
||
HESA-specific overrides for the countries and territories list. Delegates to `DfE::ReferenceData::CountriesAndTerritories::COUNTRIES_AND_TERRITORIES`. | ||
|
||
Owner: Apply team. | ||
|
||
Users: Apply team. | ||
|
||
Source: https://github.com/DFE-Digital/apply-for-teacher-training/blob/78c9421d8582f63cfdec564b5c0677bfd787552c/app/lib/domicile_resolver.rb#L29-L44 | ||
|
||
Quality: Manually updated on an ad-hoc basis. Please submit a pull request if inaccuracies or omissions are found. | ||
|
||
This list is NOT [autocomplete compatible](autocomplete_compatability.md) as it | ||
contains a `nil` value. | ||
|
||
| Field | Type | Purpose | | ||
| ------ | ----------- | --------------------------------------------------- | | ||
| `id` | string | The country or territory's ISO code | | ||
| `name` | string/null | The human-readable name of the country or territory | | ||
|
||
### `DfE::ReferenceData::HESA::Domiciles::SPECIAL_ISO_CODES` | ||
|
||
```ruby | ||
require 'dfe/reference_data/hesa/domiciles' | ||
``` | ||
|
||
HESA-specific overrides for ISO country/territory codes. | ||
|
||
Owner: Apply team. | ||
|
||
Users: Apply team. | ||
|
||
Source: https://github.com/DFE-Digital/apply-for-teacher-training/blob/78c9421d8582f63cfdec564b5c0677bfd787552c/app/lib/domicile_resolver.rb#L3-L12 | ||
|
||
Quality: Manually updated on an ad-hoc basis. Please submit a pull request if inaccuracies or omissions are found. | ||
|
||
This list is NOT [autocomplete compatible](autocomplete_compatability.md). | ||
|
||
| Field | Type | Purpose | | ||
| ------ | ----------- | ------------------------- | | ||
| `id` | string/null | The normal ISO code | | ||
| `code` | string | The special HESA ISO code | | ||
|
||
### `DfE::ReferenceData::HESA::Domiciles::CODES_FOR_UK_AND_CI` | ||
|
||
```ruby | ||
require 'dfe/reference_data/hesa/domiciles' | ||
``` | ||
|
||
HESA codes for UK and Channel Islands countries/territories. | ||
|
||
Owner: Apply team. | ||
|
||
Users: Apply team. | ||
|
||
Source: https://github.com/DFE-Digital/apply-for-teacher-training/blob/78c9421d8582f63cfdec564b5c0677bfd787552c/app/lib/domicile_resolver.rb#L14-L27 | ||
|
||
Quality: Manually updated on an ad-hoc basis. Please submit a pull request if inaccuracies or omissions are found. | ||
|
||
This list is NOT [autocomplete compatible](autocomplete_compatability.md). | ||
|
||
| Field | Type | Purpose | | ||
| ------ | ----------- | ------------------------------------- | | ||
| `id` | string/null | Human-readable country/territory name | | ||
| `code` | string | HESA code | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
23 changes: 17 additions & 6 deletions
23
spec/lib/dfe/reference_data/countries_and_territories_spec.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,22 @@ | ||
require 'dfe/reference_data/countries_and_territories' | ||
|
||
RSpec.describe DfE::ReferenceData::CountriesAndTerritories::COUNTRIES_AND_TERRITORIES do | ||
it_should_behave_like 'a list of valid records' | ||
it_should_behave_like 'a valid autocomplete-capable list' | ||
RSpec.describe DfE::ReferenceData::CountriesAndTerritories do | ||
describe described_class::COUNTRIES_AND_TERRITORIES do | ||
it_should_behave_like 'a list of valid records' | ||
it_should_behave_like 'a valid autocomplete-capable list' | ||
|
||
it 'contains mappings from ISO codes to country names' do | ||
expect(described_class.one('AW').name).to eq('Aruba') | ||
expect(described_class.one('UM-81').name).to eq('Baker Island') | ||
it 'contains mappings from ISO codes to country names' do | ||
expect(described_class.one('AW').name).to eq('Aruba') | ||
expect(described_class.one('UM-81').name).to eq('Baker Island') | ||
end | ||
end | ||
|
||
describe described_class::UK_AND_CI_POSTCODE_PREFIX_COUNTRIES do | ||
it_should_behave_like 'a list of valid records' | ||
|
||
it 'contains mappings from UK and Channel Island country/territory names to lists of postcode prefixes' do | ||
expect(described_class.one('Wales').prefixes).to eq(['CF', 'SA']) | ||
expect(described_class.one('Jersey').prefixes).to eq(['JE']) | ||
end | ||
end | ||
end |