healthdatalayer 1.6.6__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.
Files changed (105) hide show
  1. healthdatalayer/__init__.py +0 -0
  2. healthdatalayer/config/__init__.py +0 -0
  3. healthdatalayer/config/config.py +24 -0
  4. healthdatalayer/config/db.py +12 -0
  5. healthdatalayer/config/vault.py +20 -0
  6. healthdatalayer/dtos/__init__.py +2 -0
  7. healthdatalayer/dtos/collaborator/__init__.py +0 -0
  8. healthdatalayer/dtos/collaborator/schedule_collaborator.py +13 -0
  9. healthdatalayer/dtos/medical_visit/__init__.py +0 -0
  10. healthdatalayer/dtos/medical_visit/medical_certificate.py +62 -0
  11. healthdatalayer/models/__init__.py +75 -0
  12. healthdatalayer/models/bridge_area_floor_branch/__init__.py +0 -0
  13. healthdatalayer/models/bridge_area_floor_branch/area.py +8 -0
  14. healthdatalayer/models/bridge_area_floor_branch/branch.py +16 -0
  15. healthdatalayer/models/bridge_area_floor_branch/bridge_area_floor_branch.py +27 -0
  16. healthdatalayer/models/bridge_area_floor_branch/floor.py +8 -0
  17. healthdatalayer/models/bridge_area_floor_branch/room.py +8 -0
  18. healthdatalayer/models/bridge_area_floor_branch/system.py +8 -0
  19. healthdatalayer/models/client/__init__.py +0 -0
  20. healthdatalayer/models/client/address.py +13 -0
  21. healthdatalayer/models/client/city.py +11 -0
  22. healthdatalayer/models/client/client.py +25 -0
  23. healthdatalayer/models/client/client_type.py +9 -0
  24. healthdatalayer/models/client/education.py +9 -0
  25. healthdatalayer/models/client/emergency_contact.py +17 -0
  26. healthdatalayer/models/client/gender.py +9 -0
  27. healthdatalayer/models/client/marriage_status.py +9 -0
  28. healthdatalayer/models/client/nationality.py +10 -0
  29. healthdatalayer/models/client/pathological_history.py +29 -0
  30. healthdatalayer/models/client/pet.py +16 -0
  31. healthdatalayer/models/client/profession.py +9 -0
  32. healthdatalayer/models/client/px.py +35 -0
  33. healthdatalayer/models/client/state.py +9 -0
  34. healthdatalayer/models/collaborator/__init__.py +0 -0
  35. healthdatalayer/models/collaborator/collaborator.py +33 -0
  36. healthdatalayer/models/collaborator/collaborator_speciality.py +8 -0
  37. healthdatalayer/models/collaborator/collaborator_type.py +9 -0
  38. healthdatalayer/models/collaborator/speciality.py +23 -0
  39. healthdatalayer/models/lab/__init__.py +0 -0
  40. healthdatalayer/models/lab/client_lab.py +13 -0
  41. healthdatalayer/models/lab/measure_lab.py +11 -0
  42. healthdatalayer/models/lab/medical_lab.py +17 -0
  43. healthdatalayer/models/medical_visit/__init__.py +0 -0
  44. healthdatalayer/models/medical_visit/medical_diagnosis.py +12 -0
  45. healthdatalayer/models/medical_visit/medical_diagnosis_visit.py +25 -0
  46. healthdatalayer/models/medical_visit/medical_drug.py +27 -0
  47. healthdatalayer/models/medical_visit/medical_drug_recipe.py +19 -0
  48. healthdatalayer/models/medical_visit/medical_recipe_visit.py +28 -0
  49. healthdatalayer/models/medical_visit/medical_visit.py +53 -0
  50. healthdatalayer/models/medical_visit/organ_system_review.py +28 -0
  51. healthdatalayer/models/medical_visit/physical_exam.py +45 -0
  52. healthdatalayer/models/medical_visit/status_visit_enum.py +8 -0
  53. healthdatalayer/models/medical_visit/visit_triage.py +28 -0
  54. healthdatalayer/models/user/__init__.py +0 -0
  55. healthdatalayer/models/user/permission.py +27 -0
  56. healthdatalayer/models/user/permission_user.py +8 -0
  57. healthdatalayer/models/user/role.py +27 -0
  58. healthdatalayer/models/user/role_permission.py +8 -0
  59. healthdatalayer/models/user/role_user.py +8 -0
  60. healthdatalayer/models/user/user.py +30 -0
  61. healthdatalayer/repositories/__init__.py +40 -0
  62. healthdatalayer/repositories/client_repositories/__init__.py +0 -0
  63. healthdatalayer/repositories/client_repositories/address_repository.py +94 -0
  64. healthdatalayer/repositories/client_repositories/client_type_repository.py +69 -0
  65. healthdatalayer/repositories/client_repositories/education_repository.py +70 -0
  66. healthdatalayer/repositories/client_repositories/emergency_contact_repository.py +78 -0
  67. healthdatalayer/repositories/client_repositories/gender_repository.py +70 -0
  68. healthdatalayer/repositories/client_repositories/marriage_status_repository.py +70 -0
  69. healthdatalayer/repositories/client_repositories/nationality_repository.py +69 -0
  70. healthdatalayer/repositories/client_repositories/pathological_history_repository.py +73 -0
  71. healthdatalayer/repositories/client_repositories/pet_repository.py +126 -0
  72. healthdatalayer/repositories/client_repositories/profession_repository.py +70 -0
  73. healthdatalayer/repositories/client_repositories/px_repository.py +239 -0
  74. healthdatalayer/repositories/collaborator_repositories/__init__.py +0 -0
  75. healthdatalayer/repositories/collaborator_repositories/collaborator_repository.py +197 -0
  76. healthdatalayer/repositories/collaborator_repositories/collaborator_type_repository.py +69 -0
  77. healthdatalayer/repositories/collaborator_repositories/speciality_repository.py +75 -0
  78. healthdatalayer/repositories/infraestructure_repositories/__init__.py +0 -0
  79. healthdatalayer/repositories/infraestructure_repositories/area_repository.py +69 -0
  80. healthdatalayer/repositories/infraestructure_repositories/branch_repository.py +69 -0
  81. healthdatalayer/repositories/infraestructure_repositories/bridge_repository.py +82 -0
  82. healthdatalayer/repositories/infraestructure_repositories/floor_repository.py +69 -0
  83. healthdatalayer/repositories/infraestructure_repositories/room_repository.py +69 -0
  84. healthdatalayer/repositories/infraestructure_repositories/system_repository.py +69 -0
  85. healthdatalayer/repositories/lab_repositories/__init__.py +0 -0
  86. healthdatalayer/repositories/lab_repositories/measure_lab_repository.py +80 -0
  87. healthdatalayer/repositories/lab_repositories/medical_lab_repository.py +254 -0
  88. healthdatalayer/repositories/medical_visit_repositories/__init__.py +0 -0
  89. healthdatalayer/repositories/medical_visit_repositories/medical_diagnosis_repository.py +98 -0
  90. healthdatalayer/repositories/medical_visit_repositories/medical_diagnosis_visit_repository.py +109 -0
  91. healthdatalayer/repositories/medical_visit_repositories/medical_drug_recipe_repository.py +71 -0
  92. healthdatalayer/repositories/medical_visit_repositories/medical_drug_repository.py +78 -0
  93. healthdatalayer/repositories/medical_visit_repositories/medical_recipe_visit_repository.py +93 -0
  94. healthdatalayer/repositories/medical_visit_repositories/medical_visit_repository.py +509 -0
  95. healthdatalayer/repositories/medical_visit_repositories/organ_system_review_repository.py +89 -0
  96. healthdatalayer/repositories/medical_visit_repositories/physical_exam_repository.py +89 -0
  97. healthdatalayer/repositories/medical_visit_repositories/visit_triage_repository.py +95 -0
  98. healthdatalayer/repositories/user_repositories/__init__.py +0 -0
  99. healthdatalayer/repositories/user_repositories/permission_repository.py +238 -0
  100. healthdatalayer/repositories/user_repositories/role_repository.py +174 -0
  101. healthdatalayer/repositories/user_repositories/user_repository.py +251 -0
  102. healthdatalayer-1.6.6.dist-info/METADATA +30 -0
  103. healthdatalayer-1.6.6.dist-info/RECORD +105 -0
  104. healthdatalayer-1.6.6.dist-info/WHEEL +5 -0
  105. healthdatalayer-1.6.6.dist-info/top_level.txt +1 -0
