healthdatalayer 1.4.5__py3-none-any.whl → 1.4.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.
@@ -21,6 +21,36 @@ class MedicalDiagnosisRepository:
21
21
  def get_by_id_command(self, medical_diagnosis_id: UUID) -> Optional[MedicalDiagnosis]:
22
22
  with get_session(self.tenant) as session:
23
23
  return session.get(MedicalDiagnosis, medical_diagnosis_id)
24
+
25
+ def get_by_name_command(self, name:str, active_only: bool = True) -> Optional[MedicalDiagnosis]:
26
+ with get_session(self.tenant) as session:
27
+ statement = select(MedicalDiagnosis).where(MedicalDiagnosis.name == name)
28
+
29
+ if active_only:
30
+ statement = statement.where(MedicalDiagnosis.is_active == True)
31
+
32
+ medical_diagnosis = session.exec(statement).first()
33
+ return medical_diagnosis
34
+
35
+ def get_by_name_ilike_command(self, name:str, active_only: bool = True) -> List[MedicalDiagnosis]:
36
+ with get_session(self.tenant) as session:
37
+ statement = select(MedicalDiagnosis).where(MedicalDiagnosis.name.ilike(f"%{name}%"))
38
+
39
+ if active_only:
40
+ statement = statement.where(MedicalDiagnosis.is_active == True)
41
+
42
+ medical_diagnosis = session.exec(statement).all()
43
+ return medical_diagnosis
44
+
45
+ def get_by_code_command(self, code:str, active_only: bool = True) -> Optional[MedicalDiagnosis]:
46
+ with get_session(self.tenant) as session:
47
+ statement = select(MedicalDiagnosis).where(MedicalDiagnosis.cie_10_code == code)
48
+
49
+ if active_only:
50
+ statement = statement.where(MedicalDiagnosis.is_active == True)
51
+
52
+ medical_diagnosis = session.exec(statement).first()
53
+ return medical_diagnosis
24
54
 
25
55
  def list_all_command(self, active_only: bool = True) -> List[MedicalDiagnosis]:
26
56
  with get_session(self.tenant) as session:
@@ -33,10 +33,27 @@ class MedicalDiagnosisVisitRepository:
33
33
  else:
34
34
  return session.get(MedicalDiagnosisVisit, medical_diagnosis_visit_id)
35
35
 
36
- def get_by_medical_visit_id_command(self, medical_visit_id: UUID, load_relations: bool = False) ->Optional[MedicalDiagnosisVisit]:
36
+ def get_by_medical_visit_id_command(self, medical_visit_id: UUID, load_relations: bool = False) ->List[MedicalDiagnosisVisit]:
37
37
  with get_session(self.tenant) as session:
38
38
 
39
39
  statement = select(MedicalDiagnosisVisit).where(MedicalDiagnosisVisit.medical_visit_id == medical_visit_id)
40
+ if load_relations:
41
+ statement = statement.options(
42
+ joinedload(MedicalDiagnosisVisit.medical_visit),
43
+ joinedload(MedicalDiagnosisVisit.medical_diagnosis)
44
+ )
45
+ medical_diagnosis_visits = session.exec(statement).all()
46
+
47
+ return medical_diagnosis_visits
48
+
49
+ def get_by_medicalvisitid_and_diagnosisid_command(self, medical_visit_id: UUID, medical_diagnosis_id: UUID, load_relations: bool = False) ->Optional[MedicalDiagnosisVisit]:
50
+ with get_session(self.tenant) as session:
51
+
52
+ statement = select(MedicalDiagnosisVisit).where(
53
+ MedicalDiagnosisVisit.medical_visit_id == medical_visit_id,
54
+ MedicalDiagnosisVisit.medical_diagnosis_id == medical_diagnosis_id
55
+ )
56
+
40
57
  if load_relations:
