Skip to main content

Utilities to manage appointment workflows including approval, rejection, cancellation, audit logging, and conflict detection.

Project description

Appointment Workflow Manager

appointment-workflow-manager is a Python package designed to simplify and standardize the management of appointment workflows in Django applications. It provides utilities for managing appointment approvals, rejections, cancellations, auditing status changes, and conflict detection.


Features

  • Workflow Management:

    • Approve, reject, or cancel appointments.
    • Automatically update appointment status and manage notifications.
  • Audit Logging:

    • Log status changes of appointments with timestamps.
    • Helps maintain a historical record of changes for reporting and debugging.
  • Conflict Detection:

    • Detect overlapping or conflicting appointments for the same user.
    • Prevent scheduling conflicts during appointment creation.
  • Reusable Logic:

    • Encapsulates complex business logic into a reusable package for modular and maintainable code.

Installation

To install the package, use pip:

pip install appointment-workflow-manager

Usage

1. Workflow Management

The AppointmentWorkflowManager class simplifies appointment workflows such as approval, rejection, and cancellation.

Approving an Appointment

from appointment_workflow_manager.workflow_manager import AppointmentWorkflowManager

appointment = Appointment.objects.get(id=1)  # Fetch an appointment instance
AppointmentWorkflowManager.approve(appointment)
from appointment_workflow_manager.workflow_manager import AppointmentWorkflowManager

appointment = Appointment.objects.get(id=1)  # Fetch an appointment instance
AppointmentWorkflowManager.reject(appointment, "Customer unavailable")
from appointment_workflow_manager.workflow_manager import AppointmentWorkflowManager

appointment = Appointment.objects.get(id=1)  # Fetch an appointment instance
AppointmentWorkflowManager.cancel(appointment)

###Conflict Detection ####The ConflictChecker class detects overlapping or conflicting appointments. ####Checking for Appointment Conflicts

from appointment_workflow_manager.conflict_checker import ConflictChecker

# Appointment details
appointment_date = datetime.date(2024, 11, 20)
appointment_time = datetime.time(10, 0)  # 10:00 AM
duration_minutes = 60  # 1-hour duration

# Check for conflicts
if ConflictChecker.has_conflicts(user=request.user, appointment_date=appointment_date, appointment_time=appointment_time, duration_minutes=duration_minutes):
    print("Conflict detected! Please choose another time.")
else:
    print("No conflicts. Proceed with appointment creation.")

###Audit Logging ####The AuditLogger class tracks changes in appointment statuses for historical records or debugging.

####Logging Status Changes

from appointment_workflow_manager.audit_logger import AuditLogger

# Log a status change for an appointment
AuditLogger.log_status_change(
    user=request.user, 
    appointment=appointment, 
    old_status="pending", 
    new_status="approved"
)

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

appointment-workflow-manager-0.2.1.tar.gz (3.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

appointment_workflow_manager-0.2.1-py3-none-any.whl (4.3 kB view details)

Uploaded Python 3

File details

Details for the file appointment-workflow-manager-0.2.1.tar.gz.

File metadata

File hashes

Hashes for appointment-workflow-manager-0.2.1.tar.gz
Algorithm Hash digest
SHA256 8a199a8557ccf8112a5b463917bd8e3ed5b7ca6e0e3a08ecdff07ed0fdcf63fc
MD5 62e8887c6fb39e8e7e17b22c03469963
BLAKE2b-256 8bd5f3b3155a4238006d870bad9e4c753680a6de8b561ea31a4ed744b256e0f3

See more details on using hashes here.

File details

Details for the file appointment_workflow_manager-0.2.1-py3-none-any.whl.

File metadata

File hashes

Hashes for appointment_workflow_manager-0.2.1-py3-none-any.whl
Algorithm Hash digest
SHA256 8dc9e4e12965a27b7782b8cd1ca7686ecf69ab84bbf7fe8e0dcac4876aa64257
MD5 c698832977213d22588914cfcb5e499b
BLAKE2b-256 62123e98ed20410e4213305f0f19fdf28844fb1deb9c318122e5f0de0ab2b49b

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page