@@ -0,0 +1,69 @@
1
+ from typing import Optional, List
2
+ from uuid import UUID
3
+ from sqlmodel import select
4
+
5
+ from healthdatalayer.models import Branch
6
+ from healthdatalayer.config.db import engines, get_session
7
+
8
+ class BranchRepository:
9
+ def __init__(self, tenant: str):
10
+ self.tenant = tenant
11
+ if tenant not in engines:
12
+ raise ValueError(f"Tenant {tenant} is not configured")
13
+
14
+ def create_command(self, branch: Branch) -> Branch:
15
+ with get_session(self.tenant) as session:
16
+ session.add(branch)
17
+ session.commit()
18
+ session.refresh(branch)
19
+ return branch
20
+
21
+ def get_by_id_command(self, branch_id: UUID) -> Optional[Branch]:
22
+ with get_session(self.tenant) as session:
23
+ return session.get(Branch, branch_id)
24
+
25
+ def get_by_name_command(self, name: str) -> Optional[Branch]:
26
+ with get_session(self.tenant) as session:
27
+ statement = select(Branch).where(Branch.name == name)
28
+ result = session.exec(statement).first()
29
+ return result
30
+
31
+ def list_all_command(self, active_only: bool = True) -> List[Branch]:
32
+ with get_session(self.tenant) as session:
33
+ statement = select(Branch)
34
+
35
+ if active_only:
36
+ statement = statement.where(Branch.is_active == True)
37
+
38
+ results = session.exec(statement)
39
+ return results.all()
40
+
41
+ def update_command(self, branch_id: UUID, **kwargs) -> Optional[Branch]:
42
+ with get_session(self.tenant) as session:
43
+ db_branch = session.get(Branch, branch_id)
44
+ if not db_branch:
45
+ return None
46
+
47
+ for key, value in kwargs.items():
48
+ if hasattr(db_branch, key):
49
+ setattr(db_branch, key, value)
50
+
51
+ session.add(db_branch)
52
+ session.commit()
53
+ session.refresh(db_branch)
54
+ return db_branch
55
+
56
+ def delete_command(self, branch_id: UUID, soft_delete: bool = True) -> bool:
57
+ with get_session(self.tenant) as session:
58
+ db_branch = session.get(Branch, branch_id)
59
+ if not db_branch:
60
+ return False
61
+
62
+ if soft_delete:
63
+ db_branch.is_active = False
64
+ session.add(db_branch)
65
+ else:
66
+ session.delete(db_branch)
67
+
68
+ session.commit()
69
+ return True
@@ -0,0 +1,82 @@
1
+ from typing import Optional, List
2
+ from uuid import UUID
3
+ from sqlmodel import select
4
+ from sqlalchemy.orm import selectinload,joinedload
5
+
6
+ from healthdatalayer.models import BridgeAreaFloorBranch
7
+ from healthdatalayer.models import Branch
8
+ from healthdatalayer.config.db import engines, get_session
9
+
10
+ class BridgeAreaFloorBranchRepository:
11
+ def __init__(self, tenant: str):
12
+ self.tenant = tenant
13
+ if tenant not in engines:
14
+ raise ValueError(f"Tenant {tenant} is not configured")
15
+
16
+ def create_command(self, bridge: BridgeAreaFloorBranch) -> BridgeAreaFloorBranch:
17
+ with get_session(self.tenant) as session:
18
+ session.add(bridge)
19
+ session.commit()
20
+ session.refresh(bridge)
21
+ return bridge
22
+
23
+ def get_by_id_command(self, bridge_id: UUID, load_related: bool = False) -> Optional[BridgeAreaFloorBranch]:
24
+ with get_session(self.tenant) as session:
25
+ statement = select(BridgeAreaFloorBranch).where(BridgeAreaFloorBranch.bridge_area_floor_branch_id == bridge_id)
26
+ if load_related:
27
+ statement = statement.options(
28
+ selectinload(BridgeAreaFloorBranch.branch).selectinload(Branch.system),
29
+ selectinload(BridgeAreaFloorBranch.area),
30
+ selectinload(BridgeAreaFloorBranch.floor),
31
+ selectinload(BridgeAreaFloorBranch.room)
32
+ )
33
+ bridge = session.exec(statement).first()
34
+
35
+
36
+ return bridge
37
+
38
+ def get_all_command(self, active_only: bool = True,load_related: bool = False) -> List[BridgeAreaFloorBranch]:
39
+ with get_session(self.tenant) as session:
40
+ statement = select(BridgeAreaFloorBranch)
41
+ if active_only:
42
+ statement = statement.where(BridgeAreaFloorBranch.is_active == True)
43
+ #results = session.exec(statement).all()
44
+
45
+ if load_related:
46
+ statement = statement.options(
47
+ selectinload(BridgeAreaFloorBranch.branch).selectinload(Branch.system),
48
+ selectinload(BridgeAreaFloorBranch.area),
49
+ selectinload(BridgeAreaFloorBranch.floor),
50
+ selectinload(BridgeAreaFloorBranch.room)
51
+ )
52
+
53
+ results = session.exec(statement).all()
54
+ return results
55
+
56
+ def update_command(self, bridge: BridgeAreaFloorBranch) -> BridgeAreaFloorBranch:
57
+ with get_session(self.tenant) as session:
58
+ existing_bridge = session.get(BridgeAreaFloorBranch, bridge.bridge_area_floor_branch_id)
59
+ if not existing_bridge:
60
+ raise ValueError(f"BridgeAreaFloorBranch with id {bridge.bridge_area_floor_branch_id} does not exist")
61
+
62
+ for key, value in bridge.dict(exclude_unset=True).items():
63
+ setattr(existing_bridge, key, value)
64
+
65
+ bd_bridge = session.merge(existing_bridge)
66
+ session.commit()
67
+ session.refresh(bd_bridge)
68
+ return bd_bridge
69
+
70
+ def delete_command(self, bridge_id: UUID, soft_delete: bool = False) -> None:
71
+ with get_session(self.tenant) as session:
72
+ existing_bridge = session.get(BridgeAreaFloorBranch, bridge_id)
73
+ if not existing_bridge:
74
+ raise ValueError(f"BridgeAreaFloorBranch with id {bridge_id} does not exist")
75
+
76
+ if soft_delete:
77
+ existing_bridge.is_active = False
78
+ session.add(existing_bridge)
79
+ else:
80
+ session.delete(existing_bridge)
81
+
82
+ session.commit()
@@ -0,0 +1,69 @@
1
+ from typing import Optional, List
2
+ from uuid import UUID
3
+ from sqlmodel import select
4
+
5
+ from healthdatalayer.models import Floor
6
+ from healthdatalayer.config.db import engines, get_session
7
+
8
+ class FloorRepository:
9
+ def __init__(self, tenant: str):
10
+ self.tenant = tenant
11
+ if tenant not in engines:
12
+ raise ValueError(f"Tenant {tenant} is not configured")
13
+
14
+ def create_command(self, floor: Floor) -> Floor:
15
+ with get_session(self.tenant) as session:
16
+ session.add(floor)
17
+ session.commit()
18
+ session.refresh(floor)
19
+ return floor
20
+
21
+ def get_by_id_command(self, floor_id: UUID) -> Optional[Floor]:
22
+ with get_session(self.tenant) as session:
23
+ return session.get(Floor, floor_id)
24
+
25
+ def get_by_name_command(self, name: str) -> Optional[Floor]:
26
+ with get_session(self.tenant) as session:
27
+ statement = select(Floor).where(Floor.name == name)
28
+ result = session.exec(statement).first()
29
+ return result
30
+
31
+ def list_all_command(self, active_only: bool = True) -> List[Floor]:
32
+ with get_session(self.tenant) as session:
33
+ statement = select(Floor)
34
+
35
+ if active_only:
36
+ statement = statement.where(Floor.is_active == True)
37
+
38
+ results = session.exec(statement)
39
+ return results.all()
40
+
41
+ def update_command(self, floor_id: UUID, **kwargs) -> Optional[Floor]:
42
+ with get_session(self.tenant) as session:
43
+ db_floor = session.get(Floor, floor_id)
44
+ if not db_floor:
45
+ return None
46
+
47
+ for key, value in kwargs.items():
48
+ if hasattr(db_floor, key):
49
+ setattr(db_floor, key, value)
50
+
51
+ session.add(db_floor)
52
+ session.commit()
53
+ session.refresh(db_floor)
54
+ return db_floor
55
+
56
+ def delete_command(self, floor_id: UUID, soft_delete: bool = True) -> bool:
57
+ with get_session(self.tenant) as session:
58
+ db_floor = session.get(Floor, floor_id)
59
+ if not db_floor:
60
+ return False
61
+
62
+ if soft_delete:
63
+ db_floor.is_active = False
64
+ session.add(db_floor)
65
+ else:
66
+ session.delete(db_floor)
67
+
68
+ session.commit()
69
+ return True
@@ -0,0 +1,69 @@
1
+ from typing import Optional, List
2
+ from uuid import UUID
3
+ from sqlmodel import select
4
+
5
+ from healthdatalayer.models import Room
6
+ from healthdatalayer.config.db import engines, get_session
7
+
8
+ class RoomRepository:
9
+ def __init__(self, tenant: str):
10
+ self.tenant = tenant
11
+ if tenant not in engines:
12
+ raise ValueError(f"Tenant {tenant} is not configured")
13
+
14
+ def create_command(self, room: Room) -> Room:
15
+ with get_session(self.tenant) as session:
16
+ session.add(room)
17
+ session.commit()
18
+ session.refresh(room)
19
+ return room
20
+
21
+ def get_by_id_command(self, room_id: UUID) -> Optional[Room]:
22
+ with get_session(self.tenant) as session:
23
+ return session.get(Room, room_id)
24
+
25
+ def get_by_name_command(self, name: str) -> Optional[Room]:
26
+ with get_session(self.tenant) as session:
27
+ statement = select(Room).where(Room.name == name)
28
+ result = session.exec(statement).first()
29
+ return result
30
+
31
+ def list_all_command(self, active_only: bool = True) -> List[Room]:
32
+ with get_session(self.tenant) as session:
33
+ statement = select(Room)
34
+
35
+ if active_only:
36
+ statement = statement.where(Room.is_active == True)
37
+
38
+ results = session.exec(statement)
39
+ return results.all()
40
+
41
+ def update_command(self, room_id: UUID, **kwargs) -> Optional[Room]:
42
+ with get_session(self.tenant) as session:
43
+ db_room = session.get(Room, room_id)
44
+ if not db_room:
45
+ return None
46
+
47
+ for key, value in kwargs.items():
48
+ if hasattr(db_room, key):
49
+ setattr(db_room, key, value)
50
+
51
+ session.add(db_room)
52
+ session.commit()
53
+ session.refresh(db_room)
54
+ return db_room
55
+
56
+ def delete_command(self, room_id: UUID, soft_delete: bool = True) -> bool:
57
+ with get_session(self.tenant) as session:
58
+ db_room = session.get(Room, room_id)
59
+ if not db_room:
60
+ return False
61
+
62
+ if soft_delete:
63
+ db_room.is_active = False
64
+ session.add(db_room)
65
+ else:
66
+ session.delete(db_room)
67
+
68
+ session.commit()
69
+ return True
@@ -0,0 +1,69 @@
1
+ from typing import Optional, List
2
+ from uuid import UUID
3
+ from sqlmodel import select
4
+
5
+ from healthdatalayer.models import System
6
+ from healthdatalayer.config.db import engines, get_session
7
+
8
+ class SystemRepository:
9
+ def __init__(self, tenant: str):
10
+ self.tenant = tenant
11
+ if tenant not in engines:
12
+ raise ValueError(f"Tenant {tenant} is not configured")
13
+
14
+ def create_command(self, system: System) -> System:
15
+ with get_session(self.tenant) as session:
16
+ session.add(system)
17
+ session.commit()
18
+ session.refresh(system)
19
+ return system
20
+
21
+ def get_by_id_command(self, system_id: UUID) -> Optional[System]:
22
+ with get_session(self.tenant) as session:
23
+ return session.get(System, system_id)
24
+
25
+ def get_by_name_command(self, name: str) -> Optional[System]:
26
+ with get_session(self.tenant) as session:
27
+ statement = select(System).where(System.name == name)
28
+ result = session.exec(statement).first()
29
+ return result
30
+
31
+ def list_all_command(self, active_only: bool = True) -> List[System]:
32
+ with get_session(self.tenant) as session:
33
+ statement = select(System)
34
+
35
+ if active_only:
36
+ statement = statement.where(System.is_active == True)
37
+
38
+ results = session.exec(statement)
39
+ return results.all()
40
+
41
+ def update_command(self, system_id: UUID, **kwargs) -> Optional[System]:
42
+ with get_session(self.tenant) as session:
43
+ db_system = session.get(System, system_id)
44
+ if not db_system:
45
+ return None
46
+
47
+ for key, value in kwargs.items():
48
+ if hasattr(db_system, key):
49
+ setattr(db_system, key, value)
50
+
51
+ session.add(db_system)
52
+ session.commit()
53
+ session.refresh(db_system)
54
+ return db_system
55
+
56
+ def delete_command(self, system_id: UUID, soft_delete: bool = True) -> bool:
57
+ with get_session(self.tenant) as session:
58
+ db_system = session.get(System, system_id)
59
+ if not db_system:
60
+ return False
61
+
62
+ if soft_delete:
63
+ db_system.is_active = False
64
+ session.add(db_system)
65
+ else:
66
+ session.delete(db_system)
67
+
68
+ session.commit()
69
+ return True
@@ -0,0 +1,80 @@
1
+ from typing import Optional, List
2
+ from uuid import UUID
3
+ from sqlmodel import select
4
+
5
+ from healthdatalayer.models import MeasureLab
6
+ from healthdatalayer.config.db import engines, get_session
7
+
8
+ class MeasureLabRepository:
9
+ def __init__(self, tenant: str):
10
+ self.tenant = tenant
11
+ if tenant not in engines:
12
+ raise ValueError(f"Tenant {tenant} is not configured")
13
+
14
+ def create_command(self, measure_lab: MeasureLab) -> MeasureLab:
15
+ with get_session(self.tenant) as session:
16
+ session.add(measure_lab)
17
+ session.commit()
18
+ session.refresh(measure_lab)
19
+ return measure_lab
20
+
21
+ def get_by_id_command(self, measure_lab_id: UUID) -> Optional[MeasureLab]:
22
+ with get_session(self.tenant) as session:
23
+ return session.get(MeasureLab, measure_lab_id)
24
+
25
+ def get_by_name_command(self, name: str) -> Optional[MeasureLab]:
26
+ with get_session(self.tenant) as session:
27
+ statement = select(MeasureLab).where(MeasureLab.name == name)
28
+ return session.exec(statement).first()
29
+
30
+ def search_by_name_command(self, name: str) -> List[MeasureLab]:
31
+ with get_session(self.tenant) as session:
32
+ statement = select(MeasureLab).where(MeasureLab.name.ilike(f"%{name}%"))
33
+ results = session.exec(statement)
34
+ return results.all()
35
+
36
+ def list_all_command(self, active_only: bool = True) -> List[MeasureLab]:
37
+ with get_session(self.tenant) as session:
38
+ statement = select(MeasureLab)
39
+
40
+ if active_only:
41
+ statement = statement.where(MeasureLab.is_active == True)
42
+
43
+ results = session.exec(statement)
44
+ return results.all()
45
+
46
+ def update_command(self, measure_lab: MeasureLab) -> MeasureLab:
47
+ with get_session(self.tenant) as session:
48
+ db_measure_lab = session.merge(measure_lab)
49
+ session.commit()
50
+ session.refresh(db_measure_lab)
51
+ return db_measure_lab
52
+
53
+ def delete_command(self, measure_lab_id: UUID, soft_delete: bool = True) -> bool:
54
+ with get_session(self.tenant) as session:
55
+ db_measure_lab = session.get(MeasureLab, measure_lab_id)
56
+ if not db_measure_lab:
57
+ return False
58
+
59
+ if soft_delete:
60
+ db_measure_lab.is_active = False
61
+ session.add(db_measure_lab)
62
+ else:
63
+ session.delete(db_measure_lab)
64
+
65
+ session.commit()
66
+ return True
67
+
68
+ def count_command(self, active_only: bool = True) -> int:
69
+ with get_session(self.tenant) as session:
70
+ statement = select(MeasureLab)
71
+ if active_only:
72
+ statement = statement.where(MeasureLab.is_active == True)
73
+ results = session.exec(statement)
74
+ return len(results.all())
75
+
76
+ def exists_by_name_command(self, name: str) -> bool:
77
+ with get_session(self.tenant) as session:
78
+ statement = select(MeasureLab).where(MeasureLab.name == name)
79
+ result = session.exec(statement).first()
80
+ return result is not None