Implement Multi-Tenant User–Role–Facility Mapping with Healthcare Hierarchy Support

XMLWordPrintable

    • Type: Story
    • Resolution: Unresolved
    • Priority: High
    • 3.8.1
    • Affects Version/s: None
    • Sprint 54, Sprint 55
    • Platform
    • All

      As a Provider Admin I want to create and manage users, roles, facilities, and geographic assignments across multiple healthcare hierarchies (DH → CHC → PHC → SC), so that I can support clinical service delivery, field worker supervision, and ABDM-compliant reporting without breaking existing inventory, MMU, or van operations.

      Technical Analysis Document:

      http://pmp.piramalswasthya.org/confluence/spaces/AMRIT/pages/126025766/HWC+Facility+hierarchy+Route+Cause 

      Requirement Document (BRD):
      https://pmp.piramalswasthya.org/confluence/x/GYAyBg

      Description

      The system must support multi-tenant, provider–state–service–scoped user management using a three-tier architecture while allowing healthcare facility hierarchy integration to coexist with the existing Main Store / Sub Store inventory model.

      Users can have multiple roles, multiple facility assignments, and multi-village coverage, all governed through a central junction table (M_UserServiceRoleMapping2) and scoped via providerServiceMapID.

      The healthcare hierarchy is introduced as an additive, nullable extension to the existing M_Facility entity, ensuring zero disruption to current MMU, inventory, and van workflows.

      Acceptance Criteria

      User Creation & Role Assignment

      • Admin can create a user with basic profile details in M_User1
      • Admin can assign multiple roles to the same user
      • Each role assignment is scoped by providerServiceMapID
      • A user can be mapped to multiple facilities via workingLocationID
      • Soft deletion (deleted = true) is supported for users and mappings
      • JWT-based authentication with Redis-backed session management is enforced

      Facility & Healthcare Hierarchy

      • Admin can create facilities using existing /createStore API
      • Healthcare fields (stateID, districtID, blockID, healthcareLevel, hfrID) are optional
      • Inventory logic continues using storeType
      • Healthcare logic uses healthcareLevel (DH, CHC, PHC, SC)
      • Existing Main Store / Sub Store mapping remains unchanged
      • UI supports healthcare facility selection without affecting inventory UI

      Field Worker & Village Coverage

      • ASHA/ANM users can be assigned to multiple villages
      • Village coverage stored in villageidDb (comma-separated)
      • Field workers are linked to Subcenters via workingLocationID
      • Block-level organization is supported
      • Village assignments remain intact during role updates

      Supervisor & Multi-Facility Coverage

      • Supervisors can be assigned to multiple Subcenters or PHCs
      • Supervisors may overlap across other supervisors’ facilities
      • Supervision hierarchy is implicitly derived from workingLocationID
      • No new hierarchy table is required for supervision logic
      • Multiple mappings for the same user are supported and processed by mapRole()

      Multi-Tenant & Isolation Rules

      • All data access is scoped by providerServiceMapID
      • Users cannot access data outside their provider–state–service boundary
      • Supports multiple providers operating in the same geography
      • Audit trails and soft deletion are preserved

              Assignee:
              Vishwanath Balkur
              Reporter:
              Shashank Kharkwal
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

                Created:
                Updated: