hospital-management/TEMPLATE_REVIEW_DECISIONS.md
Marwan Alwali 263292f6be update
2025-11-04 00:50:06 +03:00

7.9 KiB

APPOINTMENTS APP - TEMPLATE REVIEW DECISIONS

Review Date: January 8, 2025
Reviewer: Cline AI Assistant
Purpose: Determine fate of potentially unused templates


EXECUTIVE SUMMARY

Reviewed 11 templates to determine if they should be:

  • KEEP & CREATE VIEW - Template is comprehensive and useful
  • KEEP & LINK - Template exists, view exists, just needs URL connection
  • DELETE - Functionality duplicated elsewhere

DETAILED DECISIONS

1. appointments/no_show_appointment.html KEEP & CREATE VIEW

Status: Comprehensive template, NO view exists

Template Quality: EXCELLENT

  • 300+ lines of well-structured HTML
  • Complete no-show documentation form
  • Policy guidelines included
  • Contact attempt tracking
  • No-show fee calculation
  • Patient impact documentation

Decision: CREATE VIEW

Recommended View:

@login_required
@permission_required('appointments.change_appointmentrequest')
def no_show_appointment(request, pk):
    """Mark appointment as no-show with documentation."""
    tenant = request.user.tenant
    appointment = get_object_or_404(
        AppointmentRequest,
        pk=pk,
        tenant=tenant
    )
    
    if request.method == 'POST':
        # Process no-show form
        appointment.status = 'NO_SHOW'
        appointment.no_show_time = timezone.now()
        appointment.no_show_documented_by = request.user
        appointment.no_show_notes = request.POST.get('no_show_notes', '')
        appointment.no_show_fee = request.POST.get('no_show_fee', 25.00)
        appointment.save()
        
        messages.success(request, 'Appointment marked as no-show.')
        return redirect('appointments:appointment_detail', pk=pk)
    
    return render(request, 'appointments/no_show_appointment.html', {
        'appointment': appointment
    })

URL Pattern:

path('<int:pk>/no-show/', views.no_show_appointment, name='no_show_appointment'),

Status: Template exists, Views exist (check_in_patient and check_in_appointment)

Template Quality: EXCELLENT

  • Comprehensive check-in form
  • Verification checklist
  • Insurance validation
  • Special needs tracking
  • Patient alerts display

Decision: LINK EXISTING VIEW TO TEMPLATE

Action Required:

  1. Verify which view (check_in_patient or check_in_appointment) should use this template
  2. Update the view to render 'appointments/check_in_patient.html'
  3. Ensure URL pattern exists

Recommended URL:

path('<int:pk>/check-in/', views.check_in_appointment, name='check_in_appointment'),

3. appointments/confirm_appointment.html ⚠️ NEEDS REVIEW

Status: Need to read template first

Action: Read template to determine if:

  • Functionality duplicated by status change
  • Or needs dedicated confirmation workflow

Next Step: Read template content


4. appointments/partials/provider_schedule.html ⚠️ NEEDS REVIEW

Status: Partial template - check if functionality exists elsewhere

Likely Decision: DELETE if partials/provider_availability.html covers this

Action: Compare with existing provider-related partials


5. appointments/slots/slot_availability.html ⚠️ NEEDS REVIEW

Status: Slot management template

Context:

  • SlotAvailabilityListView exists
  • Uses appointments/slots/slot_list.html

Likely Decision: DELETE - functionality covered by slot_list.html


6. appointments/slots/slot_booking.html ⚠️ NEEDS REVIEW

Status: Slot booking template

Context:

  • Booking likely handled through appointment creation
  • May be redundant

Likely Decision: DELETE - booking done via AppointmentRequestForm


7. appointments/slots/slot_calendar.html ⚠️ NEEDS REVIEW

Status: Calendar view for slots

Context:

  • scheduling_calendar.html exists
  • May be duplicate functionality

Likely Decision: DELETE if scheduling_calendar covers this


