canvas 0.67.0__py3-none-any.whl → 0.69.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.

Files changed (69) hide show
  1. {canvas-0.67.0.dist-info → canvas-0.69.0.dist-info}/METADATA +1 -1
  2. {canvas-0.67.0.dist-info → canvas-0.69.0.dist-info}/RECORD +69 -62
  3. canvas_generated/messages/effects_pb2.py +2 -2
  4. canvas_generated/messages/effects_pb2.pyi +6 -0
  5. canvas_generated/messages/events_pb2.py +2 -2
  6. canvas_generated/messages/events_pb2.pyi +2 -0
  7. canvas_sdk/effects/note/base.py +17 -0
  8. canvas_sdk/handlers/application.py +7 -7
  9. canvas_sdk/handlers/utils.py +14 -0
  10. canvas_sdk/test_utils/factories/__init__.py +25 -0
  11. canvas_sdk/test_utils/factories/claim.py +24 -0
  12. canvas_sdk/test_utils/factories/claim_diagnosis_code.py +1 -0
  13. canvas_sdk/test_utils/factories/note.py +37 -0
  14. canvas_sdk/test_utils/factories/organization.py +20 -0
  15. canvas_sdk/test_utils/factories/practicelocation.py +34 -0
  16. canvas_sdk/test_utils/factories/staff.py +111 -0
  17. canvas_sdk/utils/metrics.py +4 -1
  18. canvas_sdk/v1/data/allergy_intolerance.py +4 -10
  19. canvas_sdk/v1/data/appointment.py +2 -4
  20. canvas_sdk/v1/data/assessment.py +2 -12
  21. canvas_sdk/v1/data/banner_alert.py +2 -4
  22. canvas_sdk/v1/data/base.py +28 -0
  23. canvas_sdk/v1/data/billing.py +8 -11
  24. canvas_sdk/v1/data/care_team.py +4 -10
  25. canvas_sdk/v1/data/claim.py +15 -29
  26. canvas_sdk/v1/data/claim_diagnosis_code.py +2 -5
  27. canvas_sdk/v1/data/claim_line_item.py +2 -5
  28. canvas_sdk/v1/data/coding.py +19 -0
  29. canvas_sdk/v1/data/command.py +2 -4
  30. canvas_sdk/v1/data/compound_medication.py +3 -3
  31. canvas_sdk/v1/data/condition.py +2 -7
  32. canvas_sdk/v1/data/coverage.py +5 -13
  33. canvas_sdk/v1/data/detected_issue.py +4 -20
  34. canvas_sdk/v1/data/device.py +2 -14
  35. canvas_sdk/v1/data/discount.py +2 -5
  36. canvas_sdk/v1/data/encounter.py +2 -4
  37. canvas_sdk/v1/data/goal.py +2 -14
  38. canvas_sdk/v1/data/imaging.py +4 -30
  39. canvas_sdk/v1/data/immunization.py +3 -13
  40. canvas_sdk/v1/data/lab.py +9 -62
  41. canvas_sdk/v1/data/line_item_transaction.py +2 -5
  42. canvas_sdk/v1/data/medication.py +2 -7
  43. canvas_sdk/v1/data/medication_history.py +5 -15
  44. canvas_sdk/v1/data/medication_statement.py +2 -11
  45. canvas_sdk/v1/data/message.py +3 -7
  46. canvas_sdk/v1/data/note.py +11 -19
  47. canvas_sdk/v1/data/observation.py +8 -35
  48. canvas_sdk/v1/data/organization.py +5 -7
  49. canvas_sdk/v1/data/patient.py +4 -11
  50. canvas_sdk/v1/data/patient_consent.py +4 -14
  51. canvas_sdk/v1/data/payment_collection.py +2 -5
  52. canvas_sdk/v1/data/posting.py +3 -9
  53. canvas_sdk/v1/data/practicelocation.py +4 -6
  54. canvas_sdk/v1/data/protocol_override.py +2 -3
  55. canvas_sdk/v1/data/protocol_result.py +3 -3
  56. canvas_sdk/v1/data/questionnaire.py +9 -25
  57. canvas_sdk/v1/data/reason_for_visit.py +2 -6
  58. canvas_sdk/v1/data/referral.py +3 -17
  59. canvas_sdk/v1/data/staff.py +33 -25
  60. canvas_sdk/v1/data/stop_medication_event.py +2 -11
  61. canvas_sdk/v1/data/task.py +3 -7
  62. canvas_sdk/v1/data/team.py +2 -4
  63. canvas_sdk/v1/data/utils.py +5 -0
  64. logger/logger.py +1 -1
  65. protobufs/canvas_generated/messages/effects.proto +4 -0
  66. protobufs/canvas_generated/messages/events.proto +2 -0
  67. settings.py +2 -0
  68. {canvas-0.67.0.dist-info → canvas-0.69.0.dist-info}/WHEEL +0 -0
  69. {canvas-0.67.0.dist-info → canvas-0.69.0.dist-info}/entry_points.txt +0 -0
