Skip to content

Commit b2db442

Browse files
formatting
1 parent 32eed4a commit b2db442

5 files changed

Lines changed: 19 additions & 15 deletions

File tree

backend/compact-connect/lambdas/python/common/cc_common/data_model/data_client.py

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2641,13 +2641,14 @@ def encumber_home_jurisdiction_license_privileges(
26412641
adverse_action = provider_user_records.get_adverse_action_by_id(adverse_action_id)
26422642

26432643
if not adverse_action:
2644-
logger.error("Adverse Action not found by id",
2645-
provider_id=provider_id,
2646-
encumbered_license_jurisdiction=jurisdiction,
2647-
encumbered_license_type=license_type_abbreviation,
2648-
adverse_action_id=adverse_action_id)
2649-
raise CCInternalException("Adverse Action not found by id")
2650-
2644+
logger.error(
2645+
'Adverse Action not found by id',
2646+
provider_id=provider_id,
2647+
encumbered_license_jurisdiction=jurisdiction,
2648+
encumbered_license_type=license_type_abbreviation,
2649+
adverse_action_id=adverse_action_id,
2650+
)
2651+
raise CCInternalException('Adverse Action not found by id')
26512652

26522653
# Find privileges associated with the license that which was encumbered, which themselves are not currently
26532654
# encumbered

backend/compact-connect/lambdas/python/common/cc_common/data_model/schema/adverse_action/record.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,8 @@ class AdverseActionRecordSchema(BaseRecordSchema):
4949
# TODO - remove this hook once migration is complete to the new field # noqa: FIX002
5050
@pre_load
5151
def migrate_clinical_privilege_action_category_on_load(self, in_data, **_kwargs):
52-
"""Migrate deprecated clinicalPrivilegeActionCategory to clinicalPrivilegeActionCategories list when loading from database."""
52+
"""Migrate deprecated clinicalPrivilegeActionCategory to clinicalPrivilegeActionCategories list
53+
when loading from database."""
5354
# If the deprecated field exists and the new field doesn't, migrate it
5455
if 'clinicalPrivilegeActionCategory' in in_data and 'clinicalPrivilegeActionCategories' not in in_data:
5556
in_data['clinicalPrivilegeActionCategories'] = [in_data['clinicalPrivilegeActionCategory']]

backend/compact-connect/lambdas/python/common/cc_common/data_model/schema/privilege/record.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -56,25 +56,27 @@ class EncumbranceDetailsSchema(Schema):
5656
"""
5757
Schema for tracking details about an encumbrance.
5858
"""
59+
5960
clinicalPrivilegeActionCategories = List(ClinicalPrivilegeActionCategoryField(), required=False, allow_none=False)
6061
adverseActionId = UUID(required=True, allow_none=False)
6162
# present if update is created by upstream license encumbrance
6263
licenseJurisdiction = Jurisdiction(required=False, allow_none=False)
6364
# TODO - remove this field as part of https://github.com/csg-org/CompactConnect/issues/1136 # noqa: FIX002
6465
clinicalPrivilegeActionCategory = ClinicalPrivilegeActionCategoryField(required=False, allow_none=False)
6566

66-
6767
# TODO - remove these hooks as part of https://github.com/csg-org/CompactConnect/issues/1136 # noqa: FIX002
6868
@pre_load
6969
def migrate_clinical_privilege_action_category_on_load(self, in_data, **_kwargs):
70-
"""Migrate deprecated clinicalPrivilegeActionCategory to clinicalPrivilegeActionCategories list when loading from database."""
70+
"""Migrate deprecated clinicalPrivilegeActionCategory to clinicalPrivilegeActionCategories list
71+
when loading from database."""
7172
if 'clinicalPrivilegeActionCategory' in in_data and 'clinicalPrivilegeActionCategories' not in in_data:
7273
in_data['clinicalPrivilegeActionCategories'] = [in_data['clinicalPrivilegeActionCategory']]
7374
return in_data
7475

7576
@pre_dump
7677
def migrate_clinical_privilege_action_category_on_dump(self, in_data, **_kwargs):
77-
"""Migrate deprecated clinicalPrivilegeActionCategory to clinicalPrivilegeActionCategories list when dumping to database."""
78+
"""Migrate deprecated clinicalPrivilegeActionCategory to clinicalPrivilegeActionCategories list
79+
when dumping to database."""
7880
if 'clinicalPrivilegeActionCategory' in in_data and 'clinicalPrivilegeActionCategories' not in in_data:
7981
in_data['clinicalPrivilegeActionCategories'] = [in_data['clinicalPrivilegeActionCategory']]
8082
return in_data

backend/compact-connect/lambdas/python/provider-data-v1/handlers/encumbrance.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -105,8 +105,8 @@ def _generate_adverse_action_for_record_type(
105105
if 'clinicalPrivilegeActionCategory' in adverse_action_request:
106106
# replicate data to both the deprecated and new fields
107107
adverse_action.clinicalPrivilegeActionCategory = ClinicalPrivilegeActionCategory(
108-
adverse_action_request['clinicalPrivilegeActionCategory']
109-
)
108+
adverse_action_request['clinicalPrivilegeActionCategory']
109+
)
110110
adverse_action.clinicalPrivilegeActionCategories = [
111111
ClinicalPrivilegeActionCategory(adverse_action_request['clinicalPrivilegeActionCategory'])
112112
]

backend/compact-connect/lambdas/python/provider-data-v1/tests/function/test_handlers/test_encumbrance.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -333,7 +333,7 @@ def test_privilege_encumbrance_handler_migrates_clinical_privilege_action_catego
333333
# Load the adverse action record from the database
334334
loaded_adverse_action = AdverseActionData.from_database_record(item)
335335

336-
# TODO - remove this assertion as part of https://github.com/csg-org/CompactConnect/issues/1136
336+
# TODO - remove this assertion as part of https://github.com/csg-org/CompactConnect/issues/1136 # noqa: FIX002
337337
# Verify that the deprecated field is not present in the stored data
338338
self.assertIn('clinicalPrivilegeActionCategory', item)
339339
self.assertEqual('Unsafe Practice or Substandard Care', loaded_adverse_action.clinicalPrivilegeActionCategory)
@@ -615,7 +615,7 @@ def test_license_encumbrance_handler_migrates_clinical_privilege_action_category
615615
# Load the adverse action record from the database
616616
loaded_adverse_action = AdverseActionData.from_database_record(item)
617617

618-
# TODO - remove this assertion as part of https://github.com/csg-org/CompactConnect/issues/1136
618+
# TODO - remove this assertion as part of https://github.com/csg-org/CompactConnect/issues/1136 # noqa: FIX002
619619
# Verify that the deprecated field is not present in the stored data
620620
self.assertIn('clinicalPrivilegeActionCategory', item)
621621
self.assertEqual('Unsafe Practice or Substandard Care', loaded_adverse_action.clinicalPrivilegeActionCategory)

0 commit comments

Comments
 (0)