healthdatalayer 1.5.0__py3-none-any.whl → 1.5.2__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.
@@ -4,8 +4,8 @@ from datetime import time
4
4
 
5
5
  class ScheduleCollaboratorDTO(BaseModel):
6
6
 
7
- available_schedules: List[str] = Field(default_factory=list)
8
- busy_schedules: List[str] = Field(default_factory=list)
7
+ available_schedules: List[time] = Field(default_factory=list)
8
+ busy_schedules: List[time] = Field(default_factory=list)
9
9
 
10
10
  class Config:
11
11
  json_encoders = {
@@ -159,8 +159,8 @@ class CollaboratorRepository:
159
159
  WITH horarios_generados AS (
160
160
  SELECT horario::TIME as hora
161
161
  FROM generate_series(
162
- :fecha::DATE + TIME '08:00:00',
163
- :fecha::DATE + TIME '17:00:00',
162
+ CAST(:fecha AS DATE)+ TIME '08:00:00',
163
+ CAST(:fecha AS DATE) + TIME '17:00:00',
164
164
  INTERVAL '30 minutes'
165
165
  ) AS horario
166
166
  ),
@@ -178,12 +178,12 @@ class CollaboratorRepository:
178
178
  ORDER BY hg.hora
179
179
  """)
180
180
 
181
- result = session.exec(query, {"fecha": visit_date, "colab_id": collaborator_id})
181
+ result = session.exec(query, params={"fecha": visit_date, "colab_id": collaborator_id})
182
182
 
183
183
  availables = []
184
184
  busy = []
185
185
 
186
- for row in result:
186
+ for row in result.fetchall():
187
187
  hour, is_busy = row[0], row[1]
188
188
  if is_busy:
189
189
  busy.append(hour)
@@ -197,6 +197,48 @@ class MedicalVisitRepository:
197
197
 
198
198
  medical_visit = session.exec(statement).first()
199
199
  return medical_visit
200
+
201
+ def get_first_by_clientid_command(self, client_id: UUID, active_only: bool = True, load_relations: bool = False) -> Optional[MedicalVisit]:
202
+ with get_session(self.tenant) as session:
203
+
204
+ statement = select(MedicalVisit).where(MedicalVisit.client_id == client_id).order_by(MedicalVisit.visit_date.asc())
205
+
206
+ if active_only:
207
+ statement = statement.where(MedicalVisit.is_active == True)
208
+ if load_relations:
209
+ statement = statement.options(
210
+ joinedload(MedicalVisit.client),
211
+ joinedload(MedicalVisit.collaborator),
212
+ joinedload(MedicalVisit.speciality),
213
+ selectinload(MedicalVisit.medical_diagnosis_visits),
214
+ selectinload(MedicalVisit.medical_recipe_visits),
215
+ selectinload(MedicalVisit.organ_system_reviews),
216
+ selectinload(MedicalVisit.physical_exams)
217
+ )
218
+
219
+ medical_visit = session.exec(statement).first()
220
+ return medical_visit
221
+
222
+ def get_last_by_clientid_command(self, client_id: UUID, active_only: bool = True, load_relations: bool = False) -> Optional[MedicalVisit]:
223
+ with get_session(self.tenant) as session:
224
+
225
+ statement = select(MedicalVisit).where(MedicalVisit.client_id == client_id).order_by(MedicalVisit.visit_date.desc())
226
+
227
+ if active_only:
228
+ statement = statement.where(MedicalVisit.is_active == True)
229
+ if load_relations:
230
+ statement = statement.options(
231
+ joinedload(MedicalVisit.client),
232
+ joinedload(MedicalVisit.collaborator),
233
+ joinedload(MedicalVisit.speciality),
234
+ selectinload(MedicalVisit.medical_diagnosis_visits),
235
+ selectinload(MedicalVisit.medical_recipe_visits),
236
+ selectinload(MedicalVisit.organ_system_reviews),
237
+ selectinload(MedicalVisit.physical_exams)
238
+ )
239
+
240
+ medical_visit = session.exec(statement).first()
241
+ return medical_visit
200
242
 
201
243
  def update_command(self, medical_visit: MedicalVisit) -> MedicalVisit:
202
244
  with get_session(self.tenant) as session:
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: healthdatalayer
3
- Version: 1.5.0
3
+ Version: 1.5.2
4
4
  Summary: Health Datalayer to access data from different sources
5
5
  Author: Jesus Martinez
6
6
  Author-email: jesusmartinez@noosds.com
@@ -5,7 +5,7 @@ healthdatalayer/config/db.py,sha256=b_SWTINJSVUhR0uyD4h93jPLKUzRm6Ky0tmALWbjM18,
5
5
  healthdatalayer/config/vault.py,sha256=9yUMXjaTYSnqr0npcQXDsg6Z7G3DityqpmHl1x42zS0,748
6
6
  healthdatalayer/dtos/__init__.py,sha256=yNIWA7EF04esaVDpSymVyeuaotsHdOjLzqk3ygbh59o,71
7
7
  healthdatalayer/dtos/collaborator/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
8
- healthdatalayer/dtos/collaborator/schedule_collaborator.py,sha256=liF-UDijHIVZdyzvGuniqcXbA6avns65ey1hfnLI0J4,367
8
+ healthdatalayer/dtos/collaborator/schedule_collaborator.py,sha256=SUD7BIMownZuW9h9GUaFy2U9jaDjZ1tB_9-KCv4H0mk,369
9
9
  healthdatalayer/models/__init__.py,sha256=ZBY7CL172P68TWRWVTpzHO0_cnFzDRGz7aTy85Z8HPI,2056
10
10
  healthdatalayer/models/bridge_area_floor_branch/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
11
11
  healthdatalayer/models/bridge_area_floor_branch/area.py,sha256=g_u6RoorLJ7XUx7qcqXLavrHxpflHGi0p77f-3RPbVU,201
@@ -70,7 +70,7 @@ healthdatalayer/repositories/client_repositories/pet_repository.py,sha256=aUjti4
70
70
  healthdatalayer/repositories/client_repositories/profession_repository.py,sha256=ALnx_y_z9Jfx9rBDvOdnK1P1_lkqKmFBeR1GVXj3m3Q,2620
71
71
  healthdatalayer/repositories/client_repositories/px_repository.py,sha256=cTXDfKolG5aLdlQzXV98_r4Y1Qm5jYW9cUtntdw7e0k,10116
72
72
  healthdatalayer/repositories/collaborator_repositories/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
73
- healthdatalayer/repositories/collaborator_repositories/collaborator_repository.py,sha256=xDyLO0DqrbojaXzMBgweamKPDtPYFwURVEFoV0pgBIg,8228
73
+ healthdatalayer/repositories/collaborator_repositories/collaborator_repository.py,sha256=NBCYH3ziSZ6-SZJDsDVvMrM9oCWYqXpDAUIkh7bzEOo,8261
74
74
  healthdatalayer/repositories/collaborator_repositories/collaborator_type_repository.py,sha256=7-bJqbxgsJtyRU7nV_YCZhKufYLlighWBWjglw70nUw,2858
75
75
  healthdatalayer/repositories/collaborator_repositories/speciality_repository.py,sha256=tcAjp2OzFAnHpRKNdmw2Zsqvs7XdsO51h7cIJHt105s,2940
76
76
  healthdatalayer/repositories/infraestructure_repositories/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
@@ -89,7 +89,7 @@ healthdatalayer/repositories/medical_visit_repositories/medical_diagnosis_visit_
89
89
  healthdatalayer/repositories/medical_visit_repositories/medical_drug_recipe_repository.py,sha256=6rubP_KtheyJSvLmpBJwYuPKNsjhSvKi-_HM2QoP1hM,3141
90
90
  healthdatalayer/repositories/medical_visit_repositories/medical_drug_repository.py,sha256=mJNN6_aAK3eY9IpFc16nT3IshObGcFE5fi27SK-Sjio,2401
91
91
  healthdatalayer/repositories/medical_visit_repositories/medical_recipe_visit_repository.py,sha256=j4cJ4zURKILN3lkqfpXya29MQYFIMiTmJukOADBj5_c,4551
92
- healthdatalayer/repositories/medical_visit_repositories/medical_visit_repository.py,sha256=BmPLxuB22QOPukAAduIKwWq5lQkhKdILF4AuCF7Bj-s,11693
92
+ healthdatalayer/repositories/medical_visit_repositories/medical_visit_repository.py,sha256=EcnFzcj0wyZN3AVpqNc8SGYJVCG_OUHvajQt3b2a9H4,13853
93
93
  healthdatalayer/repositories/medical_visit_repositories/organ_system_review_repository.py,sha256=-BTfgzvt8VlE2FsBHX3snzRl2VDrRClqz-dJL3bLheE,4192
94
94
  healthdatalayer/repositories/medical_visit_repositories/physical_exam_repository.py,sha256=Q4R2-6fv57jqZrGUMFQw4YZgZGQbn8UmSRS3UhUSZQg,3877
95
95
  healthdatalayer/repositories/medical_visit_repositories/visit_triage_repository.py,sha256=9Up5M7wWo5GnaYdl6QvTamYaIG4dG_ALM0Su66rlj44,4140
@@ -97,7 +97,7 @@ healthdatalayer/repositories/user_repositories/__init__.py,sha256=47DEQpj8HBSa-_
97
97
  healthdatalayer/repositories/user_repositories/permission_repository.py,sha256=3L4y-zCkI2PIRo-L3FJRSk4g3nZnu6q35lEY4ACJyq4,9630
98
98
  healthdatalayer/repositories/user_repositories/role_repository.py,sha256=jIsbeAFFQQ_CZJqBMcOskuMXtT1Il6eiN0Y2BpVO1JE,6821
99
99
  healthdatalayer/repositories/user_repositories/user_repository.py,sha256=FUCNdRRGc12dq5XuwDT3btvDETt6HGXh_xQIPTLCAvk,9839
100
- healthdatalayer-1.5.0.dist-info/METADATA,sha256=PSPVrGaysLeAPs1TvTjrEB8abDmrrCIoowfLdrJ0eYw,827
101
- healthdatalayer-1.5.0.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
102
- healthdatalayer-1.5.0.dist-info/top_level.txt,sha256=6f1-gvpg533UEVuYsRJCDhdSDQUBwijyAHylyS4nG_4,16
103
- healthdatalayer-1.5.0.dist-info/RECORD,,
100
+ healthdatalayer-1.5.2.dist-info/METADATA,sha256=ZMt-9bN5bYCyFoch-0_KY6QObIEfsPfB8HSkSLJfwC4,827
101
+ healthdatalayer-1.5.2.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
102
+ healthdatalayer-1.5.2.dist-info/top_level.txt,sha256=6f1-gvpg533UEVuYsRJCDhdSDQUBwijyAHylyS4nG_4,16
103
+ healthdatalayer-1.5.2.dist-info/RECORD,,