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,9 +1,9 @@
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 MedicationStatement(IdentifiableModel):
6
+ class MedicationStatement(AuditedModel, IdentifiableModel):
7
7
  """MedicationStatement."""
8
8
 
9
9
  class Meta:
@@ -26,15 +26,6 @@ class MedicationStatement(IdentifiableModel):
26
26
  related_name="treatments_stated",
27
27
  db_table="canvas_sdk_data_api_medicationstatement_indications_001",
28
28
  )
29
- entered_in_error = models.ForeignKey(
30
- "v1.CanvasUser", on_delete=models.DO_NOTHING, related_name="+", null=True
31
- )
32
- committer = models.ForeignKey(
33
- "v1.CanvasUser", on_delete=models.DO_NOTHING, related_name="+", null=True
34
- )
35
- originator = models.ForeignKey("v1.CanvasUser", on_delete=models.DO_NOTHING, related_name="+")
36
- created = models.DateTimeField(auto_now_add=True)
37
- modified = models.DateTimeField(auto_now=True)
38
29
  start_date_original_input = models.CharField(max_length=255, default="")
39
30
  start_date = models.DateField(default=None, null=True)
40
31
  end_date_original_input = models.CharField(max_length=255, default="")
@@ -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 IdentifiableModel, TimestampedModel
4
4
 
5
5
 
6
6
  class TransmissionChannel(models.TextChoices):
@@ -12,14 +12,12 @@ class TransmissionChannel(models.TextChoices):
12
12
  NOOP = "noop", "No-op"
13
13
 
14
14
 
15
- class Message(IdentifiableModel):
15
+ class Message(TimestampedModel, IdentifiableModel):
16
16
  """Message."""
17
17
 
18
18
  class Meta:
19
19
  db_table = "canvas_sdk_data_api_message_001"
20
20
 
21
- created = models.DateTimeField(auto_now_add=True)
22
- modified = models.DateTimeField(auto_now=True)
23
21
  content = models.TextField()
24
22
  sender = models.ForeignKey(
25
23
  "v1.CanvasUser", on_delete=models.DO_NOTHING, related_name="sent_messages", null=True
@@ -46,14 +44,12 @@ class MessageAttachment(IdentifiableModel):
46
44
  )
47
45
 
48
46
 
49
- class MessageTransmission(IdentifiableModel):
47
+ class MessageTransmission(TimestampedModel, IdentifiableModel):
50
48
  """Message Transmission."""
51
49
 
52
50
  class Meta:
53
51
  db_table = "canvas_sdk_data_api_messagetransmission_001"
54
52
 
55
- created = models.DateTimeField(auto_now_add=True)
56
- modified = models.DateTimeField(auto_now=True)
57
53
  message = models.ForeignKey(
58
54
  "v1.Message", on_delete=models.DO_NOTHING, related_name="transmissions", null=True
59
55
  )
@@ -1,8 +1,11 @@
1
1
  from django.contrib.postgres.fields import ArrayField
2
2
  from django.db import models
3
+ from django.utils import timezone
3
4
 
4
- from canvas_sdk.v1.data.base import IdentifiableModel
5
+ from canvas_sdk.v1.data.base import IdentifiableModel, TimestampedModel
5
6
  from canvas_sdk.v1.data.claim import Claim
7
+ from canvas_sdk.v1.data.coding import Coding
8
+ from canvas_sdk.v1.data.utils import empty_note_body
6
9
 
7
10
 
8
11
  class NoteTypeCategories(models.TextChoices):
@@ -114,7 +117,7 @@ class NoteStates(models.TextChoices):
114
117
  CONFIRM_IMPORT = "CNF", "Confirmed"
115
118
 
116
119
 
117
- class NoteType(IdentifiableModel):
120
+ class NoteType(TimestampedModel, IdentifiableModel, Coding):
118
121
  """NoteType."""
119
122
 
120
123
  objects: models.Manager["NoteType"]
@@ -122,13 +125,6 @@ class NoteType(IdentifiableModel):
122
125
  class Meta:
123
126
  db_table = "canvas_sdk_data_api_notetype_001"
124
127
 
125
- created = models.DateTimeField(auto_now_add=True)
126
- modified = models.DateTimeField(auto_now=True)
127
- system = models.CharField(max_length=255)
128
- version = models.CharField(max_length=255)
129
- code = models.CharField(max_length=255)
130
- display = models.CharField(max_length=1000)
131
- user_selected = models.BooleanField()
132
128
  name = models.CharField(max_length=250)
