canvas 0.15.0__py3-none-any.whl → 0.17.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of canvas might be problematic. Click here for more details.
- {canvas-0.15.0.dist-info → canvas-0.17.0.dist-info}/METADATA +25 -31
- {canvas-0.15.0.dist-info → canvas-0.17.0.dist-info}/RECORD +70 -53
- {canvas-0.15.0.dist-info → canvas-0.17.0.dist-info}/WHEEL +1 -1
- canvas-0.17.0.dist-info/entry_points.txt +2 -0
- canvas_cli/apps/plugin/plugin.py +1 -1
- canvas_cli/templates/plugins/application/{{ cookiecutter.__project_slug }}/CANVAS_MANIFEST.json +6 -3
- canvas_cli/templates/plugins/application/{{ cookiecutter.__project_slug }}/applications/my_application.py +4 -1
- canvas_cli/utils/validators/manifest_schema.py +9 -2
- canvas_generated/messages/effects_pb2.py +2 -2
- canvas_generated/messages/effects_pb2.pyi +14 -0
- canvas_generated/messages/events_pb2.py +2 -2
- canvas_generated/messages/events_pb2.pyi +40 -0
- canvas_sdk/commands/tests/protocol/tests.py +12 -2
- canvas_sdk/commands/tests/test_utils.py +4 -9
- canvas_sdk/effects/banner_alert/tests.py +5 -2
- canvas_sdk/effects/launch_modal.py +14 -3
- canvas_sdk/handlers/action_button.py +33 -16
- canvas_sdk/templates/__init__.py +3 -0
- canvas_sdk/templates/tests/__init__.py +0 -0
- canvas_sdk/templates/tests/test_utils.py +43 -0
- canvas_sdk/templates/utils.py +44 -0
- canvas_sdk/utils/http.py +1 -1
- canvas_sdk/v1/data/__init__.py +23 -1
- canvas_sdk/v1/data/allergy_intolerance.py +22 -2
- canvas_sdk/v1/data/appointment.py +56 -0
- canvas_sdk/v1/data/assessment.py +40 -0
- canvas_sdk/v1/data/base.py +35 -22
- canvas_sdk/v1/data/billing.py +2 -2
- canvas_sdk/v1/data/care_team.py +60 -0
- canvas_sdk/v1/data/command.py +1 -1
- canvas_sdk/v1/data/common.py +53 -0
- canvas_sdk/v1/data/condition.py +19 -3
- canvas_sdk/v1/data/coverage.py +294 -0
- canvas_sdk/v1/data/detected_issue.py +1 -0
- canvas_sdk/v1/data/lab.py +26 -3
- canvas_sdk/v1/data/medication.py +13 -3
- canvas_sdk/v1/data/note.py +5 -1
- canvas_sdk/v1/data/observation.py +15 -3
- canvas_sdk/v1/data/patient.py +140 -1
- canvas_sdk/v1/data/protocol_override.py +18 -2
- canvas_sdk/v1/data/questionnaire.py +15 -2
- canvas_sdk/value_set/hcc2018.py +55369 -0
- plugin_runner/plugin_installer.py +21 -13
- plugin_runner/plugin_runner.py +67 -14
- plugin_runner/sandbox.py +28 -0
- plugin_runner/tests/fixtures/plugins/test_render_template/CANVAS_MANIFEST.json +47 -0
- plugin_runner/tests/fixtures/plugins/test_render_template/README.md +11 -0
- plugin_runner/tests/fixtures/plugins/test_render_template/protocols/__init__.py +0 -0
- plugin_runner/tests/fixtures/plugins/test_render_template/protocols/my_protocol.py +43 -0
- plugin_runner/tests/fixtures/plugins/test_render_template/templates/template.html +10 -0
- plugin_runner/tests/test_plugin_runner.py +37 -51
- plugin_runner/tests/test_sandbox.py +21 -1
- protobufs/canvas_generated/messages/effects.proto +225 -0
- protobufs/canvas_generated/messages/events.proto +1049 -0
- protobufs/canvas_generated/messages/plugins.proto +9 -0
- protobufs/canvas_generated/services/plugin_runner.proto +12 -0
- settings.py +14 -1
- canvas-0.15.0.dist-info/entry_points.txt +0 -3
- plugin_runner/plugin_synchronizer.py +0 -92
canvas_sdk/v1/data/__init__.py
CHANGED
|
@@ -1,7 +1,11 @@
|
|
|
1
1
|
from .allergy_intolerance import AllergyIntolerance, AllergyIntoleranceCoding
|
|
2
|
+
from .appointment import Appointment
|
|
3
|
+
from .assessment import Assessment
|
|
2
4
|
from .billing import BillingLineItem
|
|
5
|
+
from .care_team import CareTeamMembership, CareTeamRole
|
|
3
6
|
from .command import Command
|
|
4
7
|
from .condition import Condition, ConditionCoding
|
|
8
|
+
from .coverage import Coverage, Transactor, TransactorAddress, TransactorPhone
|
|
5
9
|
from .detected_issue import DetectedIssue, DetectedIssueEvidence
|
|
6
10
|
from .device import Device
|
|
7
11
|
from .imaging import ImagingOrder, ImagingReport, ImagingReview
|
|
@@ -25,7 +29,13 @@ from .observation import (
|
|
|
25
29
|
ObservationValueCoding,
|
|
26
30
|
)
|
|
27
31
|
from .organization import Organization
|
|
28
|
-
from .patient import
|
|
32
|
+
from .patient import (
|
|
33
|
+
Patient,
|
|
34
|
+
PatientAddress,
|
|
35
|
+
PatientContactPoint,
|
|
36
|
+
PatientExternalIdentifier,
|
|
37
|
+
PatientSetting,
|
|
38
|
+
)
|
|
29
39
|
from .practicelocation import PracticeLocation, PracticeLocationSetting
|
|
30
40
|
from .protocol_override import ProtocolOverride
|
|
31
41
|
from .questionnaire import (
|
|
@@ -43,13 +53,18 @@ from .task import Task, TaskComment, TaskLabel, TaskTaskLabel
|
|
|
43
53
|
from .user import CanvasUser
|
|
44
54
|
|
|
45
55
|
__all__ = [
|
|
56
|
+
"Appointment",
|
|
46
57
|
"AllergyIntolerance",
|
|
47
58
|
"AllergyIntoleranceCoding",
|
|
59
|
+
"Assessment",
|
|
48
60
|
"BillingLineItem",
|
|
49
61
|
"CanvasUser",
|
|
62
|
+
"CareTeamMembership",
|
|
63
|
+
"CareTeamRole",
|
|
50
64
|
"Command",
|
|
51
65
|
"Condition",
|
|
52
66
|
"ConditionCoding",
|
|
67
|
+
"Coverage",
|
|
53
68
|
"DetectedIssue",
|
|
54
69
|
"DetectedIssueEvidence",
|
|
55
70
|
"Device",
|
|
@@ -78,6 +93,10 @@ __all__ = [
|
|
|
78
93
|
"ObservationValueCoding",
|
|
79
94
|
"Organization",
|
|
80
95
|
"Patient",
|
|
96
|
+
"PatientAddress",
|
|
97
|
+
"PatientContactPoint",
|
|
98
|
+
"PatientExternalIdentifier",
|
|
99
|
+
"PatientSetting",
|
|
81
100
|
"PracticeLocation",
|
|
82
101
|
"PracticeLocationSetting",
|
|
83
102
|
"ProtocolOverride",
|
|
@@ -91,4 +110,7 @@ __all__ = [
|
|
|
91
110
|
"TaskComment",
|
|
92
111
|
"TaskLabel",
|
|
93
112
|
"TaskTaskLabel",
|
|
113
|
+
"Transactor",
|
|
114
|
+
"TransactorAddress",
|
|
115
|
+
"TransactorPhone",
|
|
94
116
|
]
|
|
@@ -1,6 +1,26 @@
|
|
|
1
|
+
from typing import cast
|
|
2
|
+
|
|
1
3
|
from django.db import models
|
|
2
4
|
|
|
3
|
-
from canvas_sdk.v1.data.base import
|
|
5
|
+
from canvas_sdk.v1.data.base import (
|
|
6
|
+
BaseModelManager,
|
|
7
|
+
CommittableQuerySetMixin,
|
|
8
|
+
ForPatientQuerySetMixin,
|
|
9
|
+
ValueSetLookupQuerySet,
|
|
10
|
+
)
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
class AllergyIntoleranceQuerySet(
|
|
14
|
+
ValueSetLookupQuerySet,
|
|
15
|
+
CommittableQuerySetMixin,
|
|
16
|
+
ForPatientQuerySetMixin,
|
|
17
|
+
):
|
|
18
|
+
"""AllergyIntoleranceQuerySet."""
|
|
19
|
+
|
|
20
|
+
pass
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
AllergyIntoleranceManager = BaseModelManager.from_queryset(AllergyIntoleranceQuerySet)
|
|
4
24
|
|
|
5
25
|
|
|
6
26
|
class AllergyIntolerance(models.Model):
|
|
@@ -10,7 +30,7 @@ class AllergyIntolerance(models.Model):
|
|
|
10
30
|
managed = False
|
|
11
31
|
db_table = "canvas_sdk_data_api_allergyintolerance_001"
|
|
12
32
|
|
|
13
|
-
objects =
|
|
33
|
+
objects = cast(AllergyIntoleranceQuerySet, AllergyIntoleranceManager())
|
|
14
34
|
|
|
15
35
|
id = models.UUIDField()
|
|
16
36
|
dbid = models.BigIntegerField(primary_key=True)
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
from django.db import models
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
class AppointmentProgressStatus(models.TextChoices):
|
|
5
|
+
"""AppointmentProgressStatus."""
|
|
6
|
+
|
|
7
|
+
UNCONFIRMED = "unconfirmed", "Unconfirmed"
|
|
8
|
+
ATTEMPTED = "attempted", "Attempted"
|
|
9
|
+
CONFIRMED = "confirmed", "Confirmed"
|
|
10
|
+
ARRIVED = "arrived", "Arrived"
|
|
11
|
+
ROOMED = "roomed", "Roomed"
|
|
12
|
+
EXITED = "exited", "Exited"
|
|
13
|
+
NOSHOWED = "noshowed", "No-showed"
|
|
14
|
+
CANCELLED = "cancelled", "Cancelled"
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
class Appointment(models.Model):
|
|
18
|
+
"""Appointment."""
|
|
19
|
+
|
|
20
|
+
class Meta:
|
|
21
|
+
managed = False
|
|
22
|
+
db_table = "canvas_sdk_data_api_appointment_001"
|
|
23
|
+
|
|
24
|
+
id = models.UUIDField()
|
|
25
|
+
dbid = models.BigIntegerField(primary_key=True)
|
|
26
|
+
entered_in_error = models.ForeignKey("v1.CanvasUser", on_delete=models.DO_NOTHING, null=True)
|
|
27
|
+
patient = models.ForeignKey(
|
|
28
|
+
"v1.Patient",
|
|
29
|
+
on_delete=models.DO_NOTHING,
|
|
30
|
+
related_name="appointments",
|
|
31
|
+
null=True,
|
|
32
|
+
)
|
|
33
|
+
appointment_rescheduled_from = models.ForeignKey(
|
|
34
|
+
"self",
|
|
35
|
+
on_delete=models.DO_NOTHING,
|
|
36
|
+
related_name="appointment_rescheduled_to",
|
|
37
|
+
null=True,
|
|
38
|
+
)
|
|
39
|
+
provider = models.ForeignKey("v1.Staff", on_delete=models.DO_NOTHING, null=True)
|
|
40
|
+
start_time = models.DateTimeField()
|
|
41
|
+
duration_minutes = models.IntegerField()
|
|
42
|
+
comment = models.TextField(null=True)
|
|
43
|
+
note = models.ForeignKey("v1.Note", on_delete=models.DO_NOTHING, null=True)
|
|
44
|
+
|
|
45
|
+
note_type = models.ForeignKey(
|
|
46
|
+
"v1.NoteType", on_delete=models.DO_NOTHING, related_name="appointments", null=True
|
|
47
|
+
)
|
|
48
|
+
|
|
49
|
+
status = models.CharField(
|
|
50
|
+
max_length=20,
|
|
51
|
+
choices=AppointmentProgressStatus,
|
|
52
|
+
)
|
|
53
|
+
meeting_link = models.URLField(null=True, blank=True)
|
|
54
|
+
telehealth_instructions_sent = models.BooleanField()
|
|
55
|
+
location = models.ForeignKey("v1.PracticeLocation", on_delete=models.DO_NOTHING, null=True)
|
|
56
|
+
description = models.TextField(null=True, blank=True)
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
from django.db import models
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
class AssessmentStatus(models.TextChoices):
|
|
5
|
+
"""AssessmentStatus."""
|
|
6
|
+
|
|
7
|
+
STATUS_IMPROVING = "improved", "Improved"
|
|
8
|
+
STATUS_STABLE = "stable", "Unchanged"
|
|
9
|
+
STATUS_DETERIORATING = "deteriorated", "Deteriorated"
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
class Assessment(models.Model):
|
|
13
|
+
"""Assessment."""
|
|
14
|
+
|
|
15
|
+
class Meta:
|
|
16
|
+
managed = False
|
|
17
|
+
db_table = "canvas_sdk_data_api_assessment_001"
|
|
18
|
+
|
|
19
|
+
id = models.UUIDField()
|
|
20
|
+
dbid = models.BigIntegerField(primary_key=True)
|
|
21
|
+
created = models.DateTimeField()
|
|
22
|
+
modified = models.DateTimeField()
|
|
23
|
+
originator = models.ForeignKey("v1.CanvasUser", on_delete=models.DO_NOTHING)
|
|
24
|
+
committer = models.ForeignKey("v1.CanvasUser", on_delete=models.DO_NOTHING, null=True)
|
|
25
|
+
deleted = models.BooleanField()
|
|
26
|
+
entered_in_error = models.ForeignKey("v1.CanvasUser", on_delete=models.DO_NOTHING, null=True)
|
|
27
|
+
patient = models.ForeignKey(
|
|
28
|
+
"v1.Patient",
|
|
29
|
+
on_delete=models.DO_NOTHING,
|
|
30
|
+
related_name="assessments",
|
|
31
|
+
)
|
|
32
|
+
note = models.ForeignKey("v1.Note", on_delete=models.DO_NOTHING, related_name="assessments")
|
|
33
|
+
condition = models.ForeignKey(
|
|
34
|
+
"v1.Condition", on_delete=models.CASCADE, related_name="assessments", null=True
|
|
35
|
+
)
|
|
36
|
+
interview = models.ForeignKey("v1.Interview", on_delete=models.DO_NOTHING, null=True)
|
|
37
|
+
status = models.CharField(choices=AssessmentStatus.choices)
|
|
38
|
+
narrative = models.CharField()
|
|
39
|
+
background = models.CharField()
|
|
40
|
+
care_team = models.CharField()
|
canvas_sdk/v1/data/base.py
CHANGED
|
@@ -10,25 +10,12 @@ if TYPE_CHECKING:
|
|
|
10
10
|
from canvas_sdk.value_set.value_set import ValueSet
|
|
11
11
|
|
|
12
12
|
|
|
13
|
-
class
|
|
14
|
-
"""A manager for
|
|
13
|
+
class BaseModelManager(models.Manager):
|
|
14
|
+
"""A base manager for models."""
|
|
15
15
|
|
|
16
|
-
def get_queryset(self) ->
|
|
16
|
+
def get_queryset(self) -> models.QuerySet:
|
|
17
17
|
"""Return a queryset that filters out deleted objects."""
|
|
18
|
-
|
|
19
|
-
return CommittableQuerySet(self.model, using=self._db).filter(deleted=False)
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
class CommittableQuerySet(models.QuerySet):
|
|
23
|
-
"""A queryset for committable objects."""
|
|
24
|
-
|
|
25
|
-
def committed(self) -> "Self":
|
|
26
|
-
"""Return a queryset that filters for objects that have been committed."""
|
|
27
|
-
return self.filter(committer_id__isnull=False, entered_in_error_id__isnull=True)
|
|
28
|
-
|
|
29
|
-
def for_patient(self, patient_id: str) -> "Self":
|
|
30
|
-
"""Return a queryset that filters objects for a specific patient."""
|
|
31
|
-
return self.filter(patient__id=patient_id)
|
|
18
|
+
return super().get_queryset().filter(deleted=False)
|
|
32
19
|
|
|
33
20
|
|
|
34
21
|
class BaseQuerySet(models.QuerySet):
|
|
@@ -40,10 +27,14 @@ class BaseQuerySet(models.QuerySet):
|
|
|
40
27
|
class QuerySetProtocol(Protocol):
|
|
41
28
|
"""A typing protocol for use in mixins into models.QuerySet-inherited classes."""
|
|
42
29
|
|
|
43
|
-
def filter(self, *args: Any, **kwargs: Any) ->
|
|
30
|
+
def filter(self, *args: Any, **kwargs: Any) -> Self:
|
|
44
31
|
"""Django's models.QuerySet filter method."""
|
|
45
32
|
...
|
|
46
33
|
|
|
34
|
+
def distinct(self) -> Self:
|
|
35
|
+
"""Django's models.QuerySet distinct method."""
|
|
36
|
+
...
|
|
37
|
+
|
|
47
38
|
|
|
48
39
|
class ValueSetLookupQuerySetProtocol(QuerySetProtocol):
|
|
49
40
|
"""A typing protocol for use in mixins using value set lookup methods."""
|
|
@@ -61,10 +52,26 @@ class ValueSetLookupQuerySetProtocol(QuerySetProtocol):
|
|
|
61
52
|
raise NotImplementedError
|
|
62
53
|
|
|
63
54
|
|
|
55
|
+
class CommittableQuerySetMixin(QuerySetProtocol):
|
|
56
|
+
"""A queryset for committable objects."""
|
|
57
|
+
|
|
58
|
+
def committed(self) -> Self:
|
|
59
|
+
"""Return a queryset that filters for objects that have been committed."""
|
|
60
|
+
return self.filter(committer_id__isnull=False, entered_in_error_id__isnull=True)
|
|
61
|
+
|
|
62
|
+
|
|
63
|
+
class ForPatientQuerySetMixin(QuerySetProtocol):
|
|
64
|
+
"""A queryset for patient assets."""
|
|
65
|
+
|
|
66
|
+
def for_patient(self, patient_id: str) -> Self:
|
|
67
|
+
"""Return a queryset that filters objects for a specific patient."""
|
|
68
|
+
return self.filter(patient__id=patient_id)
|
|
69
|
+
|
|
70
|
+
|
|
64
71
|
class ValueSetLookupQuerySetMixin(ValueSetLookupQuerySetProtocol):
|
|
65
72
|
"""A QuerySet mixin that can filter objects based on a ValueSet."""
|
|
66
73
|
|
|
67
|
-
def find(self, value_set: type["ValueSet"]) ->
|
|
74
|
+
def find(self, value_set: type["ValueSet"]) -> Self:
|
|
68
75
|
"""
|
|
69
76
|
Filters conditions, medications, etc. to those found in the inherited ValueSet class that is passed.
|
|
70
77
|
|
|
@@ -146,7 +153,7 @@ class TimeframeLookupQuerySetMixin(TimeframeLookupQuerySetProtocol):
|
|
|
146
153
|
"""Returns the field that should be filtered on. Can be overridden for different models."""
|
|
147
154
|
return "note__datetime_of_service"
|
|
148
155
|
|
|
149
|
-
def within(self, timeframe: "Timeframe") ->
|
|
156
|
+
def within(self, timeframe: "Timeframe") -> Self:
|
|
150
157
|
"""A method to filter a queryset for datetimes within a timeframe."""
|
|
151
158
|
return self.filter(
|
|
152
159
|
**{
|
|
@@ -158,13 +165,19 @@ class TimeframeLookupQuerySetMixin(TimeframeLookupQuerySetProtocol):
|
|
|
158
165
|
)
|
|
159
166
|
|
|
160
167
|
|
|
161
|
-
class
|
|
168
|
+
class CommittableQuerySet(BaseQuerySet, CommittableQuerySetMixin):
|
|
169
|
+
"""A queryset for committable objects."""
|
|
170
|
+
|
|
171
|
+
pass
|
|
172
|
+
|
|
173
|
+
|
|
174
|
+
class ValueSetLookupQuerySet(BaseQuerySet, ValueSetLookupQuerySetMixin):
|
|
162
175
|
"""A class that includes methods for looking up value sets."""
|
|
163
176
|
|
|
164
177
|
pass
|
|
165
178
|
|
|
166
179
|
|
|
167
|
-
class ValueSetLookupByNameQuerySet(
|
|
180
|
+
class ValueSetLookupByNameQuerySet(BaseQuerySet, ValueSetLookupByNameQuerySetMixin):
|
|
168
181
|
"""A class that includes methods for looking up value sets by name."""
|
|
169
182
|
|
|
170
183
|
pass
|
canvas_sdk/v1/data/billing.py
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
from typing import TYPE_CHECKING
|
|
1
|
+
from typing import TYPE_CHECKING, Self
|
|
2
2
|
|
|
3
3
|
from django.db import models
|
|
4
4
|
|
|
@@ -12,7 +12,7 @@ if TYPE_CHECKING:
|
|
|
12
12
|
class BillingLineItemQuerySet(ValueSetTimeframeLookupQuerySet):
|
|
13
13
|
"""A class that adds functionality to filter BillingLineItem objects."""
|
|
14
14
|
|
|
15
|
-
def find(self, value_set: type["ValueSet"]) ->
|
|
15
|
+
def find(self, value_set: type["ValueSet"]) -> Self:
|
|
16
16
|
"""
|
|
17
17
|
This method is overridden to use for BillingLineItem CPT codes.
|
|
18
18
|
The codes are saved as string values in the BillingLineItem.cpt field,
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
from django.db import models
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
class CareTeamMembershipStatus(models.TextChoices):
|
|
5
|
+
"""CareTeamMembershipStatus."""
|
|
6
|
+
|
|
7
|
+
PROPOSED = "proposed", "Proposed"
|
|
8
|
+
ACTIVE = "active", "Active"
|
|
9
|
+
SUSPENDED = "suspended", "Suspended"
|
|
10
|
+
INACTIVE = "inactive", "Inactive"
|
|
11
|
+
ENTERED_IN_ERROR = "entered-in-error", "Entered in Error"
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
class CareTeamRole(models.Model):
|
|
15
|
+
"""CareTeamRole."""
|
|
16
|
+
|
|
17
|
+
class Meta:
|
|
18
|
+
managed = False
|
|
19
|
+
db_table = "canvas_sdk_data_api_careteamrole_001"
|
|
20
|
+
|
|
21
|
+
dbid = models.BigIntegerField(primary_key=True)
|
|
22
|
+
system = models.CharField()
|
|
23
|
+
version = models.CharField()
|
|
24
|
+
code = models.CharField()
|
|
25
|
+
display = models.CharField()
|
|
26
|
+
user_selected = models.BooleanField()
|
|
27
|
+
active = models.BooleanField()
|
|
28
|
+
|
|
29
|
+
def __str__(self) -> str:
|
|
30
|
+
return self.display
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
class CareTeamMembership(models.Model):
|
|
34
|
+
"""CareTeamMembership."""
|
|
35
|
+
|
|
36
|
+
class Meta:
|
|
37
|
+
managed = False
|
|
38
|
+
db_table = "canvas_sdk_data_api_careteammembership_001"
|
|
39
|
+
|
|
40
|
+
id = models.UUIDField()
|
|
41
|
+
dbid = models.BigIntegerField(primary_key=True)
|
|
42
|
+
created = models.DateTimeField()
|
|
43
|
+
modified = models.DateTimeField()
|
|
44
|
+
patient = models.ForeignKey(
|
|
45
|
+
"v1.Patient", on_delete=models.DO_NOTHING, related_name="care_team_memberships", null=True
|
|
46
|
+
)
|
|
47
|
+
staff = models.ForeignKey(
|
|
48
|
+
"v1.Staff", on_delete=models.DO_NOTHING, related_name="care_team_memberships", null=True
|
|
49
|
+
)
|
|
50
|
+
role = models.ForeignKey(
|
|
51
|
+
"v1.CareTeamRole", related_name="care_teams", on_delete=models.DO_NOTHING, null=True
|
|
52
|
+
)
|
|
53
|
+
status = models.CharField(choices=CareTeamMembershipStatus.choices)
|
|
54
|
+
lead = models.BooleanField()
|
|
55
|
+
role_code = models.CharField()
|
|
56
|
+
role_system = models.CharField()
|
|
57
|
+
role_display = models.CharField()
|
|
58
|
+
|
|
59
|
+
def __str__(self) -> str:
|
|
60
|
+
return f"id={self.id}"
|
canvas_sdk/v1/data/command.py
CHANGED
|
@@ -18,7 +18,7 @@ class Command(models.Model):
|
|
|
18
18
|
entered_in_error = models.ForeignKey("v1.CanvasUser", on_delete=models.DO_NOTHING, null=True)
|
|
19
19
|
state = models.CharField()
|
|
20
20
|
patient = models.ForeignKey("v1.Patient", on_delete=models.DO_NOTHING, null=True)
|
|
21
|
-
|
|
21
|
+
note = models.ForeignKey("v1.Note", on_delete=models.DO_NOTHING, related_name="commands")
|
|
22
22
|
schema_key = models.TextField()
|
|
23
23
|
data = models.JSONField()
|
|
24
24
|
origination_source = models.CharField()
|
canvas_sdk/v1/data/common.py
CHANGED
|
@@ -101,3 +101,56 @@ class Origin(models.TextChoices):
|
|
|
101
101
|
FLAGGED_POSTING_REVIEW = ("FLG_PST_REV", "Flagged posting review")
|
|
102
102
|
BATCH_PATIENT_STATEMENTS = ("BAT_PTN_STA", "Batch patient statements")
|
|
103
103
|
INCOMPLETE_COVERAGE = ("INC_COV", "Incomplete Coverage")
|
|
104
|
+
|
|
105
|
+
|
|
106
|
+
class ContactPointSystem(models.TextChoices):
|
|
107
|
+
"""ContactPointSystem."""
|
|
108
|
+
|
|
109
|
+
PHONE = "phone", "phone"
|
|
110
|
+
FAX = "fax", "fax"
|
|
111
|
+
EMAIL = "email", "email"
|
|
112
|
+
PAGER = "pager", "pager"
|
|
113
|
+
OTHER = "other", "other"
|
|
114
|
+
|
|
115
|
+
|
|
116
|
+
class ContactPointUse(models.TextChoices):
|
|
117
|
+
"""ContactPointUse."""
|
|
118
|
+
|
|
119
|
+
HOME = "home", "Home"
|
|
120
|
+
WORK = "work", "Work"
|
|
121
|
+
TEMP = "temp", "Temp"
|
|
122
|
+
OLD = "old", "Old"
|
|
123
|
+
OTHER = "other", "Other"
|
|
124
|
+
MOBILE = "mobile", "Mobile"
|
|
125
|
+
AUTOMATION = "automation", "Automation"
|
|
126
|
+
|
|
127
|
+
|
|
128
|
+
class ContactPointState(models.TextChoices):
|
|
129
|
+
"""ContactPointState."""
|
|
130
|
+
|
|
131
|
+
ACTIVE = "active", "Active"
|
|
132
|
+
DELETED = "deleted", "Deleted"
|
|
133
|
+
|
|
134
|
+
|
|
135
|
+
class AddressUse(models.TextChoices):
|
|
136
|
+
"""AddressUse."""
|
|
137
|
+
|
|
138
|
+
HOME = "home", "Home"
|
|
139
|
+
WORK = "work", "Work"
|
|
140
|
+
TEMP = "temp", "Temp"
|
|
141
|
+
OLD = "old", "Old"
|
|
142
|
+
|
|
143
|
+
|
|
144
|
+
class AddressType(models.TextChoices):
|
|
145
|
+
"""AddressType."""
|
|
146
|
+
|
|
147
|
+
POSTAL = "postal", "Postal"
|
|
148
|
+
PHYSICAL = "physical", "Physical"
|
|
149
|
+
BOTH = "both", "Both"
|
|
150
|
+
|
|
151
|
+
|
|
152
|
+
class AddressState(models.TextChoices):
|
|
153
|
+
"""AddressState."""
|
|
154
|
+
|
|
155
|
+
ACTIVE = "active", "Active"
|
|
156
|
+
DELETED = "deleted", "Deleted"
|
canvas_sdk/v1/data/condition.py
CHANGED
|
@@ -1,7 +1,15 @@
|
|
|
1
|
+
from typing import cast
|
|
2
|
+
|
|
1
3
|
from django.db import models
|
|
2
4
|
from django.db.models import TextChoices
|
|
3
5
|
|
|
4
|
-
from canvas_sdk.v1.data.base import
|
|
6
|
+
from canvas_sdk.v1.data.base import (
|
|
7
|
+
BaseModelManager,
|
|
8
|
+
BaseQuerySet,
|
|
9
|
+
CommittableQuerySetMixin,
|
|
10
|
+
ForPatientQuerySetMixin,
|
|
11
|
+
ValueSetLookupQuerySetMixin,
|
|
12
|
+
)
|
|
5
13
|
|
|
6
14
|
|
|
7
15
|
class ClinicalStatus(TextChoices):
|
|
@@ -14,12 +22,20 @@ class ClinicalStatus(TextChoices):
|
|
|
14
22
|
INVESTIGATIVE = "investigative", "investigative"
|
|
15
23
|
|
|
16
24
|
|
|
17
|
-
class ConditionQuerySet(
|
|
25
|
+
class ConditionQuerySet(
|
|
26
|
+
BaseQuerySet,
|
|
27
|
+
ValueSetLookupQuerySetMixin,
|
|
28
|
+
CommittableQuerySetMixin,
|
|
29
|
+
ForPatientQuerySetMixin,
|
|
30
|
+
):
|
|
18
31
|
"""ConditionQuerySet."""
|
|
19
32
|
|
|
20
33
|
pass
|
|
21
34
|
|
|
22
35
|
|
|
36
|
+
ConditionManager = BaseModelManager.from_queryset(ConditionQuerySet)
|
|
37
|
+
|
|
38
|
+
|
|
23
39
|
class Condition(models.Model):
|
|
24
40
|
"""Condition."""
|
|
25
41
|
|
|
@@ -27,7 +43,7 @@ class Condition(models.Model):
|
|
|
27
43
|
managed = False
|
|
28
44
|
db_table = "canvas_sdk_data_api_condition_001"
|
|
29
45
|
|
|
30
|
-
objects = ConditionQuerySet
|
|
46
|
+
objects = cast(ConditionQuerySet, ConditionManager())
|
|
31
47
|
|
|
32
48
|
id = models.UUIDField()
|
|
33
49
|
dbid = models.BigIntegerField(primary_key=True)
|