Skip to content

Commit

Permalink
Changes choices to use TextChoices.
Browse files Browse the repository at this point in the history
  • Loading branch information
jrwils authored and jamagalhaes committed Nov 11, 2024
1 parent 7598222 commit 0851b48
Show file tree
Hide file tree
Showing 2 changed files with 46 additions and 86 deletions.
110 changes: 38 additions & 72 deletions canvas_sdk/v1/data/common.py
Original file line number Diff line number Diff line change
@@ -1,72 +1,38 @@
class DocumentReviewMode:
REVIEW_REQUIRED = "RR"
ALREADY_REVIEWED_OFFLINE = "AR"
REVIEW_NOT_REQUIRED = "RN"

CHOICES = {
REVIEW_REQUIRED: "Review required",
ALREADY_REVIEWED_OFFLINE: "Already reviewed offline",
REVIEW_NOT_REQUIRED: "Review not required",
}


class OrderStatus:
PROPOSED = "proposed"
DRAFT = "draft"
PLANNED = "planned"
REQUESTED = "requested"
RECEIVED = "received"
ACCEPTED = "accepted"
IN_PROGRESS = "in-progress"
REVIEW = "review"
COMPLETED = "completed"
CANCELLED = "cancelled"
SUSPENDED = "suspended"
REJECTED = "rejected"
FAILED = "failed"
ENTERED_IN_ERROR = "EIE"

CHOICES = {
PROPOSED: "Proposed",
DRAFT: "Draft",
PLANNED: "Planned",
REQUESTED: "Requested",
RECEIVED: "Received",
ACCEPTED: "Accepted",
IN_PROGRESS: "In-progress",
REVIEW: "Review",
COMPLETED: "Completed",
CANCELLED: "Cancelled",
SUSPENDED: "Suspended",
REJECTED: "Rejected",
FAILED: "Failed",
ENTERED_IN_ERROR: "Entered in Error",
}


class ReviewPatientCommunicationMethod:
DELEGATED_CALL_CAN_LEAVE_MESSAGE = "DM"
DELEGATED_CALL_NEED_ANSWER = "DA"
DELEGATED_LETTER = "DL"
DO_NOT_COMMUNICATE = "DC"
ALREADY_LEFT_MESSAGE = "AM"
ALREADY_REVIEWED_WITH_PATIENT = "AR"

CHOICES = {
DELEGATED_CALL_CAN_LEAVE_MESSAGE: "delegate call, can leave message",
DELEGATED_CALL_NEED_ANSWER: "delegate call, need patient to answer",
DELEGATED_LETTER: "delegate letter",
DO_NOT_COMMUNICATE: "do not communicate",
ALREADY_LEFT_MESSAGE: "already left message",
ALREADY_REVIEWED_WITH_PATIENT: "already reviewed with patient",
}


class ReviewStatus:
STATUS_REVIEWING = "reviewing"
STATUS_REVIEWED = "reviewed"

CHOICES = {
STATUS_REVIEWING: "reviewing",
STATUS_REVIEWING: "reviewed",
}
from django.db import models


class DocumentReviewMode(models.TextChoices):
REVIEW_REQUIRED = "RR", "Review required"
ALREADY_REVIEWED_OFFLINE = "AR", "Already reviewed offline"
REVIEW_NOT_REQUIRED = "RN", "Review not required"


class OrderStatus(models.TextChoices):
PROPOSED = "proposed", "Proposed"
DRAFT = "draft", "Draft"
PLANNED = "planned", "Planned"
REQUESTED = "requested", "Requested"
RECEIVED = "received", "Received"
ACCEPTED = "accepted", "Accepted"
IN_PROGRESS = "in-progress", "In-progress"
REVIEW = "review", "Review"
COMPLETED = "completed", "Completed"
CANCELLED = "cancelled", "Cancelled"
SUSPENDED = "suspended", "Suspended"
REJECTED = "rejected", "Rejected"
FAILED = "failed", "Failed"
ENTERED_IN_ERROR = "EIE", "Entered in Error"


class ReviewPatientCommunicationMethod(models.TextChoices):
DELEGATED_CALL_CAN_LEAVE_MESSAGE = "DM", "delegate call, can leave message"
DELEGATED_CALL_NEED_ANSWER = "DA", "delegate call, need patient to answer"
DELEGATED_LETTER = "DL", "delegate letter"
DO_NOT_COMMUNICATE = "DC", "do not communicate"
ALREADY_LEFT_MESSAGE = "AM", "already left message"
ALREADY_REVIEWED_WITH_PATIENT = "AR", "already reviewed with patient"


class ReviewStatus(models.TextChoices):
STATUS_REVIEWING = "reviewing", "reviewing"
STATUS_REVIEWED = "reviewed", "reviewed"
22 changes: 8 additions & 14 deletions canvas_sdk/v1/data/imaging.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ class Meta:
# imaging_center = models.ForeignKey(ServiceProvider, related_name="imaging_orders", null=True, on_delete=models.DO_NOTHING)
note_to_radiologist = models.CharField()
internal_comment = models.CharField()
status = models.CharField(choices=OrderStatus.CHOICES)
status = models.CharField(choices=OrderStatus)
date_time_ordered = models.DateTimeField()
priority = models.CharField()
# TODO - uncomment when Staff model is complete
Expand Down Expand Up @@ -60,23 +60,17 @@ class Meta:
internal_comment = models.CharField()
message_to_patient = models.CharField()
is_released_to_patient = models.BooleanField()
status = models.CharField(choices=ReviewStatus.CHOICES)
status = models.CharField(choices=ReviewStatus)
patient = models.ForeignKey(
Patient, on_delete=models.DO_NOTHING, related_name="imaging_reviews"
)


class ImagingReport(models.Model):
class ImagingReportSource:
RADIOLOGY_FROM_PATIENT = "RADIOLOGY_PATIENT"
VERBAL_FROM_PATIENT = "VERBAL_PATIENT"
DIRECTLY_REPORT = "DIRECTLY_RADIOLOGY"

CHOICES = {
RADIOLOGY_FROM_PATIENT: "Radiology Report From Patient",
VERBAL_FROM_PATIENT: "Verbal Report From Patient",
DIRECTLY_REPORT: "Directly Radiology Report",
}
class ImagingReportSource(models.TextChoices):
RADIOLOGY_FROM_PATIENT = "RADIOLOGY_PATIENT", "Radiology Report From Patient"
VERBAL_FROM_PATIENT = "VERBAL_PATIENT", "Verbal Report From Patient"
DIRECTLY_REPORT = "DIRECTLY_RADIOLOGY", "Directly Radiology Report"

class Meta:
managed = False
Expand All @@ -87,15 +81,15 @@ class Meta:
dbid = models.BigIntegerField(primary_key=True)
created = models.DateTimeField()
modified = models.DateTimeField()
review_mode = models.CharField(choices=DocumentReviewMode.CHOICES)
review_mode = models.CharField(choices=DocumentReviewMode)
junked = models.BooleanField()
requires_signature = models.BooleanField()
assigned_date = models.DateTimeField()
patient = models.ForeignKey(
Patient, on_delete=models.DO_NOTHING, related_name="imaging_results"
)
order = models.ForeignKey(ImagingOrder, on_delete=models.DO_NOTHING, null=True)
source = models.CharField(choices=ImagingReportSource.CHOICES)
source = models.CharField(choices=ImagingReportSource)
name = models.CharField()
result_date = models.DateField()
original_date = models.DateField()
Expand Down

0 comments on commit 0851b48

Please sign in to comment.