canvas 0.63.0__py3-none-any.whl → 0.89.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.
- {canvas-0.63.0.dist-info → canvas-0.89.0.dist-info}/METADATA +4 -1
- {canvas-0.63.0.dist-info → canvas-0.89.0.dist-info}/RECORD +184 -98
- {canvas-0.63.0.dist-info → canvas-0.89.0.dist-info}/WHEEL +1 -1
- canvas_cli/apps/emit/event_fixtures/UNKNOWN.ndjson +1 -0
- canvas_cli/apps/logs/logs.py +386 -22
- canvas_cli/main.py +3 -1
- canvas_cli/templates/plugins/default/{{ cookiecutter.__project_slug }}/tests/test_models.py +46 -4
- canvas_cli/utils/context/context.py +13 -13
- canvas_cli/utils/validators/manifest_schema.py +26 -1
- canvas_generated/messages/effects_pb2.py +5 -5
- canvas_generated/messages/effects_pb2.pyi +108 -2
- canvas_generated/messages/events_pb2.py +6 -6
- canvas_generated/messages/events_pb2.pyi +282 -2
- canvas_sdk/clients/__init__.py +1 -0
- canvas_sdk/clients/llms/__init__.py +17 -0
- canvas_sdk/clients/llms/libraries/__init__.py +11 -0
- canvas_sdk/clients/llms/libraries/llm_anthropic.py +87 -0
- canvas_sdk/clients/llms/libraries/llm_api.py +143 -0
- canvas_sdk/clients/llms/libraries/llm_google.py +92 -0
- canvas_sdk/clients/llms/libraries/llm_openai.py +98 -0
- canvas_sdk/clients/llms/structures/__init__.py +9 -0
- canvas_sdk/clients/llms/structures/llm_response.py +33 -0
- canvas_sdk/clients/llms/structures/llm_tokens.py +53 -0
- canvas_sdk/clients/llms/structures/llm_turn.py +47 -0
- canvas_sdk/clients/llms/structures/settings/__init__.py +13 -0
- canvas_sdk/clients/llms/structures/settings/llm_settings.py +27 -0
- canvas_sdk/clients/llms/structures/settings/llm_settings_anthropic.py +43 -0
- canvas_sdk/clients/llms/structures/settings/llm_settings_gemini.py +40 -0
- canvas_sdk/clients/llms/structures/settings/llm_settings_gpt4.py +40 -0
- canvas_sdk/clients/llms/structures/settings/llm_settings_gpt5.py +48 -0
- canvas_sdk/clients/third_party.py +3 -0
- canvas_sdk/commands/__init__.py +12 -0
- canvas_sdk/commands/base.py +33 -2
- canvas_sdk/commands/commands/adjust_prescription.py +4 -0
- canvas_sdk/commands/commands/custom_command.py +86 -0
- canvas_sdk/commands/commands/family_history.py +17 -1
- canvas_sdk/commands/commands/immunization_statement.py +42 -2
- canvas_sdk/commands/commands/medication_statement.py +16 -1
- canvas_sdk/commands/commands/past_surgical_history.py +16 -1
- canvas_sdk/commands/commands/perform.py +18 -1
- canvas_sdk/commands/commands/prescribe.py +8 -9
- canvas_sdk/commands/commands/refill.py +5 -5
- canvas_sdk/commands/commands/resolve_condition.py +5 -5
- canvas_sdk/commands/commands/review/__init__.py +3 -0
- canvas_sdk/commands/commands/review/base.py +72 -0
- canvas_sdk/commands/commands/review/imaging.py +13 -0
- canvas_sdk/commands/commands/review/lab.py +13 -0
- canvas_sdk/commands/commands/review/referral.py +13 -0
- canvas_sdk/commands/commands/review/uncategorized_document.py +13 -0
- canvas_sdk/commands/validation.py +43 -0
- canvas_sdk/effects/batch_originate.py +22 -0
- canvas_sdk/effects/calendar/__init__.py +13 -3
- canvas_sdk/effects/calendar/{create_calendar.py → calendar.py} +19 -5
- canvas_sdk/effects/calendar/event.py +172 -0
- canvas_sdk/effects/claim_label.py +93 -0
- canvas_sdk/effects/claim_line_item.py +47 -0
- canvas_sdk/effects/claim_queue.py +49 -0
- canvas_sdk/effects/fax/__init__.py +3 -0
- canvas_sdk/effects/fax/base.py +77 -0
- canvas_sdk/effects/fax/note.py +42 -0
- canvas_sdk/effects/metadata.py +15 -1
- canvas_sdk/effects/note/__init__.py +8 -1
- canvas_sdk/effects/note/appointment.py +135 -7
- canvas_sdk/effects/note/base.py +17 -0
- canvas_sdk/effects/note/message.py +22 -14
- canvas_sdk/effects/note/note.py +150 -1
- canvas_sdk/effects/observation/__init__.py +11 -0
- canvas_sdk/effects/observation/base.py +206 -0
- canvas_sdk/effects/patient/__init__.py +2 -0
- canvas_sdk/effects/patient/base.py +8 -0
- canvas_sdk/effects/payment/__init__.py +11 -0
- canvas_sdk/effects/payment/base.py +355 -0
- canvas_sdk/effects/payment/post_claim_payment.py +49 -0
- canvas_sdk/effects/send_contact_verification.py +42 -0
- canvas_sdk/effects/task/__init__.py +2 -1
- canvas_sdk/effects/task/task.py +30 -0
- canvas_sdk/effects/validation/__init__.py +3 -0
- canvas_sdk/effects/validation/base.py +92 -0
- canvas_sdk/events/base.py +15 -0
- canvas_sdk/handlers/application.py +7 -7
- canvas_sdk/handlers/simple_api/api.py +1 -4
- canvas_sdk/handlers/simple_api/websocket.py +1 -4
- canvas_sdk/handlers/utils.py +14 -0
- canvas_sdk/questionnaires/utils.py +1 -0
- canvas_sdk/templates/utils.py +17 -4
- canvas_sdk/test_utils/factories/FACTORY_GUIDE.md +362 -0
- canvas_sdk/test_utils/factories/__init__.py +115 -0
- canvas_sdk/test_utils/factories/calendar.py +24 -0
- canvas_sdk/test_utils/factories/claim.py +81 -0
- canvas_sdk/test_utils/factories/claim_diagnosis_code.py +16 -0
- canvas_sdk/test_utils/factories/coverage.py +17 -0
- canvas_sdk/test_utils/factories/imaging.py +74 -0
- canvas_sdk/test_utils/factories/lab.py +192 -0
- canvas_sdk/test_utils/factories/medication_history.py +75 -0
- canvas_sdk/test_utils/factories/note.py +52 -0
- canvas_sdk/test_utils/factories/organization.py +50 -0
- canvas_sdk/test_utils/factories/practicelocation.py +88 -0
- canvas_sdk/test_utils/factories/referral.py +81 -0
- canvas_sdk/test_utils/factories/staff.py +111 -0
- canvas_sdk/test_utils/factories/task.py +66 -0
- canvas_sdk/test_utils/factories/uncategorized_clinical_document.py +48 -0
- canvas_sdk/utils/metrics.py +4 -1
- canvas_sdk/v1/data/__init__.py +66 -7
- canvas_sdk/v1/data/allergy_intolerance.py +5 -11
- canvas_sdk/v1/data/appointment.py +18 -4
- canvas_sdk/v1/data/assessment.py +2 -12
- canvas_sdk/v1/data/banner_alert.py +2 -4
- canvas_sdk/v1/data/base.py +53 -14
- canvas_sdk/v1/data/billing.py +8 -11
- canvas_sdk/v1/data/calendar.py +64 -0
- canvas_sdk/v1/data/care_team.py +4 -10
- canvas_sdk/v1/data/claim.py +172 -66
- canvas_sdk/v1/data/claim_diagnosis_code.py +19 -0
- canvas_sdk/v1/data/claim_line_item.py +2 -5
- canvas_sdk/v1/data/coding.py +19 -0
- canvas_sdk/v1/data/command.py +2 -4
- canvas_sdk/v1/data/common.py +10 -0
- canvas_sdk/v1/data/compound_medication.py +3 -4
- canvas_sdk/v1/data/condition.py +4 -9
- canvas_sdk/v1/data/coverage.py +66 -26
- canvas_sdk/v1/data/detected_issue.py +20 -20
- canvas_sdk/v1/data/device.py +2 -14
- canvas_sdk/v1/data/discount.py +2 -5
- canvas_sdk/v1/data/encounter.py +44 -0
- canvas_sdk/v1/data/facility.py +1 -0
- canvas_sdk/v1/data/goal.py +2 -14
- canvas_sdk/v1/data/imaging.py +4 -30
- canvas_sdk/v1/data/immunization.py +7 -15
- canvas_sdk/v1/data/lab.py +12 -65
- canvas_sdk/v1/data/line_item_transaction.py +2 -5
- canvas_sdk/v1/data/medication.py +3 -8
- canvas_sdk/v1/data/medication_history.py +142 -0
- canvas_sdk/v1/data/medication_statement.py +41 -0
- canvas_sdk/v1/data/message.py +4 -8
- canvas_sdk/v1/data/note.py +37 -38
- canvas_sdk/v1/data/observation.py +9 -36
- canvas_sdk/v1/data/organization.py +70 -9
- canvas_sdk/v1/data/patient.py +8 -12
- canvas_sdk/v1/data/patient_consent.py +4 -14
- canvas_sdk/v1/data/payment_collection.py +2 -5
- canvas_sdk/v1/data/posting.py +3 -9
- canvas_sdk/v1/data/practicelocation.py +66 -7
- canvas_sdk/v1/data/protocol_override.py +3 -4
- canvas_sdk/v1/data/protocol_result.py +3 -3
- canvas_sdk/v1/data/questionnaire.py +10 -26
- canvas_sdk/v1/data/reason_for_visit.py +2 -6
- canvas_sdk/v1/data/referral.py +41 -17
- canvas_sdk/v1/data/staff.py +34 -26
- canvas_sdk/v1/data/stop_medication_event.py +27 -0
- canvas_sdk/v1/data/task.py +30 -11
- canvas_sdk/v1/data/team.py +2 -4
- canvas_sdk/v1/data/uncategorized_clinical_document.py +84 -0
- canvas_sdk/v1/data/user.py +14 -0
- canvas_sdk/v1/data/utils.py +5 -0
- canvas_sdk/value_set/v2026/__init__.py +1 -0
- canvas_sdk/value_set/v2026/adverse_event.py +157 -0
- canvas_sdk/value_set/v2026/allergy.py +116 -0
- canvas_sdk/value_set/v2026/assessment.py +466 -0
- canvas_sdk/value_set/v2026/communication.py +496 -0
- canvas_sdk/value_set/v2026/condition.py +52934 -0
- canvas_sdk/value_set/v2026/device.py +315 -0
- canvas_sdk/value_set/v2026/diagnostic_study.py +5243 -0
- canvas_sdk/value_set/v2026/encounter.py +2714 -0
- canvas_sdk/value_set/v2026/immunization.py +297 -0
- canvas_sdk/value_set/v2026/individual_characteristic.py +339 -0
- canvas_sdk/value_set/v2026/intervention.py +1703 -0
- canvas_sdk/value_set/v2026/laboratory_test.py +1831 -0
- canvas_sdk/value_set/v2026/medication.py +8218 -0
- canvas_sdk/value_set/v2026/no_qdm_category_assigned.py +26493 -0
- canvas_sdk/value_set/v2026/physical_exam.py +342 -0
- canvas_sdk/value_set/v2026/procedure.py +27869 -0
- canvas_sdk/value_set/v2026/symptom.py +625 -0
- logger/logger.py +30 -31
- logger/logstash.py +282 -0
- logger/pubsub.py +26 -0
- plugin_runner/allowed-module-imports.json +940 -9
- plugin_runner/generate_allowed_imports.py +1 -0
- plugin_runner/installation.py +2 -2
- plugin_runner/plugin_runner.py +21 -24
- plugin_runner/sandbox.py +34 -0
- protobufs/canvas_generated/messages/effects.proto +65 -0
- protobufs/canvas_generated/messages/events.proto +150 -51
- settings.py +27 -11
- canvas_sdk/effects/calendar/create_event.py +0 -43
- {canvas-0.63.0.dist-info → canvas-0.89.0.dist-info}/entry_points.txt +0 -0
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import factory
|
|
2
|
+
|
|
3
|
+
from canvas_sdk.v1.data import Task, TaskComment, TaskLabel, TaskMetadata, TaskTaskLabel
|
|
4
|
+
from canvas_sdk.v1.data.common import ColorEnum, Origin
|
|
5
|
+
from canvas_sdk.v1.data.task import TaskLabelModule, TaskStatus, TaskType
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
class TaskFactory(factory.django.DjangoModelFactory[Task]):
|
|
9
|
+
"""Factory for creating Task."""
|
|
10
|
+
|
|
11
|
+
class Meta:
|
|
12
|
+
model = Task
|
|
13
|
+
|
|
14
|
+
patient = factory.SubFactory("canvas_sdk.test_utils.factories.PatientFactory")
|
|
15
|
+
creator = factory.SubFactory("canvas_sdk.test_utils.factories.StaffFactory")
|
|
16
|
+
assignee = factory.SubFactory("canvas_sdk.test_utils.factories.StaffFactory")
|
|
17
|
+
task_type = TaskType.TASK
|
|
18
|
+
tag = factory.Faker("word")
|
|
19
|
+
title = factory.Faker("sentence", nb_words=4)
|
|
20
|
+
status = TaskStatus.OPEN
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
class TaskMetadataFactory(factory.django.DjangoModelFactory[TaskMetadata]):
|
|
24
|
+
"""Factory for creating TaskMetadata."""
|
|
25
|
+
|
|
26
|
+
class Meta:
|
|
27
|
+
model = TaskMetadata
|
|
28
|
+
|
|
29
|
+
task = factory.SubFactory(TaskFactory)
|
|
30
|
+
key = factory.Faker("word")
|
|
31
|
+
value = factory.Faker("word")
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
class TaskCommentFactory(factory.django.DjangoModelFactory[TaskComment]):
|
|
35
|
+
"""Factory for creating TaskComment."""
|
|
36
|
+
|
|
37
|
+
class Meta:
|
|
38
|
+
model = TaskComment
|
|
39
|
+
|
|
40
|
+
creator = factory.SubFactory("canvas_sdk.test_utils.factories.StaffFactory")
|
|
41
|
+
task = factory.SubFactory(TaskFactory)
|
|
42
|
+
body = factory.Faker("sentence", nb_words=10)
|
|
43
|
+
|
|
44
|
+
|
|
45
|
+
class TaskLabelFactory(factory.django.DjangoModelFactory[TaskLabel]):
|
|
46
|
+
"""Factory for creating TaskLabel."""
|
|
47
|
+
|
|
48
|
+
class Meta:
|
|
49
|
+
model = TaskLabel
|
|
50
|
+
|
|
51
|
+
position = factory.Sequence(lambda n: n)
|
|
52
|
+
color = ColorEnum.BLUE
|
|
53
|
+
task_association = [Origin.REFERAL]
|
|
54
|
+
name = factory.Faker("word")
|
|
55
|
+
active = True
|
|
56
|
+
modules = [TaskLabelModule.TASKS]
|
|
57
|
+
|
|
58
|
+
|
|
59
|
+
class TaskTaskLabelFactory(factory.django.DjangoModelFactory[TaskTaskLabel]):
|
|
60
|
+
"""Factory for creating TaskTaskLabel."""
|
|
61
|
+
|
|
62
|
+
class Meta:
|
|
63
|
+
model = TaskTaskLabel
|
|
64
|
+
|
|
65
|
+
task = factory.SubFactory(TaskFactory)
|
|
66
|
+
task_label = factory.SubFactory(TaskLabelFactory)
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import datetime
|
|
2
|
+
|
|
3
|
+
import factory
|
|
4
|
+
from django.utils import timezone
|
|
5
|
+
from factory.fuzzy import FuzzyDate
|
|
6
|
+
|
|
7
|
+
from canvas_sdk.v1.data import UncategorizedClinicalDocument, UncategorizedClinicalDocumentReview
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
class UncategorizedClinicalDocumentReviewFactory(
|
|
11
|
+
factory.django.DjangoModelFactory[UncategorizedClinicalDocumentReview]
|
|
12
|
+
):
|
|
13
|
+
"""Factory for creating UncategorizedClinicalDocumentReview."""
|
|
14
|
+
|
|
15
|
+
class Meta:
|
|
16
|
+
model = UncategorizedClinicalDocumentReview
|
|
17
|
+
|
|
18
|
+
internal_comment = factory.Faker("paragraph")
|
|
19
|
+
message_to_patient = factory.Faker("sentence", nb_words=20)
|
|
20
|
+
status = factory.Faker("random_element", elements=["pending", "reviewed", "completed"])
|
|
21
|
+
patient = factory.SubFactory("canvas_sdk.test_utils.factories.PatientFactory")
|
|
22
|
+
patient_communication_method = factory.Faker(
|
|
23
|
+
"random_element", elements=["email", "phone", "portal", "mail"]
|
|
24
|
+
)
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
class UncategorizedClinicalDocumentFactory(
|
|
28
|
+
factory.django.DjangoModelFactory[UncategorizedClinicalDocument]
|
|
29
|
+
):
|
|
30
|
+
"""Factory for creating UncategorizedClinicalDocument."""
|
|
31
|
+
|
|
32
|
+
class Meta:
|
|
33
|
+
model = UncategorizedClinicalDocument
|
|
34
|
+
|
|
35
|
+
originator = factory.SubFactory("canvas_sdk.test_utils.factories.CanvasUserFactory")
|
|
36
|
+
patient = factory.SubFactory("canvas_sdk.test_utils.factories.PatientFactory")
|
|
37
|
+
review = factory.SubFactory(UncategorizedClinicalDocumentReviewFactory)
|
|
38
|
+
assigned_by = factory.SubFactory("canvas_sdk.test_utils.factories.CanvasUserFactory")
|
|
39
|
+
|
|
40
|
+
name = factory.Faker("sentence", nb_words=3)
|
|
41
|
+
review_mode = factory.Faker("random_element", elements=["IN", "OT"])
|
|
42
|
+
requires_signature = factory.Faker("boolean")
|
|
43
|
+
assigned_date = factory.LazyFunction(lambda: timezone.now())
|
|
44
|
+
original_date = FuzzyDate(
|
|
45
|
+
start_date=datetime.date.today() - datetime.timedelta(days=365),
|
|
46
|
+
end_date=datetime.date.today(),
|
|
47
|
+
)
|
|
48
|
+
comment = factory.Faker("paragraph")
|
canvas_sdk/utils/metrics.py
CHANGED
|
@@ -137,7 +137,10 @@ def measure(
|
|
|
137
137
|
extra_tags["plugin"] = caller.split(".")[0]
|
|
138
138
|
extra_tags["handler"] = caller
|
|
139
139
|
|
|
140
|
-
tags = {
|
|
140
|
+
tags = {
|
|
141
|
+
"name": name,
|
|
142
|
+
**(extra_tags or {}),
|
|
143
|
+
}
|
|
141
144
|
|
|
142
145
|
pipeline = client.pipeline()
|
|
143
146
|
timing_start = time.perf_counter_ns()
|
canvas_sdk/v1/data/__init__.py
CHANGED
|
@@ -1,20 +1,38 @@
|
|
|
1
1
|
from .allergy_intolerance import AllergyIntolerance, AllergyIntoleranceCoding
|
|
2
|
-
from .appointment import
|
|
2
|
+
from .appointment import (
|
|
3
|
+
Appointment,
|
|
4
|
+
AppointmentExternalIdentifier,
|
|
5
|
+
AppointmentLabel,
|
|
6
|
+
AppointmentMetadata,
|
|
7
|
+
)
|
|
3
8
|
from .assessment import Assessment
|
|
4
9
|
from .banner_alert import BannerAlert
|
|
5
10
|
from .billing import BillingLineItem, BillingLineItemModifier
|
|
6
11
|
from .business_line import BusinessLine
|
|
12
|
+
from .calendar import Calendar, Event
|
|
7
13
|
from .care_team import CareTeamMembership, CareTeamRole
|
|
8
14
|
from .charge_description_master import ChargeDescriptionMaster
|
|
9
|
-
from .claim import
|
|
15
|
+
from .claim import (
|
|
16
|
+
Claim,
|
|
17
|
+
ClaimComment,
|
|
18
|
+
ClaimCoverage,
|
|
19
|
+
ClaimLabel,
|
|
20
|
+
ClaimPatient,
|
|
21
|
+
ClaimProvider,
|
|
22
|
+
ClaimQueue,
|
|
23
|
+
ClaimSubmission,
|
|
24
|
+
InstallmentPlan,
|
|
25
|
+
)
|
|
26
|
+
from .claim_diagnosis_code import ClaimDiagnosisCode
|
|
10
27
|
from .claim_line_item import ClaimLineItem
|
|
11
28
|
from .command import Command
|
|
12
29
|
from .compound_medication import CompoundMedication
|
|
13
30
|
from .condition import Condition, ConditionCoding
|
|
14
|
-
from .coverage import Coverage, Transactor, TransactorAddress, TransactorPhone
|
|
31
|
+
from .coverage import Coverage, EligibilitySummary, Transactor, TransactorAddress, TransactorPhone
|
|
15
32
|
from .detected_issue import DetectedIssue, DetectedIssueEvidence
|
|
16
33
|
from .device import Device
|
|
17
34
|
from .discount import Discount
|
|
35
|
+
from .encounter import Encounter
|
|
18
36
|
from .facility import Facility
|
|
19
37
|
from .goal import Goal
|
|
20
38
|
from .imaging import ImagingOrder, ImagingReport, ImagingReview
|
|
@@ -43,6 +61,13 @@ from .line_item_transaction import (
|
|
|
43
61
|
NewLineItemPayment,
|
|
44
62
|
)
|
|
45
63
|
from .medication import Medication, MedicationCoding
|
|
64
|
+
from .medication_history import (
|
|
65
|
+
MedicationHistoryMedication,
|
|
66
|
+
MedicationHistoryMedicationCoding,
|
|
67
|
+
MedicationHistoryResponse,
|
|
68
|
+
MedicationHistoryResponseStatus,
|
|
69
|
+
)
|
|
70
|
+
from .medication_statement import MedicationStatement
|
|
46
71
|
from .message import Message, MessageAttachment, MessageTransmission
|
|
47
72
|
from .note import CurrentNoteStateEvent, Note, NoteStateChangeEvent, NoteType
|
|
48
73
|
from .observation import (
|
|
@@ -52,7 +77,7 @@ from .observation import (
|
|
|
52
77
|
ObservationComponentCoding,
|
|
53
78
|
ObservationValueCoding,
|
|
54
79
|
)
|
|
55
|
-
from .organization import Organization
|
|
80
|
+
from .organization import Organization, OrganizationAddress, OrganizationContactPoint
|
|
56
81
|
from .patient import (
|
|
57
82
|
Patient,
|
|
58
83
|
PatientAddress,
|
|
@@ -76,7 +101,12 @@ from .posting import (
|
|
|
76
101
|
CoveragePosting,
|
|
77
102
|
PatientPosting,
|
|
78
103
|
)
|
|
79
|
-
from .practicelocation import
|
|
104
|
+
from .practicelocation import (
|
|
105
|
+
PracticeLocation,
|
|
106
|
+
PracticeLocationAddress,
|
|
107
|
+
PracticeLocationContactPoint,
|
|
108
|
+
PracticeLocationSetting,
|
|
109
|
+
)
|
|
80
110
|
from .protocol_current import ProtocolCurrent
|
|
81
111
|
from .protocol_override import ProtocolOverride
|
|
82
112
|
from .questionnaire import (
|
|
@@ -90,17 +120,23 @@ from .questionnaire import (
|
|
|
90
120
|
ResponseOptionSet,
|
|
91
121
|
)
|
|
92
122
|
from .reason_for_visit import ReasonForVisitSettingCoding
|
|
93
|
-
from .referral import Referral, ReferralReport
|
|
123
|
+
from .referral import Referral, ReferralReport, ReferralReview
|
|
94
124
|
from .service_provider import ServiceProvider
|
|
95
125
|
from .staff import Staff, StaffAddress, StaffContactPoint, StaffLicense, StaffPhoto, StaffRole
|
|
96
|
-
from .
|
|
126
|
+
from .stop_medication_event import StopMedicationEvent
|
|
127
|
+
from .task import Task, TaskComment, TaskLabel, TaskMetadata, TaskTaskLabel
|
|
97
128
|
from .team import Team, TeamContactPoint
|
|
129
|
+
from .uncategorized_clinical_document import (
|
|
130
|
+
UncategorizedClinicalDocument,
|
|
131
|
+
UncategorizedClinicalDocumentReview,
|
|
132
|
+
)
|
|
98
133
|
from .user import CanvasUser
|
|
99
134
|
|
|
100
135
|
__all__ = __exports__ = (
|
|
101
136
|
"Appointment",
|
|
102
137
|
"AppointmentMetadata",
|
|
103
138
|
"AppointmentExternalIdentifier",
|
|
139
|
+
"AppointmentLabel",
|
|
104
140
|
"AllergyIntolerance",
|
|
105
141
|
"AllergyIntoleranceCoding",
|
|
106
142
|
"Assessment",
|
|
@@ -111,15 +147,21 @@ __all__ = __exports__ = (
|
|
|
111
147
|
"BillingLineItemModifier",
|
|
112
148
|
"BusinessLine",
|
|
113
149
|
"BulkPatientPosting",
|
|
150
|
+
"Calendar",
|
|
114
151
|
"CanvasUser",
|
|
115
152
|
"CareTeamMembership",
|
|
116
153
|
"CareTeamRole",
|
|
117
154
|
"ChargeDescriptionMaster",
|
|
118
155
|
"Claim",
|
|
156
|
+
"ClaimComment",
|
|
119
157
|
"ClaimCoverage",
|
|
158
|
+
"ClaimDiagnosisCode",
|
|
159
|
+
"ClaimLabel",
|
|
120
160
|
"ClaimLineItem",
|
|
121
161
|
"ClaimPatient",
|
|
162
|
+
"ClaimProvider",
|
|
122
163
|
"ClaimQueue",
|
|
164
|
+
"ClaimSubmission",
|
|
123
165
|
"Command",
|
|
124
166
|
"CompoundMedication",
|
|
125
167
|
"Condition",
|
|
@@ -131,6 +173,9 @@ __all__ = __exports__ = (
|
|
|
131
173
|
"DetectedIssueEvidence",
|
|
132
174
|
"Device",
|
|
133
175
|
"Discount",
|
|
176
|
+
"EligibilitySummary",
|
|
177
|
+
"Encounter",
|
|
178
|
+
"Event",
|
|
134
179
|
"Facility",
|
|
135
180
|
"Goal",
|
|
136
181
|
"ImagingOrder",
|
|
@@ -158,6 +203,11 @@ __all__ = __exports__ = (
|
|
|
158
203
|
"LineItemTransfer",
|
|
159
204
|
"Medication",
|
|
160
205
|
"MedicationCoding",
|
|
206
|
+
"MedicationHistoryMedication",
|
|
207
|
+
"MedicationHistoryMedicationCoding",
|
|
208
|
+
"MedicationHistoryResponseStatus",
|
|
209
|
+
"MedicationHistoryResponse",
|
|
210
|
+
"MedicationStatement",
|
|
161
211
|
"Message",
|
|
162
212
|
"MessageAttachment",
|
|
163
213
|
"MessageTransmission",
|
|
@@ -172,6 +222,8 @@ __all__ = __exports__ = (
|
|
|
172
222
|
"ObservationComponentCoding",
|
|
173
223
|
"ObservationValueCoding",
|
|
174
224
|
"Organization",
|
|
225
|
+
"OrganizationAddress",
|
|
226
|
+
"OrganizationContactPoint",
|
|
175
227
|
"Patient",
|
|
176
228
|
"PatientAddress",
|
|
177
229
|
"PatientContactPoint",
|
|
@@ -186,6 +238,8 @@ __all__ = __exports__ = (
|
|
|
186
238
|
"PayorSpecificCharge",
|
|
187
239
|
"PaymentCollection",
|
|
188
240
|
"PracticeLocation",
|
|
241
|
+
"PracticeLocationAddress",
|
|
242
|
+
"PracticeLocationContactPoint",
|
|
189
243
|
"PracticeLocationSetting",
|
|
190
244
|
"ProtocolCurrent",
|
|
191
245
|
"ProtocolOverride",
|
|
@@ -195,6 +249,7 @@ __all__ = __exports__ = (
|
|
|
195
249
|
"ReasonForVisitSettingCoding",
|
|
196
250
|
"Referral",
|
|
197
251
|
"ReferralReport",
|
|
252
|
+
"ReferralReview",
|
|
198
253
|
"ResponseOption",
|
|
199
254
|
"ResponseOptionSet",
|
|
200
255
|
"ServiceProvider",
|
|
@@ -204,13 +259,17 @@ __all__ = __exports__ = (
|
|
|
204
259
|
"StaffPhoto",
|
|
205
260
|
"StaffRole",
|
|
206
261
|
"StaffContactPoint",
|
|
262
|
+
"StopMedicationEvent",
|
|
207
263
|
"Task",
|
|
208
264
|
"TaskComment",
|
|
209
265
|
"TaskLabel",
|
|
210
266
|
"TaskTaskLabel",
|
|
267
|
+
"TaskMetadata",
|
|
211
268
|
"Team",
|
|
212
269
|
"TeamContactPoint",
|
|
213
270
|
"Transactor",
|
|
214
271
|
"TransactorAddress",
|
|
215
272
|
"TransactorPhone",
|
|
273
|
+
"UncategorizedClinicalDocumentReview",
|
|
274
|
+
"UncategorizedClinicalDocument",
|
|
216
275
|
)
|
|
@@ -7,15 +7,16 @@ from canvas_sdk.v1.data.base import (
|
|
|
7
7
|
CommittableQuerySetMixin,
|
|
8
8
|
ForPatientQuerySetMixin,
|
|
9
9
|
IdentifiableModel,
|
|
10
|
-
|
|
10
|
+
TimestampedModel,
|
|
11
11
|
ValueSetLookupQuerySet,
|
|
12
12
|
)
|
|
13
|
+
from canvas_sdk.v1.data.coding import Coding
|
|
13
14
|
|
|
14
15
|
|
|
15
16
|
class AllergyIntoleranceQuerySet(
|
|
16
|
-
ValueSetLookupQuerySet,
|
|
17
17
|
CommittableQuerySetMixin,
|
|
18
18
|
ForPatientQuerySetMixin,
|
|
19
|
+
ValueSetLookupQuerySet,
|
|
19
20
|
):
|
|
20
21
|
"""AllergyIntoleranceQuerySet."""
|
|
21
22
|
|
|
@@ -25,7 +26,7 @@ class AllergyIntoleranceQuerySet(
|
|
|
25
26
|
AllergyIntoleranceManager = BaseModelManager.from_queryset(AllergyIntoleranceQuerySet)
|
|
26
27
|
|
|
27
28
|
|
|
28
|
-
class AllergyIntolerance(IdentifiableModel):
|
|
29
|
+
class AllergyIntolerance(TimestampedModel, IdentifiableModel):
|
|
29
30
|
"""AllergyIntolerance."""
|
|
30
31
|
|
|
31
32
|
class Meta:
|
|
@@ -33,8 +34,6 @@ class AllergyIntolerance(IdentifiableModel):
|
|
|
33
34
|
|
|
34
35
|
objects = cast(AllergyIntoleranceQuerySet, AllergyIntoleranceManager())
|
|
35
36
|
|
|
36
|
-
created = models.DateTimeField(auto_now_add=True)
|
|
37
|
-
modified = models.DateTimeField(auto_now=True)
|
|
38
37
|
deleted = models.BooleanField()
|
|
39
38
|
committer = models.ForeignKey(
|
|
40
39
|
"v1.CanvasUser", on_delete=models.DO_NOTHING, null=True, related_name="+"
|
|
@@ -61,17 +60,12 @@ class AllergyIntolerance(IdentifiableModel):
|
|
|
61
60
|
narrative = models.CharField(max_length=512)
|
|
62
61
|
|
|
63
62
|
|
|
64
|
-
class AllergyIntoleranceCoding(
|
|
63
|
+
class AllergyIntoleranceCoding(Coding):
|
|
65
64
|
"""AllergyIntoleranceCoding."""
|
|
66
65
|
|
|
67
66
|
class Meta:
|
|
68
67
|
db_table = "canvas_sdk_data_api_allergyintolerancecoding_001"
|
|
69
68
|
|
|
70
|
-
system = models.CharField(max_length=255)
|
|
71
|
-
version = models.CharField(max_length=255)
|
|
72
|
-
code = models.CharField(max_length=255)
|
|
73
|
-
display = models.CharField(max_length=1000)
|
|
74
|
-
user_selected = models.BooleanField()
|
|
75
69
|
allergy_intolerance = models.ForeignKey(
|
|
76
70
|
AllergyIntolerance,
|
|
77
71
|
on_delete=models.DO_NOTHING,
|
|
@@ -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, Model, TimestampedModel
|
|
4
4
|
|
|
5
5
|
|
|
6
6
|
class AppointmentProgressStatus(models.TextChoices):
|
|
@@ -60,14 +60,12 @@ class Appointment(IdentifiableModel):
|
|
|
60
60
|
description = models.TextField(null=True, blank=True)
|
|
61
61
|
|
|
62
62
|
|
|
63
|
-
class AppointmentExternalIdentifier(IdentifiableModel):
|
|
63
|
+
class AppointmentExternalIdentifier(TimestampedModel, IdentifiableModel):
|
|
64
64
|
"""AppointmentExternalIdentifier."""
|
|
65
65
|
|
|
66
66
|
class Meta:
|
|
67
67
|
db_table = "canvas_sdk_data_api_appointmentexternalidentifier_001"
|
|
68
68
|
|
|
69
|
-
created = models.DateTimeField(auto_now_add=True)
|
|
70
|
-
modified = models.DateTimeField(auto_now=True)
|
|
71
69
|
use = models.CharField(max_length=255)
|
|
72
70
|
identifier_type = models.CharField(max_length=255)
|
|
73
71
|
system = models.CharField(max_length=255)
|
|
@@ -79,6 +77,21 @@ class AppointmentExternalIdentifier(IdentifiableModel):
|
|
|
79
77
|
)
|
|
80
78
|
|
|
81
79
|
|
|
80
|
+
class AppointmentLabel(Model):
|
|
81
|
+
"""M2M for Appointment -> TaskLabels."""
|
|
82
|
+
|
|
83
|
+
class Meta:
|
|
84
|
+
db_table = "canvas_sdk_data_api_appointment_labels_001"
|
|
85
|
+
|
|
86
|
+
appointment = models.ForeignKey(Appointment, on_delete=models.DO_NOTHING, null=True)
|
|
87
|
+
task_label = models.ForeignKey(
|
|
88
|
+
"v1.TaskLabel",
|
|
89
|
+
on_delete=models.DO_NOTHING,
|
|
90
|
+
null=True,
|
|
91
|
+
db_column="userselectedtasklabel_id",
|
|
92
|
+
)
|
|
93
|
+
|
|
94
|
+
|
|
82
95
|
class AppointmentMetadata(IdentifiableModel):
|
|
83
96
|
"""A class representing Appointment Metadata."""
|
|
84
97
|
|
|
@@ -97,4 +110,5 @@ __exports__ = (
|
|
|
97
110
|
"Appointment",
|
|
98
111
|
"AppointmentMetadata",
|
|
99
112
|
"AppointmentExternalIdentifier",
|
|
113
|
+
"AppointmentLabel",
|
|
100
114
|
)
|
canvas_sdk/v1/data/assessment.py
CHANGED
|
@@ -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 AssessmentStatus(models.TextChoices):
|
|
@@ -11,22 +11,12 @@ class AssessmentStatus(models.TextChoices):
|
|
|
11
11
|
STATUS_DETERIORATING = "deteriorated", "Deteriorated"
|
|
12
12
|
|
|
13
13
|
|
|
14
|
-
class Assessment(IdentifiableModel):
|
|
14
|
+
class Assessment(AuditedModel, IdentifiableModel):
|
|
15
15
|
"""Assessment."""
|
|
16
16
|
|
|
17
17
|
class Meta:
|
|
18
18
|
db_table = "canvas_sdk_data_api_assessment_001"
|
|
19
19
|
|
|
20
|
-
created = models.DateTimeField(auto_now_add=True)
|
|
21
|
-
modified = models.DateTimeField(auto_now=True)
|
|
22
|
-
originator = models.ForeignKey("v1.CanvasUser", on_delete=models.DO_NOTHING, related_name="+")
|
|
23
|
-
committer = models.ForeignKey(
|
|
24
|
-
"v1.CanvasUser", on_delete=models.DO_NOTHING, null=True, related_name="+"
|
|
25
|
-
)
|
|
26
|
-
deleted = models.BooleanField()
|
|
27
|
-
entered_in_error = models.ForeignKey(
|
|
28
|
-
"v1.CanvasUser", on_delete=models.DO_NOTHING, null=True, related_name="+"
|
|
29
|
-
)
|
|
30
20
|
patient = models.ForeignKey(
|
|
31
21
|
"v1.Patient",
|
|
32
22
|
on_delete=models.DO_NOTHING,
|
|
@@ -1,17 +1,15 @@
|
|
|
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
|
|
4
|
+
from canvas_sdk.v1.data.base import TimestampedModel
|
|
5
5
|
|
|
6
6
|
|
|
7
|
-
class BannerAlert(
|
|
7
|
+
class BannerAlert(TimestampedModel):
|
|
8
8
|
"""BannerAlert."""
|
|
9
9
|
|
|
10
10
|
class Meta:
|
|
11
11
|
db_table = "canvas_sdk_data_api_banneralert_001"
|
|
12
12
|
|
|
13
|
-
created = models.DateTimeField(auto_now_add=True)
|
|
14
|
-
modified = models.DateTimeField(auto_now=True)
|
|
15
13
|
patient = models.ForeignKey(
|
|
16
14
|
"v1.Patient",
|
|
17
15
|
on_delete=models.DO_NOTHING,
|
canvas_sdk/v1/data/base.py
CHANGED
|
@@ -54,6 +54,34 @@ class IdentifiableModel(Model):
|
|
|
54
54
|
id = models.UUIDField(default=uuid.uuid4, editable=False, unique=True)
|
|
55
55
|
|
|
56
56
|
|
|
57
|
+
class TimestampedModel(Model):
|
|
58
|
+
"""A model that includes created and modified timestamps."""
|
|
59
|
+
|
|
60
|
+
class Meta:
|
|
61
|
+
abstract = True
|
|
62
|
+
|
|
63
|
+
created = models.DateTimeField(auto_now_add=True)
|
|
64
|
+
modified = models.DateTimeField(auto_now=True)
|
|
65
|
+
|
|
66
|
+
|
|
67
|
+
class AuditedModel(TimestampedModel):
|
|
68
|
+
"""A model that includes auditing fields."""
|
|
69
|
+
|
|
70
|
+
class Meta:
|
|
71
|
+
abstract = True
|
|
72
|
+
|
|
73
|
+
originator = models.ForeignKey(
|
|
74
|
+
"v1.CanvasUser", on_delete=models.DO_NOTHING, null=True, related_name="+"
|
|
75
|
+
)
|
|
76
|
+
committer = models.ForeignKey(
|
|
77
|
+
"v1.CanvasUser", on_delete=models.DO_NOTHING, null=True, related_name="+"
|
|
78
|
+
)
|
|
79
|
+
entered_in_error = models.ForeignKey(
|
|
80
|
+
"v1.CanvasUser", on_delete=models.DO_NOTHING, null=True, related_name="+"
|
|
81
|
+
)
|
|
82
|
+
deleted = models.BooleanField(default=False)
|
|
83
|
+
|
|
84
|
+
|
|
57
85
|
class BaseModelManager(models.Manager):
|
|
58
86
|
"""A base manager for models."""
|
|
59
87
|
|
|
@@ -68,16 +96,27 @@ class BaseQuerySet(models.QuerySet):
|
|
|
68
96
|
pass
|
|
69
97
|
|
|
70
98
|
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
99
|
+
if TYPE_CHECKING:
|
|
100
|
+
# For type checking: Define the Protocol with method signatures
|
|
101
|
+
class QuerySetProtocol(Protocol):
|
|
102
|
+
"""A typing protocol for use in mixins into models.QuerySet-inherited classes."""
|
|
103
|
+
|
|
104
|
+
def filter(self, *args: Any, **kwargs: Any) -> Self:
|
|
105
|
+
"""Django's models.QuerySet filter method."""
|
|
106
|
+
...
|
|
107
|
+
|
|
108
|
+
def distinct(self) -> Self:
|
|
109
|
+
"""Django's models.QuerySet distinct method."""
|
|
110
|
+
...
|
|
111
|
+
else:
|
|
112
|
+
# At runtime: Empty class that doesn't shadow Django's methods
|
|
113
|
+
class QuerySetProtocol:
|
|
114
|
+
"""A typing protocol for use in mixins into models.QuerySet-inherited classes.
|
|
115
|
+
|
|
116
|
+
This Protocol is intentionally empty at runtime to avoid shadowing Django's
|
|
117
|
+
QuerySet methods in the MRO. The method signatures are only defined when
|
|
118
|
+
type checking (see TYPE_CHECKING block above).
|
|
119
|
+
"""
|
|
81
120
|
|
|
82
121
|
|
|
83
122
|
class ValueSetLookupQuerySetProtocol(QuerySetProtocol):
|
|
@@ -209,25 +248,25 @@ class TimeframeLookupQuerySetMixin(TimeframeLookupQuerySetProtocol):
|
|
|
209
248
|
)
|
|
210
249
|
|
|
211
250
|
|
|
212
|
-
class CommittableQuerySet(
|
|
251
|
+
class CommittableQuerySet(CommittableQuerySetMixin, BaseQuerySet):
|
|
213
252
|
"""A queryset for committable objects."""
|
|
214
253
|
|
|
215
254
|
pass
|
|
216
255
|
|
|
217
256
|
|
|
218
|
-
class ValueSetLookupQuerySet(
|
|
257
|
+
class ValueSetLookupQuerySet(ValueSetLookupQuerySetMixin, BaseQuerySet):
|
|
219
258
|
"""A class that includes methods for looking up value sets."""
|
|
220
259
|
|
|
221
260
|
pass
|
|
222
261
|
|
|
223
262
|
|
|
224
|
-
class ValueSetLookupByNameQuerySet(
|
|
263
|
+
class ValueSetLookupByNameQuerySet(ValueSetLookupByNameQuerySetMixin, BaseQuerySet):
|
|
225
264
|
"""A class that includes methods for looking up value sets by name."""
|
|
226
265
|
|
|
227
266
|
pass
|
|
228
267
|
|
|
229
268
|
|
|
230
|
-
class ValueSetTimeframeLookupQuerySet(
|
|
269
|
+
class ValueSetTimeframeLookupQuerySet(TimeframeLookupQuerySetMixin, ValueSetLookupQuerySet):
|
|
231
270
|
"""A class that includes methods for looking up value sets and using timeframes."""
|
|
232
271
|
|
|
233
272
|
pass
|
canvas_sdk/v1/data/billing.py
CHANGED
|
@@ -2,7 +2,12 @@ from typing import TYPE_CHECKING, Self
|
|
|
2
2
|
|
|
3
3
|
from django.db import models
|
|
4
4
|
|
|
5
|
-
from canvas_sdk.v1.data.base import
|
|
5
|
+
from canvas_sdk.v1.data.base import (
|
|
6
|
+
IdentifiableModel,
|
|
7
|
+
TimestampedModel,
|
|
8
|
+
ValueSetTimeframeLookupQuerySet,
|
|
9
|
+
)
|
|
10
|
+
from canvas_sdk.v1.data.coding import Coding
|
|
6
11
|
from canvas_sdk.value_set.value_set import CodeConstants
|
|
7
12
|
|
|
8
13
|
if TYPE_CHECKING:
|
|
@@ -29,17 +34,14 @@ class BillingLineItemStatus(models.TextChoices):
|
|
|
29
34
|
REMOVED = "removed", "Removed"
|
|
30
35
|
|
|
31
36
|
|
|
32
|
-
class BillingLineItem(IdentifiableModel):
|
|
37
|
+
class BillingLineItem(TimestampedModel, IdentifiableModel):
|
|
33
38
|
"""BillingLineItem."""
|
|
34
39
|
|
|
35
40
|
class Meta:
|
|
36
41
|
db_table = "canvas_sdk_data_api_billinglineitem_001"
|
|
37
42
|
|
|
38
|
-
# objects = BillingLineItemQuerySet.as_manager()
|
|
39
43
|
objects = models.Manager().from_queryset(BillingLineItemQuerySet)()
|
|
40
44
|
|
|
41
|
-
created = models.DateTimeField(auto_now_add=True)
|
|
42
|
-
modified = models.DateTimeField(auto_now=True)
|
|
43
45
|
note = models.ForeignKey(
|
|
44
46
|
"v1.Note",
|
|
45
47
|
on_delete=models.DO_NOTHING,
|
|
@@ -61,17 +63,12 @@ class BillingLineItem(IdentifiableModel):
|
|
|
61
63
|
status = models.CharField(choices=BillingLineItemStatus.choices, max_length=20)
|
|
62
64
|
|
|
63
65
|
|
|
64
|
-
class BillingLineItemModifier(
|
|
66
|
+
class BillingLineItemModifier(Coding):
|
|
65
67
|
"""BillingLineItemModifier."""
|
|
66
68
|
|
|
67
69
|
class Meta:
|
|
68
70
|
db_table = "canvas_sdk_data_api_billinglineitemmodifier_001"
|
|
69
71
|
|
|
70
|
-
system = models.CharField(max_length=255)
|
|
71
|
-
version = models.CharField(max_length=255)
|
|
72
|
-
code = models.CharField(max_length=255)
|
|
73
|
-
display = models.CharField(max_length=1000)
|
|
74
|
-
user_selected = models.BooleanField()
|
|
75
72
|
line_item = models.ForeignKey(
|
|
76
73
|
"v1.BillingLineItem",
|
|
77
74
|
on_delete=models.DO_NOTHING,
|