canvas 0.64.0__py3-none-any.whl → 0.66.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.

@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: canvas
3
- Version: 0.64.0
3
+ Version: 0.66.0
4
4
  Summary: SDK to customize event-driven actions in your Canvas instance
5
5
  Author-email: Canvas Team <engineering@canvasmedical.com>
6
6
  License-Expression: MIT
@@ -105,7 +105,7 @@ canvas_sdk/commands/__init__.py,sha256=qX7xkagyYk4W4JqczoTHv3W3Bk16BXQG4Ut7zQV8w
105
105
  canvas_sdk/commands/base.py,sha256=XHHS2mvTm0Do3y5xxUJJzj1JFMZ3Jp-E0Go7ZtnXkww,6763
106
106
  canvas_sdk/commands/constants.py,sha256=0iuPRW1xC0O7i1KxxQbFhjbOA5VAnBkfyxELRJ3M86o,1652
107
107
  canvas_sdk/commands/commands/__init__.py,sha256=YYXr5tEQlnwMgTXJbOG963tKSPiUOM4mUkX8wuiqp7U,17
108
- canvas_sdk/commands/commands/adjust_prescription.py,sha256=LgA0x7YS6wK84kxI5r3ULSBSvxi4XFB6hdIMdfakPNQ,453
108
+ canvas_sdk/commands/commands/adjust_prescription.py,sha256=-q5P_70fZWHsByr_claO8S3IuhNKf1pkbiqYrDWzN30,635
109
109
  canvas_sdk/commands/commands/allergy.py,sha256=OCWd6sF8JxehpxUiBBVKqzGE8Ywcs70QUGwHmvwWBvk,922
110
110
  canvas_sdk/commands/commands/assess.py,sha256=njU34KMEMCbKTQDGNuEz2M_K08qd1bE9QCnMmHNNA-E,1417
111
111
  canvas_sdk/commands/commands/change_medication.py,sha256=MIRVnbk2wXk_E19b66ghR2dQNfnHJhzWDY30gh8DCmE,1779
@@ -126,7 +126,7 @@ canvas_sdk/commands/commands/medication_statement.py,sha256=1nH-N3sI1T_dLHXksGLH
126
126
  canvas_sdk/commands/commands/past_surgical_history.py,sha256=0mwybwfiAFE7elVXw1ichVitC3Jpl1JhPfNP89jhVhU,503
127
127
  canvas_sdk/commands/commands/perform.py,sha256=8o5q3snZ7TdkFFTsExZQWctXlpItSJfSihRQVZ3EEGo,409
128
128
  canvas_sdk/commands/commands/plan.py,sha256=2aJ9sUzP45sGw5ExHQToCkndidod5zwVx0a93LA1oRk,251
129
- canvas_sdk/commands/commands/prescribe.py,sha256=nuCIDABvFmDUXsUUQl7TvLX-owvO7j5GBd6Gg75Rmr8,8556
129
+ canvas_sdk/commands/commands/prescribe.py,sha256=IoESMNaY8l8ybPDRpuXmZfHTAme_Ll9qbwX85uXEkkI,8488
130
130
  canvas_sdk/commands/commands/reason_for_visit.py,sha256=eEUnlmRa6yNjJ-_6oIHx18s_DKZxkgY0sv7CkyxIbVY,1986
131
131
  canvas_sdk/commands/commands/refer.py,sha256=uZFYxBajCiMSABEEztRM-jYxhOa1W2dw--fgi68mIOs,1620
132
132
  canvas_sdk/commands/commands/refill.py,sha256=4uTgwIryz_ab4pUGN_wgrEHlDGv__9ecOXOTuLJM6n8,1228
@@ -223,9 +223,10 @@ canvas_sdk/questionnaires/utils.py,sha256=6RrGQbcc1uxG6-H5fCzS2mwQTYQdYiQlVVrtSb
223
223
  canvas_sdk/templates/__init__.py,sha256=LtUmLDsGSTq249T6sA7PUzkl2OfCAyvtIOGPNHr6wTo,83
