healthdatalayer 1.5.1__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.
@@ -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.1
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
@@ -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.1.dist-info/METADATA,sha256=qPMRS9Q3Pgc9-6d7X1zWCbvQNePhBPOmoAmr_olmZm0,827
101
- healthdatalayer-1.5.1.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
102
- healthdatalayer-1.5.1.dist-info/top_level.txt,sha256=6f1-gvpg533UEVuYsRJCDhdSDQUBwijyAHylyS4nG_4,16
103
- healthdatalayer-1.5.1.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,,