The Medical Specialties module manages the catalogue of clinical disciplines the clinic offers (e.g. Cardiology, Dentistry, General Practice). Each specialty carries two domain-level policy values: a typical encounter duration used as a default when creating appointment types, and a cancellation limit that specifies the minimum advance-notice window within which patients can cancel without incurring a penalty. All commands are validated by FluentValidation before reaching the handler.Documentation Index
Fetch the complete documentation index at: https://mintlify.com/0Crazy-0/ClinicFlow/llms.txt
Use this file to discover all available pages before exploring further.
CancellationLimit Explained
MinCancellationHours defines how many hours before an appointment a patient must cancel to avoid triggering an automatic penalty. Cancellations made within this window are treated as late cancellations by the penalty engine. The allowed values are constrained to CancellationLimit.AllowedHours — a fixed set defined in the domain value object: 0, 12, 24, 48, 72. A value of 0 means no restriction (any cancellation is penalty-free). Providing a value outside that set causes the validator to reject the command with DomainErrors.MedicalSpecialty.InvalidCancellationLimit.
Commands
CreateMedicalSpecialty
Type:IRequest<Guid>
Creates a new active medical specialty. TypicalDurationMinutes is validated against EncounterDuration.IsValid; MinCancellationHours must be a member of CancellationLimit.AllowedHours. Both constraints are enforced in the FluentValidation validator as well as in the domain entity factory method.
Parameters
Display name of the specialty (e.g.
"Cardiology"). Must not be empty.Brief description of the specialty’s scope. Must not be empty.
Indicative appointment length in minutes. Must pass
EncounterDuration.IsValid — invalid durations are rejected with DomainErrors.MedicalSpecialty.InvalidEncounterDuration. Used as a suggested default for appointment type definitions; does not directly drive scheduling.Minimum hours of advance notice required for penalty-free cancellation. Must be a value present in
CancellationLimit.AllowedHours. Rejected with DomainErrors.MedicalSpecialty.InvalidCancellationLimit otherwise.MedicalSpecialty.Id as a Guid.
UpdateMedicalSpecialty
Type:IRequest (returns Unit)
Updates all mutable fields of an existing specialty. Applies the same EncounterDuration and CancellationLimit validation as CreateMedicalSpecialty.
Parameters
Primary key of the specialty to update. Must be a non-empty GUID.
Replacement display name. Must not be empty.
Replacement description. Must not be empty.
New typical duration. Must pass
EncounterDuration.IsValid.New cancellation notice window. Must be a value in
CancellationLimit.AllowedHours.Unit (void).
DeactivateMedicalSpecialty
Type:IRequest (returns Unit)
Soft-deletes a specialty. The domain entity checks two preconditions before marking it deleted: the specialty must not already be inactive (DomainErrors.MedicalSpecialty.AlreadyInactive), and it must have no active doctors assigned to it (DomainErrors.MedicalSpecialty.HasActiveDoctors). These checks are enforced in MedicalSpecialty.Deactivate(bool hasActiveDoctors).
Parameters
The specialty to deactivate. Throws
BusinessRuleValidationException if there are still active doctors assigned to this specialty.Unit (void).
ReactivateMedicalSpecialty
Type:IRequest (returns Unit)
Restores a previously deactivated (soft-deleted) specialty. The domain entity throws BusinessRuleValidationException with DomainErrors.MedicalSpecialty.AlreadyActive if the specialty is not currently inactive.
Parameters
The specialty to reactivate. Must currently be in a soft-deleted state.
Unit (void).
Queries
GetMedicalSpecialtyById
Type:IRequest<MedicalSpecialtyDto>
Fetches a single specialty — active or inactive — by its primary key.
Parameters
The primary key of the specialty to retrieve. Must be a non-empty GUID.
MedicalSpecialtyDto or throws EntityNotFoundException.
GetActiveMedicalSpecialties
Type:IRequest<IReadOnlyList<MedicalSpecialtyDto>>
Returns all specialties that are currently active (not soft-deleted). Used to populate lists in appointment booking flows.
MedicalSpecialtyDto records.
GetAllMedicalSpecialties
Type:IRequest<IReadOnlyList<MedicalSpecialtyDto>>
Returns all specialties including soft-deleted ones. Intended for administrative views where the full catalogue history is needed.
MedicalSpecialtyDto records (active + inactive).
Response Shape
MedicalSpecialtyDto
The unique identifier of the specialty.
The display name of the specialty.
A brief description of the specialty’s clinical scope.
The indicative appointment length in minutes. Used as a suggested default when defining appointment types for this specialty.
The minimum hours of advance notice required for a penalty-free cancellation. Cancellations within this window may trigger an automatic
Warning or TemporaryBlock penalty.true if the specialty has been deactivated (soft-deleted); false if it is currently active.