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

Addditional check: share object values in interests #112

Closed kd-ods closed 1 month ago

kd-ods commented 3 months ago

This is a bit of a minefield. I've tried to rationalise what tests we do.

Specification for Check(s):

Check 1:

That in each interest object in a Relationship statement, if a value for share.exact exists, then no values exist for share.exclusiveMinimum, share.minimum, share.maximum, or share.exclusiveMaximum.

On fail:

On pass:

Check 2:

That in each interest object in a Relationship statement, if both the following exist:

(a) EITHER a value for share.exclusiveMinimum OR a value for share.minimum (not both) and (b) EITHER a value for share.maximum OR a value for share.exclusiveMaximum (not both).

Then assign value (a) to minVal, and assign value (b) to maxVal.

Check that maxVal >= minVal

On fail:

On pass:

Check 3:

That maxVal != minVal

On fail:

kathryn-ods commented 3 months ago

wondering if there's a case where we might allow minimum=maximum? This would effectively be the same as having an exact value as these are both inclusive. Maybe there's a scenario where that would make sense in some cases? Will proceed as that not being allowed but noting as a thought here.

kathryn-ods commented 3 months ago

I've done quite a few files here to get different combos of the options Valid Valid 1 - Check 1

[
  {
    "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":[
        {
          "share":{
            "exact": 88
          }
        }
      ]
    }
  }
]

Valid 2 - check 2/3

[
  {
    "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":[
        {
          "share":{
            "minimum": 88,
            "exclusiveMaximum":99
          }
        }
      ]
    }
  }
]

Valid 3 - check 2/3

[
  {
    "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":[
        {
          "share":{
            "exclusiveMinimum": 88,
            "maximum":99
          }
        }
      ]
    }
  }
]

Invalid Invalid - check 1

[
  {
    "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":[
        {
          "share":{
            "exact": 88,
            "exclusiveMinimum": 12,
            "exclusiveMaximum": 95
          }
        }
      ]
    }
  }
]

Invalid 2 - check 1

[
  {
    "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":[
        {
          "share":{
            "exact": 88,
            "minimum": 12,
            "maximum": 100
          }
        }
      ]
    }
  }
]

Invalid 3 - check 2

[
  {
    "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":[
        {
          "share":{
            "exact": 88,
            "minimum": 12,
            "maximum": 100
          }
        }
      ]
    }
  }
]

Invalid 4 - Check 2

[
  {
    "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":[
        {
          "share":{
            "minimum": 88,
            "exclusiveMaximum":99,
            "maximum": 98
          }
        }
      ]
    }
  }
]

Invalid 5 - check 2

[
  {
    "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":[
        {
          "share":{
            "minimum": 99,
            "maximum": 1
          }
        }
      ]
    }
  }
]

Invalid 6 - check 2

[
  {
    "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":[
        {
          "share":{
            "exclusiveMinimum": 99,
            "exclusiveMaximum": 1
          }
        }
      ]
    }
  }
]

Invalid 7 - check 3

[
  {
    "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":[
        {
          "share":{
            "minimum": 50,
            "exclusiveMaximum": 50
          }
        }
      ]
    }
  }
]

Invalid 8 - check 3

[
  {
    "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":[
        {
          "share":{
            "exclusiveMinimum": 50,
            "maximum": 50
          }
        }
      ]
    }
  }
]