canvas 0.44.3__py3-none-any.whl → 0.46.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.44.3.dist-info → canvas-0.46.0.dist-info}/METADATA +4 -2
- {canvas-0.44.3.dist-info → canvas-0.46.0.dist-info}/RECORD +64 -59
- canvas_cli/apps/plugin/plugin.py +21 -2
- canvas_generated/messages/effects_pb2.py +2 -2
- canvas_generated/messages/effects_pb2.pyi +10 -0
- canvas_generated/messages/events_pb2.py +2 -2
- canvas_generated/messages/events_pb2.pyi +18 -0
- canvas_sdk/commands/commands/exam.py +2 -1
- canvas_sdk/commands/commands/immunization_statement.py +32 -0
- canvas_sdk/commands/commands/questionnaire/__init__.py +18 -3
- canvas_sdk/commands/commands/questionnaire/question.py +3 -2
- canvas_sdk/commands/commands/questionnaire/toggle_questions.py +68 -0
- canvas_sdk/commands/commands/review_of_systems.py +2 -1
- canvas_sdk/utils/http.py +4 -1
- canvas_sdk/v1/data/__init__.py +17 -3
- canvas_sdk/v1/data/allergy_intolerance.py +16 -19
- canvas_sdk/v1/data/appointment.py +10 -14
- canvas_sdk/v1/data/assessment.py +9 -10
- canvas_sdk/v1/data/banner_alert.py +12 -12
- canvas_sdk/v1/data/base.py +45 -1
- canvas_sdk/v1/data/billing.py +13 -18
- canvas_sdk/v1/data/business_line.py +7 -8
- canvas_sdk/v1/data/care_team.py +14 -17
- canvas_sdk/v1/data/charge_description_master.py +29 -0
- canvas_sdk/v1/data/claim.py +87 -95
- canvas_sdk/v1/data/claim_line_item.py +17 -18
- canvas_sdk/v1/data/command.py +8 -9
- canvas_sdk/v1/data/condition.py +9 -12
- canvas_sdk/v1/data/coverage.py +47 -53
- canvas_sdk/v1/data/detected_issue.py +16 -20
- canvas_sdk/v1/data/device.py +20 -21
- canvas_sdk/v1/data/discount.py +8 -8
- canvas_sdk/v1/data/imaging.py +24 -30
- canvas_sdk/v1/data/invoice.py +3 -3
- canvas_sdk/v1/data/lab.py +65 -84
- canvas_sdk/v1/data/line_item_transaction.py +7 -9
- canvas_sdk/v1/data/medication.py +14 -17
- canvas_sdk/v1/data/message.py +10 -17
- canvas_sdk/v1/data/note.py +87 -24
- canvas_sdk/v1/data/observation.py +24 -33
- canvas_sdk/v1/data/organization.py +14 -15
- canvas_sdk/v1/data/patient.py +57 -68
- canvas_sdk/v1/data/patient_consent.py +14 -19
- canvas_sdk/v1/data/payment_collection.py +7 -8
- canvas_sdk/v1/data/payor_specific_charge.py +10 -12
- canvas_sdk/v1/data/posting.py +10 -18
- canvas_sdk/v1/data/practicelocation.py +17 -21
- canvas_sdk/v1/data/protocol_override.py +8 -10
- canvas_sdk/v1/data/questionnaire.py +56 -73
- canvas_sdk/v1/data/reason_for_visit.py +7 -9
- canvas_sdk/v1/data/staff.py +61 -57
- canvas_sdk/v1/data/task.py +21 -31
- canvas_sdk/v1/data/team.py +15 -18
- canvas_sdk/v1/data/user.py +3 -3
- canvas_sdk/v1/data/utils.py +6 -0
- plugin_runner/allowed-module-imports.json +1340 -0
- plugin_runner/generate_allowed_imports.py +97 -0
- plugin_runner/plugin_runner.py +9 -0
- plugin_runner/sandbox.py +55 -60
- protobufs/canvas_generated/messages/effects.proto +6 -0
- protobufs/canvas_generated/messages/events.proto +12 -1
- settings.py +56 -22
- {canvas-0.44.3.dist-info → canvas-0.46.0.dist-info}/WHEEL +0 -0
- {canvas-0.44.3.dist-info → canvas-0.46.0.dist-info}/entry_points.txt +0 -0
canvas_sdk/v1/data/patient.py
CHANGED
|
@@ -7,6 +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
11
|
from canvas_sdk.v1.data.common import (
|
|
11
12
|
AddressState,
|
|
12
13
|
AddressType,
|
|
@@ -15,6 +16,7 @@ from canvas_sdk.v1.data.common import (
|
|
|
15
16
|
ContactPointSystem,
|
|
16
17
|
ContactPointUse,
|
|
17
18
|
)
|
|
19
|
+
from canvas_sdk.v1.data.utils import create_key
|
|
18
20
|
|
|
19
21
|
if TYPE_CHECKING:
|
|
20
22
|
from django_stubs_ext.db.models.manager import RelatedManager
|
|
@@ -40,47 +42,47 @@ class PatientSettingConstants:
|
|
|
40
42
|
PREFERRED_SCHEDULING_TIMEZONE = "preferredSchedulingTimezone"
|
|
41
43
|
|
|
42
44
|
|
|
43
|
-
class Patient(
|
|
45
|
+
class Patient(Model):
|
|
44
46
|
"""A class representing a patient."""
|
|
45
47
|
|
|
46
48
|
class Meta:
|
|
47
|
-
managed = False
|
|
48
49
|
db_table = "canvas_sdk_data_api_patient_001"
|
|
49
50
|
|
|
50
|
-
id = models.CharField(
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
51
|
+
id = models.CharField(
|
|
52
|
+
max_length=32, db_column="key", unique=True, editable=False, default=create_key
|
|
53
|
+
)
|
|
54
|
+
first_name = models.CharField(max_length=255)
|
|
55
|
+
last_name = models.CharField(max_length=255)
|
|
54
56
|
birth_date = models.DateField()
|
|
55
57
|
business_line = models.ForeignKey(
|
|
56
58
|
"v1.BusinessLine", on_delete=models.DO_NOTHING, related_name="patients"
|
|
57
59
|
)
|
|
58
|
-
sex_at_birth = models.CharField(choices=SexAtBirth.choices)
|
|
59
|
-
created = models.DateTimeField()
|
|
60
|
-
modified = models.DateTimeField()
|
|
61
|
-
prefix = models.CharField()
|
|
62
|
-
suffix = models.CharField()
|
|
63
|
-
middle_name = models.CharField()
|
|
64
|
-
maiden_name = models.CharField()
|
|
65
|
-
nickname = models.CharField()
|
|
66
|
-
sexual_orientation_term = models.CharField()
|
|
67
|
-
sexual_orientation_code = models.CharField()
|
|
68
|
-
gender_identity_term = models.CharField()
|
|
69
|
-
gender_identity_code = models.CharField()
|
|
70
|
-
preferred_pronouns = models.CharField()
|
|
71
|
-
biological_race_codes = ArrayField(models.CharField())
|
|
72
|
-
last_known_timezone = models.CharField()
|
|
73
|
-
mrn = models.CharField()
|
|
60
|
+
sex_at_birth = models.CharField(choices=SexAtBirth.choices, max_length=3)
|
|
61
|
+
created = models.DateTimeField(auto_now_add=True)
|
|
62
|
+
modified = models.DateTimeField(auto_now=True)
|
|
63
|
+
prefix = models.CharField(max_length=100)
|
|
64
|
+
suffix = models.CharField(max_length=100)
|
|
65
|
+
middle_name = models.CharField(max_length=255)
|
|
66
|
+
maiden_name = models.CharField(max_length=255)
|
|
67
|
+
nickname = models.CharField(max_length=255)
|
|
68
|
+
sexual_orientation_term = models.CharField(max_length=255)
|
|
69
|
+
sexual_orientation_code = models.CharField(max_length=255)
|
|
70
|
+
gender_identity_term = models.CharField(max_length=255)
|
|
71
|
+
gender_identity_code = models.CharField(max_length=255)
|
|
72
|
+
preferred_pronouns = models.CharField(max_length=255)
|
|
73
|
+
biological_race_codes = ArrayField(models.CharField(max_length=100))
|
|
74
|
+
last_known_timezone = models.CharField(max_length=32)
|
|
75
|
+
mrn = models.CharField(max_length=9)
|
|
74
76
|
active = models.BooleanField()
|
|
75
77
|
deceased = models.BooleanField()
|
|
76
78
|
deceased_datetime = models.DateTimeField()
|
|
77
79
|
deceased_cause = models.TextField()
|
|
78
80
|
deceased_comment = models.TextField()
|
|
79
|
-
other_gender_description = models.CharField()
|
|
80
|
-
social_security_number = models.CharField()
|
|
81
|
+
other_gender_description = models.CharField(max_length=255)
|
|
82
|
+
social_security_number = models.CharField(max_length=9)
|
|
81
83
|
administrative_note = models.TextField()
|
|
82
84
|
clinical_note = models.TextField()
|
|
83
|
-
mothers_maiden_name = models.CharField()
|
|
85
|
+
mothers_maiden_name = models.CharField(max_length=255)
|
|
84
86
|
multiple_birth_indicator = models.BooleanField()
|
|
85
87
|
birth_order = models.BigIntegerField()
|
|
86
88
|
default_location_id = models.BigIntegerField()
|
|
@@ -143,53 +145,47 @@ class Patient(models.Model):
|
|
|
143
145
|
return self.nickname or self.first_name
|
|
144
146
|
|
|
145
147
|
|
|
146
|
-
class PatientContactPoint(
|
|
148
|
+
class PatientContactPoint(IdentifiableModel):
|
|
147
149
|
"""A class representing a patient contact point."""
|
|
148
150
|
|
|
149
151
|
class Meta:
|
|
150
|
-
managed = False
|
|
151
152
|
db_table = "canvas_sdk_data_api_patientcontactpoint_001"
|
|
152
153
|
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
use = models.CharField(choices=ContactPointUse.choices)
|
|
158
|
-
use_notes = models.CharField()
|
|
154
|
+
system = models.CharField(choices=ContactPointSystem.choices, max_length=20)
|
|
155
|
+
value = models.CharField(max_length=100)
|
|
156
|
+
use = models.CharField(choices=ContactPointUse.choices, max_length=20)
|
|
157
|
+
use_notes = models.CharField(max_length=255)
|
|
159
158
|
rank = models.IntegerField()
|
|
160
|
-
state = models.CharField(choices=ContactPointState.choices)
|
|
159
|
+
state = models.CharField(choices=ContactPointState.choices, max_length=20)
|
|
161
160
|
patient = models.ForeignKey(
|
|
162
161
|
"v1.Patient", on_delete=models.DO_NOTHING, related_name="telecom", null=True
|
|
163
162
|
)
|
|
164
163
|
has_consent = models.BooleanField()
|
|
165
164
|
last_verified = models.DateTimeField
|
|
166
|
-
verification_token = models.CharField()
|
|
165
|
+
verification_token = models.CharField(max_length=32)
|
|
167
166
|
opted_out = models.BooleanField()
|
|
168
167
|
|
|
169
168
|
|
|
170
|
-
class PatientAddress(
|
|
169
|
+
class PatientAddress(IdentifiableModel):
|
|
171
170
|
"""A class representing a patient address."""
|
|
172
171
|
|
|
173
172
|
class Meta:
|
|
174
|
-
managed = False
|
|
175
173
|
db_table = "canvas_sdk_data_api_patientaddress_001"
|
|
176
174
|
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
use = models.CharField(choices=AddressUse.choices)
|
|
186
|
-
type = models.CharField(choices=AddressType.choices)
|
|
175
|
+
line1 = models.CharField(max_length=255)
|
|
176
|
+
line2 = models.CharField(max_length=255)
|
|
177
|
+
city = models.CharField(max_length=255)
|
|
178
|
+
district = models.CharField(max_length=255)
|
|
179
|
+
state_code = models.CharField(max_length=2)
|
|
180
|
+
postal_code = models.CharField(max_length=255)
|
|
181
|
+
use = models.CharField(choices=AddressUse.choices, max_length=10)
|
|
182
|
+
type = models.CharField(choices=AddressType.choices, max_length=10)
|
|
187
183
|
longitude = models.FloatField()
|
|
188
184
|
latitude = models.FloatField()
|
|
189
185
|
start = models.DateField()
|
|
190
186
|
end = models.DateField()
|
|
191
|
-
country = models.CharField()
|
|
192
|
-
state = models.CharField(choices=AddressState.choices)
|
|
187
|
+
country = models.CharField(max_length=255)
|
|
188
|
+
state = models.CharField(choices=AddressState.choices, max_length=20)
|
|
193
189
|
patient = models.ForeignKey(
|
|
194
190
|
"v1.Patient", on_delete=models.DO_NOTHING, related_name="addresses", null=True
|
|
195
191
|
)
|
|
@@ -198,27 +194,24 @@ class PatientAddress(models.Model):
|
|
|
198
194
|
return f"id={self.id}"
|
|
199
195
|
|
|
200
196
|
|
|
201
|
-
class PatientExternalIdentifier(
|
|
197
|
+
class PatientExternalIdentifier(IdentifiableModel):
|
|
202
198
|
"""A class representing a patient external identifier."""
|
|
203
199
|
|
|
204
200
|
class Meta:
|
|
205
|
-
managed = False
|
|
206
201
|
db_table = "canvas_sdk_data_api_patientexternalidentifier_001"
|
|
207
202
|
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
created = models.DateTimeField()
|
|
211
|
-
modified = models.DateTimeField()
|
|
203
|
+
created = models.DateTimeField(auto_now_add=True)
|
|
204
|
+
modified = models.DateTimeField(auto_now=True)
|
|
212
205
|
patient = models.ForeignKey(
|
|
213
206
|
"v1.Patient",
|
|
214
207
|
related_name="external_identifiers",
|
|
215
208
|
on_delete=models.DO_NOTHING,
|
|
216
209
|
null=True,
|
|
217
210
|
)
|
|
218
|
-
use = models.CharField()
|
|
219
|
-
identifier_type = models.CharField()
|
|
220
|
-
system = models.CharField()
|
|
221
|
-
value = models.CharField()
|
|
211
|
+
use = models.CharField(max_length=255)
|
|
212
|
+
identifier_type = models.CharField(max_length=255)
|
|
213
|
+
system = models.CharField(max_length=255)
|
|
214
|
+
value = models.CharField(max_length=255)
|
|
222
215
|
issued_date = models.DateField()
|
|
223
216
|
expiration_date = models.DateField()
|
|
224
217
|
|
|
@@ -226,31 +219,27 @@ class PatientExternalIdentifier(models.Model):
|
|
|
226
219
|
return f"id={self.id}"
|
|
227
220
|
|
|
228
221
|
|
|
229
|
-
class PatientSetting(
|
|
222
|
+
class PatientSetting(Model):
|
|
230
223
|
"""PatientSetting."""
|
|
231
224
|
|
|
232
225
|
class Meta:
|
|
233
|
-
managed = False
|
|
234
226
|
db_table = "canvas_sdk_data_api_patientsetting_001"
|
|
235
227
|
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
modified = models.DateTimeField()
|
|
228
|
+
created = models.DateTimeField(auto_now_add=True)
|
|
229
|
+
modified = models.DateTimeField(auto_now=True)
|
|
239
230
|
patient = models.ForeignKey(
|
|
240
231
|
"v1.Patient", on_delete=models.DO_NOTHING, related_name="settings", null=True
|
|
241
232
|
)
|
|
242
|
-
name = models.CharField()
|
|
233
|
+
name = models.CharField(max_length=100)
|
|
243
234
|
value = models.JSONField()
|
|
244
235
|
|
|
245
236
|
|
|
246
|
-
class PatientMetadata(
|
|
237
|
+
class PatientMetadata(IdentifiableModel):
|
|
247
238
|
"""A class representing Patient Metadata."""
|
|
248
239
|
|
|
249
240
|
class Meta:
|
|
250
|
-
managed = False
|
|
251
241
|
db_table = "canvas_sdk_data_api_patientmetadata_001"
|
|
252
242
|
|
|
253
|
-
dbid = models.BigIntegerField(primary_key=True)
|
|
254
243
|
patient = models.ForeignKey(
|
|
255
244
|
"v1.Patient", on_delete=models.DO_NOTHING, related_name="metadata", null=True
|
|
256
245
|
)
|
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
from django.db import models
|
|
2
2
|
|
|
3
|
+
from canvas_sdk.v1.data.base import IdentifiableModel, Model
|
|
3
4
|
|
|
4
|
-
|
|
5
|
+
|
|
6
|
+
class PatientConsentRejectionCoding(Model):
|
|
5
7
|
"""Patient Consent Rejection Coding."""
|
|
6
8
|
|
|
7
9
|
class Meta:
|
|
8
|
-
managed = False
|
|
9
10
|
db_table = "canvas_sdk_data_api_patientconsentrejectioncoding_001"
|
|
10
11
|
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
display = models.CharField()
|
|
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
16
|
user_selected = models.BooleanField()
|
|
17
17
|
|
|
18
18
|
|
|
@@ -24,20 +24,18 @@ class PatientConsentExpirationRule(models.TextChoices):
|
|
|
24
24
|
END_OF_YEAR = "end_of_year", "End of year"
|
|
25
25
|
|
|
26
26
|
|
|
27
|
-
class PatientConsentCoding(
|
|
27
|
+
class PatientConsentCoding(Model):
|
|
28
28
|
"""Patient Consent Coding."""
|
|
29
29
|
|
|
30
30
|
class Meta:
|
|
31
|
-
managed = False
|
|
32
31
|
db_table = "canvas_sdk_data_api_patientconsentcoding_001"
|
|
33
32
|
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
display = models.CharField()
|
|
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)
|
|
39
37
|
user_selected = models.BooleanField()
|
|
40
|
-
expiration_rule = models.CharField(choices=PatientConsentExpirationRule, max_length=255)
|
|
38
|
+
expiration_rule = models.CharField(choices=PatientConsentExpirationRule.choices, max_length=255)
|
|
41
39
|
is_mandatory = models.BooleanField()
|
|
42
40
|
is_proof_required = models.BooleanField()
|
|
43
41
|
show_in_patient_portal = models.BooleanField()
|
|
@@ -56,15 +54,12 @@ class PatientConsentStatus(models.TextChoices):
|
|
|
56
54
|
REJECTED_VIA_PORTAL = "rejected_via_patient_portal", "Rejected Via Patient Portal"
|
|
57
55
|
|
|
58
56
|
|
|
59
|
-
class PatientConsent(
|
|
57
|
+
class PatientConsent(IdentifiableModel):
|
|
60
58
|
"""Patient Consent."""
|
|
61
59
|
|
|
62
60
|
class Meta:
|
|
63
|
-
managed = False
|
|
64
61
|
db_table = "canvas_sdk_data_api_patientconsent_001"
|
|
65
62
|
|
|
66
|
-
id = models.UUIDField()
|
|
67
|
-
dbid = models.BigIntegerField(primary_key=True)
|
|
68
63
|
patient = models.ForeignKey(
|
|
69
64
|
"v1.Patient", on_delete=models.DO_NOTHING, related_name="patient_consent"
|
|
70
65
|
)
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
from django.db import models
|
|
2
2
|
|
|
3
|
+
from canvas_sdk.v1.data.base import IdentifiableModel
|
|
4
|
+
|
|
3
5
|
|
|
4
6
|
class PostingMethods(models.TextChoices):
|
|
5
7
|
"""PostingMethods."""
|
|
@@ -10,26 +12,23 @@ class PostingMethods(models.TextChoices):
|
|
|
10
12
|
OTHER = "other", "Other"
|
|
11
13
|
|
|
12
14
|
|
|
13
|
-
class PaymentCollection(
|
|
15
|
+
class PaymentCollection(IdentifiableModel):
|
|
14
16
|
"""Stores the total collected amount and the payment method."""
|
|
15
17
|
|
|
16
18
|
class Meta:
|
|
17
|
-
managed = False
|
|
18
19
|
db_table = "canvas_sdk_data_quality_and_revenue_paymentcollection_001"
|
|
19
20
|
|
|
20
|
-
id = models.UUIDField()
|
|
21
|
-
dbid = models.BigIntegerField(primary_key=True)
|
|
22
21
|
total_collected = models.DecimalField(max_digits=8, decimal_places=2)
|
|
23
|
-
method = models.CharField(choices=PostingMethods.choices)
|
|
22
|
+
method = models.CharField(choices=PostingMethods.choices, max_length=10)
|
|
24
23
|
|
|
25
|
-
check_number = models.CharField()
|
|
24
|
+
check_number = models.CharField(max_length=250)
|
|
26
25
|
check_date = models.DateField()
|
|
27
26
|
deposit_date = models.DateField()
|
|
28
27
|
|
|
29
28
|
description = models.TextField()
|
|
30
29
|
|
|
31
|
-
created = models.DateTimeField()
|
|
32
|
-
modified = models.DateTimeField()
|
|
30
|
+
created = models.DateTimeField(auto_now_add=True)
|
|
31
|
+
modified = models.DateTimeField(auto_now=True)
|
|
33
32
|
|
|
34
33
|
|
|
35
34
|
__exports__ = ("PaymentCollection", "PostingMethods")
|
|
@@ -1,27 +1,25 @@
|
|
|
1
1
|
from django.db import models
|
|
2
2
|
|
|
3
|
+
from canvas_sdk.v1.data.base import Model
|
|
3
4
|
|
|
4
|
-
|
|
5
|
+
|
|
6
|
+
class PayorSpecificCharge(Model):
|
|
5
7
|
"""Payor Specific Charge."""
|
|
6
8
|
|
|
7
9
|
class Meta:
|
|
8
|
-
managed = False
|
|
9
10
|
db_table = "canvas_sdk_data_quality_and_revenue_payorspecificcharge_001"
|
|
10
11
|
|
|
11
|
-
dbid = models.BigIntegerField(primary_key=True)
|
|
12
12
|
transactor = models.ForeignKey(
|
|
13
13
|
"v1.Transactor", related_name="specific_charges", on_delete=models.DO_NOTHING
|
|
14
14
|
)
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
charge_amount = models.DecimalField()
|
|
15
|
+
charge = models.ForeignKey(
|
|
16
|
+
"v1.ChargeDescriptionMaster",
|
|
17
|
+
related_name="transactor_charges",
|
|
18
|
+
on_delete=models.DO_NOTHING,
|
|
19
|
+
)
|
|
20
|
+
charge_amount = models.DecimalField(max_digits=8, decimal_places=2)
|
|
23
21
|
effective_date = models.DateField()
|
|
24
|
-
end_date = models.DateField()
|
|
22
|
+
end_date = models.DateField(null=True)
|
|
25
23
|
part_of_capitated_set = models.BooleanField()
|
|
26
24
|
|
|
27
25
|
|
canvas_sdk/v1/data/posting.py
CHANGED
|
@@ -3,6 +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
7
|
from canvas_sdk.v1.data.utils import quantize
|
|
7
8
|
|
|
8
9
|
|
|
@@ -14,18 +15,16 @@ class PostingQuerySet(models.QuerySet):
|
|
|
14
15
|
return self.filter(entered_in_error__isnull=True)
|
|
15
16
|
|
|
16
17
|
|
|
17
|
-
class BasePosting(
|
|
18
|
+
class BasePosting(Model):
|
|
18
19
|
"""
|
|
19
20
|
Base model to aggregate multiple line item transactions on a claim.
|
|
20
21
|
"""
|
|
21
22
|
|
|
22
23
|
class Meta:
|
|
23
|
-
managed = False
|
|
24
24
|
db_table = "canvas_sdk_data_quality_and_revenue_baseposting_001"
|
|
25
25
|
|
|
26
26
|
objects = PostingQuerySet.as_manager()
|
|
27
27
|
|
|
28
|
-
dbid = models.BigIntegerField(primary_key=True)
|
|
29
28
|
corrected_posting = models.ForeignKey(
|
|
30
29
|
"v1.BasePosting", related_name="correction_postings", on_delete=models.PROTECT, null=True
|
|
31
30
|
)
|
|
@@ -41,8 +40,8 @@ class BasePosting(models.Model):
|
|
|
41
40
|
"v1.CanvasUser", on_delete=models.PROTECT, null=True, blank=True
|
|
42
41
|
)
|
|
43
42
|
|
|
44
|
-
created = models.DateTimeField()
|
|
45
|
-
modified = models.DateTimeField()
|
|
43
|
+
created = models.DateTimeField(auto_now_add=True)
|
|
44
|
+
modified = models.DateTimeField(auto_now=True)
|
|
46
45
|
|
|
47
46
|
@property
|
|
48
47
|
def paid_amount(self) -> Decimal:
|
|
@@ -93,7 +92,6 @@ class CoveragePosting(BasePosting):
|
|
|
93
92
|
"""Represents an insurance payment/adjustment on a claim level."""
|
|
94
93
|
|
|
95
94
|
class Meta:
|
|
96
|
-
managed = False
|
|
97
95
|
db_table = "canvas_sdk_data_quality_and_revenue_coverageposting_001"
|
|
98
96
|
|
|
99
97
|
remittance = models.ForeignKey(
|
|
@@ -103,9 +101,9 @@ class CoveragePosting(BasePosting):
|
|
|
103
101
|
"v1.ClaimCoverage", related_name="postings", on_delete=models.PROTECT
|
|
104
102
|
)
|
|
105
103
|
|
|
106
|
-
crossover_carrier = models.CharField()
|
|
107
|
-
crossover_id = models.CharField()
|
|
108
|
-
payer_icn = models.CharField()
|
|
104
|
+
crossover_carrier = models.CharField(max_length=255)
|
|
105
|
+
crossover_id = models.CharField(max_length=255)
|
|
106
|
+
payer_icn = models.CharField(max_length=255)
|
|
109
107
|
position_in_era = models.PositiveIntegerField()
|
|
110
108
|
|
|
111
109
|
|
|
@@ -113,7 +111,6 @@ class PatientPosting(BasePosting):
|
|
|
113
111
|
"""A model that represents a patient payment/adjustment on a claim level."""
|
|
114
112
|
|
|
115
113
|
class Meta:
|
|
116
|
-
managed = False
|
|
117
114
|
db_table = "canvas_sdk_data_quality_and_revenue_patientposting_001"
|
|
118
115
|
|
|
119
116
|
claim_patient = models.ForeignKey(
|
|
@@ -152,30 +149,26 @@ class PatientPosting(BasePosting):
|
|
|
152
149
|
return self.discounted_amount + self.paid_amount
|
|
153
150
|
|
|
154
151
|
|
|
155
|
-
class AbstractBulkPosting(
|
|
152
|
+
class AbstractBulkPosting(IdentifiableModel):
|
|
156
153
|
"""Patient and Insurance bulk posting shared columns."""
|
|
157
154
|
|
|
158
155
|
class Meta:
|
|
159
156
|
abstract = True
|
|
160
157
|
|
|
161
|
-
id = models.UUIDField()
|
|
162
|
-
dbid = models.BigIntegerField(primary_key=True)
|
|
163
|
-
|
|
164
158
|
payment_collection = models.OneToOneField(
|
|
165
159
|
"v1.PaymentCollection", related_name="%(class)s", on_delete=models.PROTECT
|
|
166
160
|
)
|
|
167
161
|
|
|
168
162
|
total_paid = models.DecimalField(max_digits=8, decimal_places=2)
|
|
169
163
|
|
|
170
|
-
created = models.DateTimeField()
|
|
171
|
-
modified = models.DateTimeField()
|
|
164
|
+
created = models.DateTimeField(auto_now_add=True)
|
|
165
|
+
modified = models.DateTimeField(auto_now=True)
|
|
172
166
|
|
|
173
167
|
|
|
174
168
|
class BulkPatientPosting(AbstractBulkPosting):
|
|
175
169
|
"""Model to aggregate bulk patient payments on multiple claims."""
|
|
176
170
|
|
|
177
171
|
class Meta:
|
|
178
|
-
managed = False
|
|
179
172
|
db_table = "canvas_sdk_data_quality_and_revenue_bulkpatientposting_001"
|
|
180
173
|
|
|
181
174
|
discount = models.ForeignKey(
|
|
@@ -200,7 +193,6 @@ class BaseRemittanceAdvice(AbstractBulkPosting):
|
|
|
200
193
|
"""Manual and Electronic Shared columns."""
|
|
201
194
|
|
|
202
195
|
class Meta:
|
|
203
|
-
managed = False
|
|
204
196
|
db_table = "canvas_sdk_data_quality_and_revenue_baseremittanceadvice_001"
|
|
205
197
|
|
|
206
198
|
transactor = models.ForeignKey(
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
from django.db import models
|
|
2
2
|
|
|
3
|
+
from canvas_sdk.v1.data.base import IdentifiableModel, Model
|
|
3
4
|
from canvas_sdk.v1.data.common import TaxIDType
|
|
4
5
|
|
|
5
6
|
|
|
@@ -52,51 +53,46 @@ class PracticeLocationPOS(models.TextChoices):
|
|
|
52
53
|
OTHER = "99", "Other Place of Service"
|
|
53
54
|
|
|
54
55
|
|
|
55
|
-
class PracticeLocation(
|
|
56
|
+
class PracticeLocation(IdentifiableModel):
|
|
56
57
|
"""PracticeLocation."""
|
|
57
58
|
|
|
58
59
|
class Meta:
|
|
59
|
-
managed = False
|
|
60
60
|
db_table = "canvas_sdk_data_api_practicelocation_001"
|
|
61
61
|
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
created = models.DateTimeField()
|
|
65
|
-
modified = models.DateTimeField()
|
|
62
|
+
created = models.DateTimeField(auto_now_add=True)
|
|
63
|
+
modified = models.DateTimeField(auto_now=True)
|
|
66
64
|
organization = models.ForeignKey(
|
|
67
65
|
"v1.Organization", on_delete=models.DO_NOTHING, related_name="practice_locations", null=True
|
|
68
66
|
)
|
|
69
|
-
place_of_service_code = models.CharField(choices=PracticeLocationPOS.choices)
|
|
70
|
-
full_name = models.CharField()
|
|
71
|
-
short_name = models.CharField()
|
|
72
|
-
background_image_url = models.CharField()
|
|
73
|
-
background_gradient = models.CharField()
|
|
67
|
+
place_of_service_code = models.CharField(choices=PracticeLocationPOS.choices, max_length=2)
|
|
68
|
+
full_name = models.CharField(max_length=255)
|
|
69
|
+
short_name = models.CharField(max_length=255)
|
|
70
|
+
background_image_url = models.CharField(max_length=255)
|
|
71
|
+
background_gradient = models.CharField(max_length=255)
|
|
74
72
|
active = models.BooleanField()
|
|
75
|
-
npi_number = models.CharField()
|
|
73
|
+
npi_number = models.CharField(max_length=10)
|
|
76
74
|
bill_through_organization = models.BooleanField()
|
|
77
|
-
tax_id = models.CharField()
|
|
78
|
-
tax_id_type = models.CharField(choices=TaxIDType.choices)
|
|
79
|
-
billing_location_name = models.CharField()
|
|
80
|
-
group_npi_number = models.CharField()
|
|
81
|
-
taxonomy_number = models.CharField()
|
|
75
|
+
tax_id = models.CharField(max_length=25)
|
|
76
|
+
tax_id_type = models.CharField(choices=TaxIDType.choices, max_length=1)
|
|
77
|
+
billing_location_name = models.CharField(max_length=255)
|
|
78
|
+
group_npi_number = models.CharField(max_length=10)
|
|
79
|
+
taxonomy_number = models.CharField(max_length=10)
|
|
82
80
|
include_zz_qualifier = models.BooleanField()
|
|
83
81
|
|
|
84
82
|
def __str__(self) -> str:
|
|
85
83
|
return self.full_name
|
|
86
84
|
|
|
87
85
|
|
|
88
|
-
class PracticeLocationSetting(
|
|
86
|
+
class PracticeLocationSetting(Model):
|
|
89
87
|
"""PracticeLocationSetting."""
|
|
90
88
|
|
|
91
89
|
class Meta:
|
|
92
|
-
managed = False
|
|
93
90
|
db_table = "canvas_sdk_data_api_practicelocationsetting_001"
|
|
94
91
|
|
|
95
|
-
dbid = models.BigIntegerField(primary_key=True)
|
|
96
92
|
practice_location = models.ForeignKey(
|
|
97
93
|
"v1.PracticeLocation", on_delete=models.DO_NOTHING, related_name="settings", null=True
|
|
98
94
|
)
|
|
99
|
-
name = models.CharField()
|
|
95
|
+
name = models.CharField(max_length=100)
|
|
100
96
|
value = models.JSONField()
|
|
101
97
|
|
|
102
98
|
def __str__(self) -> str:
|
|
@@ -7,6 +7,7 @@ from canvas_sdk.v1.data.base import (
|
|
|
7
7
|
BaseQuerySet,
|
|
8
8
|
CommittableQuerySetMixin,
|
|
9
9
|
ForPatientQuerySetMixin,
|
|
10
|
+
IdentifiableModel,
|
|
10
11
|
)
|
|
11
12
|
|
|
12
13
|
|
|
@@ -34,19 +35,16 @@ class ProtocolOverrideQuerySet(BaseQuerySet, ForPatientQuerySetMixin, Committabl
|
|
|
34
35
|
ProtocolOverrideManager = BaseModelManager.from_queryset(ProtocolOverrideQuerySet)
|
|
35
36
|
|
|
36
37
|
|
|
37
|
-
class ProtocolOverride(
|
|
38
|
+
class ProtocolOverride(IdentifiableModel):
|
|
38
39
|
"""ProtocolOverride."""
|
|
39
40
|
|
|
40
41
|
class Meta:
|
|
41
|
-
managed = False
|
|
42
42
|
db_table = "canvas_sdk_data_api_protocoloverride_001"
|
|
43
43
|
|
|
44
44
|
objects = cast(ProtocolOverrideQuerySet, ProtocolOverrideManager())
|
|
45
45
|
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
created = models.DateTimeField()
|
|
49
|
-
modified = models.DateTimeField()
|
|
46
|
+
created = models.DateTimeField(auto_now_add=True)
|
|
47
|
+
modified = models.DateTimeField(auto_now=True)
|
|
50
48
|
deleted = models.BooleanField()
|
|
51
49
|
committer = models.ForeignKey(
|
|
52
50
|
"v1.CanvasUser", on_delete=models.DO_NOTHING, null=True, related_name="+"
|
|
@@ -57,7 +55,7 @@ class ProtocolOverride(models.Model):
|
|
|
57
55
|
patient = models.ForeignKey(
|
|
58
56
|
"v1.Patient", on_delete=models.DO_NOTHING, related_name="protocol_overrides", null=True
|
|
59
57
|
)
|
|
60
|
-
protocol_key = models.CharField()
|
|
58
|
+
protocol_key = models.CharField(max_length=250)
|
|
61
59
|
is_adjustment = models.BooleanField()
|
|
62
60
|
reference_date = models.DateTimeField()
|
|
63
61
|
cycle_in_days = models.IntegerField()
|
|
@@ -66,11 +64,11 @@ class ProtocolOverride(models.Model):
|
|
|
66
64
|
snoozed_days = models.IntegerField()
|
|
67
65
|
# reason_id = models.BigIntegerField()
|
|
68
66
|
snooze_comment = models.TextField()
|
|
69
|
-
narrative = models.CharField()
|
|
67
|
+
narrative = models.CharField(max_length=512)
|
|
70
68
|
# note_id = models.BigIntegerField()
|
|
71
69
|
cycle_quantity = models.IntegerField()
|
|
72
|
-
cycle_unit = models.CharField(choices=IntervalUnit.choices)
|
|
73
|
-
status = models.CharField(choices=Status.choices)
|
|
70
|
+
cycle_unit = models.CharField(choices=IntervalUnit.choices, max_length=20)
|
|
71
|
+
status = models.CharField(choices=Status.choices, max_length=20)
|
|
74
72
|
|
|
75
73
|
|
|
76
74
|
__exports__ = (
|