canvas 0.7.1__py3-none-any.whl → 0.8.1__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 (58) hide show
  1. {canvas-0.7.1.dist-info → canvas-0.8.1.dist-info}/METADATA +2 -2
  2. {canvas-0.7.1.dist-info → canvas-0.8.1.dist-info}/RECORD +58 -58
  3. canvas_cli/apps/auth/tests.py +10 -0
  4. canvas_cli/apps/emit/emit.py +0 -1
  5. canvas_cli/apps/logs/logs.py +4 -4
  6. canvas_cli/apps/plugin/plugin.py +55 -43
  7. canvas_cli/apps/plugin/tests.py +4 -2
  8. canvas_cli/conftest.py +1 -0
  9. canvas_cli/main.py +1 -2
  10. canvas_cli/templates/plugins/default/{{ cookiecutter.__project_slug }}/protocols/my_protocol.py +1 -2
  11. canvas_cli/tests.py +36 -26
  12. canvas_cli/utils/context/context.py +4 -2
  13. canvas_cli/utils/context/tests.py +1 -1
  14. canvas_cli/utils/print/tests.py +2 -2
  15. canvas_cli/utils/validators/tests.py +2 -1
  16. canvas_generated/messages/events_pb2.py +2 -2
  17. canvas_generated/messages/events_pb2.pyi +68 -0
  18. canvas_sdk/base.py +1 -1
  19. canvas_sdk/commands/base.py +4 -6
  20. canvas_sdk/commands/commands/prescribe.py +3 -3
  21. canvas_sdk/commands/commands/reason_for_visit.py +1 -1
  22. canvas_sdk/commands/commands/task.py +3 -2
  23. canvas_sdk/commands/commands/vitals.py +0 -1
  24. canvas_sdk/commands/constants.py +3 -1
  25. canvas_sdk/commands/tests/protocol/tests.py +6 -1
  26. canvas_sdk/commands/tests/schema/tests.py +5 -1
  27. canvas_sdk/commands/tests/test_utils.py +27 -12
  28. canvas_sdk/commands/tests/unit/tests.py +3 -0
  29. canvas_sdk/effects/__init__.py +2 -0
  30. canvas_sdk/effects/banner_alert/__init__.py +2 -0
  31. canvas_sdk/effects/banner_alert/tests.py +22 -14
  32. canvas_sdk/effects/protocol_card/__init__.py +2 -0
  33. canvas_sdk/effects/protocol_card/tests.py +10 -6
  34. canvas_sdk/events/__init__.py +2 -0
  35. canvas_sdk/handlers/__init__.py +2 -0
  36. canvas_sdk/protocols/__init__.py +2 -0
  37. canvas_sdk/protocols/base.py +0 -2
  38. canvas_sdk/protocols/clinical_quality_measure.py +2 -1
  39. canvas_sdk/utils/http.py +2 -1
  40. canvas_sdk/utils/tests.py +4 -0
  41. canvas_sdk/v1/data/__init__.py +13 -0
  42. canvas_sdk/v1/data/allergy_intolerance.py +0 -1
  43. canvas_sdk/v1/data/base.py +5 -5
  44. canvas_sdk/v1/data/billing.py +2 -2
  45. canvas_sdk/v1/data/common.py +0 -1
  46. canvas_sdk/v1/data/patient.py +1 -1
  47. canvas_sdk/v1/data/questionnaire.py +2 -1
  48. canvas_sdk/value_set/custom.py +0 -10
  49. canvas_sdk/value_set/tests/test_value_sets.py +4 -0
  50. canvas_sdk/value_set/v2022/individual_characteristic.py +12 -6
  51. canvas_sdk/value_set/v2022/procedure.py +4 -2
  52. canvas_sdk/value_set/value_set.py +1 -1
  53. plugin_runner/plugin_runner.py +4 -3
  54. plugin_runner/sandbox.py +6 -8
  55. plugin_runner/tests/test_plugin_runner.py +1 -2
  56. settings.py +3 -1
  57. {canvas-0.7.1.dist-info → canvas-0.8.1.dist-info}/WHEEL +0 -0
  58. {canvas-0.7.1.dist-info → canvas-0.8.1.dist-info}/entry_points.txt +0 -0
@@ -2,7 +2,8 @@ from ..value_set import ValueSet
2
2
 
