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: componentRecords is an array of recordIds #126

Closed kathryn-ods closed 1 month ago

kathryn-ods commented 3 months ago

Check: all items in a componentRecords array are recordIds present in the data set.

On fail:

Check if the failing value is a statementId

If yes: Error message: Component record entry is a statement Id. Component record entries must be record Ids Info message: Component record (componentRecords): [VALUE]

If no: Error message: Component record entries must be record Ids present in the data set. Info message: Component record (componentRecords): [VALUE]

kathryn-ods commented 3 months ago

Valid data

[
  {
    "statementId": "8729fec1-eb01-4866-ba40-dd5525d43db8",
    "declarationSubject": "ad3f6c2fcc9e",
    "statementDate": "2018-12-17",
    "recordId": "ad3f6c2fcc9e",
    "recordStatus": "new",
    "recordType": "entity",
    "recordDetails": {
      "isComponent": false,
      "entityType": {
        "type": "registeredEntity"
      }
    }
  },
  {
    "statementId": "e2bbe3ce-f5b4-42d0-bb68-9b405e8fd6a0",
    "declarationSubject": "ad3f6c2fcc9e",
    "statementDate": "2018-12-17",
    "recordId": "d4ab89ea169a",
    "recordStatus": "new",
    "recordType": "entity",
    "recordDetails": {
      "isComponent": true,
      "entityType": {
        "type": "registeredEntity"
      }
    }
  },
  {
    "statementId": "6b9cfb52-505a-49cb-ab02-cc856a4e5c66",
    "declarationSubject": "ad3f6c2fcc9e",
    "statementDate": "2018-12-17",
    "recordId": "c25d4d612c2c",
    "recordStatus": "new",
    "recordType": "person",
    "recordDetails": {
      "isComponent": false,
      "personType": "knownPerson"
    }
  },
  {
    "statementId": "7fff3986-233f-413f-bec8-3b28c62a4a51",
    "declarationSubject": "ad3f6c2fcc9e",
    "statementDate": "2018-12-17",
    "recordId": "4cf2837bd01f",
    "recordStatus": "new",
    "recordType": "relationship",
    "recordDetails": {
      "isComponent": true,
      "subject": "ad3f6c2fcc9e",
      "interestedParty": "d4ab89ea169a"
    }
  },
  {
    "statementId": "860155d1-a4fb-4742-9735-7a7deb899075",
    "declarationSubject": "ad3f6c2fcc9e",
    "statementDate": "2018-12-17",
    "recordId": "05e81af035e4",
    "recordStatus": "new",
    "recordType": "relationship",
    "recordDetails": {
      "isComponent": true,
      "subject": "d4ab89ea169a",
      "interestedParty": "c25d4d612c2c"
    }
  },
  {
    "statementId": "cdb6acc7-426e-4a7a-9410-895d556fd329",
    "declarationSubject": "ad3f6c2fcc9e",
    "statementDate": "2018-12-17",
    "recordId": "d8d75ccf40e4",
    "recordStatus": "new",
    "recordType": "relationship",
    "recordDetails": {
      "isComponent": false,
      "subject": "ad3f6c2fcc9e",
      "interestedParty": "c25d4d612c2c",
      "componentRecords": [
        "d4ab89ea169a",
        "4cf2837bd01f",
        "05e81af035e4"
      ]
    }
  }
]

Invalid data 1 - statementId