224
224
  canvas_sdk/templates/utils.py,sha256=J-wDQ9ijOr_jz1SJxjpyZgR7JwXqtGMSS5IperLi2qE,1475
225
225
  canvas_sdk/test_utils/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
226
- canvas_sdk/test_utils/factories/__init__.py,sha256=Rg8C6um05bil4PuajoWyPGMecXKvMqe0uClgTBiaYSk,491
226
+ canvas_sdk/test_utils/factories/__init__.py,sha256=HJarvs_hgtqalgaabrcZVYGZpxwtXesCotjivzLX8Hg,781
227
227
  canvas_sdk/test_utils/factories/claim_diagnosis_code.py,sha256=3kqcgDRfZup8aly66EW-OX2hs3oJNqHkJY5aeeID0Po,557
228
228
  canvas_sdk/test_utils/factories/facility.py,sha256=9ZNBHCgPelD4oQynwez32I4Gx0kV1O78kgKvuiByyhg,697
229
+ canvas_sdk/test_utils/factories/medication_history.py,sha256=FgDwzRVA6leGzocHMV0S5nOK0F2waJMdnGLeEacOBRM,2312
229
230
  canvas_sdk/test_utils/factories/patient.py,sha256=zXy47K9C6cmQympOABHGUv-1hOqYIXNb7c4TziFO1RE,1594
230
231
  canvas_sdk/test_utils/factories/protocol_current.py,sha256=twq6GdTM29WYZ-AvfE3vkfV3dOMhZDmv_lNZC2eGe8g,1904
231
232
  canvas_sdk/test_utils/factories/user.py,sha256=QLxilvK22fHSsGFxe1j354VdMrdquO8nyWApdXXdS8Q,306
@@ -237,7 +238,7 @@ canvas_sdk/utils/plugins.py,sha256=OPq9OiE1v1AF24HSdEEOlSJxRVc2NVksK0Gpf6OH1NE,1
237
238
  canvas_sdk/v1/__init__.py,sha256=YYXr5tEQlnwMgTXJbOG963tKSPiUOM4mUkX8wuiqp7U,17
238
239
  canvas_sdk/v1/apps.py,sha256=4MwQfQu78oX5bUVlyxYzbt4rZODi0ZesXe_3QOsEWO8,170
239
240
  canvas_sdk/v1/models.py,sha256=LqeHZ-Hz3EWyM9vYr9uZ9rBYdMXNuuvJqbmojV8EcEM,224
240
- canvas_sdk/v1/data/__init__.py,sha256=asFixU1731QJTXQSgZn5WACoRGcHui0DFVvQRN4WypY,6106
241
+ canvas_sdk/v1/data/__init__.py,sha256=-466YxZaNQooCjD2shJhWpQsJ13O74wqVP1Ux2XIwyk,6430
241
242
  canvas_sdk/v1/data/allergy_intolerance.py,sha256=KXfU7UqTdRfHUFrP8yncQGMvlRPEt2K6TrC_y7JYgiE,2453
242
243
  canvas_sdk/v1/data/appointment.py,sha256=wRxRYWvGHP6zXFA-Hq3I08fwC56wHKb3zwpp5kqj4Yw,3227
243
244
  canvas_sdk/v1/data/assessment.py,sha256=vnVoaKWoJGCfaYn6WilxpI5cTgkvM647hFIuTyi_AgY,1663
@@ -252,7 +253,7 @@ canvas_sdk/v1/data/claim_diagnosis_code.py,sha256=JJIOAXeleCn1TthepA3PA5MTnf9pe_
252
253
  canvas_sdk/v1/data/claim_line_item.py,sha256=5WyTqlWSdQSDKyGWwRv5Dyn24_etyp8Zg_Q8aNgGL6o,5072
253
254
  canvas_sdk/v1/data/command.py,sha256=G7qtNypiTK274QQExKLbnij4gM71HZMs8f79VFYvIiY,1944
254
255
  canvas_sdk/v1/data/common.py,sha256=u5W3_7kXAGPe7guEBwRouKp8FMRCx9iZL6ei8QMmtwU,4880