3
3
 
4
4
  class Ethnicity(ValueSet):
5
- """
5
+ """Ethnicity value set.
6
+
6
7
  **Clinical Focus:**
7
8
 
8
9
  **Data Element Scope:**
@@ -26,7 +27,8 @@ class Ethnicity(ValueSet):
26
27
 
27
28
 
28
29
  class OncAdministrativeSex(ValueSet):
29
- """
30
+ """ONC Administrative Sex value set.
31
+
30
32
  **Clinical Focus:** Gender identity restricted to only Male and Female used in administrative situations requiring a restriction to these two categories.
31
33
 
32
34
  **Data Element Scope:** Gender
@@ -50,7 +52,8 @@ class OncAdministrativeSex(ValueSet):
50
52
 
51
53
 
52
54
  class Payer(ValueSet):
53
- """
55
+ """Payer value set.
56
+
54
57
  **Clinical Focus:** Categories of types of health care payor entities as defined by the US Public Health Data Consortium SOP code system
55
58
 
56
59
  **Data Element Scope:** @code in CCDA r2.1 template Planned Coverage [act: identifier urn:oid:2.16.840.1.113883.10.20.22.4.129 (open)] DYNAMIC
@@ -234,7 +237,8 @@ class Payer(ValueSet):
234
237
 
235
238
 
236
239
  class Race(ValueSet):
237
- """
240
+ """Race value set.
241
+
238
242
  **Clinical Focus:**
239
243
 
240
244
  **Data Element Scope:**
@@ -262,7 +266,8 @@ class Race(ValueSet):
262
266
 
263
267
 
264
268
  class Female(ValueSet):
265
- """
269
+ """Female Gender value set.
270
+
266
271
  **Clinical Focus:** Concepts that represent Female when assessing quality measures
267
272
 
268
273
  **Data Element Scope:** Gender
@@ -285,7 +290,8 @@ class Female(ValueSet):
285
290
 
286
291
 
287
292
  class White(ValueSet):
288
- """
293
+ """White Race value set.
294
+
289
295
  **Clinical Focus:** The purpose of this value set is to represent concepts for the patient characteristic of white race.
290
296
 
291
297
  **Data Element Scope:** This value set may use a model element related to Race.
@@ -1563,7 +1563,8 @@ class PeritonealDialysis(ValueSet):
1563
1563
 
1564
1564
 
1565
1565
  class ProceduresUsedToIndicateSexualActivity(ValueSet):
1566
- """
1566
+ """Procedures Used to Indicate Sexual Activity Value Set.
1567
+
1567
1568
  **Clinical Focus:** The purpose of this value set is to represent procedures indicating history of sexual activity
1568
1569
 
1569
1570
  **Data Element Scope:** This value set may use a model element related to Procedure.
@@ -2514,7 +2515,8 @@ class CabgSurgeries(ValueSet):
2514
2515
 
2515
2516
 
2516
2517
  class Cabg_PciProcedure(ValueSet):
2517
- """
2518
+ """CABG, PCI Procedure Value Set.
2519
+
2518
2520
  **Clinical Focus:** CABG and PCI procedures
2519
2521
 
2520
2522
  **Data Element Scope:** CABG and PCI procedures
@@ -107,6 +107,6 @@ class ValueSet(CodeConstantsURLMappingMixin, metaclass=ValueSystems):
107
107
  """A property that returns a dictionary of code systems and their associated values."""
108
108
  return {
109
109
  system: getattr(cls, system)
110
- for system in cls.CODE_SYSTEM_MAPPING.keys()
110
+ for system in cls.CODE_SYSTEM_MAPPING
111
111
  if hasattr(cls, system)
112
112
  }
@@ -8,8 +8,9 @@ import sys
8
8
  import time
9
9
  import traceback
10
10
  from collections import defaultdict
11
+ from collections.abc import AsyncGenerator
11
12
  from types import FrameType
12
- from typing import Any, AsyncGenerator, Optional, TypedDict
13
+ from typing import Any, TypedDict
13
14
 
14
15
  import grpc
15
16
  import statsd
@@ -181,7 +182,7 @@ class PluginRunner(PluginRunnerServicer):
181
182
  yield ReloadPluginsResponse(success=True)
