> For the complete documentation index, see [llms.txt](https://docs.physiqo.in/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.physiqo.in/04-product/prd-2.md).

# Auto Assignment

## Auto Assignment Module

***

## 1. Purpose

The Auto Assignment Module automatically identifies and assigns the most suitable physiotherapist for a confirmed booking.

The objective is to minimize manual intervention while maximizing booking success rate and patient satisfaction.

***

## 2. Business Objectives

The module shall:

* Automatically assign physiotherapists.
* Reduce assignment time.
* Improve booking completion rate.
* Balance workload across physiotherapists.
* Minimize patient waiting time.
* Eliminate manual allocation.

***

## 3. Assignment Workflow

1. Booking Confirmed
2. Retrieve Eligible Physiotherapists
3. Filter by Service Radius
4. Filter by Online Status
5. Calculate Assignment Score
6. Select Best Candidate
7. Send Assignment Notification
8. Wait for Response
9. Confirm or Reassign

```mermaid
flowchart TD

A[Booking Confirmed]

A --> B[Find Nearby Physios]

B --> C[Online Only]

C --> D[Calculate Score]

D --> E[Best Candidate]

E --> F[Send Assignment]

F --> G{Accepted?}

G -->|Yes| H[Booking Confirmed]

G -->|No| I[Next Candidate]

I --> F
```

***

## 4. Eligibility Criteria

A physiotherapist shall be eligible only if:

* Account is Active
* KYC is Approved
* Online Status is Active
* Within Service Radius
* Available for Selected Time Slot
* No Active Suspension

***

## 5. Assignment Score

The Assignment Score shall be calculated using the following weighted parameters.

| Parameter       | Weight |
| --------------- | ------ |
| Availability    | 40%    |
| Distance        | 25%    |
| Rating          | 15%    |
| Experience      | 10%    |
| Acceptance Rate | 10%    |

The physiotherapist with the highest score shall receive the assignment.

***

## 6. Reassignment Rules

The booking shall be reassigned when:

* Assignment Rejected
* No Response Within Timeout
* Physiotherapist Goes Offline
* Technical Failure

Reassignment shall occur automatically without requiring any patient action.

***

## 7. Timeout Rules

The assigned physiotherapist shall respond within the configured timeout period.

If no response is received:

* Assignment expires.
* Next eligible physiotherapist is selected.
* Patient continues to see the same booking status until confirmation.

***

## 8. Notifications

#### Patient

* Physiotherapist Assigned
* Physiotherapist Reassigned
* Booking Confirmed

#### Physiotherapist

* New Assignment
* Assignment Expired
* Booking Cancelled

#### Administrator

* Assignment Failure
* Multiple Rejections

***

## 9. Failure Handling

If no eligible physiotherapist is available:

* Booking remains Pending Assignment.
* Operations team may manually intervene.
* Patient shall be notified regarding the delay.

***

## 10. Future Enhancements

* AI-based Assignment
* Traffic-aware ETA
* Specialty Matching
* Language Preference Matching
* Gender Preference (where applicable)
* Preferred Physiotherapist

***

## Backend Mapping

Controller

* BookingController

Services

* AssignmentService
* BookingService
* NotificationService

Repositories

* PhysioRepository
* BookingRepository

Entities

* Booking
* Physio
* Assignment

***

## Related Documents

* Business Rules
* Booking PRD
* Payment PRD
* Notification PRD
* User Journey

***

Status

Draft


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.physiqo.in/04-product/prd-2.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
