Departments
A complete guide to the Departments module — creating and managing clinic departments, assigning department heads, budgets, and linking staff, patients, and services.
Written By Dev010
Last updated 19 days ago
The Departments module organizes your clinic into distinct operational units. Departments act as a grouping layer across the platform — patients, services, staff, expenses, and lab tests can all be assigned to a department, giving you structured visibility into how each part of your clinic operates.
Accessing the Module
Sidebar → Departments
Direct URL:
https://yourdomain.com/dashboard/departmentsWho can access:
Only Admin accounts can create, edit, or delete departments. All other roles have view-only access.
Departments List
The main departments page shows a complete list of all clinic departments.
Each row displays:
Department name
Department code
Head of department
Location
Phone
Status badge (active / inactive)
Budget
Action buttons (edit, delete)
Creating a Department
Click the Add Department button on the departments list page. A dialog opens with the department creation form.
Required Fields
Optional Fields
Identity:
Location and Contact:
Leadership:
Financial:
Status:
Saving the Department
Click Save to create the department. It appears immediately in the departments list and becomes available as a department option across the platform — in patients, services, staff, expenses, and lab test categories.
Department names must be unique. Attempting to create two departments with the same name will return a validation error.
Editing a Department
Click the Edit button on any department row. The edit form opens with all existing values pre-filled.
Update any fields and click Save. Changes take effect immediately across all linked records.
Changing a department name updates the name everywhere it is displayed across the platform since all references use the department ID (UUID), not the name string.
Department Head Assignment
The department head can be recorded in two ways:
Option A — Free text (Head of Department): Enter the department head's name as plain text. This is a simple label with no system link.
Option B — Linked user (Head ID): Link the department head to an actual user account in the system by selecting from the users list.
Linking to a user account creates a formal FK relationship (departments.head_id → users.id) that can be used in reporting queries to identify which staff member leads each department.
Both fields can be used simultaneously — the free text name for display and the user ID for system queries. If the linked user is deleted,
head_idis set to null automatically (ON DELETE SET NULL).
Budget Tracking
Each department has two budget fields:
These are informational fields — CareNova does not automatically enforce spending limits against the budget values. They are used for reference and can be compared against actual expenses using the Expenses module.
Comparing Budget vs Actual Spend
To see how a department's actual expenses compare to its budget:
Sidebar → Expenses
Filter expenses by department
Sum the expense amounts for the period
Compare against the department's budget value in the Departments list
A future version of CareNova may include automatic budget vs expense reporting at the department level. For now this comparison is done manually.
Deactivating a Department
If a department is being closed or restructured but has existing records linked to it, deactivate it rather than deleting it.
Edit the department → toggle Active to off → Save.
Deactivated departments:
Are hidden from assignment dropdowns across the platform
Preserve all historical links to patients, services, staff, and expenses
Can be reactivated at any time
Deleting a Department
Click the Delete option from the department row action menu.
A confirmation dialog appears before deletion.
⚠️ Deleting a department sets
department_idto null on all linked records — patients, services, staff, expenses, users, and test categories (ON DELETE SET NULL). The linked records themselves are preserved but lose the department reference. Deactivate instead of delete when historical records exist.
Department Dependencies
Departments are referenced across many modules. Before deleting or restructuring a department, be aware of what is linked to it:
Database Schema Reference
departments
Relationship to Other Modules
Workflow Examples
Setting up departments for a new multi-specialty clinic:
Sidebar → Departments → Add Department
Create: General Medicine
Code: GEN
Location: Floor 1
Annual Budget: 50,000
Create: Dental
Code: DENT
Location: Floor 2
Annual Budget: 75,000
Create: Radiology
Code: RAD
Location: Basement
Annual Budget: 40,000
Create: Laboratory
Code: LAB
Location: Floor 1, Wing B
Annual Budget: 30,000
Departments are now available for assignment across patients, services, and staff
Assigning a department head:
Sidebar → Departments
Find the department → Edit
In Head of Department — enter the doctor's name
In Head ID — select the doctor's user account
Save — department head is now formally recorded
Reviewing department expenses against budget:
Note the department's budget from the departments list
Sidebar → Expenses
Filter by the department
Review total expenses for the current period
Compare against budget to assess spending
Restructuring — merging two departments:
Reassign all staff from the old department to the new one via Sidebar → Staff
Reassign all patients via Sidebar → Patients
Update services via Sidebar → Services
Deactivate the old department — do not delete if historical expenses exist
Troubleshooting
Department name already exists error:
Department names must be unique across the system
Check the existing departments list for a duplicate name
Use a more specific name (e.g. "Dental - Pediatric" instead of "Dental")
Department not appearing in patient or service dropdowns:
Confirm the department is set to Active
Hard refresh the browser after activating a department
Cannot create or edit departments:
Department management is restricted to Admin role only
Doctor, Receptionist, and Nurse accounts have view-only access
Head ID dropdown is empty:
No user accounts exist in the system yet — create user accounts first via the signup flow or manually in Supabase
Confirm users have
approved_atset — pending users may not appear in the dropdown
Deleting department causes missing department on records:
This is expected behavior — ON DELETE SET NULL removes the department reference from linked records when a department is deleted
Always deactivate rather than delete departments that have historical records attached
Next Step
Continue to the Inventory module guide to learn how to manage medical supplies, track stock levels, and handle low stock alerts in CareNova.