FHIR icon indicating copy to clipboard operation
FHIR copied to clipboard

Enforce (optional/configurable) uniqueness of resource identifier values

Open punktilious opened this issue 2 years ago • 0 comments

Is your feature request related to a problem? Please describe. Currently the LinuxForHealth FHIR Server does not enforce uniqueness for identifier values - multiple resources can therefore have the same value, and searches using identifiers may return multiple resources.

In addition, it is possible to encounter a race condition when using If-None-Exist. Two threads may each create their own instance of a resource (using server-assigned ids).

Describe the solution you'd like Consider a configuration-based approach to enforcing uniqueness for certain identifiers. The configuration could be based on resource type, the identifier system, or some combination of the two.

Describe alternatives you've considered Accept the existing non-deterministic behaviour, and leave it to the client to identify and resolve resolve issues where a resource was stored more than once.

Acceptance Criteria

  1. GIVEN [a precondition] AND [another precondition] WHEN [test step] AND [test step] THEN [verification step] AND [verification step]

Additional context https://chat.fhir.org/#narrow/stream/179166-implementers/topic/Enforcing.20unique.20identifiers.3F

See the above chat for debate on this. There is clearly a race condition here, but there are also use cases which require multiple resources to share the same identity value. Any solution therefore needs to be configurable. Changing the configuration after data has already been ingested may cause problems. Some tooling is required to support the update of any indexes and identify which records violate any new uniqueness constraints.

punktilious avatar Jul 12 '22 13:07 punktilious