41
58
  statement = statement.options(
42
59
  joinedload(MedicalDiagnosisVisit.medical_visit),
@@ -46,7 +63,7 @@ class MedicalDiagnosisVisitRepository:
46
63
 
47
64
  return medical_diagnosis_visit
48
65
 
49
- def get_all_command(self, active_only: bool = True,load_related: bool = False) -> List[MedicalDiagnosisVisit]:
66
+ def list_all_command(self, active_only: bool = True,load_related: bool = False) -> List[MedicalDiagnosisVisit]:
50
67
  with get_session(self.tenant) as session:
51
68
 
52
69
  statement = select(MedicalDiagnosisVisit)
@@ -1,6 +1,6 @@
1
1
  from typing import Optional, List
2
2
  from uuid import UUID
3
- from sqlmodel import select, or_
3
+ from sqlmodel import select
4
4
  from sqlalchemy.orm import selectinload,joinedload
5
5
  from healthdatalayer.models import VisitTriage
6
6
  from healthdatalayer.models import MedicalVisit
@@ -86,4 +86,10 @@ class VisitTriageRepository:
86
86
  else:
87
87
  session.delete(existing_visit_triage)
88
88
 
89
- session.commit()
89
+ session.commit()
90
+
91
+ def exists_by_medical_visit_id_command(self, medical_visit_id: UUID) -> bool:
92
+ with get_session(self.tenant) as session:
93
+ statement = select(VisitTriage).where(VisitTriage.medical_visit_id == medical_visit_id)
94
+ result = session.exec(statement).first()
95
+ return result is not None
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: healthdatalayer
3
- Version: 1.4.5
3
+ Version: 1.4.6
4
4
  Summary: Health Datalayer to access data from different sources
5
5
  Author: Jesus Martinez
6
6
  Author-email: jesusmartinez@noosds.com
@@ -81,20 +81,20 @@ healthdatalayer/repositories/lab_repositories/__init__.py,sha256=47DEQpj8HBSa-_T
81
81
  healthdatalayer/repositories/lab_repositories/measure_lab_repository.py,sha256=AAwgGjaLWTqyH3YHTD_eisunn6I0E0GmYLEseuLgZ0Q,3174
82
82
  healthdatalayer/repositories/lab_repositories/medical_lab_repository.py,sha256=owZQe3cXKkXsRuGXpqPBXjZvA-DEb7yD1OKPMOCqF1o,10909
83
83
  healthdatalayer/repositories/medical_visit_repositories/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
84
- healthdatalayer/repositories/medical_visit_repositories/medical_diagnosis_repository.py,sha256=mRrNGt6Z4vsZBhvhlOSXlED289WelBJbTn5EetMmQJ8,2567
85
- healthdatalayer/repositories/medical_visit_repositories/medical_diagnosis_visit_repository.py,sha256=GKgjRvddcaw82WMXDO9R7S8HuaJPYTvRT0ev2trKaa8,4659
84
+ healthdatalayer/repositories/medical_visit_repositories/medical_diagnosis_repository.py,sha256=dnVW3hMUqrVGctBSNKVU2_j0ITH46aXN31XduELO8wg,4012
85
+ healthdatalayer/repositories/medical_visit_repositories/medical_diagnosis_visit_repository.py,sha256=BHhglV8CBw4xpcLsFjRJPglg2D0ASnYD2k4RmbP80tU,5499
86
86
  healthdatalayer/repositories/medical_visit_repositories/medical_drug_recipe_repository.py,sha256=6rubP_KtheyJSvLmpBJwYuPKNsjhSvKi-_HM2QoP1hM,3141
87
87
  healthdatalayer/repositories/medical_visit_repositories/medical_drug_repository.py,sha256=mJNN6_aAK3eY9IpFc16nT3IshObGcFE5fi27SK-Sjio,2401
88
88
  healthdatalayer/repositories/medical_visit_repositories/medical_recipe_visit_repository.py,sha256=j4cJ4zURKILN3lkqfpXya29MQYFIMiTmJukOADBj5_c,4551
89
89
  healthdatalayer/repositories/medical_visit_repositories/medical_visit_repository.py,sha256=BmPLxuB22QOPukAAduIKwWq5lQkhKdILF4AuCF7Bj-s,11693
90
90
  healthdatalayer/repositories/medical_visit_repositories/organ_system_review_repository.py,sha256=-BTfgzvt8VlE2FsBHX3snzRl2VDrRClqz-dJL3bLheE,4192
91
91
  healthdatalayer/repositories/medical_visit_repositories/physical_exam_repository.py,sha256=Q4R2-6fv57jqZrGUMFQw4YZgZGQbn8UmSRS3UhUSZQg,3877
92
- healthdatalayer/repositories/medical_visit_repositories/visit_triage_repository.py,sha256=0xVnhXV2CSNi2FcW2tG_BGsqlm_oA9jvXP5qz5Aqj_c,3821
92
+ healthdatalayer/repositories/medical_visit_repositories/visit_triage_repository.py,sha256=9Up5M7wWo5GnaYdl6QvTamYaIG4dG_ALM0Su66rlj44,4140
93
93
  healthdatalayer/repositories/user_repositories/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
94
94
  healthdatalayer/repositories/user_repositories/permission_repository.py,sha256=3L4y-zCkI2PIRo-L3FJRSk4g3nZnu6q35lEY4ACJyq4,9630
95
95
  healthdatalayer/repositories/user_repositories/role_repository.py,sha256=jIsbeAFFQQ_CZJqBMcOskuMXtT1Il6eiN0Y2BpVO1JE,6821
96
96
  healthdatalayer/repositories/user_repositories/user_repository.py,sha256=FUCNdRRGc12dq5XuwDT3btvDETt6HGXh_xQIPTLCAvk,9839
97
- healthdatalayer-1.4.5.dist-info/METADATA,sha256=8JRrMnan-t3mU9GK2JZ_dYAW2nUjvg3de0Mm04juGKY,827
98
- healthdatalayer-1.4.5.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
99
- healthdatalayer-1.4.5.dist-info/top_level.txt,sha256=6f1-gvpg533UEVuYsRJCDhdSDQUBwijyAHylyS4nG_4,16
100
- healthdatalayer-1.4.5.dist-info/RECORD,,
97
+ healthdatalayer-1.4.6.dist-info/METADATA,sha256=T7QzPWNWK4gtfco36C-ZFyfMT95eNS_vbU3EYjybbWM,827
98
+ healthdatalayer-1.4.6.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
99
+ healthdatalayer-1.4.6.dist-info/top_level.txt,sha256=6f1-gvpg533UEVuYsRJCDhdSDQUBwijyAHylyS4nG_4,16
100
+ healthdatalayer-1.4.6.dist-info/RECORD,,