255
- canvas_sdk/v1/data/compound_medication.py,sha256=a_m_hlRyZyF_c6FIIEUuX34hSslikd7RueLmjbRC12s,2239
256
+ canvas_sdk/v1/data/compound_medication.py,sha256=DXzAnpez0Yk_z9BbKmxQXe2dXHP9oQdfCvETyFGpwpo,2215
256
257
  canvas_sdk/v1/data/condition.py,sha256=u9Vgo8h5TYhof-GYPpezpP3YdN_lfCAw4jCN4QSqpfE,2376
257
258
  canvas_sdk/v1/data/coverage.py,sha256=i03BeVxNCsxXWnBL8klySFRXXN-T1hF01HyCvcCnlYk,11339
258
259
  canvas_sdk/v1/data/detected_issue.py,sha256=k-tOX6fpzfRf9WmG7neHPEeWrpZUdTiTEqYzKaa2haI,1865
@@ -268,6 +269,7 @@ canvas_sdk/v1/data/invoice.py,sha256=F5j_Hvu-YwqhHFkp6FDui8vx6GumCAgj14YgDvfyeYU
268
269
  canvas_sdk/v1/data/lab.py,sha256=8FPnApgcEfZ5f62387EgY6RZd8za2wps5LMzCB0_x6U,12969
269
270
  canvas_sdk/v1/data/line_item_transaction.py,sha256=OJA_3DLA1RF0v8jCgQ8SHaoqij_Z97Iatfi5i6CVEis,2406
270
271
  canvas_sdk/v1/data/medication.py,sha256=QMAUqqldJeQK9IuaoO5mWFp3IEjbqcqrxkzIgFZ4O0U,2333
272
+ canvas_sdk/v1/data/medication_history.py,sha256=VLoEdSUNMfviui3-uwo-ZK4Rf0gidBCc7I_oHjGJuE8,5886
271
273
  canvas_sdk/v1/data/medication_statement.py,sha256=lNzwQryRIAxt0m4sC7AHUpx7WXxyrsFPC-s4Si-to1E,1987
272
274
  canvas_sdk/v1/data/message.py,sha256=EKc2kkWGuzrgBH3sDUa9jiNpRP7J1ZdWE6BnPhY2gvs,2268
273
275
  canvas_sdk/v1/data/note.py,sha256=Eq0JgDRzwK84BAT6Y51f47Gke2rseC3vvcjoqhzAsVE,9335
@@ -317,7 +319,7 @@ canvas_sdk/views/__init__.py,sha256=YYXr5tEQlnwMgTXJbOG963tKSPiUOM4mUkX8wuiqp7U,
317
319
  logger/__init__.py,sha256=uMIOf1CDdKSmBKxKwO4CmDpvnJITci76IMXENOwSHEo,85
318
320
  logger/logger.py,sha256=l5W5jn3vGQt6TM7OxOpoMy-vC7RNNA2pGnQJJgHeXWA,2068
319
321
  plugin_runner/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
320
- plugin_runner/allowed-module-imports.json,sha256=txhTDIMO3kCz3HXO1tPboWMCfLD4VX8pY1QDqVOgwKk,38364
322
+ plugin_runner/allowed-module-imports.json,sha256=b64nOr1VaBbol6KMAI3Uhr5E54mPxicR7QJABoNN-4o,38709
321
323
  plugin_runner/authentication.py,sha256=UyyhXajokVFH866dpDhoTlXS9Cg7y0sQltn0_LcwXrY,1131
322
324
  plugin_runner/aws_headers.py,sha256=wZ8584E1fTW0CdGxOCnLSF8alH27z-URcUyoc6y6ohg,2782
323
325
  plugin_runner/exceptions.py,sha256=ltqn56SMTg-T5miSh5hux4ojwx0hZGSWaB7BxyAmcAo,545
