Skip to content

Enforce uniqueness of Partij #267

Closed
@mariusvandam

Description

@mariusvandam

Thema / Theme

Klantinteracties API

Omschrijving / Description

It is currently possible to create multiple identical Partij Identificator records for the same 'Partij'

As a replacement story for #241 we should create a more intelligent enforcement of uniqueness for partij. Depending on the used identificatoren for a Partij, different logic should be applied to make sure a single Partij is only created once.

  1. Any bsn can only be occur once (natural persons)
  2. A kvkNummer without a vestigingsnummer can only occur once (representing the "niet natuurlijk persoon" in general, separate from any concrete vestiging)
  3. A combination of kvkNummer AND vestigingsnummer can only occur once (vestigingen, disambiguated according to their associated parent entity)
  4. A Partij can never have a vestigingsnummer assigned without a kvkNummer being assigned at the same time

This will almost certainly require some kind of bulk creation/deletion of identificatoren, to avoid to avoid intermediate states which would violate these invariants (e.g. if there's already a Partij with 1 kvkNummer, you would have to provide both kvkNummer and vestigingsnummer together for a second Partij you might want to create to represent a vestiging separately from the generic niet-natuurlijk persoon).

It would also require being able to filter the Partij resource on an array of identificator values (to filter a list down to a specific kvk/vestigingsnummer pairing (ideally using the identificator register/objecttype/id values directly, to avoid having to first fetch the partij identificatoren and filter on the identificator UUIDs).

Toegevoegde waarde / Added value

The value of an identificator should be that it actually functions as a unique identifier, both for developer experience (no difficult-to-resolve edge-cases to handle), but it would also improve the data quality (less chance of spurious duplicates). This would be complementary to #233 . Specifically it is important that there is no ambiguity when referring to vestigingen, where two vestigingen may have the same number but different parent kvkNummer entities.

Aanvullende opmerkingen / Additional context

No response

Metadata

Metadata

Projects

  • Status

    Done

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions