canvas 0.14.0__py3-none-any.whl → 0.16.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.14.0.dist-info → canvas-0.16.0.dist-info}/METADATA +2 -2
- {canvas-0.14.0.dist-info → canvas-0.16.0.dist-info}/RECORD +87 -52
- 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/templates/plugins/default/{{ cookiecutter.__project_slug }}/protocols/my_protocol.py +1 -1
- canvas_cli/utils/validators/manifest_schema.py +9 -2
- canvas_generated/messages/effects_pb2.py +2 -2
- canvas_generated/messages/effects_pb2.pyi +18 -0
- canvas_generated/messages/events_pb2.py +2 -2
- canvas_generated/messages/events_pb2.pyi +48 -0
- canvas_sdk/commands/tests/protocol/tests.py +3 -1
- canvas_sdk/commands/tests/test_utils.py +76 -18
- canvas_sdk/effects/banner_alert/tests.py +41 -20
- canvas_sdk/effects/launch_modal.py +14 -3
- canvas_sdk/events/base.py +1 -3
- canvas_sdk/handlers/action_button.py +33 -13
- canvas_sdk/handlers/application.py +1 -1
- canvas_sdk/handlers/cron_task.py +1 -1
- canvas_sdk/protocols/clinical_quality_measure.py +1 -1
- 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/v1/apps.py +7 -0
- canvas_sdk/v1/data/__init__.py +98 -5
- canvas_sdk/v1/data/allergy_intolerance.py +25 -9
- 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 +4 -7
- canvas_sdk/v1/data/care_team.py +60 -0
- canvas_sdk/v1/data/command.py +8 -10
- canvas_sdk/v1/data/common.py +53 -0
- canvas_sdk/v1/data/condition.py +22 -10
- canvas_sdk/v1/data/coverage.py +294 -0
- canvas_sdk/v1/data/detected_issue.py +5 -9
- canvas_sdk/v1/data/device.py +4 -8
- canvas_sdk/v1/data/imaging.py +12 -17
- canvas_sdk/v1/data/lab.py +41 -31
- canvas_sdk/v1/data/medication.py +16 -10
- canvas_sdk/v1/data/note.py +11 -14
- canvas_sdk/v1/data/observation.py +19 -14
- canvas_sdk/v1/data/organization.py +1 -2
- canvas_sdk/v1/data/patient.py +140 -2
- canvas_sdk/v1/data/practicelocation.py +2 -4
- canvas_sdk/v1/data/protocol_override.py +21 -8
- canvas_sdk/v1/data/questionnaire.py +20 -17
- canvas_sdk/v1/data/staff.py +5 -7
- canvas_sdk/v1/data/task.py +5 -11
- canvas_sdk/v1/data/user.py +0 -1
- canvas_sdk/v1/models.py +4 -0
- canvas_sdk/value_set/hcc2018.py +55369 -0
- plugin_runner/plugin_installer.py +1 -1
- plugin_runner/plugin_runner.py +5 -25
- plugin_runner/sandbox.py +133 -9
- plugin_runner/tests/fixtures/plugins/test_implicit_imports_plugin/CANVAS_MANIFEST.json +38 -0
- plugin_runner/tests/fixtures/plugins/test_implicit_imports_plugin/README.md +11 -0
- plugin_runner/tests/fixtures/plugins/test_implicit_imports_plugin/protocols/__init__.py +0 -0
- plugin_runner/tests/fixtures/plugins/test_implicit_imports_plugin/protocols/my_protocol.py +33 -0
- plugin_runner/tests/fixtures/plugins/test_implicit_imports_plugin/templates/__init__.py +3 -0
- plugin_runner/tests/fixtures/plugins/test_implicit_imports_plugin/templates/base.py +6 -0
- plugin_runner/tests/fixtures/plugins/test_implicit_imports_plugin/utils/__init__.py +5 -0
- plugin_runner/tests/fixtures/plugins/test_implicit_imports_plugin/utils/base.py +4 -0
- plugin_runner/tests/fixtures/plugins/test_module_forbidden_imports_plugin/CANVAS_MANIFEST.json +29 -0
- plugin_runner/tests/fixtures/plugins/test_module_forbidden_imports_plugin/README.md +12 -0
- plugin_runner/tests/fixtures/plugins/test_module_forbidden_imports_plugin/other_module/__init__.py +0 -0
- plugin_runner/tests/fixtures/plugins/test_module_forbidden_imports_plugin/other_module/base.py +10 -0
- plugin_runner/tests/fixtures/plugins/test_module_forbidden_imports_plugin/protocols/__init__.py +0 -0
- plugin_runner/tests/fixtures/plugins/test_module_forbidden_imports_plugin/protocols/my_protocol.py +18 -0
- plugin_runner/tests/fixtures/plugins/test_module_forbidden_imports_runtime_plugin/CANVAS_MANIFEST.json +29 -0
- plugin_runner/tests/fixtures/plugins/test_module_forbidden_imports_runtime_plugin/README.md +12 -0
- plugin_runner/tests/fixtures/plugins/test_module_forbidden_imports_runtime_plugin/other_module/__init__.py +0 -0
- plugin_runner/tests/fixtures/plugins/test_module_forbidden_imports_runtime_plugin/other_module/base.py +10 -0
- plugin_runner/tests/fixtures/plugins/test_module_forbidden_imports_runtime_plugin/protocols/__init__.py +0 -0
- plugin_runner/tests/fixtures/plugins/test_module_forbidden_imports_runtime_plugin/protocols/my_protocol.py +18 -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_application.py +9 -9
- plugin_runner/tests/test_plugin_installer.py +12 -1
- plugin_runner/tests/test_plugin_runner.py +159 -66
- plugin_runner/tests/test_sandbox.py +26 -14
- settings.py +13 -1
- canvas_sdk/models/__init__.py +0 -8
- {canvas-0.14.0.dist-info → canvas-0.16.0.dist-info}/WHEEL +0 -0
- {canvas-0.14.0.dist-info → canvas-0.16.0.dist-info}/entry_points.txt +0 -0
canvas_sdk/v1/data/imaging.py
CHANGED
|
@@ -6,8 +6,6 @@ from canvas_sdk.v1.data.common import (
|
|
|
6
6
|
ReviewPatientCommunicationMethod,
|
|
7
7
|
ReviewStatus,
|
|
8
8
|
)
|
|
9
|
-
from canvas_sdk.v1.data.patient import Patient
|
|
10
|
-
from canvas_sdk.v1.data.user import CanvasUser
|
|
11
9
|
|
|
12
10
|
|
|
13
11
|
class ImagingOrder(models.Model):
|
|
@@ -15,32 +13,31 @@ class ImagingOrder(models.Model):
|
|
|
15
13
|
|
|
16
14
|
class Meta:
|
|
17
15
|
managed = False
|
|
18
|
-
app_label = "canvas_sdk"
|
|
19
16
|
db_table = "canvas_sdk_data_api_imagingorder_001"
|
|
20
17
|
|
|
21
18
|
id = models.UUIDField()
|
|
22
19
|
dbid = models.BigIntegerField(primary_key=True)
|
|
23
20
|
created = models.DateTimeField()
|
|
24
21
|
modified = models.DateTimeField()
|
|
25
|
-
originator = models.ForeignKey(CanvasUser, on_delete=models.DO_NOTHING, null=True)
|
|
22
|
+
originator = models.ForeignKey("v1.CanvasUser", on_delete=models.DO_NOTHING, null=True)
|
|
26
23
|
deleted = models.BooleanField()
|
|
27
|
-
committer = models.ForeignKey(CanvasUser, on_delete=models.DO_NOTHING, null=True)
|
|
28
|
-
entered_in_error = models.ForeignKey(CanvasUser, on_delete=models.DO_NOTHING)
|
|
24
|
+
committer = models.ForeignKey("v1.CanvasUser", on_delete=models.DO_NOTHING, null=True)
|
|
25
|
+
entered_in_error = models.ForeignKey("v1.CanvasUser", on_delete=models.DO_NOTHING)
|
|
29
26
|
patient = models.ForeignKey(
|
|
30
|
-
Patient, on_delete=models.DO_NOTHING, related_name="imaging_orders", null=True
|
|
27
|
+
"v1.Patient", on_delete=models.DO_NOTHING, related_name="imaging_orders", null=True
|
|
31
28
|
)
|
|
32
29
|
# TODO - uncomment when Note model is complete
|
|
33
30
|
# note = models.ForeigneKey(Note, on_delete=models.DO_NOTHING, related_name="imaging_orders", null=True)
|
|
34
31
|
imaging = models.CharField()
|
|
35
32
|
# TODO - uncomment when ServiceProvider model is complete
|
|
36
|
-
# imaging_center = models.ForeignKey(ServiceProvider, on_delete=models.DO_NOTHING, related_name="imaging_orders", null=True)
|
|
33
|
+
# imaging_center = models.ForeignKey('v1.ServiceProvider', on_delete=models.DO_NOTHING, related_name="imaging_orders", null=True)
|
|
37
34
|
note_to_radiologist = models.CharField()
|
|
38
35
|
internal_comment = models.CharField()
|
|
39
36
|
status = models.CharField(choices=OrderStatus)
|
|
40
37
|
date_time_ordered = models.DateTimeField()
|
|
41
38
|
priority = models.CharField()
|
|
42
39
|
# TODO - uncomment when Staff model is complete
|
|
43
|
-
# ordering_provider = models.ForeignKey(Staff, on_delete=models.DO_NOTHING, related_name="imaging_orders", null=True)
|
|
40
|
+
# ordering_provider = models.ForeignKey('v1.Staff', on_delete=models.DO_NOTHING, related_name="imaging_orders", null=True)
|
|
44
41
|
delegated = models.BooleanField(default=False)
|
|
45
42
|
|
|
46
43
|
|
|
@@ -49,26 +46,25 @@ class ImagingReview(models.Model):
|
|
|
49
46
|
|
|
50
47
|
class Meta:
|
|
51
48
|
managed = False
|
|
52
|
-
app_label = "canvas_sdk"
|
|
53
49
|
db_table = "canvas_sdk_data_api_imagingreview_001"
|
|
54
50
|
|
|
55
51
|
id = models.UUIDField()
|
|
56
52
|
dbid = models.BigIntegerField(primary_key=True)
|
|
57
53
|
created = models.DateTimeField()
|
|
58
54
|
modified = models.DateTimeField()
|
|
59
|
-
originator = models.ForeignKey(CanvasUser, on_delete=models.DO_NOTHING, null=True)
|
|
55
|
+
originator = models.ForeignKey("v1.CanvasUser", on_delete=models.DO_NOTHING, null=True)
|
|
60
56
|
deleted = models.BooleanField()
|
|
61
|
-
committer = models.ForeignKey(CanvasUser, on_delete=models.DO_NOTHING, null=True)
|
|
62
|
-
entered_in_error = models.ForeignKey(CanvasUser, on_delete=models.DO_NOTHING, null=True)
|
|
57
|
+
committer = models.ForeignKey("v1.CanvasUser", on_delete=models.DO_NOTHING, null=True)
|
|
58
|
+
entered_in_error = models.ForeignKey("v1.CanvasUser", on_delete=models.DO_NOTHING, null=True)
|
|
63
59
|
patient_communication_method = models.CharField(choices=ReviewPatientCommunicationMethod)
|
|
64
60
|
# TODO - uncomment when Note model is complete
|
|
65
|
-
# note = models.ForeignKey(Note, on_delete=models.DO_NOTHING, related_name="imaging_reviews", null=True)
|
|
61
|
+
# note = models.ForeignKey('v1.Note', on_delete=models.DO_NOTHING, related_name="imaging_reviews", null=True)
|
|
66
62
|
internal_comment = models.CharField()
|
|
67
63
|
message_to_patient = models.CharField()
|
|
68
64
|
is_released_to_patient = models.BooleanField()
|
|
69
65
|
status = models.CharField(choices=ReviewStatus)
|
|
70
66
|
patient = models.ForeignKey(
|
|
71
|
-
Patient, on_delete=models.DO_NOTHING, related_name="imaging_reviews", null=True
|
|
67
|
+
"v1.Patient", on_delete=models.DO_NOTHING, related_name="imaging_reviews", null=True
|
|
72
68
|
)
|
|
73
69
|
|
|
74
70
|
|
|
@@ -82,7 +78,6 @@ class ImagingReport(models.Model):
|
|
|
82
78
|
|
|
83
79
|
class Meta:
|
|
84
80
|
managed = False
|
|
85
|
-
app_label = "canvas_sdk"
|
|
86
81
|
db_table = "canvas_sdk_data_api_imagingreport_001"
|
|
87
82
|
|
|
88
83
|
id = models.UUIDField()
|
|
@@ -94,7 +89,7 @@ class ImagingReport(models.Model):
|
|
|
94
89
|
requires_signature = models.BooleanField()
|
|
95
90
|
assigned_date = models.DateTimeField()
|
|
96
91
|
patient = models.ForeignKey(
|
|
97
|
-
Patient, on_delete=models.DO_NOTHING, related_name="imaging_results", null=True
|
|
92
|
+
"v1.Patient", on_delete=models.DO_NOTHING, related_name="imaging_results", null=True
|
|
98
93
|
)
|
|
99
94
|
order = models.ForeignKey(ImagingOrder, on_delete=models.DO_NOTHING, null=True)
|
|
100
95
|
source = models.CharField(choices=ImagingReportSource)
|
canvas_sdk/v1/data/lab.py
CHANGED
|
@@ -1,15 +1,24 @@
|
|
|
1
|
+
from typing import cast
|
|
2
|
+
|
|
1
3
|
from django.db import models
|
|
2
4
|
|
|
3
5
|
from canvas_sdk.v1.data.base import (
|
|
4
|
-
|
|
6
|
+
BaseModelManager,
|
|
7
|
+
BaseQuerySet,
|
|
8
|
+
CommittableQuerySetMixin,
|
|
9
|
+
ForPatientQuerySetMixin,
|
|
5
10
|
TimeframeLookupQuerySetMixin,
|
|
6
11
|
ValueSetLookupQuerySet,
|
|
7
12
|
)
|
|
8
|
-
from canvas_sdk.v1.data.condition import Condition
|
|
9
|
-
from canvas_sdk.v1.data.patient import Patient
|
|
10
13
|
|
|
11
|
-
|
|
12
|
-
|
|
14
|
+
|
|
15
|
+
class LabReportQuerySet(BaseQuerySet, CommittableQuerySetMixin, ForPatientQuerySetMixin):
|
|
16
|
+
"""A queryset for lab reports."""
|
|
17
|
+
|
|
18
|
+
pass
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
LabReportManager = BaseModelManager.from_queryset(LabReportQuerySet)
|
|
13
22
|
|
|
14
23
|
|
|
15
24
|
class TransmissionType(models.TextChoices):
|
|
@@ -25,10 +34,9 @@ class LabReport(models.Model):
|
|
|
25
34
|
|
|
26
35
|
class Meta:
|
|
27
36
|
managed = False
|
|
28
|
-
app_label = "canvas_sdk"
|
|
29
37
|
db_table = "canvas_sdk_data_api_labreport_001"
|
|
30
38
|
|
|
31
|
-
objects =
|
|
39
|
+
objects = cast(LabReportQuerySet, LabReportManager())
|
|
32
40
|
|
|
33
41
|
id = models.UUIDField()
|
|
34
42
|
dbid = models.BigIntegerField(primary_key=True)
|
|
@@ -39,7 +47,7 @@ class LabReport(models.Model):
|
|
|
39
47
|
requires_signature = models.BooleanField()
|
|
40
48
|
assigned_date = models.DateTimeField()
|
|
41
49
|
patient = models.ForeignKey(
|
|
42
|
-
Patient, on_delete=models.DO_NOTHING, related_name="lab_reports", null=True
|
|
50
|
+
"v1.Patient", on_delete=models.DO_NOTHING, related_name="lab_reports", null=True
|
|
43
51
|
)
|
|
44
52
|
transmission_type = models.CharField(choices=TransmissionType)
|
|
45
53
|
for_test_only = models.BooleanField()
|
|
@@ -52,35 +60,43 @@ class LabReport(models.Model):
|
|
|
52
60
|
original_date = models.DateTimeField()
|
|
53
61
|
date_performed = models.DateTimeField()
|
|
54
62
|
custom_document_name = models.CharField()
|
|
55
|
-
originator = models.ForeignKey(CanvasUser, on_delete=models.DO_NOTHING, null=True)
|
|
56
|
-
committer = models.ForeignKey(CanvasUser, on_delete=models.DO_NOTHING, null=True)
|
|
57
|
-
entered_in_error = models.ForeignKey(CanvasUser, on_delete=models.DO_NOTHING, null=True)
|
|
63
|
+
originator = models.ForeignKey("v1.CanvasUser", on_delete=models.DO_NOTHING, null=True)
|
|
64
|
+
committer = models.ForeignKey("v1.CanvasUser", on_delete=models.DO_NOTHING, null=True)
|
|
65
|
+
entered_in_error = models.ForeignKey("v1.CanvasUser", on_delete=models.DO_NOTHING, null=True)
|
|
58
66
|
deleted = models.BooleanField()
|
|
59
67
|
|
|
60
68
|
|
|
69
|
+
class LabReviewQuerySet(BaseQuerySet, CommittableQuerySetMixin, ForPatientQuerySetMixin):
|
|
70
|
+
"""A queryset for lab reviews."""
|
|
71
|
+
|
|
72
|
+
pass
|
|
73
|
+
|
|
74
|
+
|
|
75
|
+
LabReviewManager = BaseModelManager.from_queryset(LabReviewQuerySet)
|
|
76
|
+
|
|
77
|
+
|
|
61
78
|
class LabReview(models.Model):
|
|
62
79
|
"""A class representing a lab review."""
|
|
63
80
|
|
|
64
81
|
class Meta:
|
|
65
82
|
managed = False
|
|
66
|
-
app_label = "canvas_sdk"
|
|
67
83
|
db_table = "canvas_sdk_data_api_labreview_001"
|
|
68
84
|
|
|
69
|
-
objects =
|
|
85
|
+
objects = cast(LabReviewQuerySet, LabReviewManager())
|
|
70
86
|
|
|
71
87
|
id = models.UUIDField()
|
|
72
88
|
dbid = models.BigIntegerField(primary_key=True)
|
|
73
89
|
created = models.DateTimeField()
|
|
74
90
|
modified = models.DateTimeField()
|
|
75
|
-
originator = models.ForeignKey(CanvasUser, on_delete=models.DO_NOTHING, null=True)
|
|
91
|
+
originator = models.ForeignKey("v1.CanvasUser", on_delete=models.DO_NOTHING, null=True)
|
|
76
92
|
deleted = models.BooleanField()
|
|
77
|
-
committer = models.ForeignKey(CanvasUser, on_delete=models.DO_NOTHING, null=True)
|
|
78
|
-
entered_in_error = models.ForeignKey(CanvasUser, on_delete=models.DO_NOTHING, null=True)
|
|
93
|
+
committer = models.ForeignKey("v1.CanvasUser", on_delete=models.DO_NOTHING, null=True)
|
|
94
|
+
entered_in_error = models.ForeignKey("v1.CanvasUser", on_delete=models.DO_NOTHING, null=True)
|
|
79
95
|
internal_comment = models.TextField()
|
|
80
96
|
message_to_patient = models.CharField()
|
|
81
97
|
status = models.CharField()
|
|
82
98
|
patient = models.ForeignKey(
|
|
83
|
-
Patient, on_delete=models.DO_NOTHING, related_name="lab_reviews", null=True
|
|
99
|
+
"v1.Patient", on_delete=models.DO_NOTHING, related_name="lab_reviews", null=True
|
|
84
100
|
)
|
|
85
101
|
patient_communication_method = models.CharField()
|
|
86
102
|
|
|
@@ -105,7 +121,6 @@ class LabValue(models.Model):
|
|
|
105
121
|
|
|
106
122
|
class Meta:
|
|
107
123
|
managed = False
|
|
108
|
-
app_label = "canvas_sdk"
|
|
109
124
|
db_table = "canvas_sdk_data_api_labvalue_001"
|
|
110
125
|
|
|
111
126
|
objects = LabValueQuerySet.as_manager()
|
|
@@ -132,7 +147,6 @@ class LabValueCoding(models.Model):
|
|
|
132
147
|
|
|
133
148
|
class Meta:
|
|
134
149
|
managed = False
|
|
135
|
-
app_label = "canvas_sdk"
|
|
136
150
|
db_table = "canvas_sdk_data_api_labvaluecoding_001"
|
|
137
151
|
|
|
138
152
|
dbid = models.BigIntegerField(primary_key=True)
|
|
@@ -173,19 +187,18 @@ class LabOrder(models.Model):
|
|
|
173
187
|
|
|
174
188
|
class Meta:
|
|
175
189
|
managed = False
|
|
176
|
-
app_label = "canvas_sdk"
|
|
177
190
|
db_table = "canvas_sdk_data_api_laborder_001"
|
|
178
191
|
|
|
179
192
|
id = models.UUIDField()
|
|
180
193
|
dbid = models.BigIntegerField(primary_key=True)
|
|
181
194
|
created = models.DateTimeField()
|
|
182
195
|
modified = models.DateTimeField()
|
|
183
|
-
originator = models.ForeignKey(CanvasUser, on_delete=models.DO_NOTHING, null=True)
|
|
196
|
+
originator = models.ForeignKey("v1.CanvasUser", on_delete=models.DO_NOTHING, null=True)
|
|
184
197
|
deleted = models.BooleanField()
|
|
185
|
-
committer = models.ForeignKey(CanvasUser, on_delete=models.DO_NOTHING, null=True)
|
|
186
|
-
entered_in_error = models.ForeignKey(CanvasUser, on_delete=models.DO_NOTHING, null=True)
|
|
198
|
+
committer = models.ForeignKey("v1.CanvasUser", on_delete=models.DO_NOTHING, null=True)
|
|
199
|
+
entered_in_error = models.ForeignKey("v1.CanvasUser", on_delete=models.DO_NOTHING, null=True)
|
|
187
200
|
patient = models.ForeignKey(
|
|
188
|
-
Patient, on_delete=models.DO_NOTHING, related_name="lab_orders", null=True
|
|
201
|
+
"v1.Patient", on_delete=models.DO_NOTHING, related_name="lab_orders", null=True
|
|
189
202
|
)
|
|
190
203
|
ontology_lab_partner = models.CharField()
|
|
191
204
|
# TODO - uncomment when the Note model is finished
|
|
@@ -222,16 +235,15 @@ class LabOrderReason(models.Model):
|
|
|
222
235
|
|
|
223
236
|
class Meta:
|
|
224
237
|
managed = False
|
|
225
|
-
app_label = "canvas_sdk"
|
|
226
238
|
db_table = "canvas_sdk_data_api_laborderreason_001"
|
|
227
239
|
|
|
228
240
|
dbid = models.BigIntegerField(primary_key=True)
|
|
229
241
|
created = models.DateTimeField()
|
|
230
242
|
modified = models.DateTimeField()
|
|
231
|
-
originator = models.ForeignKey(CanvasUser, on_delete=models.DO_NOTHING, null=True)
|
|
243
|
+
originator = models.ForeignKey("v1.CanvasUser", on_delete=models.DO_NOTHING, null=True)
|
|
232
244
|
deleted = models.BooleanField()
|
|
233
|
-
committer = models.ForeignKey(CanvasUser, on_delete=models.DO_NOTHING, null=True)
|
|
234
|
-
entered_in_error = models.ForeignKey(CanvasUser, on_delete=models.DO_NOTHING, null=True)
|
|
245
|
+
committer = models.ForeignKey("v1.CanvasUser", on_delete=models.DO_NOTHING, null=True)
|
|
246
|
+
entered_in_error = models.ForeignKey("v1.CanvasUser", on_delete=models.DO_NOTHING, null=True)
|
|
235
247
|
order = models.ForeignKey(
|
|
236
248
|
LabOrder, on_delete=models.DO_NOTHING, related_name="reasons", null=True
|
|
237
249
|
)
|
|
@@ -243,7 +255,6 @@ class LabOrderReasonCondition(models.Model):
|
|
|
243
255
|
|
|
244
256
|
class Meta:
|
|
245
257
|
managed = False
|
|
246
|
-
app_label = "canvas_sdk"
|
|
247
258
|
db_table = "canvas_sdk_data_api_laborderreasoncondition_001"
|
|
248
259
|
|
|
249
260
|
dbid = models.BigIntegerField(primary_key=True)
|
|
@@ -253,7 +264,7 @@ class LabOrderReasonCondition(models.Model):
|
|
|
253
264
|
LabOrderReason, on_delete=models.DO_NOTHING, related_name="reason_conditions", null=True
|
|
254
265
|
)
|
|
255
266
|
condition = models.ForeignKey(
|
|
256
|
-
Condition,
|
|
267
|
+
"v1.Condition",
|
|
257
268
|
on_delete=models.DO_NOTHING,
|
|
258
269
|
related_name="lab_order_reason_conditions",
|
|
259
270
|
null=True,
|
|
@@ -278,7 +289,6 @@ class LabTest(models.Model):
|
|
|
278
289
|
|
|
279
290
|
class Meta:
|
|
280
291
|
managed = False
|
|
281
|
-
app_label = "canvas_sdk"
|
|
282
292
|
db_table = "canvas_sdk_data_api_labtest_001"
|
|
283
293
|
|
|
284
294
|
id = models.UUIDField()
|
canvas_sdk/v1/data/medication.py
CHANGED
|
@@ -1,9 +1,14 @@
|
|
|
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
|
|
5
|
-
|
|
6
|
-
|
|
6
|
+
from canvas_sdk.v1.data.base import (
|
|
7
|
+
BaseModelManager,
|
|
8
|
+
CommittableQuerySetMixin,
|
|
9
|
+
ForPatientQuerySetMixin,
|
|
10
|
+
ValueSetLookupQuerySet,
|
|
11
|
+
)
|
|
7
12
|
|
|
8
13
|
|
|
9
14
|
class Status(TextChoices):
|
|
@@ -13,30 +18,32 @@ class Status(TextChoices):
|
|
|
13
18
|
INACTIVE = "inactive", "inactive"
|
|
14
19
|
|
|
15
20
|
|
|
16
|
-
class MedicationQuerySet(ValueSetLookupQuerySet):
|
|
21
|
+
class MedicationQuerySet(ValueSetLookupQuerySet, CommittableQuerySetMixin, ForPatientQuerySetMixin):
|
|
17
22
|
"""MedicationQuerySet."""
|
|
18
23
|
|
|
19
24
|
pass
|
|
20
25
|
|
|
21
26
|
|
|
27
|
+
MedicationManager = BaseModelManager.from_queryset(MedicationQuerySet)
|
|
28
|
+
|
|
29
|
+
|
|
22
30
|
class Medication(models.Model):
|
|
23
31
|
"""Medication."""
|
|
24
32
|
|
|
25
33
|
class Meta:
|
|
26
34
|
managed = False
|
|
27
|
-
app_label = "canvas_sdk"
|
|
28
35
|
db_table = "canvas_sdk_data_api_medication_001"
|
|
29
36
|
|
|
30
|
-
objects =
|
|
37
|
+
objects = cast(MedicationQuerySet, MedicationManager())
|
|
31
38
|
|
|
32
39
|
id = models.UUIDField()
|
|
33
40
|
dbid = models.BigIntegerField(primary_key=True)
|
|
34
41
|
patient = models.ForeignKey(
|
|
35
|
-
Patient, on_delete=models.DO_NOTHING, related_name="medications", null=True
|
|
42
|
+
"v1.Patient", on_delete=models.DO_NOTHING, related_name="medications", null=True
|
|
36
43
|
)
|
|
37
44
|
deleted = models.BooleanField()
|
|
38
|
-
entered_in_error = models.ForeignKey(CanvasUser, on_delete=models.DO_NOTHING, null=True)
|
|
39
|
-
committer = models.ForeignKey(CanvasUser, on_delete=models.DO_NOTHING, null=True)
|
|
45
|
+
entered_in_error = models.ForeignKey("v1.CanvasUser", on_delete=models.DO_NOTHING, null=True)
|
|
46
|
+
committer = models.ForeignKey("v1.CanvasUser", on_delete=models.DO_NOTHING, null=True)
|
|
40
47
|
status = models.CharField(choices=Status.choices)
|
|
41
48
|
start_date = models.DateTimeField()
|
|
42
49
|
end_date = models.DateTimeField()
|
|
@@ -52,7 +59,6 @@ class MedicationCoding(models.Model):
|
|
|
52
59
|
|
|
53
60
|
class Meta:
|
|
54
61
|
managed = False
|
|
55
|
-
app_label = "canvas_sdk"
|
|
56
62
|
db_table = "canvas_sdk_data_api_medicationcoding_001"
|
|
57
63
|
|
|
58
64
|
dbid = models.BigIntegerField(primary_key=True)
|
canvas_sdk/v1/data/note.py
CHANGED
|
@@ -1,11 +1,6 @@
|
|
|
1
1
|
from django.contrib.postgres.fields import ArrayField
|
|
2
2
|
from django.db import models
|
|
3
3
|
|
|
4
|
-
from canvas_sdk.v1.data.patient import Patient
|
|
5
|
-
|
|
6
|
-
# from canvas_sdk.v1.data.staff import Staff
|
|
7
|
-
from canvas_sdk.v1.data.user import CanvasUser
|
|
8
|
-
|
|
9
4
|
|
|
10
5
|
class NoteTypeCategories(models.TextChoices):
|
|
11
6
|
"""Note type categories."""
|
|
@@ -97,7 +92,6 @@ class NoteType(models.Model):
|
|
|
97
92
|
|
|
98
93
|
class Meta:
|
|
99
94
|
managed = False
|
|
100
|
-
app_label = "canvas_sdk"
|
|
101
95
|
db_table = "canvas_sdk_data_api_notetype_001"
|
|
102
96
|
|
|
103
97
|
dbid = models.BigIntegerField(primary_key=True)
|
|
@@ -126,6 +120,8 @@ class NoteType(models.Model):
|
|
|
126
120
|
deprecated_at = models.DateTimeField()
|
|
127
121
|
is_patient_required = models.BooleanField()
|
|
128
122
|
allow_custom_title = models.BooleanField()
|
|
123
|
+
is_scheduleable_via_patient_portal = models.BooleanField()
|
|
124
|
+
online_duration = models.IntegerField()
|
|
129
125
|
|
|
130
126
|
|
|
131
127
|
class Note(models.Model):
|
|
@@ -133,30 +129,31 @@ class Note(models.Model):
|
|
|
133
129
|
|
|
134
130
|
class Meta:
|
|
135
131
|
managed = False
|
|
136
|
-
app_label = "canvas_sdk"
|
|
137
132
|
db_table = "canvas_sdk_data_api_note_001"
|
|
138
133
|
|
|
139
134
|
id = models.CharField(max_length=32)
|
|
140
135
|
dbid = models.BigIntegerField(db_column="dbid", primary_key=True)
|
|
141
136
|
created = models.DateTimeField()
|
|
142
137
|
modified = models.DateTimeField()
|
|
143
|
-
patient = models.ForeignKey(
|
|
138
|
+
patient = models.ForeignKey(
|
|
139
|
+
"v1.Patient", on_delete=models.DO_NOTHING, related_name="notes", null=True
|
|
140
|
+
)
|
|
144
141
|
provider = models.ForeignKey(
|
|
145
|
-
"Staff", on_delete=models.DO_NOTHING, related_name="notes", null=True
|
|
142
|
+
"v1.Staff", on_delete=models.DO_NOTHING, related_name="notes", null=True
|
|
146
143
|
)
|
|
147
144
|
note_type = models.CharField(choices=NoteTypes.choices, null=True)
|
|
148
145
|
note_type_version = models.ForeignKey(
|
|
149
|
-
"NoteType", on_delete=models.DO_NOTHING, related_name="notes", null=True
|
|
146
|
+
"v1.NoteType", on_delete=models.DO_NOTHING, related_name="notes", null=True
|
|
150
147
|
)
|
|
151
148
|
title = models.TextField()
|
|
152
149
|
body = models.JSONField()
|
|
153
|
-
originator = models.ForeignKey(CanvasUser, on_delete=models.DO_NOTHING, null=True)
|
|
154
|
-
last_modified_by_staff = models.ForeignKey("Staff", on_delete=models.DO_NOTHING, null=True)
|
|
150
|
+
originator = models.ForeignKey("v1.CanvasUser", on_delete=models.DO_NOTHING, null=True)
|
|
151
|
+
last_modified_by_staff = models.ForeignKey("v1.Staff", on_delete=models.DO_NOTHING, null=True)
|
|
155
152
|
checksum = models.CharField()
|
|
156
153
|
billing_note = models.TextField()
|
|
157
154
|
# TODO -implement InpatientStay model
|
|
158
|
-
# inpatient_stay = models.ForeignKey("InpatientStay", on_delete=models.DO_NOTHING, null=True)
|
|
155
|
+
# inpatient_stay = models.ForeignKey("v1.InpatientStay", on_delete=models.DO_NOTHING, null=True)
|
|
159
156
|
related_data = models.JSONField()
|
|
160
|
-
location = models.ForeignKey("PracticeLocation", on_delete=models.DO_NOTHING, null=True)
|
|
157
|
+
location = models.ForeignKey("v1.PracticeLocation", on_delete=models.DO_NOTHING, null=True)
|
|
161
158
|
datetime_of_service = models.DateTimeField()
|
|
162
159
|
place_of_service = models.CharField()
|
|
@@ -1,36 +1,45 @@
|
|
|
1
|
+
from typing import cast
|
|
2
|
+
|
|
1
3
|
from django.db import models
|
|
2
4
|
|
|
3
|
-
from canvas_sdk.v1.data.base import
|
|
4
|
-
|
|
5
|
-
|
|
5
|
+
from canvas_sdk.v1.data.base import (
|
|
6
|
+
BaseModelManager,
|
|
7
|
+
CommittableQuerySetMixin,
|
|
8
|
+
ForPatientQuerySetMixin,
|
|
9
|
+
ValueSetLookupQuerySet,
|
|
10
|
+
)
|
|
6
11
|
|
|
7
12
|
|
|
8
|
-
class ObservationQuerySet(
|
|
13
|
+
class ObservationQuerySet(
|
|
14
|
+
ValueSetLookupQuerySet, CommittableQuerySetMixin, ForPatientQuerySetMixin
|
|
15
|
+
):
|
|
9
16
|
"""ObservationQuerySet."""
|
|
10
17
|
|
|
11
18
|
pass
|
|
12
19
|
|
|
13
20
|
|
|
21
|
+
ObservationManager = BaseModelManager.from_queryset(ObservationQuerySet)
|
|
22
|
+
|
|
23
|
+
|
|
14
24
|
class Observation(models.Model):
|
|
15
25
|
"""Observation."""
|
|
16
26
|
|
|
17
27
|
class Meta:
|
|
18
28
|
managed = False
|
|
19
|
-
app_label = "canvas_sdk"
|
|
20
29
|
db_table = "canvas_sdk_data_api_observation_001"
|
|
21
30
|
|
|
22
|
-
objects =
|
|
31
|
+
objects = cast(ObservationQuerySet, ObservationManager())
|
|
23
32
|
|
|
24
33
|
id = models.UUIDField()
|
|
25
34
|
dbid = models.BigIntegerField(primary_key=True)
|
|
26
35
|
created = models.DateTimeField()
|
|
27
36
|
modified = models.DateTimeField()
|
|
28
|
-
originator = models.ForeignKey(CanvasUser, on_delete=models.DO_NOTHING, null=True)
|
|
29
|
-
committer = models.ForeignKey(CanvasUser, on_delete=models.DO_NOTHING, null=True)
|
|
30
|
-
entered_in_error = models.ForeignKey(CanvasUser, on_delete=models.DO_NOTHING, null=True)
|
|
37
|
+
originator = models.ForeignKey("v1.CanvasUser", on_delete=models.DO_NOTHING, null=True)
|
|
38
|
+
committer = models.ForeignKey("v1.CanvasUser", on_delete=models.DO_NOTHING, null=True)
|
|
39
|
+
entered_in_error = models.ForeignKey("v1.CanvasUser", on_delete=models.DO_NOTHING, null=True)
|
|
31
40
|
deleted = models.BooleanField()
|
|
32
41
|
patient = models.ForeignKey(
|
|
33
|
-
Patient, on_delete=models.DO_NOTHING, related_name="observations", null=True
|
|
42
|
+
"v1.Patient", on_delete=models.DO_NOTHING, related_name="observations", null=True
|
|
34
43
|
)
|
|
35
44
|
is_member_of = models.ForeignKey(
|
|
36
45
|
"self", on_delete=models.DO_NOTHING, related_name="members", null=True
|
|
@@ -48,7 +57,6 @@ class ObservationCoding(models.Model):
|
|
|
48
57
|
|
|
49
58
|
class Meta:
|
|
50
59
|
managed = False
|
|
51
|
-
app_label = "canvas_sdk"
|
|
52
60
|
db_table = "canvas_sdk_data_api_observationcoding_001"
|
|
53
61
|
|
|
54
62
|
dbid = models.BigIntegerField(primary_key=True)
|
|
@@ -67,7 +75,6 @@ class ObservationComponent(models.Model):
|
|
|
67
75
|
|
|
68
76
|
class Meta:
|
|
69
77
|
managed = False
|
|
70
|
-
app_label = "canvas_sdk"
|
|
71
78
|
db_table = "canvas_sdk_data_api_observationcomponent_001"
|
|
72
79
|
|
|
73
80
|
dbid = models.BigIntegerField(primary_key=True)
|
|
@@ -86,7 +93,6 @@ class ObservationComponentCoding(models.Model):
|
|
|
86
93
|
|
|
87
94
|
class Meta:
|
|
88
95
|
managed = False
|
|
89
|
-
app_label = "canvas_sdk"
|
|
90
96
|
db_table = "canvas_sdk_data_api_observationcomponentcoding_001"
|
|
91
97
|
|
|
92
98
|
dbid = models.BigIntegerField(primary_key=True)
|
|
@@ -105,7 +111,6 @@ class ObservationValueCoding(models.Model):
|
|
|
105
111
|
|
|
106
112
|
class Meta:
|
|
107
113
|
managed = False
|
|
108
|
-
app_label = "canvas_sdk"
|
|
109
114
|
db_table = "canvas_sdk_data_api_observationvaluecoding_001"
|
|
110
115
|
|
|
111
116
|
dbid = models.BigIntegerField(primary_key=True)
|
|
@@ -8,7 +8,6 @@ class Organization(models.Model):
|
|
|
8
8
|
|
|
9
9
|
class Meta:
|
|
10
10
|
managed = False
|
|
11
|
-
app_label = "canvas_sdk"
|
|
12
11
|
db_table = "canvas_sdk_data_api_organization_001"
|
|
13
12
|
|
|
14
13
|
dbid = models.BigIntegerField(primary_key=True)
|
|
@@ -26,4 +25,4 @@ class Organization(models.Model):
|
|
|
26
25
|
group_npi_number = models.CharField()
|
|
27
26
|
group_taxonomy_number = models.CharField()
|
|
28
27
|
include_zz_qualifier = models.BooleanField()
|
|
29
|
-
main_location = models.OneToOneField("PracticeLocation", on_delete=models.DO_NOTHING)
|
|
28
|
+
main_location = models.OneToOneField("v1.PracticeLocation", on_delete=models.DO_NOTHING)
|