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: isComponent and relationship statements #134

Closed kathryn-ods closed 1 month ago

kathryn-ods commented 3 months ago

Check:

Where isComponent is 'true': (1) the recordId of this secondary Relationship Statement MUST be an element in the componentRecords array of that primary Relationship Statement

and

(2) this Relationship Statement MUST come before that primary Relationship Statement in a BODS package or stream

On fail: Error message - Statement is set as component of primary relationship statement. The record identifier of this Statement must be in the Component Statements array of the primary statement. Component Statements must be before the primary Relationship Statement in the statement series. Info message - Statement identifier [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 - record id not in array

[
  {
    "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",
        "05e81af035e4"
      ]
    }
  }
]

Invalid data 2 - component statement after primary statement

[
  {
    "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": "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"
      ]
    }
  },
  {
    "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"
    }
  }
]