openownership / lib-cove-bods

Check that your data complies with the Beneficial Ownership Data Standard (BODS) using our install our data review library to analyse files via your command line interface
https://datareview.openownership.org/
Other
1 stars 0 forks source link

Additional check: if interestedParty is a string, the interested party MAY be an entity or a person. #129

Open kathryn-ods opened 3 months ago

kathryn-ods commented 3 months ago

Interpretation of this wording - "The interested party MUST be one of: the recordId for an entity, the recordId for a person, or an Unspecified Record object"

Check 1: If interestedParty is a string check interestedParty refers to a recordId

On fail: Error message: interested party must be a recordId for a statement in the data set or an UnspecifiedRecord object. Info message: subject: [VALUE]

Check 2: The recordId in subject refers to an entity statement or person statement

On fail Error message: Interested party is the recordId of a relationship statement. Interested party can only refer to an entity statement or person statement. Info message: subject: [VALUE]

kathryn-ods commented 3 months ago

Valid data 1 - generic test set

[
  {
    "statementId": "1dc0e987-5c57-4a1c-b3ad-61353b66a9b7",
    "declarationSubject": "c359f58d2977",
    "statementDate": "2020-03-04",
    "recordId": "c359f58d2977",
    "recordType": "entity",
    "recordDetails": {
      "isComponent": false,
      "entityType": {
        "type": "registeredEntity"
      }
    }
  },
  {
    "statementId": "019a93f1-e470-42e9-957b-03559861b2e2",
    "declarationSubject": "c359f58d2977",
    "statementDate": "2020-03-04",
    "recordId": "10478c6cf6de",
    "recordType": "person",
    "recordDetails": {
      "isComponent": false,
      "personType": "knownPerson"
    }
  },
  {
    "statementId": "fbfd0547-d0c6-4a00-b559-5c5e91c34f5c",
    "declarationSubject": "c359f58d2977",
    "statementDate": "2020-03-04",
    "recordId": "93b53022ae6a",
    "recordType": "relationship",
    "recordDetails": {
      "isComponent": false,
      "subject": "c359f58d2977",
      "interestedParty": "10478c6cf6de",
      "interests":[
        {
          "beneficialOwnershipOrControl": true
        }
      ]
    }
  }
]

Valid data 2 - interestedParty is an entity

[
  {
    "statementId": "1dc0e987-5c57-4a1c-b3ad-61353b66a9b7",
    "declarationSubject": "c359f58d2977",
    "statementDate": "2020-03-04",
    "recordId": "c359f58d2977",
    "recordType": "entity",
    "recordDetails": {
      "isComponent": false,
      "entityType": {
        "type": "registeredEntity"
      }
    }
  },
  {
    "statementId": "019a93f1-e470-42e9-957b-03559861b2e2",
    "declarationSubject": "c359f58d2977",
    "statementDate": "2020-03-04",
    "recordId": "10478c6cf6de",
    "recordType": "entity",
    "recordDetails": {
      "isComponent": false,
      "entityType": {
        "type": "registeredEntity"
      }
    }
  },
  {
    "statementId": "fbfd0547-d0c6-4a00-b559-5c5e91c34f5c",
    "declarationSubject": "c359f58d2977",
    "statementDate": "2020-03-04",
    "recordId": "93b53022ae6a",
    "recordType": "relationship",
    "recordDetails": {
      "isComponent": false,
      "subject": "c359f58d2977",
      "interestedParty": "10478c6cf6de",
      "interests":[
        {
          "beneficialOwnershipOrControl": false
        }
      ]
    }
  }
]

Invalid data 1 - interestedParty is a string that is not a recordId

[
  {
    "statementId": "1dc0e987-5c57-4a1c-b3ad-61353b66a9b7",
    "declarationSubject": "c359f58d2977",
    "statementDate": "2020-03-04",
    "recordId": "c359f58d2977",
    "recordType": "entity",
    "recordDetails": {
      "isComponent": false,
      "entityType": {
        "type": "registeredEntity"
      }
    }
  },
  {
    "statementId": "019a93f1-e470-42e9-957b-03559861b2e2",
    "declarationSubject": "c359f58d2977",
    "statementDate": "2020-03-04",
    "recordId": "10478c6cf6de",
    "recordType": "entity",
    "recordDetails": {
      "isComponent": false,
      "entityType": {
        "type": "registeredEntity"
      }
    }
  },
  {
    "statementId": "fbfd0547-d0c6-4a00-b559-5c5e91c34f5c",
    "declarationSubject": "c359f58d2977",
    "statementDate": "2020-03-04",
    "recordId": "93b53022ae6a",
    "recordType": "relationship",
    "recordDetails": {
      "isComponent": false,
      "subject": "c359f58d2977",
      "interestedParty": "123",
      "interests":[
        {
          "beneficialOwnershipOrControl": true
        }
      ]
    }
  }
]

Invalid data 2 - interestedParty is the recordId of a relationship statement

[
  {
    "statementId": "1dc0e987-5c57-4a1c-b3ad-61353b66a9b7",
    "declarationSubject": "c359f58d2977",
    "statementDate": "2020-03-04",
    "recordId": "c359f58d2977",
    "recordType": "entity",
    "recordDetails": {
      "isComponent": false,
      "entityType": {
        "type": "registeredEntity"
      }
    }
  },
  {
    "statementId": "019a93f1-e470-42e9-957b-03559861b2e2",
    "declarationSubject": "c359f58d2977",
    "statementDate": "2020-03-04",
    "recordId": "10478c6cf6de",
    "recordType": "entity",
    "recordDetails": {
      "isComponent": false,
      "entityType": {
        "type": "registeredEntity"
      }
    }
  },
  {
    "statementId": "fbfd0547-d0c6-4a00-b559-5c5e91c34f5c",
    "declarationSubject": "c359f58d2977",
    "statementDate": "2020-03-04",
    "recordId": "93b53022ae6a",
    "recordType": "relationship",
    "recordDetails": {
      "isComponent": false,
      "subject": "c359f58d2977",
      "interestedParty": "10478c6cf6de",
      "interests":[
        {
          "beneficialOwnershipOrControl": true
        }
      ]
    }
  },
  {
    "statementId": "cd4c52633f6761962e98e1dd9dbf7da7",
    "declarationSubject": "c359f58d2977",
    "statementDate": "2020-03-04",
    "recordId": "",
    "recordType": "relationship",
    "recordDetails": {
      "isComponent": false,
      "subject": "c359f58d2977",
      "interestedParty": "93b53022ae6a",
      "interests":[
        {
          "beneficialOwnershipOrControl": true
        }
      ]
    }
  }
]