182
183
 
183
184
 
184
- def handle_hup_cb(_signum: int, _frame: Optional[FrameType]) -> None:
185
+ def handle_hup_cb(_signum: int, _frame: FrameType | None) -> None:
185
186
  """handle_hup_cb."""
186
187
  log.info("Received SIGHUP, reloading plugins...")
187
188
  load_plugins()
@@ -191,7 +192,7 @@ def find_modules(base_path: pathlib.Path, prefix: str | None = None) -> list[str
191
192
  """Find all modules in the specified package path."""
192
193
  modules: list[str] = []
193
194
 
194
- for file_finder, module_name, is_pkg in pkgutil.iter_modules(
195
+ for _, module_name, is_pkg in pkgutil.iter_modules(
195
196
  [base_path.as_posix()],
196
197
  ):
197
198
  if is_pkg:
plugin_runner/sandbox.py CHANGED
@@ -141,13 +141,12 @@ class Sandbox:
141
141
  ):
142
142
  self.warn(
143
143
  node,
144
- '"{name}" is an invalid variable name because it '
145
- 'starts with "_"'.format(name=name),
144
+ f'"{name}" is an invalid variable name because it ' 'starts with "_"',
146
145
  )
147
146
  elif name.endswith("__roles__"):
148
147
  self.error(
149
148
  node,
150
- '"%s" is an invalid variable name because ' 'it ends with "__roles__".' % name,
149
+ f'"{name}" is an invalid variable name because ' 'it ends with "__roles__".',
151
150
  )
152
151
  elif name in FORBIDDEN_FUNC_NAMES:
153
152
  self.error(node, f'"{name}" is a reserved name.')
@@ -166,15 +165,14 @@ class Sandbox:
166
165
  if node.attr.startswith("_") and node.attr != "_":
167
166
  self.warn(
168
167
  node,
169
- '"{name}" is an invalid attribute name because it starts '
170
- 'with "_".'.format(name=node.attr),
168
+ f'"{node.attr}" is an invalid attribute name because it starts ' 'with "_".',
171
169
  )
172
170
 
173
171
  if node.attr.endswith("__roles__"):
174
172
  self.error(
175
173
  node,
176
- '"{name}" is an invalid attribute name because it ends '
177
- 'with "__roles__".'.format(name=node.attr),
174
+ f'"{node.attr}" is an invalid attribute name because it ends '
175
+ 'with "__roles__".',
178
176
  )
179
177
 
180
178
  if isinstance(node.ctx, ast.Load):
@@ -188,7 +186,7 @@ class Sandbox:
188
186
  copy_locations(new_node, node)
189
187
  return new_node
190
188
 
191
- elif isinstance(node.ctx, (ast.Store, ast.Del)):
189
+ elif isinstance(node.ctx, ast.Store | ast.Del):
192
190
  node = self.node_contents_visit(node)
193
191
  new_value = ast.Call(
194
192
  func=ast.Name("_write_", ast.Load()), args=[node.value], keywords=[]
@@ -1,6 +1,6 @@
1
1
  import shutil
2
+ from collections.abc import Generator
2
3
  from pathlib import Path
3
- from typing import Generator
4
4
  from unittest.mock import MagicMock, patch
5
5
 
6
6
  import pytest
@@ -179,7 +179,6 @@ async def test_reload_plugins_event_handler_successfully_loads_plugins(
179
179
  setup_test_plugin: Path, plugin_runner: PluginRunner
180
180
  ) -> None:
181
181
  """Test ReloadPlugins Event handler successfully loads plugins."""
182
-
183
182
  with patch("plugin_runner.plugin_runner.publish_message", MagicMock()) as mock_publish_message:
184
183
  request = ReloadPluginsRequest()
185
184
 
settings.py CHANGED
@@ -57,7 +57,9 @@ PLUGIN_DIRECTORY = os.getenv(
57
57
  (
58
58
  "/plugin-runner/custom-plugins"
59
59
  if IS_PRODUCTION
60
- else "./plugin_runner/tests/data/plugins" if IS_TESTING else "./custom-plugins"
60
+ else "./plugin_runner/tests/data/plugins"
61
+ if IS_TESTING
62
+ else "./custom-plugins"
61
63
  ),
62
64
  )
63
65
 
File without changes