@@ -325,7 +327,7 @@ plugin_runner/generate_allowed_imports.py,sha256=LQuVxL_j5n0Sj-KgR4Q8D9mj0xfuDqz
325
327
  plugin_runner/installation.py,sha256=2KTDWWsQ97WIN2k9tC4d50zN77WWK_1D5obXlhLfWw8,8536
326
328
  plugin_runner/load_all_plugins.py,sha256=4T2gW2YljhIx4xfwf1c0F_8oIbE1ubsLj0ShkHRtlVY,5847
327
329
  plugin_runner/plugin_runner.py,sha256=RpcZoXXzGEflJGuHJaAOCP24mWb4fG1bLw3ryA6n88k,26623
328
- plugin_runner/sandbox.py,sha256=A5iaxQePwA5FERK232MArq2VzZzHKM5ydrfTDFeXcLg,30232
330
+ plugin_runner/sandbox.py,sha256=DhYbDl6BOkSBciYuFTwIXhSrcnaWm2WxUXYEkrRaAhQ,30332
329
331
  protobufs/canvas_generated/messages/effects.proto,sha256=knnBn15oyJhNQ_diywrJ6NgwPsd1Q6TWuff2nQ8U7Og,10632
330
332
  protobufs/canvas_generated/messages/events.proto,sha256=KwjnaA8ekFwQTg54vWhbQuGF0_mLK9kFdtjuJ-K1cfo,52782
331
333
  protobufs/canvas_generated/messages/plugins.proto,sha256=xJyEeTwM6wWja3vGECLsIzfabwf1VahDgacoPL3TuwI,323
@@ -346,7 +348,7 @@ canvas_cli/templates/plugins/default/{{ cookiecutter.__project_slug }}/{{ cookie
346
348
  canvas_cli/templates/plugins/default/{{ cookiecutter.__project_slug }}/{{ cookiecutter.__package_name }}/README.md,sha256=3QKoJQq3YmdplGnDOBMsLCJ3Ya1_aKjoz-QiWc4QfjA,291
347
349
  canvas_cli/templates/plugins/default/{{ cookiecutter.__project_slug }}/{{ cookiecutter.__package_name }}/protocols/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
348
350
  canvas_cli/templates/plugins/default/{{ cookiecutter.__project_slug }}/{{ cookiecutter.__package_name }}/protocols/my_protocol.py,sha256=fKLLcOIwvSWenW8-7tr8VqnF4Iox_5wU9V-Qw9UySsA,2381
349
- canvas-0.64.0.dist-info/METADATA,sha256=FP2NAEIk_X8u7B7pJehu0FKQ2GQz2KhFvsdFslOohrI,4758
350
- canvas-0.64.0.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
351
- canvas-0.64.0.dist-info/entry_points.txt,sha256=0Vs_9GmTVUNniH6eDBlRPgofmADMV4BES6Ao26M4AbM,47
352
- canvas-0.64.0.dist-info/RECORD,,
351
+ canvas-0.66.0.dist-info/METADATA,sha256=6nPjQnFNheHNqqyAKykgcOYQjGvp1CsBYw9x8Y4EzWo,4758
352
+ canvas-0.66.0.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
353
+ canvas-0.66.0.dist-info/entry_points.txt,sha256=0Vs_9GmTVUNniH6eDBlRPgofmADMV4BES6Ao26M4AbM,47
354
+ canvas-0.66.0.dist-info/RECORD,,
@@ -13,5 +13,9 @@ class AdjustPrescriptionCommand(RefillCommand):
13
13
  default=None, json_schema_extra={"commands_api_name": "change_medication_to"}
14
14
  )
15
15
 
16
+ def _has_fdb_code(self) -> bool:
17
+ """Check if new_fdb_code is provided and non-empty."""
18
+ return self.new_fdb_code is not None and self.new_fdb_code.strip() != ""
19
+
16
20
 
17
21
  __exports__ = ("AdjustPrescriptionCommand",)
@@ -74,12 +74,16 @@ class PrescribeCommand(_SendableCommandMixin, _BaseCommand):
74
74
  default=None, json_schema_extra={"commands_api_name": "compound_medication_data"}
75
75
  )
