Overview
The Specialty Management feature enables administrators to define and manage medical specialties within Clínica Vitalis. Specialties are used to categorize professionals and help patients find the right type of healthcare provider for their needs.Data Model
Specialties have a simple but essential structure:Specialty States
- Activa (Active): Specialty is available for assignment to professionals
- Inactiva (Inactive): Specialty is archived and not available for new assignments
Key Features
Create Specialty
Administrators can add new medical specialties to the system:Enter Specialty Name
Provide a descriptive name for the specialty (e.g., “Cardiología”, “Pediatría”).
Specialty names must be unique across the system. This prevents duplicate categories and ensures consistent professional categorization.
Validation Rules
The system enforces validation frombackend/routes/speciality.ts:29-37:
Database Constraints
The specialty model includes important constraints:View Specialties
Specialties can be retrieved in multiple ways:- All specialties: Complete list with active and inactive specialties
- By ID: Specific specialty details
- With Professionals: When viewing professionals, their specialty is included
Update Specialty
Administrators can modify specialty information:Validate Uniqueness
System ensures the new name doesn’t conflict with existing specialties (excluding current one).
When updating a specialty name, the system validates uniqueness while excluding the current specialty from the check.
Professional Integration
Specialties are directly linked to professionals:Assignment
Each professional must be assigned to exactly one specialty when created:Display
When retrieving professionals, specialty information is included:API Endpoints
GET /api/speciality
Retrieve all specialties.
Response:
GET /api/speciality/:id
Retrieve a specific specialty by ID.
Response:
POST /api/speciality
Create a new specialty (Admin only).
Required Fields:
- name
PATCH /api/speciality/:id
Update a specialty (Admin only).
Required Fields:
- name, state
State Management
Inactivating Specialties
When a specialty is no longer offered by the clinic:- Change the specialty state to “Inactive”
- Existing professionals keep their specialty assignment
- New professionals cannot be assigned to inactive specialties
Never delete specialties that have professionals assigned to them. Use the state field to mark them as inactive instead.
Reactivating Specialties
If a specialty is offered again:- Update the state back to “Active”
- The specialty becomes available for new professional assignments
Common Specialties
Typical medical specialties in a clinic:- Medicina General (General Medicine)
- Cardiología (Cardiology)
- Pediatría (Pediatrics)
- Traumatología (Traumatology)
- Dermatología (Dermatology)
- Ginecología (Gynecology)
- Oftalmología (Ophthalmology)
- Odontología (Dentistry)
- Psicología (Psychology)
- Nutrición (Nutrition)
Security
All specialty operations require JWT authentication. Create and update operations are restricted to administrators only.
- GET requests: Authenticated users only
- POST/PATCH requests: Administrator role required
Database Relationships
Specialties connect to:- Professionals (One-to-Many): Each specialty can have multiple professionals
- Appointments (Indirectly): Through professionals, appointments are linked to specialties
Use Cases
Adding New Medical Services
Filtering Professionals by Specialty
Patients and staff can filter professionals by specialty:Reporting and Analytics
Specialties enable useful analytics:- Professional distribution by specialty
- Appointment volume by specialty
- Popular specialties based on booking frequency
- Capacity planning by specialty demand
Best Practices
- Use consistent naming conventions for specialties (e.g., all in Spanish or all in English)
- Keep specialty names clear and specific to avoid confusion
- Use state management instead of deleting specialties
- Validate specialty exists and is active before assigning to professionals
- Group related services under appropriate specialty names
- Review specialty usage periodically to identify unused categories
- Coordinate with medical staff when adding or changing specialties
- Consider patient perspective when naming specialties
