Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Additional check: alternative address is an alternative to another address #123

Closed
kathryn-ods opened this issue Aug 14, 2024 · 5 comments
Closed

Comments

@kathryn-ods
Copy link

Check:
If an address in the addresses array is of type "alternative" then there is also another address in the array with a different type

On fail:

Error message: An alternative address has been provided with no primary address.
Info message: Address: [address VALUE]

@kathryn-ods
Copy link
Author

Original spec "If an address in the addresses array is of type "alternative" then there is also another address in the array"

2 possible edge cases here.

  • I'm thinking it's not valid to have 2 addresses with type 'alternative' so have said it needs to be an address of another type.
  • address.type is not a required field so can you have one address with no type and one alternative? It is sensible to be applying these kind of constraints at all when type isn't a required field??

@kd-ods thoughts?

@kathryn-ods
Copy link
Author

Valid

[
  {
    "statementId": "1dc0e987-5c57-4a1c-b3ad-61353b66a9b7",
    "declarationSubject": "c359f58d2977",
    "statementDate": "2020-03-04",
    "recordId": "c359f58d2977",
    "recordType": "entity",
    "recordDetails": {
      "isComponent": false,
      "entityType": {
        "type": "registeredEntity",
        "addresses": [
          {
            "type": "business", 
            "address": "123"
          },
          {
            "type": "alternative",
            "address": "123"
          }
        ]
      }
    }
  },
  {
    "statementId": "019a93f1-e470-42e9-957b-03559861b2e2",
    "declarationSubject": "c359f58d2977",
    "statementDate": "2020-03-04",
    "recordId": "10478c6cf6de",
    "recordType": "person",
    "recordDetails": {
      "isComponent": false,
      "personType": "knownPerson",
      "addresses": [
        {
          "type": "residence",
          "postCode": "123"
        },
        {
          "type": "alternative",
          "country": {
            "name": "United Kingdom" 
          }
        }
      ]
    }
  }
]

Invalid 1

[
  {
    "statementId": "1dc0e987-5c57-4a1c-b3ad-61353b66a9b7",
    "declarationSubject": "c359f58d2977",
    "statementDate": "2020-03-04",
    "recordId": "c359f58d2977",
    "recordType": "entity",
    "recordDetails": {
      "isComponent": false,
      "entityType": {
        "type": "registeredEntity",
        "addresses": [
          {
            "type": "alternative",
            "address": "123"
          }
        ]
      }
    }
  }
]

Invalid 2

[
  {
    "statementId": "019a93f1-e470-42e9-957b-03559861b2e2",
    "declarationSubject": "c359f58d2977",
    "statementDate": "2020-03-04",
    "recordId": "10478c6cf6de",
    "recordType": "person",
    "recordDetails": {
      "isComponent": false,
      "personType": "knownPerson",
      "addresses": [
        {
          "type": "alternative",
          "postCode": "123"
        }
      ]
    }
  }
]

Edge case 1 - alternative address & address with no type

[
  {
    "statementId": "1dc0e987-5c57-4a1c-b3ad-61353b66a9b7",
    "declarationSubject": "c359f58d2977",
    "statementDate": "2020-03-04",
    "recordId": "c359f58d2977",
    "recordType": "entity",
    "recordDetails": {
      "isComponent": false,
      "entityType": {
        "type": "registeredEntity",
        "addresses": [
          {
            "type": "alternative",
            "address": "123"
          },
          {
            "address": "1234"
          }
        ]
      }
    }
  }
]

Edge case 2 - 2 alternative addresses

[
  {
    "statementId": "019a93f1-e470-42e9-957b-03559861b2e2",
    "declarationSubject": "c359f58d2977",
    "statementDate": "2020-03-04",
    "recordId": "10478c6cf6de",
    "recordType": "person",
    "recordDetails": {
      "isComponent": false,
      "personType": "knownPerson",
      "addresses": [
        {
          "type": "alternative",
          "postCode": "123"
        },
        {
          "type": "alternative",
          "country": {
            "name": "United Kingdom" 
          }
        }
      ]
    }
  }
]

@kd-ods
Copy link
Collaborator

kd-ods commented Aug 19, 2024

@kathryn-ods

Is it sensible to be applying these kind of constraints at all when type isn't a required field??

Good point. tbh, it's made me think that 'alternative' is just an unhelpful code. We should probably turn it into 'other', make the field required and reduce constraints. I can't see that loosening constraints would open up any particular loophole wrt BO verification. (For example, I don't imagine that red-flagging would depend on categorisation of addresses: if a BODS statement from one source categorised an entity's address as 'business' but the same entity's address in another source was categorised as 'other' that would not be of great interest. The address itself is the target of interest.)

Depending on what you think about the above, Kathryn, we may want to NOT work on this check during this round of work, pending a review of address type codes in the data standard.

@kathryn-ods
Copy link
Author

kathryn-ods commented Aug 19, 2024

We should probably turn it into 'other', make the field required and reduce constraints.

Yes I think this is sensible. I'm happy to leave this check out for now.

Do we already have an appropriate ticket to document this suggestion against?

@kathryn-ods
Copy link
Author

I have added a new ticket here openownership/data-standard#725

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

2 participants