76
76
 
77
+ def _has_fdb_code(self) -> bool:
78
+ """Check if fdb_code is provided and non-empty."""
79
+ return self.fdb_code is not None and self.fdb_code.strip() != ""
80
+
77
81
  def _get_error_details(self, method: str) -> list[InitErrorDetails]:
78
82
  """Add compound medication validation to the base validation."""
79
83
  errors = super()._get_error_details(method)
80
84
 
81
85
  # Validate that exactly one medication type is provided
82
- has_fdb_code = self.fdb_code is not None and self.fdb_code.strip() != ""
86
+ has_fdb_code = self._has_fdb_code()
83
87
  has_compound_medication_id = (
84
88
  self.compound_medication_id is not None and self.compound_medication_id.strip() != ""
85
89
  )
@@ -156,10 +160,8 @@ class PrescribeCommand(_SendableCommandMixin, _BaseCommand):
156
160
  str(Decimal(self.quantity_to_dispense)) if self.quantity_to_dispense else None
157
161
  )
158
162
 
159
- values["compound_medication_values"] = {}
160
-
161
163
  if self.is_dirty("compound_medication_id") and self.compound_medication_id:
162
- values["compound_medication_values"]["id"] = values.pop("compound_medication_id")
164
+ values["compound_medication_values"] = {"id": values.pop("compound_medication_id")}
163
165
 
164
166
  # Handle compound medication data
