Skip to content

Commit

Permalink
feat: additional patient-centric data module models (#327)
Browse files Browse the repository at this point in the history
  • Loading branch information
jrwils authored Jan 29, 2025
1 parent 114fd22 commit 38ecd1b
Show file tree
Hide file tree
Showing 5 changed files with 566 additions and 2 deletions.
20 changes: 19 additions & 1 deletion canvas_sdk/v1/data/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,10 @@
from .appointment import Appointment
from .assessment import Assessment
from .billing import BillingLineItem
from .care_team import CareTeamMembership, CareTeamRole
from .command import Command
from .condition import Condition, ConditionCoding
from .coverage import Coverage, Transactor, TransactorAddress, TransactorPhone
from .detected_issue import DetectedIssue, DetectedIssueEvidence
from .device import Device
from .imaging import ImagingOrder, ImagingReport, ImagingReview
Expand All @@ -27,7 +29,13 @@
ObservationValueCoding,
)
from .organization import Organization
from .patient import Patient
from .patient import (
Patient,
PatientAddress,
PatientContactPoint,
PatientExternalIdentifier,
PatientSetting,
)
from .practicelocation import PracticeLocation, PracticeLocationSetting
from .protocol_override import ProtocolOverride
from .questionnaire import (
Expand All @@ -51,9 +59,12 @@
"Assessment",
"BillingLineItem",
"CanvasUser",
"CareTeamMembership",
"CareTeamRole",
"Command",
"Condition",
"ConditionCoding",
"Coverage",
"DetectedIssue",
"DetectedIssueEvidence",
"Device",
Expand Down Expand Up @@ -82,6 +93,10 @@
"ObservationValueCoding",
"Organization",
"Patient",
"PatientAddress",
"PatientContactPoint",
"PatientExternalIdentifier",
"PatientSetting",
"PracticeLocation",
"PracticeLocationSetting",
"ProtocolOverride",
Expand All @@ -95,4 +110,7 @@
"TaskComment",
"TaskLabel",
"TaskTaskLabel",
"Transactor",
"TransactorAddress",
"TransactorPhone",
]
60 changes: 60 additions & 0 deletions canvas_sdk/v1/data/care_team.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
from django.db import models


class CareTeamMembershipStatus(models.TextChoices):
"""CareTeamMembershipStatus."""

PROPOSED = "proposed", "Proposed"
ACTIVE = "active", "Active"
SUSPENDED = "suspended", "Suspended"
INACTIVE = "inactive", "Inactive"
ENTERED_IN_ERROR = "entered-in-error", "Entered in Error"


class CareTeamRole(models.Model):
"""CareTeamRole."""

class Meta:
managed = False
db_table = "canvas_sdk_data_api_careteamrole_001"

dbid = models.BigIntegerField(primary_key=True)
system = models.CharField()
version = models.CharField()
code = models.CharField()
display = models.CharField()
user_selected = models.BooleanField()
active = models.BooleanField()

def __str__(self) -> str:
return self.display


class CareTeamMembership(models.Model):
"""CareTeamMembership."""

class Meta:
managed = False
db_table = "canvas_sdk_data_api_careteammembership_001"

id = models.UUIDField()
dbid = models.BigIntegerField(primary_key=True)
created = models.DateTimeField()
modified = models.DateTimeField()
patient = models.ForeignKey(
"v1.Patient", on_delete=models.DO_NOTHING, related_name="care_team_memberships", null=True
)
staff = models.ForeignKey(
"v1.Staff", on_delete=models.DO_NOTHING, related_name="care_team_memberships", null=True
)
role = models.ForeignKey(
"v1.CareTeamRole", related_name="care_teams", on_delete=models.DO_NOTHING, null=True
)
status = models.CharField(choices=CareTeamMembershipStatus.choices)
lead = models.BooleanField()
role_code = models.CharField()
role_system = models.CharField()
role_display = models.CharField()

def __str__(self) -> str:
return f"id={self.id}"
53 changes: 53 additions & 0 deletions canvas_sdk/v1/data/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -101,3 +101,56 @@ class Origin(models.TextChoices):
FLAGGED_POSTING_REVIEW = ("FLG_PST_REV", "Flagged posting review")
BATCH_PATIENT_STATEMENTS = ("BAT_PTN_STA", "Batch patient statements")
INCOMPLETE_COVERAGE = ("INC_COV", "Incomplete Coverage")


class ContactPointSystem(models.TextChoices):
"""ContactPointSystem."""

PHONE = "phone", "phone"
FAX = "fax", "fax"
EMAIL = "email", "email"
PAGER = "pager", "pager"
OTHER = "other", "other"


class ContactPointUse(models.TextChoices):
"""ContactPointUse."""

HOME = "home", "Home"
WORK = "work", "Work"
TEMP = "temp", "Temp"
OLD = "old", "Old"
OTHER = "other", "Other"
MOBILE = "mobile", "Mobile"
AUTOMATION = "automation", "Automation"


class ContactPointState(models.TextChoices):
"""ContactPointState."""

ACTIVE = "active", "Active"
DELETED = "deleted", "Deleted"


class AddressUse(models.TextChoices):
"""AddressUse."""

HOME = "home", "Home"
WORK = "work", "Work"
TEMP = "temp", "Temp"
OLD = "old", "Old"


class AddressType(models.TextChoices):
"""AddressType."""

POSTAL = "postal", "Postal"
PHYSICAL = "physical", "Physical"
BOTH = "both", "Both"


class AddressState(models.TextChoices):
"""AddressState."""

ACTIVE = "active", "Active"
DELETED = "deleted", "Deleted"
Loading

0 comments on commit 38ecd1b

Please sign in to comment.