diff --git a/canvas_sdk/v1/data/__init__.py b/canvas_sdk/v1/data/__init__.py index cc48eb9f..ba0cc066 100644 --- a/canvas_sdk/v1/data/__init__.py +++ b/canvas_sdk/v1/data/__init__.py @@ -1,4 +1,5 @@ from .allergy_intolerance import AllergyIntolerance, AllergyIntoleranceCoding +from .appointment import Appointment from .billing import BillingLineItem from .command import Command from .condition import Condition, ConditionCoding @@ -43,6 +44,7 @@ from .user import CanvasUser __all__ = [ + "Appointment", "AllergyIntolerance", "AllergyIntoleranceCoding", "BillingLineItem", diff --git a/canvas_sdk/v1/data/appointment.py b/canvas_sdk/v1/data/appointment.py new file mode 100644 index 00000000..c4b338b7 --- /dev/null +++ b/canvas_sdk/v1/data/appointment.py @@ -0,0 +1,56 @@ +from django.db import models + + +class AppointmentProgressStatus(models.TextChoices): + """AppointmentProgressStatus.""" + + UNCONFIRMED = "unconfirmed", "Unconfirmed" + ATTEMPTED = "attempted", "Attempted" + CONFIRMED = "confirmed", "Confirmed" + ARRIVED = "arrived", "Arrived" + ROOMED = "roomed", "Roomed" + EXITED = "exited", "Exited" + NOSHOWED = "noshowed", "No-showed" + CANCELLED = "cancelled", "Cancelled" + + +class Appointment(models.Model): + """Appointment.""" + + class Meta: + managed = False + db_table = "canvas_sdk_data_api_appointment_001" + + id = models.UUIDField() + dbid = models.BigIntegerField(primary_key=True) + entered_in_error = models.ForeignKey("v1.CanvasUser", on_delete=models.DO_NOTHING, null=True) + patient = models.ForeignKey( + "v1.Patient", + on_delete=models.DO_NOTHING, + related_name="appointments", + null=True, + ) + appointment_rescheduled_from = models.ForeignKey( + "self", + on_delete=models.DO_NOTHING, + related_name="appointment_rescheduled_to", + null=True, + ) + provider = models.ForeignKey("v1.Staff", on_delete=models.DO_NOTHING, null=True) + start_time = models.DateTimeField() + duration_minutes = models.IntegerField() + comment = models.TextField(null=True) + note = models.ForeignKey("v1.Note", on_delete=models.DO_NOTHING, null=True) + + note_type = models.ForeignKey( + "v1.NoteType", on_delete=models.DO_NOTHING, related_name="appointments", null=True + ) + + status = models.CharField( + max_length=20, + choices=AppointmentProgressStatus, + ) + meeting_link = models.URLField(null=True, blank=True) + telehealth_instructions_sent = models.BooleanField() + location = models.ForeignKey("v1.PracticeLocation", on_delete=models.DO_NOTHING, null=True) + description = models.TextField(null=True, blank=True)