healthdatalayer 1.4.2__py3-none-any.whl → 1.4.3__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 healthdatalayer might be problematic. Click here for more details.

@@ -23,20 +23,11 @@ class CollaboratorRepository:
23
23
  with get_session(self.tenant) as session:
24
24
  if load_relations:
25
25
  statement = select(Collaborator).where(Collaborator.collaborator_id == collaborator_id).options(
26
- selectinload(Collaborator.specialties)
26
+ selectinload(Collaborator.collaborator_type),
27
+ joinedload(Collaborator.user),
28
+ selectinload(Collaborator.specialties)
27
29
  )
28
30
  collaborator = session.exec(statement).first()
29
- if load_relations:
30
-
31
- if collaborator.collaborator_type_id:
32
- from healthdatalayer.models.collaborator.collaborator_type import CollaboratorType
33
- collab_type_obj = session.get(CollaboratorType, collaborator.collaborator_type_id)
34
- object.__setattr__(collaborator,'collaborator_type', collab_type_obj)
35
-
36
- if collaborator.user_id:
37
- from healthdatalayer.models.user.user import User
38
- user_obj = session.get(User, collaborator.user_id)
39
- object.__setattr__(collaborator,'user',user_obj)
40
31
 
41
32
  return collaborator
42
33
  else:
@@ -47,11 +38,15 @@ class CollaboratorRepository:
47
38
  statement = (
48
39
  select(Collaborator)
49
40
  .join(CollaboratorSpeciality)
50
- .where(CollaboratorSpeciality.speciality_id == speciality_id)
41
+ .where(CollaboratorSpeciality.speciality_id == speciality_id, Collaborator.is_active == True)
51
42
  )
52
43
 
53
44
  if load_relations:
54
- statement = statement.options(selectinload(Collaborator.specialties))
45
+ statement = statement.options(
46
+ selectinload(Collaborator.collaborator_type),
47
+ joinedload(Collaborator.user),
48
+ selectinload(Collaborator.specialties)
49
+ )
55
50
 
56
51
  collaborators = session.exec(statement).all()
57
52
 
@@ -92,29 +87,19 @@ class CollaboratorRepository:
92
87
  def get_all_command(self, active_only: bool = True,load_related: bool = False) -> List[Collaborator]:
93
88
  with get_session(self.tenant) as session:
94
89
 
90
+ statement = select(Collaborator)
95
91
 
96
92
  if load_related:
97
93
 
98
- statement = select(Collaborator).options(
99
- selectinload(Collaborator.specialties)
100
- )
101
- if active_only:
102
- statement = statement.where(Collaborator.is_active == True)
103
- collaborators = session.exec(statement).all()
104
-
105
- for collaborator in collaborators:
106
- if collaborator.collaborator_type_id:
107
- from healthdatalayer.models.collaborator.collaborator_type import CollaboratorType
108
- collab_type_obj = session.get(CollaboratorType, collaborator.collaborator_type_id)
109
- object.__setattr__(collaborator,'collaborator_type', collab_type_obj)
110
-
111
- if collaborator.user_id:
112
- from healthdatalayer.models.user.user import User
113
- user_obj = session.get(User, collaborator.user_id)
114
- object.__setattr__(collaborator,'user',user_obj)
115
- return collaborators
94
+ statement = statement.options(
95
+ selectinload(Collaborator.collaborator_type),
96
+ joinedload(Collaborator.user),
97
+ selectinload(Collaborator.specialties)
98
+ )
116
99
 
117
- statement = select(Collaborator)
100
+ if active_only:
101
+ statement = statement.where(Collaborator.is_active == True)
102
+
118
103
  return session.exec(statement).all()
119
104
 
120
105
  def update_command(self, collaborator: Collaborator) -> Collaborator:
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: healthdatalayer
3
- Version: 1.4.2
3
+ Version: 1.4.3
4
4
  Summary: Health Datalayer to access data from different sources
5
5
  Author: Jesus Martinez
6
6
  Author-email: jesusmartinez@noosds.com
@@ -64,7 +64,7 @@ healthdatalayer/repositories/client_repositories/pet_repository.py,sha256=aUjti4
64
64
  healthdatalayer/repositories/client_repositories/profession_repository.py,sha256=ALnx_y_z9Jfx9rBDvOdnK1P1_lkqKmFBeR1GVXj3m3Q,2620
65
65
  healthdatalayer/repositories/client_repositories/px_repository.py,sha256=cTXDfKolG5aLdlQzXV98_r4Y1Qm5jYW9cUtntdw7e0k,10116
66
66
  healthdatalayer/repositories/collaborator_repositories/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
67
- healthdatalayer/repositories/collaborator_repositories/collaborator_repository.py,sha256=JB0UdtUEJEY8y33EIT51wHNytroXw_4aVg1U4KmGmGw,7572
67
+ healthdatalayer/repositories/collaborator_repositories/collaborator_repository.py,sha256=aYew_0UMYRvng3DgP5vnKbSVmYe8ozYWUnLly6LxTcI,6467
68
68
  healthdatalayer/repositories/collaborator_repositories/collaborator_type_repository.py,sha256=7-bJqbxgsJtyRU7nV_YCZhKufYLlighWBWjglw70nUw,2858
69
69
  healthdatalayer/repositories/collaborator_repositories/speciality_repository.py,sha256=tcAjp2OzFAnHpRKNdmw2Zsqvs7XdsO51h7cIJHt105s,2940
70
70
  healthdatalayer/repositories/infraestructure_repositories/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
@@ -91,7 +91,7 @@ healthdatalayer/repositories/user_repositories/__init__.py,sha256=47DEQpj8HBSa-_
91
91
  healthdatalayer/repositories/user_repositories/permission_repository.py,sha256=3L4y-zCkI2PIRo-L3FJRSk4g3nZnu6q35lEY4ACJyq4,9630
92
92
  healthdatalayer/repositories/user_repositories/role_repository.py,sha256=jIsbeAFFQQ_CZJqBMcOskuMXtT1Il6eiN0Y2BpVO1JE,6821
93
93
  healthdatalayer/repositories/user_repositories/user_repository.py,sha256=FUCNdRRGc12dq5XuwDT3btvDETt6HGXh_xQIPTLCAvk,9839
94
- healthdatalayer-1.4.2.dist-info/METADATA,sha256=gP7YXWYYDnmmDfIUJ3I1iwFwdZCitP_pK2z9rrSM6sA,827
95
- healthdatalayer-1.4.2.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
96
- healthdatalayer-1.4.2.dist-info/top_level.txt,sha256=6f1-gvpg533UEVuYsRJCDhdSDQUBwijyAHylyS4nG_4,16
97
- healthdatalayer-1.4.2.dist-info/RECORD,,
94
+ healthdatalayer-1.4.3.dist-info/METADATA,sha256=L-a_MY4FT7TQj1yV9jeLJJ8GV2j6aAd8Pd5hug-opO4,827
95
+ healthdatalayer-1.4.3.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
96
+ healthdatalayer-1.4.3.dist-info/top_level.txt,sha256=6f1-gvpg533UEVuYsRJCDhdSDQUBwijyAHylyS4nG_4,16
97
+ healthdatalayer-1.4.3.dist-info/RECORD,,