165
167
  elif (
@@ -170,9 +172,6 @@ class PrescribeCommand(_SendableCommandMixin, _BaseCommand):
170
172
  if isinstance(compound_data, CompoundMedicationData):
171
173
  values["compound_medication_values"] = compound_data.to_dict()
172
174
 
173
- if values.get("fdb_code") is not None and values.get("compound_medication_values") == {}:
174
- del values["compound_medication_values"]
175
-
176
175
  return values
177
176
 
178
177
  def originate(self, line_number: int = -1) -> Effect:
@@ -1,5 +1,10 @@
1
1
  from .claim_diagnosis_code import ClaimDiagnosisCodeFactory
2
2
  from .facility import FacilityFactory
3
+ from .medication_history import (
4
+ MedicationHistoryMedicationCodingFactory,
5
+ MedicationHistoryMedicationFactory,
6
+ MedicationHistoryResponseFactory,
7
+ )
3
8
  from .patient import PatientAddressFactory, PatientFacilityAddressFactory, PatientFactory
4
9
  from .protocol_current import ProtocolCurrentFactory
5
10
  from .user import CanvasUserFactory
@@ -8,6 +13,9 @@ __all__ = (
8
13
  "CanvasUserFactory",
9
14
  "ClaimDiagnosisCodeFactory",
10
15
  "FacilityFactory",
16
+ "MedicationHistoryMedicationFactory",
17
+ "MedicationHistoryMedicationCodingFactory",
18
+ "MedicationHistoryResponseFactory",
11
19
  "PatientAddressFactory",
12
20
  "PatientFacilityAddressFactory",
13
21
  "PatientFactory",
@@ -0,0 +1,75 @@
1
+ import datetime
2
+
3
+ import factory
4
+ from django.utils import timezone
5
+ from factory.fuzzy import FuzzyDate, FuzzyDateTime
6
+
7
+ from canvas_sdk.test_utils.factories.patient import PatientFactory
8
+ from canvas_sdk.v1.data.medication_history import (
9
+ MedicationHistoryMedication,
10
+ MedicationHistoryMedicationCoding,
11
+ MedicationHistoryResponse,
12
+ MedicationHistoryResponseStatus,
13
+ )
14
+
15
+
16
+ class MedicationHistoryMedicationFactory(
17
+ factory.django.DjangoModelFactory[MedicationHistoryMedication]
18
+ ):
19
+ """Factory for creating a MedicationHistoryMedication."""
20
+
21
+ class Meta:
22
+ model = MedicationHistoryMedication
23
+
24
+ patient = factory.SubFactory(PatientFactory)
25
+ last_fill_date = FuzzyDateTime(
26
+ start_dt=timezone.now() - datetime.timedelta(days=365), end_dt=timezone.now()
27
+ )
28
+
29
+ drug_description = factory.Faker("word")
30
+ strength_value = "10"
31
+ strength_form = "tablet"
32
+ strength_unit_of_measure = "mg"
33
+ quantity = 30.0
34
+ quantity_unit_of_measure = "tablets"
35
+ days_supply = 30
36
+ sig = factory.Faker("sentence", nb_words=4)
37
+
38
+
39
+ class MedicationHistoryMedicationCodingFactory(
40
+ factory.django.DjangoModelFactory[MedicationHistoryMedicationCoding]
41
+ ):
42
+ """Factory for creating a MedicationHistoryMedicationCoding."""
43
+
44
+ class Meta:
45
+ model = MedicationHistoryMedicationCoding
46
+
47
+ medication = factory.SubFactory(MedicationHistoryMedicationFactory)
48
+
49
+ system = "http://www.nlm.nih.gov/research/umls/rxnorm"
50
+ version = "1.0"
51
+ code = factory.Faker("numerify", text="######")
52
+ display = factory.Faker("word")
53
+ user_selected = False
54
+
55
+
56
+ class MedicationHistoryResponseFactory(
57
+ factory.django.DjangoModelFactory[MedicationHistoryResponse]
58
+ ):
59
+ """Factory for creating a MedicationHistoryResponse."""
60
+
61
+ class Meta:
62
+ model = MedicationHistoryResponse
63
+
64
+ patient = factory.SubFactory(PatientFactory)
65
+ status = MedicationHistoryResponseStatus.STATUS_APPROVED
66
+ start_date = FuzzyDate(
67
+ start_date=datetime.date.today() - datetime.timedelta(days=365),
68
+ end_date=datetime.date.today(),
69
+ )
70
+ end_date = FuzzyDate(
71
+ start_date=datetime.date.today(),
72
+ end_date=datetime.date.today() + datetime.timedelta(days=365),
73
+ )
74
+ message_id = factory.Faker("uuid4")
75
+ related_to_message_id = factory.Faker("uuid4")
@@ -45,6 +45,12 @@ from .line_item_transaction import (
45
45
  NewLineItemPayment,
46
46
  )
47
47
  from .medication import Medication, MedicationCoding
48
+ from .medication_history import (
49
+ MedicationHistoryMedication,
50
+ MedicationHistoryMedicationCoding,
51
+ MedicationHistoryResponse,
52
+ MedicationHistoryResponseStatus,
53
+ )
48
54
  from .medication_statement import MedicationStatement
49
55
  from .message import Message, MessageAttachment, MessageTransmission
50
56
  from .note import CurrentNoteStateEvent, Note, NoteStateChangeEvent, NoteType
@@ -164,6 +170,10 @@ __all__ = __exports__ = (
164
170
  "LineItemTransfer",
165
171
  "Medication",
166
172
  "MedicationCoding",
173
+ "MedicationHistoryMedication",
174
+ "MedicationHistoryMedicationCoding",
175
+ "MedicationHistoryResponseStatus",
176
+ "MedicationHistoryResponse",
167
177
  "MedicationStatement",
168
178
  "Message",
169
179
  "MessageAttachment",
@@ -6,7 +6,6 @@ class CompoundMedication(models.Model):
6
6
  """CompoundMedication."""
7
7
 
8
8
  class Meta:
9
- managed = False
10
9
  db_table = "canvas_sdk_data_api_compoundmedication_001"
11
10
 
12
11
  class PotencyUnits(TextChoices):
@@ -0,0 +1,152 @@
1
+ from django.contrib.postgres.fields import ArrayField
2
+ from django.db import models
3
+ from django.db.models import TextChoices
4
+
5
+ from canvas_sdk.v1.data.base import (
6
+ IdentifiableModel,
7
+ Model,
8
+ )
9
+
10
+
11
+ class MedicationHistoryMedication(IdentifiableModel):
12
+ """MedicationHistoryMedication."""
13
+
14
+ class Meta:
15
+ db_table = "canvas_sdk_data_api_medicationhistorymedication_001"
16
+
17
+ created = models.DateTimeField(auto_now_add=True)
18
+ modified = models.DateTimeField(auto_now=True)
19
+
20
+ patient = models.ForeignKey(
21
+ "v1.Patient",
22
+ on_delete=models.DO_NOTHING,
23
+ related_name="medication_history_medications",
24
+ null=True,
25
+ )
26
+
27
+ drug_description = models.TextField(blank=True, default="")
28
+
29
+ strength_value = models.CharField(max_length=255, blank=True, default="")
30
+ strength_form = models.CharField(max_length=255, blank=True, default="")
31
+ strength_unit_of_measure = models.CharField(max_length=255, blank=True, default="")
32
+
33
+ quantity = models.FloatField(null=True)
34
+ quantity_unit_of_measure = models.CharField(max_length=255, blank=True, default="")
35
+ quantity_code_list_qualifier = models.CharField(max_length=255, blank=True, default="")
36
+
37
+ days_supply = models.IntegerField(null=True)
38
+
39
+ last_fill_date = models.DateTimeField(db_index=True)
40
+ written_date = models.DateTimeField(blank=True, null=True)
41
+
42
+ other_date = models.DateTimeField(blank=True, null=True)
43
+ other_date_qualifier = models.CharField(max_length=255, blank=True, default="")
44
+
45
+ substitutions = models.BooleanField(null=True)
46
+
47
+ refills_remaining = models.IntegerField(null=True)
48
+
49
+ diagnosis_code = models.CharField(max_length=255, blank=True, default="")
50
+ diagnosis_qualifier = models.CharField(max_length=255, blank=True, default="")
51
+ diagnosis_description = models.CharField(max_length=255, blank=True, default="")
52
+
53
+ secondary_diagnosis_code = models.CharField(max_length=255, blank=True, default="")
54
+ secondary_diagnosis_qualifier = models.CharField(max_length=255, blank=True, default="")
55
+ secondary_diagnosis_description = models.CharField(max_length=255, blank=True, default="")
56
+
57
+ dea_schedule = models.CharField(max_length=255, blank=True, default="")
58
+
59
+ potency_unit_code = models.CharField(max_length=20, blank=True, default="")
60
+ etc_path_id = ArrayField(base_field=models.IntegerField(), null=True)
61
+ etc_path_name = ArrayField(base_field=models.CharField(max_length=255), null=True)
62
+
63
+ fill_number = models.IntegerField(blank=True, null=True)
64
+
65
+ prescriber_order_number = models.CharField(max_length=255, blank=True, default="")
66
+
67
+ source_description = models.CharField(max_length=255, blank=True, default="")
68
+ source_qualifier = models.CharField(max_length=255, blank=True, default="")
69
+ source_payer_id = models.CharField(max_length=255, blank=True, default="")
70
+ source_type = models.CharField(max_length=255, blank=True, default="")
71
+
72
+ note = models.TextField(blank=True, default="")
73
+ sig = models.TextField(blank=True, default="")
74
+
75
+ prior_authorization_status = models.CharField(max_length=255, blank=True, default="")
76
+ prior_authorization = models.CharField(max_length=255, blank=True, default="")
77
+
78
+ pharmacy_name = models.CharField(max_length=255, blank=True, default="")
79
+ pharmacy_ncpdp_id = models.CharField(max_length=255, blank=True, default="")
80
+ pharmacy_npi = models.CharField(max_length=255, blank=True, default="")
81
+
82
+ prescriber_business_name = models.CharField(max_length=255, blank=True, default="")
83
+ prescriber_first_name = models.CharField(max_length=255, blank=True, default="")
84
+ prescriber_last_name = models.CharField(max_length=255, blank=True, default="")
85
+ prescriber_npi = models.CharField(max_length=255, blank=True, default="")
86
+ prescriber_dea_number = models.CharField(max_length=255, blank=True, default="")
87
+
88
+
89
+ class MedicationHistoryMedicationCoding(Model):
90
+ """MedicationHistoryMedicationCoding."""
91
+
92
+ class Meta:
93
+ db_table = "canvas_sdk_data_api_medicationhistorymedicationcoding_001"
94
+
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
+ medication = models.ForeignKey(
101
+ MedicationHistoryMedication, on_delete=models.CASCADE, related_name="codings"
102
+ )
103
+
104
+
105
+ class MedicationHistoryResponseStatus(TextChoices):
106
+ """MedicationHistoryResponseStatus."""
107
+
108
+ STATUS_APPROVED = "approved"
109
+ STATUS_DENIED = "denied"
110
+
111
+
112
+ class MedicationHistoryResponse(IdentifiableModel):
113
+ """MedicationHistoryResponse."""
114
+
115
+ class Meta:
116
+ db_table = "canvas_sdk_data_api_medicationhistoryresponse_001"
117
+
118
+ created = models.DateTimeField(auto_now_add=True)
119
+ modified = models.DateTimeField(auto_now=True)
120
+
121
+ patient = models.ForeignKey(
122
+ "v1.Patient",
123
+ on_delete=models.CASCADE,
124
+ related_name="medication_history_responses",
125
+ )
126
+ staff = models.ForeignKey(
127
+ "v1.Staff",
128
+ on_delete=models.CASCADE,
129
+ related_name="medication_history_responses",
130
+ null=True,
131
+ )
132
+
133
+ message_id = models.CharField(max_length=35, blank=True, default="", db_index=True)
134
+ related_to_message_id = models.CharField(max_length=35, blank=True, default="", db_index=True)
135
+
136
+ status = models.CharField(choices=MedicationHistoryResponseStatus.choices, max_length=20)
137
+
138
+ reason = models.TextField(blank=True, default="")
139
+ reason_code = models.CharField(max_length=2, blank=True, default="")
140
+
141
+ note = models.TextField(blank=True, default="")
142
+
143
+ start_date = models.DateField()
144
+ end_date = models.DateField()
145
+
146
+
147
+ __exports__ = (
148
+ "MedicationHistoryMedication",
149
+ "MedicationHistoryMedicationCoding",
150
+ "MedicationHistoryResponseStatus",
151
+ "MedicationHistoryResponse",
152
+ )
@@ -602,6 +602,10 @@
602
602
  "LineItemTransfer",
603
603
  "Medication",
604
604
  "MedicationCoding",
605
+ "MedicationHistoryMedication",
606
+ "MedicationHistoryMedicationCoding",
607
+ "MedicationHistoryResponse",
608
+ "MedicationHistoryResponseStatus",
605
609
  "MedicationStatement",
606
610
  "Message",
607
611
  "MessageAttachment",
@@ -822,6 +826,12 @@
822
826
  "MedicationCoding",
823
827
  "Status"
824
828
  ],
829
+ "canvas_sdk.v1.data.medication_history": [
830
+ "MedicationHistoryMedication",
831
+ "MedicationHistoryMedicationCoding",
832
+ "MedicationHistoryResponse",
833
+ "MedicationHistoryResponseStatus"
834
+ ],
825
835
  "canvas_sdk.v1.data.medication_statement": [
826
836
  "MedicationStatement"
827
837
  ],
plugin_runner/sandbox.py CHANGED
@@ -168,6 +168,7 @@ STANDARD_LIBRARY_MODULES = {
168
168
  "Tuple",
169
169
  "Type",
170
170
  "TypedDict",
171
+ "TypeGuard",
171
172
  "Union",
172
173
  },
173
174
  "urllib": {
@@ -210,6 +211,10 @@ THIRD_PARTY_MODULES = {
210
211
  "Value",
211
212
  "When",
212
213
  },
214
+ "django.db.models.functions": {
215
+ "Coalesce",
216
+ "Trim",
217
+ },
213
218
  "django.db.models.query": {
214
219
  "QuerySet",
215
220
  },