[
  {
    "statementId": "8729fec1-eb01-4866-ba40-dd5525d43db8",
    "declarationSubject": "ad3f6c2fcc9e",
    "statementDate": "2018-12-17",
    "recordId": "ad3f6c2fcc9e",
    "recordStatus": "new",
    "recordType": "entity",
    "recordDetails": {
      "isComponent": false,
      "entityType": {
        "type": "registeredEntity"
      }
    }
  },
  {
    "statementId": "e2bbe3ce-f5b4-42d0-bb68-9b405e8fd6a0",
    "declarationSubject": "ad3f6c2fcc9e",
    "statementDate": "2018-12-17",
    "recordId": "d4ab89ea169a",
    "recordStatus": "new",
    "recordType": "entity",
    "recordDetails": {
      "isComponent": true,
      "entityType": {
        "type": "registeredEntity"
      }
    }
  },
  {
    "statementId": "6b9cfb52-505a-49cb-ab02-cc856a4e5c66",
    "declarationSubject": "ad3f6c2fcc9e",
    "statementDate": "2018-12-17",
    "recordId": "c25d4d612c2c",
    "recordStatus": "new",
    "recordType": "person",
    "recordDetails": {
      "isComponent": false,
      "personType": "knownPerson"
    }
  },
  {
    "statementId": "7fff3986-233f-413f-bec8-3b28c62a4a51",
    "declarationSubject": "ad3f6c2fcc9e",
    "statementDate": "2018-12-17",
    "recordId": "4cf2837bd01f",
    "recordStatus": "new",
    "recordType": "relationship",
    "recordDetails": {
      "isComponent": true,
      "subject": "ad3f6c2fcc9e",
      "interestedParty": "d4ab89ea169a"
    }
  },
  {
    "statementId": "860155d1-a4fb-4742-9735-7a7deb899075",
    "declarationSubject": "ad3f6c2fcc9e",
    "statementDate": "2018-12-17",
    "recordId": "05e81af035e4",
    "recordStatus": "new",
    "recordType": "relationship",
    "recordDetails": {
      "isComponent": true,
      "subject": "d4ab89ea169a",
      "interestedParty": "c25d4d612c2c"
    }
  },
  {
    "statementId": "cdb6acc7-426e-4a7a-9410-895d556fd329",
    "declarationSubject": "ad3f6c2fcc9e",
    "statementDate": "2018-12-17",
    "recordId": "d8d75ccf40e4",
    "recordStatus": "new",
    "recordType": "relationship",
    "recordDetails": {
      "isComponent": false,
      "subject": "ad3f6c2fcc9e",
      "interestedParty": "c25d4d612c2c",
      "componentRecords": [
        "860155d1-a4fb-4742-9735-7a7deb899075",
        "4cf2837bd01f",
        "05e81af035e4"
      ]
    }
  }
]

Invalid data 2 - random string

[
  {
    "statementId": "8729fec1-eb01-4866-ba40-dd5525d43db8",
    "declarationSubject": "ad3f6c2fcc9e",
    "statementDate": "2018-12-17",
    "recordId": "ad3f6c2fcc9e",
    "recordStatus": "new",
    "recordType": "entity",
    "recordDetails": {
      "isComponent": false,
      "entityType": {
        "type": "registeredEntity"
      }
    }
  },
  {
    "statementId": "e2bbe3ce-f5b4-42d0-bb68-9b405e8fd6a0",
    "declarationSubject": "ad3f6c2fcc9e",
    "statementDate": "2018-12-17",
    "recordId": "d4ab89ea169a",
    "recordStatus": "new",
    "recordType": "entity",
    "recordDetails": {
      "isComponent": true,
      "entityType": {
        "type": "registeredEntity"
      }
    }
  },
  {
    "statementId": "6b9cfb52-505a-49cb-ab02-cc856a4e5c66",
    "declarationSubject": "ad3f6c2fcc9e",
    "statementDate": "2018-12-17",
    "recordId": "c25d4d612c2c",
    "recordStatus": "new",
    "recordType": "person",
    "recordDetails": {
      "isComponent": false,
      "personType": "knownPerson"
    }
  },
  {
    "statementId": "7fff3986-233f-413f-bec8-3b28c62a4a51",
    "declarationSubject": "ad3f6c2fcc9e",
    "statementDate": "2018-12-17",
    "recordId": "4cf2837bd01f",
    "recordStatus": "new",
    "recordType": "relationship",
    "recordDetails": {
      "isComponent": true,
      "subject": "ad3f6c2fcc9e",
      "interestedParty": "d4ab89ea169a"
    }
  },
  {
    "statementId": "860155d1-a4fb-4742-9735-7a7deb899075",
    "declarationSubject": "ad3f6c2fcc9e",
    "statementDate": "2018-12-17",
    "recordId": "05e81af035e4",
    "recordStatus": "new",
    "recordType": "relationship",
    "recordDetails": {
      "isComponent": true,
      "subject": "d4ab89ea169a",
      "interestedParty": "c25d4d612c2c"
    }
  },
  {
    "statementId": "cdb6acc7-426e-4a7a-9410-895d556fd329",
    "declarationSubject": "ad3f6c2fcc9e",
    "statementDate": "2018-12-17",
    "recordId": "d8d75ccf40e4",
    "recordStatus": "new",
    "recordType": "relationship",
    "recordDetails": {
      "isComponent": false,
      "subject": "ad3f6c2fcc9e",
      "interestedParty": "c25d4d612c2c",
      "componentRecords": [
        "d4ab89ea169a",
        "123",
        "05e81af035e4"
      ]
    }
  }
]