Skip to content

Specialties Feature

Medical specialty categories (Cardiology, Physical Therapy, Dermatology) to organize your team.

What this enables

Team organization: Categorize your specialists by medical discipline—helps you manage who can do what.

Patient filtering: Patients can browse by specialty ("I want a Cardiologist") to find the right specialist.

Multi-specialty clinics: Run a clinic with Cardiology, PT, and Dermatology all in the same platform, each with their own team.

How it works

  1. Admin creates specialties: "Cardiology", "Physical Therapy", "Dermatology"
  2. Admin assigns specialists: Dr. Smith → Cardiology, Dr. Jones → Physical Therapy
  3. Patients filter by specialty: "Show me available Cardiologists"
  4. System filters: Shows only specialists tagged with Cardiology

Technical Reference

Overview

Specialties are medical specialty categories (e.g., Cardiology, Dermatology, Orthopedics) used to organize specialists and appointment templates within an organization.

Key Concepts

  • Organization-scoped: Each organization maintains its own specialty catalog
  • Specialist association: Specialists can belong to multiple specialties (M:M relationship via specialist_specialties junction table)
  • Appointment template filtering: Templates can be linked to a specific specialty
  • Simple CRUD: Basic create/read/update/delete operations with admin-only mutations

Database Schema

See schema.sql for the complete table definition, including:

  • specialties table with organization_id for multi-tenancy
  • Unique constraint on (slug, organization_id)
  • Indexes for RLS performance
  • Row-Level Security policies (admin-only mutations, org-scoped reads)

Key fields:

  • id (bigserial) - Internal primary key
  • organization_id (bigint) - Organization foreign key
  • title (text) - Display name (e.g., "Cardiology")
  • slug (text) - URL-safe identifier (e.g., "cardiology")
  • created_at, updated_at - Standard timestamps

API Reference

See api.md for complete endpoint documentation.

Endpoints:

  • GET /v1/specialties - List all specialties in current organization
  • POST /v1/specialties - Create specialty (admin only)
  • GET /v1/specialties/{id} - Get specialty with related specialists
  • PUT /v1/specialties/{id} - Update specialty (admin only)
  • DELETE /v1/specialties/{id} - Delete specialty (admin only)
  • Specialists (/docs/features/specialists/) - Specialists link to specialties via specialist_specialties
  • Appointment Templates (/docs/features/appointment-templates/) - Templates can reference a single specialty via specialty_id FK

Implementation Files

Backend implementation (Go):

  • /services/api/internal/handlers/specialty_handlers.go - HTTP request handlers
  • /services/api/internal/services/specialty_service.go - Business logic
  • /services/api/internal/repositories/specialty_repository.go - Database access layer
  • /services/api/internal/routes/specialty_routes.go - Route registration

Database migrations:

  • Migration 000001: Core schema (CREATE TABLE specialties)
  • Migration 000002: Indexes (idx_specialties_org, idx_specialties_slug_org)
  • Migration 000003: RLS policies (specialties_select, specialties_modify)