133
129
  icon = models.CharField(max_length=250)
134
130
  category = models.CharField(choices=NoteTypeCategories.choices, max_length=50)
@@ -153,14 +149,12 @@ class NoteType(IdentifiableModel):
153
149
  online_duration = models.IntegerField()
154
150
 
155
151
 
156
- class Note(IdentifiableModel):
152
+ class Note(TimestampedModel, IdentifiableModel):
157
153
  """Note."""
158
154
 
159
155
  class Meta:
160
156
  db_table = "canvas_sdk_data_api_note_001"
161
157
 
162
- created = models.DateTimeField(auto_now_add=True)
163
- modified = models.DateTimeField(auto_now=True)
164
158
  patient = models.ForeignKey(
165
159
  "v1.Patient", on_delete=models.DO_NOTHING, related_name="notes", null=True
166
160
  )
@@ -171,17 +165,17 @@ class Note(IdentifiableModel):
171
165
  note_type_version = models.ForeignKey(
172
166
  "v1.NoteType", on_delete=models.DO_NOTHING, related_name="notes", null=True
173
167
  )
174
- title = models.TextField()
175
- body = models.JSONField()
168
+ title = models.TextField(default="", blank=True)
169
+ body = models.JSONField(default=empty_note_body)
176
170
  originator = models.ForeignKey("v1.CanvasUser", on_delete=models.DO_NOTHING, null=True)
177
171
  last_modified_by_staff = models.ForeignKey("v1.Staff", on_delete=models.DO_NOTHING, null=True)
178
172
  checksum = models.CharField(max_length=32)
179
173
  billing_note = models.TextField()
180
174
  # TODO -implement InpatientStay model
181
175
  # inpatient_stay = models.ForeignKey("v1.InpatientStay", on_delete=models.DO_NOTHING, null=True)
182
- related_data = models.JSONField()
176
+ related_data = models.JSONField(default=dict, blank=True)
183
177
  location = models.ForeignKey("v1.PracticeLocation", on_delete=models.DO_NOTHING, null=True)
184
- datetime_of_service = models.DateTimeField()
178
+ datetime_of_service = models.DateTimeField(default=timezone.now)
185
179
  place_of_service = models.CharField(max_length=255)
186
180
 
187
181
  def get_claim(self) -> Claim | None:
@@ -192,14 +186,12 @@ class Note(IdentifiableModel):
192
186
  return self.claims.order_by("-created").first()
193
187
 
194
188
 
195
- class NoteStateChangeEvent(IdentifiableModel):
189
+ class NoteStateChangeEvent(TimestampedModel, IdentifiableModel):
196
190
  """NoteStateChangeEvent."""
197
191
 
198
192
  class Meta:
199
193
  db_table = "canvas_sdk_data_api_notestatechangeevent_001"
200
194
 
201
- created = models.DateTimeField()
202
- modified = models.DateTimeField()
203
195
  note = models.ForeignKey("v1.Note", on_delete=models.DO_NOTHING, related_name="state_history")
204
196
  originator = models.ForeignKey("v1.CanvasUser", on_delete=models.DO_NOTHING, null=True)
205
197
  state = models.CharField(choices=NoteStates.choices, max_length=3)
@@ -3,13 +3,15 @@ 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
  CommittableQuerySetMixin,
8
9
  ForPatientQuerySetMixin,
9
10
  IdentifiableModel,
10
- Model,
11
+ TimestampedModel,
11
12
  ValueSetLookupQuerySet,
12
13
  )
14
+ from canvas_sdk.v1.data.coding import Coding
13
15
 
14
16
 
15
17
  class ObservationQuerySet(
@@ -23,7 +25,7 @@ class ObservationQuerySet(
23
25
  ObservationManager = BaseModelManager.from_queryset(ObservationQuerySet)
24
26
 
25
27
 
26
- class Observation(IdentifiableModel):
28
+ class Observation(AuditedModel, IdentifiableModel):
27
29
  """Observation."""
28
30
 
29
31
  class Meta:
@@ -31,18 +33,6 @@ class Observation(IdentifiableModel):
31
33
 
32
34
  objects = cast(ObservationQuerySet, ObservationManager())
33
35
 
34
- created = models.DateTimeField(auto_now_add=True)
35
- modified = models.DateTimeField(auto_now=True)
36
- originator = models.ForeignKey(
37
- "v1.CanvasUser", on_delete=models.DO_NOTHING, null=True, related_name="+"
38
- )
39
- committer = models.ForeignKey(
40
- "v1.CanvasUser", on_delete=models.DO_NOTHING, null=True, related_name="+"
41
- )
42
- entered_in_error = models.ForeignKey(
43
- "v1.CanvasUser", on_delete=models.DO_NOTHING, null=True, related_name="+"
44
- )
45
- deleted = models.BooleanField()
46
36
  patient = models.ForeignKey(
47
37
  "v1.Patient", on_delete=models.DO_NOTHING, related_name="observations", null=True
48
38
  )
@@ -57,30 +47,23 @@ class Observation(IdentifiableModel):
57
47
  effective_datetime = models.DateTimeField()
58
48
 
59
49
 
60
- class ObservationCoding(Model):
50
+ class ObservationCoding(Coding):
61
51
  """ObservationCoding."""
62
52
 
63
53
  class Meta:
64
54
  db_table = "canvas_sdk_data_api_observationcoding_001"
65
55
 
66
- system = models.CharField(max_length=255)
67
- version = models.CharField(max_length=255)
68
- code = models.CharField(max_length=255)
69
- display = models.CharField(max_length=1000)
70
- user_selected = models.BooleanField()
71
56
  observation = models.ForeignKey(
72
57
  Observation, on_delete=models.DO_NOTHING, related_name="codings", null=True
73
58
  )
74
59
 
75
60
 
76
- class ObservationComponent(Model):
61
+ class ObservationComponent(TimestampedModel):
77
62
  """ObservationComponent."""
78
63
 
79
64
  class Meta:
80
65
  db_table = "canvas_sdk_data_api_observationcomponent_001"
81
66
 
82
- created = models.DateTimeField(auto_now_add=True)
83
- modified = models.DateTimeField(auto_now=True)
84
67
  observation = models.ForeignKey(
85
68
  Observation, on_delete=models.DO_NOTHING, related_name="components", null=True
86
69
  )
@@ -89,33 +72,23 @@ class ObservationComponent(Model):
89
72
  name = models.TextField()
90
73
 
91
74
 
92
- class ObservationComponentCoding(Model):
75
+ class ObservationComponentCoding(Coding):
93
76
  """ObservationComponentCoding."""
94
77
 
95
78
  class Meta:
96
79
  db_table = "canvas_sdk_data_api_observationcomponentcoding_001"
97
80
 
98
- system = models.CharField(max_length=255)
99
- version = models.CharField(max_length=255)
100
- code = models.CharField(max_length=255)
101
- display = models.CharField(max_length=1000)
102
- user_selected = models.BooleanField()
103
81
  observation_component = models.ForeignKey(
104
82
  ObservationComponent, on_delete=models.DO_NOTHING, related_name="codings", null=True
105
83
  )
106
84
 
107
85
 
108
- class ObservationValueCoding(Model):
86
+ class ObservationValueCoding(Coding):
109
87
  """ObservationValueCoding."""
110
88
 
111
89
  class Meta:
112
90
  db_table = "canvas_sdk_data_api_observationvaluecoding_001"
113
91
 
114
- system = models.CharField(max_length=255)
115
- version = models.CharField(max_length=255)
116
- code = models.CharField(max_length=255)
117
- display = models.CharField(max_length=1000)
118
- user_selected = models.BooleanField()
119
92
  observation = models.ForeignKey(
120
93
  Observation, on_delete=models.DO_NOTHING, related_name="value_codings", null=True
121
94
  )
@@ -1,31 +1,29 @@
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
  from canvas_sdk.v1.data.common import TaxIDType
5
5
 
6
6
 
7
- class Organization(Model):
7
+ class Organization(TimestampedModel):
8
8
  """Organization."""
9
9
 
10
10
  class Meta:
11
11
  db_table = "canvas_sdk_data_api_organization_001"
12
12
 
13
- created = models.DateTimeField(auto_now_add=True)
14
- modified = models.DateTimeField(auto_now=True)
15
13
  full_name = models.CharField(max_length=255)
16
14
  short_name = models.CharField(max_length=255)
17
15
  subdomain = models.CharField(max_length=100)
18
16
  logo_url = models.CharField(max_length=255)
19
17
  background_image_url = models.CharField(max_length=255)
20
18
  background_gradient = models.CharField(max_length=255)
21
- active = models.BooleanField()
19
+ active = models.BooleanField(default=True)
22
20
  tax_id = models.CharField(null=True, max_length=25)
23
21
  tax_id_type = models.CharField(choices=TaxIDType.choices, max_length=1)
24
22
  group_npi_number = models.CharField(max_length=10)
25
23
  group_taxonomy_number = models.CharField(max_length=10)
26
- include_zz_qualifier = models.BooleanField()
24
+ include_zz_qualifier = models.BooleanField(default=False)
27
25
  main_location = models.OneToOneField(
28
- "v1.PracticeLocation", on_delete=models.DO_NOTHING, related_name="+"
26
+ "PracticeLocation", related_name="+", null=True, on_delete=models.PROTECT
29
27
  )
30
28
 
31
29
 
@@ -7,7 +7,7 @@ from django.contrib.postgres.fields import ArrayField
7
7
  from django.db import models
8
8
  from django.db.models import TextChoices
9
9
 
10
- from canvas_sdk.v1.data.base import IdentifiableModel, Model
10
+ from canvas_sdk.v1.data.base import IdentifiableModel, TimestampedModel
11
11
  from canvas_sdk.v1.data.common import (
12
12
  AddressState,
13
13
  AddressType,
@@ -39,7 +39,7 @@ class PatientSettingConstants:
39
39
  PREFERRED_SCHEDULING_TIMEZONE = "preferredSchedulingTimezone"
40
40
 
41
41
 
42
- class Patient(Model):
42
+ class Patient(TimestampedModel):
43
43
  """A class representing a patient."""
44
44
 
45
45
  class Meta:
@@ -108,9 +108,6 @@ class Patient(Model):
108
108
  )
109
109
  user = models.ForeignKey("v1.CanvasUser", on_delete=models.DO_NOTHING, null=True)
110
110
 
111
- created = models.DateTimeField(auto_now_add=True)
112
- modified = models.DateTimeField(auto_now=True)
113
-
114
111
  @classmethod
115
112
  def find(cls, id: str) -> Patient:
116
113
  """Find a patient by id."""
@@ -243,14 +240,12 @@ class PatientAddress(IdentifiableModel):
243
240
  return f"id={self.id}"
244
241
 
245
242
 
246
- class PatientExternalIdentifier(IdentifiableModel):
243
+ class PatientExternalIdentifier(TimestampedModel, IdentifiableModel):
247
244
  """A class representing a patient external identifier."""
248
245
 
249
246
  class Meta:
250
247
  db_table = "canvas_sdk_data_api_patientexternalidentifier_001"
251
248
 
252
- created = models.DateTimeField(auto_now_add=True)
253
- modified = models.DateTimeField(auto_now=True)
254
249
  patient = models.ForeignKey(
255
250
  "v1.Patient",
256
251
  related_name="external_identifiers",
@@ -268,14 +263,12 @@ class PatientExternalIdentifier(IdentifiableModel):
268
263
  return f"id={self.id}"
269
264
 
270
265
 
271
- class PatientSetting(Model):
266
+ class PatientSetting(TimestampedModel):
272
267
  """PatientSetting."""
273
268
 
274
269
  class Meta:
275
270
  db_table = "canvas_sdk_data_api_patientsetting_001"
276
271
 
277
- created = models.DateTimeField(auto_now_add=True)
278
- modified = models.DateTimeField(auto_now=True)
279
272
  patient = models.ForeignKey(
280
273
  "v1.Patient", on_delete=models.DO_NOTHING, related_name="settings", null=True
281
274
  )
@@ -1,20 +1,15 @@
1
1
  from django.db import models
2
2
 
3
- from canvas_sdk.v1.data.base import IdentifiableModel, Model
3
+ from canvas_sdk.v1.data.base import IdentifiableModel
4
+ from canvas_sdk.v1.data.coding import Coding
4
5
 
5
6
 
6
- class PatientConsentRejectionCoding(Model):
7
+ class PatientConsentRejectionCoding(Coding):
7
8
  """Patient Consent Rejection Coding."""
8
9
 
9
10
  class Meta:
10
11
  db_table = "canvas_sdk_data_api_patientconsentrejectioncoding_001"
11
12
 
12
- system = models.CharField(max_length=255)
13
- version = models.CharField(max_length=255)
14
- code = models.CharField(max_length=255)
15
- display = models.CharField(max_length=1000)
16
- user_selected = models.BooleanField()
17
-
18
13
 
19
14
  class PatientConsentExpirationRule(models.TextChoices):
20
15
  """PatientConsentExpirationRule."""
@@ -24,17 +19,12 @@ class PatientConsentExpirationRule(models.TextChoices):
24
19
  END_OF_YEAR = "end_of_year", "End of year"
25
20
 
26
21
 
27
- class PatientConsentCoding(Model):
22
+ class PatientConsentCoding(Coding):
28
23
  """Patient Consent Coding."""
29
24
 
30
25
  class Meta:
31
26
  db_table = "canvas_sdk_data_api_patientconsentcoding_001"
32
27
 
33
- system = models.CharField(max_length=255)
34
- version = models.CharField(max_length=255)
35
- code = models.CharField(max_length=255)
36
- display = models.CharField(max_length=1000)
37
- user_selected = models.BooleanField()
38
28
  expiration_rule = models.CharField(choices=PatientConsentExpirationRule.choices, max_length=255)
39
29
  is_mandatory = models.BooleanField()
40
30
  is_proof_required = models.BooleanField()
@@ -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 IdentifiableModel, TimestampedModel
4
4
 
5
5
 
6
6
  class PostingMethods(models.TextChoices):
@@ -12,7 +12,7 @@ class PostingMethods(models.TextChoices):
12
12
  OTHER = "other", "Other"
13
13
 
14
14
 
15
- class PaymentCollection(IdentifiableModel):
15
+ class PaymentCollection(TimestampedModel, IdentifiableModel):
16
16
  """Stores the total collected amount and the payment method."""
17
17
 
18
18
  class Meta:
@@ -27,8 +27,5 @@ class PaymentCollection(IdentifiableModel):
27
27
 
28
28
  description = models.TextField()
29
29
 
30
- created = models.DateTimeField(auto_now_add=True)
31
- modified = models.DateTimeField(auto_now=True)
32
-
33
30
 
34
31
  __exports__ = ("PaymentCollection", "PostingMethods")
@@ -3,7 +3,7 @@ from typing import Self
3
3
 
4
4
  from django.db import models
5
5
 
6
- from canvas_sdk.v1.data.base import IdentifiableModel, Model
6
+ from canvas_sdk.v1.data.base import IdentifiableModel, TimestampedModel
7
7
  from canvas_sdk.v1.data.utils import quantize
8
8
 
9
9
 
@@ -15,7 +15,7 @@ class PostingQuerySet(models.QuerySet):
15
15
  return self.filter(entered_in_error__isnull=True)
16
16
 
17
17
 
18
- class BasePosting(Model):
18
+ class BasePosting(TimestampedModel):
19
19
  """
20
20
  Base model to aggregate multiple line item transactions on a claim.
21
21
  """
@@ -40,9 +40,6 @@ class BasePosting(Model):
40
40
  "v1.CanvasUser", on_delete=models.PROTECT, null=True, blank=True
41
41
  )
42
42
 
43
- created = models.DateTimeField(auto_now_add=True)
44
- modified = models.DateTimeField(auto_now=True)
45
-
46
43
  @property
47
44
  def paid_amount(self) -> Decimal:
48
45
  """Returns the total amount paid for this posting."""
@@ -149,7 +146,7 @@ class PatientPosting(BasePosting):
149
146
  return self.discounted_amount + self.paid_amount
150
147
 
151
148
 
152
- class AbstractBulkPosting(IdentifiableModel):
149
+ class AbstractBulkPosting(TimestampedModel, IdentifiableModel):
153
150
  """Patient and Insurance bulk posting shared columns."""
154
151
 
155
152
  class Meta:
@@ -161,9 +158,6 @@ class AbstractBulkPosting(IdentifiableModel):
161
158
 
162
159
  total_paid = models.DecimalField(max_digits=8, decimal_places=2)
163
160
 
164
- created = models.DateTimeField(auto_now_add=True)
165
- modified = models.DateTimeField(auto_now=True)
166
-
167
161
 
168
162
  class BulkPatientPosting(AbstractBulkPosting):
169
163
  """Model to aggregate bulk patient payments on multiple claims."""
@@ -1,6 +1,6 @@
1
1
  from django.db import models
2
2
 
3
- from canvas_sdk.v1.data.base import IdentifiableModel, Model
3
+ from canvas_sdk.v1.data.base import IdentifiableModel, Model, TimestampedModel
4
4
  from canvas_sdk.v1.data.common import TaxIDType
5
5
 
6
6
 
@@ -53,14 +53,12 @@ class PracticeLocationPOS(models.TextChoices):
53
53
  OTHER = "99", "Other Place of Service"
54
54
 
55
55
 
56
- class PracticeLocation(IdentifiableModel):
56
+ class PracticeLocation(TimestampedModel, IdentifiableModel):
57
57
  """PracticeLocation."""
58
58
 
59
59
  class Meta:
60
60
  db_table = "canvas_sdk_data_api_practicelocation_001"
61
61
 
62
- created = models.DateTimeField(auto_now_add=True)
63
- modified = models.DateTimeField(auto_now=True)
64
62
  organization = models.ForeignKey(
65
63
  "v1.Organization", on_delete=models.DO_NOTHING, related_name="practice_locations", null=True
66
64
  )
@@ -69,7 +67,7 @@ class PracticeLocation(IdentifiableModel):
69
67
  short_name = models.CharField(max_length=255)
70
68
  background_image_url = models.CharField(max_length=255)
71
69
  background_gradient = models.CharField(max_length=255)
72
- active = models.BooleanField()
70
+ active = models.BooleanField(default=True)
73
71
  npi_number = models.CharField(max_length=10)
74
72
  bill_through_organization = models.BooleanField()
75
73
  tax_id = models.CharField(max_length=25)
@@ -77,7 +75,7 @@ class PracticeLocation(IdentifiableModel):
77
75
  billing_location_name = models.CharField(max_length=255)
78
76
  group_npi_number = models.CharField(max_length=10)
79
77
  taxonomy_number = models.CharField(max_length=10)
80
- include_zz_qualifier = models.BooleanField()
78
+ include_zz_qualifier = models.BooleanField(default=False)
81
79
 
82
80
  def __str__(self) -> str:
83
81
  return self.full_name
@@ -8,6 +8,7 @@ from canvas_sdk.v1.data.base import (
8
8
  CommittableQuerySetMixin,
9
9
  ForPatientQuerySetMixin,
10
10
  IdentifiableModel,
11
+ TimestampedModel,
11
12
  )
12
13
 
13
14
 
@@ -35,7 +36,7 @@ class ProtocolOverrideQuerySet(BaseQuerySet, ForPatientQuerySetMixin, Committabl
35
36
  ProtocolOverrideManager = BaseModelManager.from_queryset(ProtocolOverrideQuerySet)
36
37
 
37
38
 
38
- class ProtocolOverride(IdentifiableModel):
39
+ class ProtocolOverride(TimestampedModel, IdentifiableModel):
39
40
  """ProtocolOverride."""
40
41
 
41
42
  class Meta:
@@ -43,8 +44,6 @@ class ProtocolOverride(IdentifiableModel):
43
44
 
44
45
  objects = cast(ProtocolOverrideQuerySet, ProtocolOverrideManager())
45
46
 
46
- created = models.DateTimeField(auto_now_add=True)
47
- modified = models.DateTimeField(auto_now=True)
48
47
  deleted = models.BooleanField()
49
48
  committer = models.ForeignKey(
50
49
  "v1.CanvasUser", on_delete=models.DO_NOTHING, null=True, related_name="+"
@@ -1,6 +1,8 @@
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 TimestampedModel
5
+
4
6
 
5
7
  class ProtocolResultStatus(models.TextChoices):
6
8
  """Constants for ProtocolResultStatus."""
@@ -12,7 +14,7 @@ class ProtocolResultStatus(models.TextChoices):
12
14
  STATUS_NOT_RELEVANT = "not_relevant"
13
15
 
14
16
 
15
- class ProtocolResult(models.Model):
17
+ class ProtocolResult(TimestampedModel):
16
18
  """ProtocolResult."""
17
19
 
18
20
  class Meta:
@@ -36,8 +38,6 @@ class ProtocolResult(models.Model):
36
38
  next_review = models.DateTimeField(null=True)
37
39
  feedback_enabled = models.BooleanField(default=False)
38
40
  plugin_can_be_snoozed = models.BooleanField(default=False)
39
- created = models.DateTimeField(auto_now_add=True)
40
- modified = models.DateTimeField(auto_now=True)
41
41
 
42
42
 
43
43
  __exports__ = (