8. appointments/slots/slot_management.html ⚠️ NEEDS REVIEW

Status: Slot management interface

Context:

  • Slot CRUD operations exist via standard views
  • May be administrative dashboard

Decision: Need to read template to determine purpose


9. appointments/appointment_stats.html ⚠️ NEEDS REVIEW

Status: Full-page stats view

Context:

  • partials/appointment_stats.html exists for HTMX
  • May be for standalone stats page

Likely Decision: KEEP if provides comprehensive dashboard, DELETE if redundant


10. appointments/scheduling/conflicts.html ⚠️ NEEDS REVIEW

Status: Conflicts display

Context:

  • partials/conflicts.html exists
  • May be for full-page conflict resolution

Likely Decision: DELETE - partial version sufficient


11. appointments/queue/queue_entry_confirm_delete.html CREATE VIEW

Status: Delete confirmation template exists, NO delete view

Template Quality: Standard Django delete confirmation

Decision: CREATE DELETE VIEW

Recommended View:

class QueueEntryDeleteView(LoginRequiredMixin, PermissionRequiredMixin, DeleteView):
    model = QueueEntry
    template_name = 'appointments/queue/queue_entry_confirm_delete.html'
    permission_required = 'appointments.delete_queueentry'
    success_url = reverse_lazy('appointments:queue_entry_list')
    
    def get_queryset(self):
        return QueueEntry.objects.filter(queue__tenant=self.request.user.tenant)

URL Pattern:

path('queue/entry/<int:pk>/delete/', views.QueueEntryDeleteView.as_view(), name='queue_entry_delete'),

SUMMARY OF DECISIONS

Template Decision Priority Effort
no_show_appointment.html CREATE VIEW HIGH 2 hours
check_in_patient.html LINK VIEW HIGH 30 min
confirm_appointment.html REVIEW MEDIUM 1 hour
partials/provider_schedule.html LIKELY DELETE LOW 15 min
slots/slot_availability.html LIKELY DELETE LOW 15 min
slots/slot_booking.html LIKELY DELETE LOW 15 min
slots/slot_calendar.html LIKELY DELETE LOW 15 min
slots/slot_management.html REVIEW MEDIUM 1 hour
appointment_stats.html REVIEW MEDIUM 1 hour
scheduling/conflicts.html LIKELY DELETE LOW 15 min
queue_entry_confirm_delete.html CREATE VIEW HIGH 1 hour

IMMEDIATE ACTIONS (HIGH PRIORITY)

1. Create No-Show View (2 hours)

  • Implement no_show_appointment function
  • Add URL pattern
  • Test workflow
  • Add to appointment detail page as action button
  • Update check_in_appointment view to use template
  • Verify URL pattern exists
  • Test check-in workflow

3. Create Queue Entry Delete View (1 hour)

  • Implement QueueEntryDeleteView class
  • Add URL pattern
  • Test deletion workflow

Total Immediate Work: 3.5 hours


NEXT STEPS

  1. Read remaining templates (confirm_appointment, slot_management, appointment_stats)
  2. Make final DELETE decisions for slot templates and conflicts
  3. Implement HIGH priority views
  4. Test all new functionality
  5. Update documentation

TEMPLATES TO DELETE (Pending Final Review)

Likely candidates for deletion:

  • partials/provider_schedule.html - Covered by provider_availability
  • slots/slot_availability.html - Covered by slot_list
  • slots/slot_booking.html - Covered by appointment creation
  • slots/slot_calendar.html - Covered by scheduling_calendar
  • scheduling/conflicts.html - Partial version sufficient

Estimated cleanup: 5 templates, saves ~500 lines of unused code


IMPLEMENTATION PRIORITY

Week 1:

  1. Create no-show view and URL
  2. Link check-in template
  3. Create queue entry delete view

Week 2: 4. Review and decide on remaining 3 templates 5. Delete confirmed unused templates 6. Update documentation

Total Effort: ~8 hours


End of Review

Next Action: Toggle to Act Mode to implement HIGH priority items