@@ -1,7 +1,7 @@
1
1
  from django.contrib.postgres.fields import ArrayField
2
2
  from django.db import models
3
3
 
4
- from canvas_sdk.v1.data.base import IdentifiableModel, Model
4
+ from canvas_sdk.v1.data.base import IdentifiableModel, Model, TimestampedModel
5
5
  from canvas_sdk.v1.data.common import (
6
6
  AddressState,
7
7
  AddressType,
@@ -145,14 +145,12 @@ class TransactorType(models.TextChoices):
145
145
  BCBS = "bcbs", "Blue Cross Blue Shield"
146
146
 
147
147
 
148
- class Coverage(IdentifiableModel):
148
+ class Coverage(TimestampedModel, IdentifiableModel):
149
149
  """Coverage."""
150
150
 
151
151
  class Meta:
152
152
  db_table = "canvas_sdk_data_api_coverage_001"
153
153
 
154
- created = models.DateTimeField(auto_now_add=True)
155
- modified = models.DateTimeField(auto_now=True)
156
154
  patient = models.ForeignKey(
157
155
  "v1.Patient", on_delete=models.DO_NOTHING, related_name="coverages", null=True
158
156
  )
@@ -236,14 +234,12 @@ class Transactor(Model):
236
234
  )
237
235
 
238
236
 
239
- class TransactorAddress(IdentifiableModel):
237
+ class TransactorAddress(TimestampedModel, IdentifiableModel):
240
238
  """TransactorAddress."""
241
239
 
242
240
  class Meta:
243
241
  db_table = "canvas_sdk_data_quality_and_revenue_transactoraddress_001"
244
242
 
245
- created = models.DateTimeField(auto_now_add=True)
246
- modified = models.DateTimeField(auto_now=True)
247
243
  line1 = models.CharField(max_length=255)
248
244
  line2 = models.CharField(max_length=255)
249
245
  city = models.CharField(max_length=255)
@@ -266,14 +262,12 @@ class TransactorAddress(IdentifiableModel):
266
262
  return f"id={self.id}"
267
263
 
268
264
 
269
- class TransactorPhone(IdentifiableModel):
265
+ class TransactorPhone(TimestampedModel, IdentifiableModel):
270
266
  """TransactorPhone."""
271
267
 
272
268
  class Meta:
273
269
  db_table = "canvas_sdk_data_quality_and_revenue_transactorphone_001"
274
270
 
275
- created = models.DateTimeField(auto_now_add=True)
276
- modified = models.DateTimeField(auto_now=True)
277
271
  system = models.CharField(choices=ContactPointSystem.choices, max_length=20)
278
272
  value = models.CharField(max_length=100)
279
273
  use = models.CharField(choices=ContactPointUse.choices, max_length=20)
@@ -288,14 +282,12 @@ class TransactorPhone(IdentifiableModel):
288
282
  return f"id={self.id}"
289
283
 
290
284
 
291
- class EligibilitySummary(IdentifiableModel):
285
+ class EligibilitySummary(TimestampedModel, IdentifiableModel):
292
286
  """EligibilitySummary."""
293
287
 
294
288
  class Meta:
295
289
  db_table = "canvas_sdk_data_quality_and_revenue_eligibilitysummary_001"
296
290
 
297
- created = models.DateTimeField(auto_now_add=True)
298
- modified = models.DateTimeField(auto_now=True)
299
291
  coverage = models.OneToOneField(
300
292
  "v1.Coverage", on_delete=models.CASCADE, related_name="eligibility_summary"
301
293
  )
@@ -1,27 +1,16 @@
1
1
  from django.db import models
2
2
 
3
- from canvas_sdk.v1.data.base import IdentifiableModel
3
+ from canvas_sdk.v1.data.base import AuditedModel, IdentifiableModel
4
+ from canvas_sdk.v1.data.coding import Coding
4
5
 
5
6
 
6
- class DetectedIssue(IdentifiableModel):
7
+ class DetectedIssue(AuditedModel, IdentifiableModel):
7
8
  """DetectedIssue."""
8
9
 
9
10
  class Meta:
10
11
  db_table = "canvas_sdk_data_api_detectedissue_001"
11
12
 
12
- created = models.DateTimeField(auto_now_add=True)
13
- modified = models.DateTimeField(auto_now=True)
14
13
  identified = models.DateTimeField()
15
- deleted = models.BooleanField()
16
- originator = models.ForeignKey(
17
- "v1.CanvasUser", on_delete=models.DO_NOTHING, null=True, related_name="+"
18
- )
19
- committer = models.ForeignKey(
20
- "v1.CanvasUser", on_delete=models.DO_NOTHING, null=True, related_name="+"
21
- )
22
- entered_in_error = models.ForeignKey(
23
- "v1.CanvasUser", on_delete=models.DO_NOTHING, null=True, related_name="+"
24
- )
25
14
  patient = models.ForeignKey(
26
15
  "v1.Patient", on_delete=models.DO_NOTHING, related_name="detected_issues", null=True
27
16
  )
@@ -34,17 +23,12 @@ class DetectedIssue(IdentifiableModel):
34
23
  detail = models.TextField()
35
24
 
36
25
 
37
- class DetectedIssueEvidence(IdentifiableModel):
26
+ class DetectedIssueEvidence(IdentifiableModel, Coding):
38
27
  """DetectedIssueEvidence."""
39
28
 
40
29
  class Meta:
41
30
  db_table = "canvas_sdk_data_api_detectedissueevidence_001"
42
31
 
43
- system = models.CharField(max_length=255)
44
- version = models.CharField(max_length=255)
45
- code = models.CharField(max_length=255)
46
- display = models.CharField(max_length=1000)
47
- user_selected = models.BooleanField()
48
32
  detected_issue = models.ForeignKey(
49
33
  DetectedIssue,
50
34
  on_delete=models.DO_NOTHING,
@@ -1,30 +1,18 @@
1
1
  from django.db import models
2
2
 
3
- from canvas_sdk.v1.data.base import IdentifiableModel
3
+ from canvas_sdk.v1.data.base import AuditedModel, IdentifiableModel
4
4
 
5
5
 
6
- class Device(IdentifiableModel):
6
+ class Device(AuditedModel, IdentifiableModel):
7
7
  """Device."""
8
8
 
9
9
  class Meta:
10
10
  db_table = "canvas_sdk_data_api_device_001"
11
11
 
12
- created = models.DateTimeField(auto_now_add=True)
13
- modified = models.DateTimeField(auto_now=True)
14
- originator = models.ForeignKey(
15
- "v1.CanvasUser", on_delete=models.DO_NOTHING, null=True, related_name="+"
16
- )
17
- committer = models.ForeignKey(
18
- "v1.CanvasUser", on_delete=models.DO_NOTHING, null=True, related_name="+"
19
- )
20
- entered_in_error = models.ForeignKey(
21
- "v1.CanvasUser", on_delete=models.DO_NOTHING, null=True, related_name="+"
22
- )
23
12
  patient = models.ForeignKey(
24
13
  "v1.Patient", on_delete=models.DO_NOTHING, related_name="devices", null=True
25
14
  )
26
15
  note_id = models.BigIntegerField()
27
- deleted = models.BooleanField()
28
16
  labeled_contains_NRL = models.BooleanField()
29
17
  assigning_authority = models.CharField(max_length=255)
30
18
  scoping_entity = models.CharField(max_length=255)
@@ -1,9 +1,9 @@
1
1
  from django.db import models
2
2
 
3
- from canvas_sdk.v1.data.base import Model
3
+ from canvas_sdk.v1.data.base import TimestampedModel
4
4
 
5
5
 
6
- class Discount(Model):
6
+ class Discount(TimestampedModel):
7
7
  """Model to represent a discount applied to a claim or patient posting."""
8
8
 
9
9
  class Meta:
@@ -14,8 +14,5 @@ class Discount(Model):
14
14
  adjustment_code = models.CharField(max_length=3)
15
15
  discount = models.DecimalField(max_digits=8, decimal_places=2)
16
16
 
17
- created = models.DateTimeField(auto_now_add=True)
18
- modified = models.DateTimeField(auto_now=True)
19
-
20
17
 
21
18
  __exports__ = ("Discount",)
@@ -1,7 +1,7 @@
1
1
  from django.db import models
2
2
  from django.utils import timezone
3
3
 
4
- from canvas_sdk.v1.data.base import IdentifiableModel
4
+ from canvas_sdk.v1.data.base import IdentifiableModel, TimestampedModel
5
5
 
6
6
 
7
7
  class EncounterMedium(models.TextChoices):
@@ -24,15 +24,13 @@ class EncounterState(models.TextChoices):
24
24
  CANCELLED = "CAN", "Cancelled"
25
25
 
26
26
 
27
- class Encounter(IdentifiableModel):
27
+ class Encounter(TimestampedModel, IdentifiableModel):
28
28
  """Encounter."""
29
29
 
30
30
  class Meta:
31
31
  db_table = "canvas_sdk_data_api_encounter_001"
32
32
 
33
33
  note = models.OneToOneField("v1.Note", on_delete=models.CASCADE, related_name="encounter")
34
- created = models.DateTimeField(auto_now_add=True)
35
- modified = models.DateTimeField(auto_now=True)
36
34
  medium = models.CharField(choices=EncounterMedium.choices, max_length=20)
37
35
  state = models.CharField(max_length=3, choices=EncounterState.choices)
38
36
  start_time = models.DateTimeField(default=timezone.now, null=True)
@@ -1,6 +1,6 @@
1
1
  from django.db import models
2
2
 
3
- from canvas_sdk.v1.data.base import IdentifiableModel
3
+ from canvas_sdk.v1.data.base import AuditedModel, IdentifiableModel
4
4
 
5
5
 
6
6
  class GoalLifecycleStatus(models.TextChoices):
@@ -38,24 +38,12 @@ class GoalPriority(models.TextChoices):
38
38
  LOW = "low-priority", "Low Priority"
39
39
 
40
40
 
41
- class Goal(IdentifiableModel):
41
+ class Goal(AuditedModel, IdentifiableModel):
42
42
  """Goal."""
43
43
 
44
44
  class Meta:
45
45
  db_table = "canvas_sdk_data_api_goal_001"
46
46
 
47
- created = models.DateTimeField(auto_now_add=True)
48
- modified = models.DateTimeField(auto_now=True)
49
- originator = models.ForeignKey(
50
- "v1.CanvasUser", on_delete=models.DO_NOTHING, null=True, related_name="+"
51
- )
52
- committer = models.ForeignKey(
53
- "v1.CanvasUser", on_delete=models.DO_NOTHING, null=True, related_name="+"
54
- )
55
- entered_in_error = models.ForeignKey(
56
- "v1.CanvasUser", on_delete=models.DO_NOTHING, null=True, related_name="+"
57
- )
58
-
59
47
  patient = models.ForeignKey("v1.Patient", on_delete=models.DO_NOTHING, related_name="goals")
60
48
  note = models.ForeignKey("v1.Note", on_delete=models.DO_NOTHING, related_name="goals")
61
49
  lifecycle_status = models.CharField(max_length=20, choices=GoalLifecycleStatus.choices)
@@ -2,7 +2,7 @@ import json
2
2
 
3
3
  from django.db import models
4
4
 
5
- from canvas_sdk.v1.data.base import IdentifiableModel
5
+ from canvas_sdk.v1.data.base import AuditedModel, IdentifiableModel, TimestampedModel
6
6
  from canvas_sdk.v1.data.common import (
7
7
  DocumentReviewMode,
8
8
  OrderStatus,
@@ -12,24 +12,12 @@ from canvas_sdk.v1.data.common import (
12
12
  from canvas_sdk.v1.data.task import Task
13
13
 
14
14
 
15
- class ImagingOrder(IdentifiableModel):
15
+ class ImagingOrder(AuditedModel, IdentifiableModel):
16
16
  """Model to read ImagingOrder data."""
17
17
 
18
18
  class Meta:
19
19
  db_table = "canvas_sdk_data_api_imagingorder_001"
20
20
 
21
- created = models.DateTimeField(auto_now_add=True)
22
- modified = models.DateTimeField(auto_now=True)
23
- originator = models.ForeignKey(
24
- "v1.CanvasUser", on_delete=models.DO_NOTHING, null=True, related_name="+"
25
- )
26
- deleted = models.BooleanField()
27
- committer = models.ForeignKey(
28
- "v1.CanvasUser", on_delete=models.DO_NOTHING, null=True, related_name="+"
29
- )
30
- entered_in_error = models.ForeignKey(
31
- "v1.CanvasUser", on_delete=models.DO_NOTHING, related_name="+"
32
- )
33
21
  patient = models.ForeignKey(
34
22
  "v1.Patient", on_delete=models.DO_NOTHING, related_name="imaging_orders", null=True
35
23
  )
@@ -67,24 +55,12 @@ class ImagingOrder(IdentifiableModel):
67
55
  return list(self.get_task_objects())
68
56
 
69
57
 
70
- class ImagingReview(IdentifiableModel):
58
+ class ImagingReview(AuditedModel, IdentifiableModel):
71
59
  """Model to read ImagingReview data."""
72
60
 
73
61
  class Meta:
74
62
  db_table = "canvas_sdk_data_api_imagingreview_001"
75
63
 
76
- created = models.DateTimeField(auto_now_add=True)
77
- modified = models.DateTimeField(auto_now=True)
78
- originator = models.ForeignKey(
79
- "v1.CanvasUser", on_delete=models.DO_NOTHING, null=True, related_name="+"
80
- )
81
- deleted = models.BooleanField()
82
- committer = models.ForeignKey(
83
- "v1.CanvasUser", on_delete=models.DO_NOTHING, null=True, related_name="+"
84
- )
85
- entered_in_error = models.ForeignKey(
86
- "v1.CanvasUser", on_delete=models.DO_NOTHING, null=True, related_name="+"
87
- )
88
64
  patient_communication_method = models.CharField(
89
65
  choices=ReviewPatientCommunicationMethod.choices, max_length=30
90
66
  )
@@ -99,7 +75,7 @@ class ImagingReview(IdentifiableModel):
99
75
  )
100
76
 
101
77
 
102
- class ImagingReport(IdentifiableModel):
78
+ class ImagingReport(TimestampedModel, IdentifiableModel):
103
79
  """Model to read ImagingReport data."""
104
80
 
105
81
  class ImagingReportSource(models.TextChoices):
@@ -110,8 +86,6 @@ class ImagingReport(IdentifiableModel):
110
86
  class Meta:
111
87
  db_table = "canvas_sdk_data_api_imagingreport_001"
112
88
 
113
- created = models.DateTimeField(auto_now_add=True)
114
- modified = models.DateTimeField(auto_now=True)
115
89
  review_mode = models.CharField(choices=DocumentReviewMode.choices, max_length=2)
116
90
  junked = models.BooleanField()
117
91
  requires_signature = models.BooleanField()
@@ -7,9 +7,9 @@ from canvas_sdk.v1.data.base import (
7
7
  CommittableQuerySetMixin,
8
8
  ForPatientQuerySetMixin,
9
9
  IdentifiableModel,
10
- Model,
11
10
  ValueSetLookupQuerySet,
12
11
  )
12
+ from canvas_sdk.v1.data.coding import Coding
13
13
 
14
14
 
15
15
  class ImmunizationStatus(models.TextChoices):
@@ -78,17 +78,12 @@ class Immunization(IdentifiableModel):
78
78
  deleted = models.BooleanField()
79
79
 
80
80
 
81
- class ImmunizationCoding(Model):
81
+ class ImmunizationCoding(Coding):
82
82
  """ImmunizationCoding."""
83
83
 
84
84
  class Meta:
85
85
  db_table = "canvas_sdk_data_api_immunizationcoding_001"
86
86
 
87
- system = models.CharField(max_length=255)
88
- version = models.CharField(max_length=255)
89
- code = models.CharField(max_length=255)
90
- display = models.CharField(max_length=1000)
91
- user_selected = models.BooleanField()
92
87
  immunization = models.ForeignKey(
93
88
  Immunization, on_delete=models.DO_NOTHING, related_name="codings", null=True
94
89
  )
@@ -133,17 +128,12 @@ class ImmunizationStatement(IdentifiableModel):
133
128
  deleted = models.BooleanField()
134
129
 
135
130
 
136
- class ImmunizationStatementCoding(Model):
131
+ class ImmunizationStatementCoding(Coding):
137
132
  """ImmunizationStatementCoding."""
138
133
 
139
134
  class Meta:
140
135
  db_table = "canvas_sdk_data_api_immunizationstatementcoding_001"
141
136
 
142
- system = models.CharField(max_length=255)
143
- version = models.CharField(max_length=255)
144
- code = models.CharField(max_length=255)
145
- display = models.CharField(max_length=1000)
146
- user_selected = models.BooleanField()
147
137
  immunization_statement = models.ForeignKey(
148
138
  ImmunizationStatement, on_delete=models.CASCADE, related_name="coding"
149
139
  )
canvas_sdk/v1/data/lab.py CHANGED
@@ -3,13 +3,14 @@ from typing import cast
3
3
  from django.db import models
4
4
 
5
5
  from canvas_sdk.v1.data.base import (
6
+ AuditedModel,
6
7
  BaseModelManager,
7
8
  BaseQuerySet,
8
9
  CommittableQuerySetMixin,
9
10
  ForPatientQuerySetMixin,
10
11
  IdentifiableModel,
11
- Model,
12
12
  TimeframeLookupQuerySetMixin,
13
+ TimestampedModel,
13
14
  ValueSetLookupQuerySet,
14
15
  )
15
16
  from canvas_sdk.v1.data.staff import Staff
@@ -32,7 +33,7 @@ class TransmissionType(models.TextChoices):
32
33
  MANUAL = "M", "manual"
33
34
 
34
35
 
35
- class LabReport(IdentifiableModel):
36
+ class LabReport(AuditedModel, IdentifiableModel):
36
37
  """A class representing a lab report."""
37
38
 
38
39
  class Meta:
@@ -40,8 +41,6 @@ class LabReport(IdentifiableModel):
40
41
 
41
42
  objects = cast(LabReportQuerySet, LabReportManager())
42
43
 
43
- created = models.DateTimeField(auto_now_add=True)
44
- modified = models.DateTimeField(auto_now=True)
45
44
  review_mode = models.CharField(max_length=2)
46
45
  junked = models.BooleanField()
47
46
  requires_signature = models.BooleanField()
@@ -60,16 +59,6 @@ class LabReport(IdentifiableModel):
60
59
  original_date = models.DateTimeField()
61
60
  date_performed = models.DateTimeField()
62
61
  custom_document_name = models.CharField(max_length=500)
63
- originator = models.ForeignKey(
64
- "v1.CanvasUser", on_delete=models.DO_NOTHING, null=True, related_name="+"
65
- )
66
- committer = models.ForeignKey(
67
- "v1.CanvasUser", on_delete=models.DO_NOTHING, null=True, related_name="+"
68
- )
69
- entered_in_error = models.ForeignKey(
70
- "v1.CanvasUser", on_delete=models.DO_NOTHING, null=True, related_name="+"
71
- )
72
- deleted = models.BooleanField()
73
62
 
74
63
 
75
64
  class LabReviewQuerySet(BaseQuerySet, CommittableQuerySetMixin, ForPatientQuerySetMixin):
@@ -81,7 +70,7 @@ class LabReviewQuerySet(BaseQuerySet, CommittableQuerySetMixin, ForPatientQueryS
81
70
  LabReviewManager = BaseModelManager.from_queryset(LabReviewQuerySet)
82
71
 
83
72
 
84
- class LabReview(IdentifiableModel):
73
+ class LabReview(AuditedModel, IdentifiableModel):
85
74
  """A class representing a lab review."""
86
75
 
87
76
  class Meta:
@@ -89,18 +78,6 @@ class LabReview(IdentifiableModel):
89
78
 
90
79
  objects = cast(LabReviewQuerySet, LabReviewManager())
91
80
 
92
- created = models.DateTimeField(auto_now_add=True)
93
- modified = models.DateTimeField(auto_now=True)
94
- originator = models.ForeignKey(
95
- "v1.CanvasUser", on_delete=models.DO_NOTHING, null=True, related_name="+"
96
- )
97
- deleted = models.BooleanField()
98
- committer = models.ForeignKey(
99
- "v1.CanvasUser", on_delete=models.DO_NOTHING, null=True, related_name="+"
100
- )
101
- entered_in_error = models.ForeignKey(
102
- "v1.CanvasUser", on_delete=models.DO_NOTHING, null=True, related_name="+"
103
- )
104
81
  internal_comment = models.TextField()
105
82
  message_to_patient = models.CharField(max_length=2048)
106
83
  status = models.CharField(max_length=50)
@@ -125,7 +102,7 @@ class LabValueQuerySet(ValueSetLookupQuerySet, LabValueTimeframeLookupQuerySetMi
125
102
  pass
126
103
 
127
104
 
128
- class LabValue(IdentifiableModel):
105
+ class LabValue(TimestampedModel, IdentifiableModel):
129
106
  """A class representing a lab value."""
130
107
 
131
108
  class Meta:
@@ -133,8 +110,6 @@ class LabValue(IdentifiableModel):
133
110
 
134
111
  objects = LabValueQuerySet.as_manager()
135
112
 
136
- created = models.DateTimeField(auto_now_add=True)
137
- modified = models.DateTimeField(auto_now=True)
138
113
  report = models.ForeignKey(
139
114
  "LabReport", on_delete=models.DO_NOTHING, related_name="values", null=True
140
115
  )
@@ -148,14 +123,12 @@ class LabValue(IdentifiableModel):
148
123
  observation_status = models.CharField(max_length=24)
149
124
 
150
125
 
151
- class LabValueCoding(Model):
126
+ class LabValueCoding(TimestampedModel):
152
127
  """A class representing a lab value coding."""
153
128
 
154
129
  class Meta:
155
130
  db_table = "canvas_sdk_data_api_labvaluecoding_001"
156
131
 
157
- created = models.DateTimeField(auto_now_add=True)
158
- modified = models.DateTimeField(auto_now=True)
159
132
  value = models.ForeignKey(
160
133
  LabValue, on_delete=models.DO_NOTHING, related_name="codings", null=True
161
134
  )
@@ -164,7 +137,7 @@ class LabValueCoding(Model):
164
137
  system = models.CharField(max_length=128)
165
138
 
166
139
 
167
- class LabOrder(IdentifiableModel):
140
+ class LabOrder(AuditedModel, IdentifiableModel):
168
141
  """A class representing a lab order."""
169
142
 
170
143
  class SpecimenCollectionType(models.TextChoices):
@@ -192,18 +165,6 @@ class LabOrder(IdentifiableModel):
192
165
  class Meta:
193
166
  db_table = "canvas_sdk_data_api_laborder_001"
194
167
 
195
- created = models.DateTimeField(auto_now_add=True)
196
- modified = models.DateTimeField(auto_now=True)
197
- originator = models.ForeignKey(
198
- "v1.CanvasUser", on_delete=models.DO_NOTHING, null=True, related_name="+"
199
- )
200
- deleted = models.BooleanField()
201
- committer = models.ForeignKey(
202
- "v1.CanvasUser", on_delete=models.DO_NOTHING, null=True, related_name="+"
203
- )
204
- entered_in_error = models.ForeignKey(
205
- "v1.CanvasUser", on_delete=models.DO_NOTHING, null=True, related_name="+"
206
- )
207
168
  patient = models.ForeignKey(
208
169
  "v1.Patient", on_delete=models.DO_NOTHING, related_name="lab_orders", null=True
209
170
  )
@@ -238,7 +199,7 @@ class LabOrder(IdentifiableModel):
238
199
  reports = models.ManyToManyField("v1.LabReport", through="v1.LabTest")
239
200
 
240
201
 
241
- class LabOrderReason(Model):
202
+ class LabOrderReason(AuditedModel):
242
203
  """A class representing a lab order reason."""
243
204
 
244
205
  class LabReasonMode(models.TextChoices):
@@ -252,32 +213,18 @@ class LabOrderReason(Model):
252
213
  class Meta:
253
214
  db_table = "canvas_sdk_data_api_laborderreason_001"
254
215
 
255
- created = models.DateTimeField(auto_now_add=True)
256
- modified = models.DateTimeField(auto_now=True)
257
- originator = models.ForeignKey(
258
- "v1.CanvasUser", on_delete=models.DO_NOTHING, null=True, related_name="+"
259
- )
260
- deleted = models.BooleanField()
261
- committer = models.ForeignKey(
262
- "v1.CanvasUser", on_delete=models.DO_NOTHING, null=True, related_name="+"
263
- )
264
- entered_in_error = models.ForeignKey(
265
- "v1.CanvasUser", on_delete=models.DO_NOTHING, null=True, related_name="+"
266
- )
267
216
  order = models.ForeignKey(
268
217
  LabOrder, on_delete=models.DO_NOTHING, related_name="reasons", null=True
269
218
  )
270
219
  mode = models.CharField(max_length=30, choices=LabReasonMode)
271
220
 
272
221
 
273
- class LabOrderReasonCondition(Model):
222
+ class LabOrderReasonCondition(TimestampedModel):
274
223
  """A class representing a lab order reason's condition."""
275
224
 
276
225
  class Meta:
277
226
  db_table = "canvas_sdk_data_api_laborderreasoncondition_001"
278
227
 
279
- created = models.DateTimeField(auto_now_add=True)
280
- modified = models.DateTimeField(auto_now=True)
281
228
  reason = models.ForeignKey(
282
229
  LabOrderReason, on_delete=models.DO_NOTHING, related_name="reason_conditions", null=True
283
230
  )
@@ -1,7 +1,7 @@
1
1
  from django.db import models
2
2
  from django.db.models import QuerySet
3
3
 
4
- from canvas_sdk.v1.data.base import Model
4
+ from canvas_sdk.v1.data.base import TimestampedModel
5
5
 
6
6
 
7
7
  class AbstractLineItemQuerySet(models.QuerySet):
@@ -12,7 +12,7 @@ class AbstractLineItemQuerySet(models.QuerySet):
12
12
  return self.filter(entered_in_error__isnull=True)
13
13
 
14
14
 
15
- class AbstractLineItemTransaction(Model):
15
+ class AbstractLineItemTransaction(TimestampedModel):
16
16
  """Abstract class with common properties for both payments and adjustments."""
17
17
 
18
18
  class Meta:
@@ -28,9 +28,6 @@ class AbstractLineItemTransaction(Model):
28
28
  )
29
29
  amount = models.DecimalField(max_digits=8, decimal_places=2)
30
30
 
31
- created = models.DateTimeField(auto_now_add=True)
32
- modified = models.DateTimeField(auto_now=True)
33
-
34
31
 
35
32
  class NewLineItemPayment(AbstractLineItemTransaction):
36
33
  """Subclass that represents a payment on a billing line item."""
@@ -8,9 +8,9 @@ from canvas_sdk.v1.data.base import (
8
8
  CommittableQuerySetMixin,
9
9
  ForPatientQuerySetMixin,
10
10
  IdentifiableModel,
11
- Model,
12
11
  ValueSetLookupQuerySet,
13
12
  )
13
+ from canvas_sdk.v1.data.coding import Coding
14
14
 
15
15
 
16
16
  class Status(TextChoices):
@@ -59,17 +59,12 @@ class Medication(IdentifiableModel):
59
59
  erx_quantity = models.FloatField()
60
60
 
61
61
 
62
- class MedicationCoding(Model):
62
+ class MedicationCoding(Coding):
63
63
  """MedicationCoding."""
64
64
 
65
65
  class Meta:
66
66
  db_table = "canvas_sdk_data_api_medicationcoding_001"
67
67
 
68
- system = models.CharField(max_length=255)
69
- version = models.CharField(max_length=255)
70
- code = models.CharField(max_length=255)
71
- display = models.CharField(max_length=1000)
72
- user_selected = models.BooleanField()
73
68
  medication = models.ForeignKey(
74
69
  Medication, on_delete=models.DO_NOTHING, related_name="codings", null=True
75
70
  )
@@ -4,19 +4,17 @@ from django.db.models import TextChoices
4
4
 
5
5
  from canvas_sdk.v1.data.base import (
6
6
  IdentifiableModel,
7
- Model,
7
+ TimestampedModel,
8
8
  )
9
+ from canvas_sdk.v1.data.coding import Coding
9
10
 
10
11
 
11
- class MedicationHistoryMedication(IdentifiableModel):
12
+ class MedicationHistoryMedication(TimestampedModel, IdentifiableModel):
12
13
  """MedicationHistoryMedication."""
13
14
 
14
15
  class Meta:
15
16
  db_table = "canvas_sdk_data_api_medicationhistorymedication_001"
16
17
 
17
- created = models.DateTimeField(auto_now_add=True)
18
- modified = models.DateTimeField(auto_now=True)
19
-
20
18
  patient = models.ForeignKey(
21
19
  "v1.Patient",
22
20
  on_delete=models.DO_NOTHING,
@@ -86,17 +84,12 @@ class MedicationHistoryMedication(IdentifiableModel):
86
84
  prescriber_dea_number = models.CharField(max_length=255, blank=True, default="")
87
85
 
88
86
 
89
- class MedicationHistoryMedicationCoding(Model):
87
+ class MedicationHistoryMedicationCoding(Coding):
90
88
  """MedicationHistoryMedicationCoding."""
91
89
 
92
90
  class Meta:
93
91
  db_table = "canvas_sdk_data_api_medicationhistorymedicationcoding_001"
94
92
 
95
- system = models.CharField(max_length=255)
96
- version = models.CharField(max_length=255)
97
- code = models.CharField(max_length=255)
98
- display = models.CharField(max_length=1000)
99
- user_selected = models.BooleanField(default=False)
100
93
  medication = models.ForeignKey(
101
94
  MedicationHistoryMedication, on_delete=models.CASCADE, related_name="codings"
102
95
  )
@@ -109,15 +102,12 @@ class MedicationHistoryResponseStatus(TextChoices):
109
102
  STATUS_DENIED = "denied"
110
103
 
111
104
 
112
- class MedicationHistoryResponse(IdentifiableModel):
105
+ class MedicationHistoryResponse(TimestampedModel, IdentifiableModel):
113
106
  """MedicationHistoryResponse."""
114
107
 
115
108
  class Meta:
116
109
  db_table = "canvas_sdk_data_api_medicationhistoryresponse_001"
117
110
 
118
- created = models.DateTimeField(auto_now_add=True)
119
- modified = models.DateTimeField(auto_now=True)
120
-
121
111
  patient = models.ForeignKey(
122
112
  "v1.Patient",
123
113
  on_delete=models.CASCADE,