Skip to content

Duplicate organisations created when multiple colleagues sign up independently #666

Description

@Joe-Heffer-Shef

Problem

Multiple colleagues from the same NHS Trust can independently create separate Organisation records with the same (or nearly the same) name, because organisation creation has no duplicate check and there is no way for a user to join an existing organisation instead of creating a new one.

How it happens

  1. A user at an NHS Trust signs up and creates an organisation (e.g. "Sheffield Teaching Hospitals NHS Foundation Trust").
  2. Before they get around to inviting their colleagues, one or more of those colleagues also sign up independently and each create their own organisation with the same or a very similar name.
  3. The result is several distinct Organisation rows in the database that all represent the same real-world Trust, each with only one member.

Impact

  • Each duplicate organisation is a completely separate Organisation object (see home/models.py), so:
    • Users in different duplicate orgs cannot see or share each other's Project/Survey data, even though they belong to the same real organisation.
    • Invitations sent by one colleague only add members to their organisation, not to the others.
  • The app currently has no organisation switcher — a user only ever sees their first associated organisation (User.organisation_set.all() is used without any selection UI, e.g. User.projects_iter() in home/models.py). If a user ends up in more than one organisation (e.g. after a manual merge, or if they were separately invited into two of the duplicates), they cannot choose or even see the "other" organisation from the UI.
  • There is currently no admin/staff tooling to detect or merge duplicate organisations. The only workaround today is manual: a staff member identifies the duplicates and deletes the redundant Organisation rows directly.

Current workaround

Redundant organisations are currently being cleaned up manually (identified and deleted) on an ad-hoc basis when noticed. This is not scalable and risks data loss if a redundant org has already accumulated projects/surveys/members before it's spotted.

Root cause

  • Organisation.name (home/models.py) has no uniqueness constraint and no fuzzy-duplicate check at creation time.
  • There is no join-existing-organisation flow — the only path into an organisation is either creating a new one or being invited by an existing member, so a user with no invitation has no way to discover and request access to an org that already exists for their Trust.

Metadata

Metadata

Labels

No labels
No labels

Type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions