care.emr.api.viewsets.scheduling.availability module

class SlotsForDayRequestSpec(*, resource_type: SchedulableResourceTypeOptions, resource_id: Annotated[UUID, UuidVersion(uuid_version=4)], day: date)

Bases: BaseModel

resource_type: SchedulableResourceTypeOptions
resource_id: Annotated[UUID, UuidVersion(uuid_version=4)]
day: date
model_config: ClassVar[ConfigDict] = {}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

class AppointmentBookingSpec(*, patient: Annotated[UUID, UuidVersion(uuid_version=4)], note: str, tags: list[Annotated[UUID, UuidVersion(uuid_version=4)]] = [])

Bases: BaseModel

patient: Annotated[UUID, UuidVersion(uuid_version=4)]
note: str
tags: list[Annotated[UUID, UuidVersion(uuid_version=4)]]
model_config: ClassVar[ConfigDict] = {}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

class AvailabilityStatsRequestSpec(*, from_date: date, to_date: date, resource_type: SchedulableResourceTypeOptions, resource_id: Annotated[UUID, UuidVersion(uuid_version=4)])

Bases: BaseModel

from_date: date
to_date: date
resource_type: SchedulableResourceTypeOptions
resource_id: Annotated[UUID, UuidVersion(uuid_version=4)]
validate_period()
model_config: ClassVar[ConfigDict] = {}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

convert_availability_and_exceptions_to_slots(availabilities, exceptions, day)
lock_create_appointment(token_slot, patient, created_by, note)
class SlotViewSet(**kwargs)

Bases: EMRRetrieveMixin, EMRBaseViewSet

database_model

alias of TokenSlot

pydantic_read_model

alias of TokenSlotBaseSpec

get_slots_for_day(request, *args, **kwargs)
classmethod get_slots_for_day_handler(facility_external_id, request_data)
classmethod create_appointment_handler(obj, request_data, user)
authorize_update(request_obj, model_instance)
create_appointment(request, *args, **kwargs)
availability_stats(request, *args, **kwargs)

Return the stats for available slots compared to the booked slots ie Availability percentage.

authorize_retrieve(model_instance)
authorize_resource_read(resource_obj)
get_queryset()
calculate_slots(date: date, availabilities: list[Availability], schedules, exceptions: list[AvailabilityException])