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.
- healthdatalayer/__init__.py +0 -0
- healthdatalayer/config/__init__.py +0 -0
- healthdatalayer/config/config.py +24 -0
- healthdatalayer/config/db.py +12 -0
- healthdatalayer/config/vault.py +20 -0
- healthdatalayer/dtos/__init__.py +2 -0
- healthdatalayer/dtos/collaborator/__init__.py +0 -0
- healthdatalayer/dtos/collaborator/schedule_collaborator.py +13 -0
- healthdatalayer/dtos/medical_visit/__init__.py +0 -0
- healthdatalayer/dtos/medical_visit/medical_certificate.py +62 -0
- healthdatalayer/models/__init__.py +75 -0
- healthdatalayer/models/bridge_area_floor_branch/__init__.py +0 -0
- healthdatalayer/models/bridge_area_floor_branch/area.py +8 -0
- healthdatalayer/models/bridge_area_floor_branch/branch.py +16 -0
- healthdatalayer/models/bridge_area_floor_branch/bridge_area_floor_branch.py +27 -0
- healthdatalayer/models/bridge_area_floor_branch/floor.py +8 -0
- healthdatalayer/models/bridge_area_floor_branch/room.py +8 -0
- healthdatalayer/models/bridge_area_floor_branch/system.py +8 -0
- healthdatalayer/models/client/__init__.py +0 -0
- healthdatalayer/models/client/address.py +13 -0
- healthdatalayer/models/client/city.py +11 -0
- healthdatalayer/models/client/client.py +25 -0
- healthdatalayer/models/client/client_type.py +9 -0
- healthdatalayer/models/client/education.py +9 -0
- healthdatalayer/models/client/emergency_contact.py +17 -0
- healthdatalayer/models/client/gender.py +9 -0
- healthdatalayer/models/client/marriage_status.py +9 -0
- healthdatalayer/models/client/nationality.py +10 -0
- healthdatalayer/models/client/pathological_history.py +29 -0
- healthdatalayer/models/client/pet.py +16 -0
- healthdatalayer/models/client/profession.py +9 -0
- healthdatalayer/models/client/px.py +35 -0
- healthdatalayer/models/client/state.py +9 -0
- healthdatalayer/models/collaborator/__init__.py +0 -0
- healthdatalayer/models/collaborator/collaborator.py +33 -0
- healthdatalayer/models/collaborator/collaborator_speciality.py +8 -0
- healthdatalayer/models/collaborator/collaborator_type.py +9 -0
- healthdatalayer/models/collaborator/speciality.py +23 -0
- healthdatalayer/models/lab/__init__.py +0 -0
- healthdatalayer/models/lab/client_lab.py +13 -0
- healthdatalayer/models/lab/measure_lab.py +11 -0
- healthdatalayer/models/lab/medical_lab.py +17 -0
- healthdatalayer/models/medical_visit/__init__.py +0 -0
- healthdatalayer/models/medical_visit/medical_diagnosis.py +12 -0
- healthdatalayer/models/medical_visit/medical_diagnosis_visit.py +25 -0
- healthdatalayer/models/medical_visit/medical_drug.py +27 -0
- healthdatalayer/models/medical_visit/medical_drug_recipe.py +19 -0
- healthdatalayer/models/medical_visit/medical_recipe_visit.py +28 -0
- healthdatalayer/models/medical_visit/medical_visit.py +53 -0
- healthdatalayer/models/medical_visit/organ_system_review.py +28 -0
- healthdatalayer/models/medical_visit/physical_exam.py +45 -0
- healthdatalayer/models/medical_visit/status_visit_enum.py +8 -0
- healthdatalayer/models/medical_visit/visit_triage.py +28 -0
- healthdatalayer/models/user/__init__.py +0 -0
- healthdatalayer/models/user/permission.py +27 -0
- healthdatalayer/models/user/permission_user.py +8 -0
- healthdatalayer/models/user/role.py +27 -0
- healthdatalayer/models/user/role_permission.py +8 -0
- healthdatalayer/models/user/role_user.py +8 -0
- healthdatalayer/models/user/user.py +30 -0
- healthdatalayer/repositories/__init__.py +40 -0
- healthdatalayer/repositories/client_repositories/__init__.py +0 -0
- healthdatalayer/repositories/client_repositories/address_repository.py +94 -0
- healthdatalayer/repositories/client_repositories/client_type_repository.py +69 -0
- healthdatalayer/repositories/client_repositories/education_repository.py +70 -0
- healthdatalayer/repositories/client_repositories/emergency_contact_repository.py +78 -0
- healthdatalayer/repositories/client_repositories/gender_repository.py +70 -0
- healthdatalayer/repositories/client_repositories/marriage_status_repository.py +70 -0
- healthdatalayer/repositories/client_repositories/nationality_repository.py +69 -0
- healthdatalayer/repositories/client_repositories/pathological_history_repository.py +73 -0
- healthdatalayer/repositories/client_repositories/pet_repository.py +126 -0
- healthdatalayer/repositories/client_repositories/profession_repository.py +70 -0
- healthdatalayer/repositories/client_repositories/px_repository.py +239 -0
- healthdatalayer/repositories/collaborator_repositories/__init__.py +0 -0
- healthdatalayer/repositories/collaborator_repositories/collaborator_repository.py +197 -0
- healthdatalayer/repositories/collaborator_repositories/collaborator_type_repository.py +69 -0
- healthdatalayer/repositories/collaborator_repositories/speciality_repository.py +75 -0
- healthdatalayer/repositories/infraestructure_repositories/__init__.py +0 -0
- healthdatalayer/repositories/infraestructure_repositories/area_repository.py +69 -0
- healthdatalayer/repositories/infraestructure_repositories/branch_repository.py +69 -0
- healthdatalayer/repositories/infraestructure_repositories/bridge_repository.py +82 -0
- healthdatalayer/repositories/infraestructure_repositories/floor_repository.py +69 -0
- healthdatalayer/repositories/infraestructure_repositories/room_repository.py +69 -0
- healthdatalayer/repositories/infraestructure_repositories/system_repository.py +69 -0
- healthdatalayer/repositories/lab_repositories/__init__.py +0 -0
- healthdatalayer/repositories/lab_repositories/measure_lab_repository.py +80 -0
- healthdatalayer/repositories/lab_repositories/medical_lab_repository.py +254 -0
- healthdatalayer/repositories/medical_visit_repositories/__init__.py +0 -0
- healthdatalayer/repositories/medical_visit_repositories/medical_diagnosis_repository.py +98 -0
- healthdatalayer/repositories/medical_visit_repositories/medical_diagnosis_visit_repository.py +109 -0
- healthdatalayer/repositories/medical_visit_repositories/medical_drug_recipe_repository.py +71 -0
- healthdatalayer/repositories/medical_visit_repositories/medical_drug_repository.py +78 -0
- healthdatalayer/repositories/medical_visit_repositories/medical_recipe_visit_repository.py +93 -0
- healthdatalayer/repositories/medical_visit_repositories/medical_visit_repository.py +509 -0
- healthdatalayer/repositories/medical_visit_repositories/organ_system_review_repository.py +89 -0
- healthdatalayer/repositories/medical_visit_repositories/physical_exam_repository.py +89 -0
- healthdatalayer/repositories/medical_visit_repositories/visit_triage_repository.py +95 -0
- healthdatalayer/repositories/user_repositories/__init__.py +0 -0
- healthdatalayer/repositories/user_repositories/permission_repository.py +238 -0
- healthdatalayer/repositories/user_repositories/role_repository.py +174 -0
- healthdatalayer/repositories/user_repositories/user_repository.py +251 -0
- healthdatalayer-1.6.6.dist-info/METADATA +30 -0
- healthdatalayer-1.6.6.dist-info/RECORD +105 -0
- healthdatalayer-1.6.6.dist-info/WHEEL +5 -0
- healthdatalayer-1.6.6.dist-info/top_level.txt +1 -0
|
File without changes
|
|
File without changes
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import os
|
|
2
|
+
from urllib.parse import quote_plus
|
|
3
|
+
from dotenv import load_dotenv
|
|
4
|
+
from .vault import AzureVault
|
|
5
|
+
|
|
6
|
+
load_dotenv()
|
|
7
|
+
|
|
8
|
+
vault=AzureVault()
|
|
9
|
+
|
|
10
|
+
app_env=os.getenv("APP_ENV").lower() # type: ignore
|
|
11
|
+
|
|
12
|
+
DB_USER_T1 = vault.get_secret(f"milaf-db-{app_env}-username")
|
|
13
|
+
DB_PASSWORD_T1 = vault.get_secret(f"milaf-db-{app_env}-password")
|
|
14
|
+
DB_HOST_T1 = os.getenv("DATABASE_HOST_T1")
|
|
15
|
+
DB_PORT_T1 = os.getenv("DATABASE_PORT_T1")
|
|
16
|
+
DB_NAME_T1 = os.getenv("DATABASE_NAME_T1")
|
|
17
|
+
|
|
18
|
+
DB_PASSWORD_ENCODED_T1 = quote_plus(DB_PASSWORD_T1) # type: ignore
|
|
19
|
+
|
|
20
|
+
DATABASE_URL_T1 = f"postgresql+psycopg2://{DB_USER_T1}:{DB_PASSWORD_ENCODED_T1}@{DB_HOST_T1}:{DB_PORT_T1}/{DB_NAME_T1}"
|
|
21
|
+
|
|
22
|
+
DATABASES = {
|
|
23
|
+
"tenant1": DATABASE_URL_T1
|
|
24
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
from sqlmodel import create_engine, Session
|
|
2
|
+
from .config import DATABASES
|
|
3
|
+
|
|
4
|
+
engines = {
|
|
5
|
+
tenant: create_engine(url, echo=True)
|
|
6
|
+
for tenant, url in DATABASES.items()
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
def get_session(tenant: str) -> Session:
|
|
10
|
+
if tenant not in engines:
|
|
11
|
+
raise ValueError(f"Tenant {tenant} is not configured")
|
|
12
|
+
return Session(engines[tenant])
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import os
|
|
2
|
+
from azure.identity import ClientSecretCredential
|
|
3
|
+
from azure.keyvault.secrets import SecretClient
|
|
4
|
+
|
|
5
|
+
class AzureVault:
|
|
6
|
+
def __init__(self) -> None:
|
|
7
|
+
credential=ClientSecretCredential(
|
|
8
|
+
tenant_id=os.getenv("AZURE_TENANT_ID",""),
|
|
9
|
+
client_id=os.getenv("AZURE_CLIENT_ID",""),
|
|
10
|
+
client_secret=os.getenv("AZURE_CLIENT_SECRET","")
|
|
11
|
+
)
|
|
12
|
+
self.key_vault_uri=os.getenv("AZURE_KEY_VAULT_URI","")
|
|
13
|
+
self.client=SecretClient(vault_url=self.key_vault_uri,credential=credential)
|
|
14
|
+
|
|
15
|
+
def get_secret(self,secret_name:str):
|
|
16
|
+
secret=self.client.get_secret(name=secret_name)
|
|
17
|
+
if secret:
|
|
18
|
+
return secret.value
|
|
19
|
+
else:
|
|
20
|
+
raise ValueError("Secret not exist")
|
|
File without changes
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
from pydantic import BaseModel, Field
|
|
2
|
+
from typing import List
|
|
3
|
+
from datetime import time
|
|
4
|
+
|
|
5
|
+
class ScheduleCollaboratorDTO(BaseModel):
|
|
6
|
+
|
|
7
|
+
available_schedules: List[time] = Field(default_factory=list)
|
|
8
|
+
busy_schedules: List[time] = Field(default_factory=list)
|
|
9
|
+
|
|
10
|
+
class Config:
|
|
11
|
+
json_encoders = {
|
|
12
|
+
time: lambda v: v.strftime('%H:%M')
|
|
13
|
+
}
|
|
File without changes
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
from pydantic import BaseModel, Field
|
|
2
|
+
from typing import List, Optional
|
|
3
|
+
from datetime import date, datetime, time
|
|
4
|
+
|
|
5
|
+
class MedicalCertificateDTO(BaseModel):
|
|
6
|
+
sys: Optional[str] = None
|
|
7
|
+
stablishment: Optional[str] = None
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
medical_record_number: Optional[str] = None
|
|
11
|
+
number_his: Optional[str] = None
|
|
12
|
+
last_name: Optional[str] = None
|
|
13
|
+
first_name: Optional[str] = None
|
|
14
|
+
sex: Optional[str] = None
|
|
15
|
+
age: Optional[int] = None
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
service: Optional[str] = None
|
|
19
|
+
speciality: Optional[str] = None
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
year_visit: Optional[int] = None
|
|
23
|
+
month_visit: Optional[int] = None
|
|
24
|
+
day_visit: Optional[int] = None
|
|
25
|
+
hour_start: Optional[time] = None
|
|
26
|
+
hour_end: Optional[time] = None
|
|
27
|
+
visit_date_spanish: Optional[str] = None
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
rest: Optional[bool] = None
|
|
31
|
+
rest_hours: Optional[float] = None
|
|
32
|
+
rest_date_start: Optional[datetime] = None
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
year_rest_start: Optional[int] = None
|
|
36
|
+
month_rest_start: Optional[int] = None
|
|
37
|
+
day_rest_start: Optional[int] = None
|
|
38
|
+
rest_date_start_spanish: Optional[str] = None
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
rest_date_end: Optional[datetime] = None
|
|
42
|
+
|
|
43
|
+
|
|
44
|
+
year_rest_end: Optional[int] = None
|
|
45
|
+
month_rest_end: Optional[int] = None
|
|
46
|
+
day_rest_end: Optional[int] = None
|
|
47
|
+
rest_date_end_spanish: Optional[str] = None
|
|
48
|
+
|
|
49
|
+
|
|
50
|
+
doctor_name: Optional[str] = None
|
|
51
|
+
doctor_ruc: Optional[str] = None
|
|
52
|
+
|
|
53
|
+
|
|
54
|
+
class DiagnosisDTO(BaseModel):
|
|
55
|
+
name_diagnosis: str
|
|
56
|
+
cie_10_code: Optional[str] = None
|
|
57
|
+
|
|
58
|
+
class MedicalDiagnosesDTO(BaseModel):
|
|
59
|
+
diagnoses: List[DiagnosisDTO]
|
|
60
|
+
|
|
61
|
+
class Config:
|
|
62
|
+
from_attributes = True
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
from .bridge_area_floor_branch.system import System
|
|
2
|
+
from .bridge_area_floor_branch.area import Area
|
|
3
|
+
from .bridge_area_floor_branch.branch import Branch
|
|
4
|
+
from .bridge_area_floor_branch.floor import Floor
|
|
5
|
+
from .bridge_area_floor_branch.room import Room
|
|
6
|
+
from .bridge_area_floor_branch.bridge_area_floor_branch import BridgeAreaFloorBranch
|
|
7
|
+
|
|
8
|
+
from .user.user import User
|
|
9
|
+
from .user.permission import Permission
|
|
10
|
+
from .user.permission_user import PermissionUser
|
|
11
|
+
from .user.role import Role
|
|
12
|
+
from .user.role_permission import RolePermission
|
|
13
|
+
from .user.role_user import RoleUser
|
|
14
|
+
|
|
15
|
+
from .client.client import Client
|
|
16
|
+
from .client.address import Address
|
|
17
|
+
from .client.client_type import ClientType
|
|
18
|
+
from .client.education import Education
|
|
19
|
+
from .client.emergency_contact import EmergencyContact
|
|
20
|
+
from .client.gender import Gender
|
|
21
|
+
from .client.marriage_status import MarriageStatus
|
|
22
|
+
from .client.nationality import Nationality
|
|
23
|
+
from .client.pathological_history import PathologicalHistory
|
|
24
|
+
from .client.pet import Pet
|
|
25
|
+
from .client.profession import Profession
|
|
26
|
+
from .client.px import Px
|
|
27
|
+
from .client.state import State
|
|
28
|
+
from .client.city import City
|
|
29
|
+
|
|
30
|
+
from .collaborator.collaborator_speciality import CollaboratorSpeciality
|
|
31
|
+
from .collaborator.collaborator import Collaborator
|
|
32
|
+
from .collaborator.collaborator_type import CollaboratorType
|
|
33
|
+
from .collaborator.speciality import Speciality
|
|
34
|
+
|
|
35
|
+
from .lab.medical_lab import MedicalLab
|
|
36
|
+
from .lab.measure_lab import MeasureLab
|
|
37
|
+
from .lab.client_lab import ClientLab
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
from .medical_visit.medical_diagnosis import MedicalDiagnosis
|
|
41
|
+
from .medical_visit.medical_drug import MedicalDrug
|
|
42
|
+
from .medical_visit.medical_drug_recipe import MedicalDrugRecipe
|
|
43
|
+
from .medical_visit.medical_recipe_visit import MedicalRecipeVisit
|
|
44
|
+
from .medical_visit.medical_diagnosis_visit import MedicalDiagnosisVisit
|
|
45
|
+
from .medical_visit.organ_system_review import OrganSystemReview
|
|
46
|
+
from .medical_visit.physical_exam import PhysicalExam
|
|
47
|
+
from .medical_visit.visit_triage import VisitTriage
|
|
48
|
+
from .medical_visit.medical_visit import MedicalVisit
|
|
49
|
+
from .medical_visit.status_visit_enum import StatusVisitEnum
|
|
50
|
+
|
|
51
|
+
|
|
52
|
+
|
|
53
|
+
|
|
54
|
+
|
|
55
|
+
|
|
56
|
+
|
|
57
|
+
|
|
58
|
+
|
|
59
|
+
|
|
60
|
+
|
|
61
|
+
|
|
62
|
+
|
|
63
|
+
|
|
64
|
+
|
|
65
|
+
|
|
66
|
+
|
|
67
|
+
|
|
68
|
+
|
|
69
|
+
|
|
70
|
+
|
|
71
|
+
|
|
72
|
+
|
|
73
|
+
|
|
74
|
+
|
|
75
|
+
|
|
File without changes
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import uuid
|
|
2
|
+
from sqlmodel import SQLModel, Field, Relationship
|
|
3
|
+
from typing import Optional
|
|
4
|
+
|
|
5
|
+
from healthdatalayer.models import System
|
|
6
|
+
|
|
7
|
+
class Branch(SQLModel, table=True):
|
|
8
|
+
__tablename__ = "branch"
|
|
9
|
+
|
|
10
|
+
branch_id: uuid.UUID = Field(default_factory=uuid.uuid4, primary_key=True)
|
|
11
|
+
name: str
|
|
12
|
+
location_x: Optional[float] = None
|
|
13
|
+
location_y: Optional[float] = None
|
|
14
|
+
|
|
15
|
+
system_id: Optional[uuid.UUID] = Field(default=None, foreign_key="system.system_id")
|
|
16
|
+
system: Optional[System] = Relationship()
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import uuid
|
|
2
|
+
from typing import Optional
|
|
3
|
+
from sqlmodel import SQLModel, Field, Relationship
|
|
4
|
+
|
|
5
|
+
from .area import Area
|
|
6
|
+
from .branch import Branch
|
|
7
|
+
from .floor import Floor
|
|
8
|
+
from .room import Room
|
|
9
|
+
|
|
10
|
+
class BridgeAreaFloorBranch(SQLModel, table=True):
|
|
11
|
+
__tablename__ = "bridge_area_floor_branch"
|
|
12
|
+
|
|
13
|
+
bridge_area_floor_branch_id:uuid.UUID=Field(default_factory=uuid.uuid4,primary_key=True)
|
|
14
|
+
|
|
15
|
+
area_id:Optional[uuid.UUID]=Field(default=None,foreign_key="area.area_id")
|
|
16
|
+
area: Optional[Area] = Relationship()
|
|
17
|
+
|
|
18
|
+
branch_id:Optional[uuid.UUID]=Field(default=None,foreign_key="branch.branch_id")
|
|
19
|
+
branch: Optional[Branch] = Relationship()
|
|
20
|
+
|
|
21
|
+
floor_id:Optional[uuid.UUID]=Field(default=None,foreign_key="floor.floor_id")
|
|
22
|
+
floor: Optional[Floor] = Relationship()
|
|
23
|
+
|
|
24
|
+
room_id:Optional[uuid.UUID]=Field(default=None,foreign_key="room.room_id")
|
|
25
|
+
room: Optional[Room] = Relationship()
|
|
26
|
+
|
|
27
|
+
is_active: bool = Field(default=True)
|
|
File without changes
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import uuid
|
|
2
|
+
from sqlmodel import SQLModel,Field
|
|
3
|
+
|
|
4
|
+
class Address(SQLModel,table=True):
|
|
5
|
+
__tablename__ = "address"
|
|
6
|
+
|
|
7
|
+
address_id:uuid.UUID=Field(default_factory=uuid.uuid4,primary_key=True)
|
|
8
|
+
postal_code:str = Field(default=None)
|
|
9
|
+
state:str
|
|
10
|
+
country:str
|
|
11
|
+
city:str
|
|
12
|
+
neighborhood:str
|
|
13
|
+
is_active: bool = Field(default=True)
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import uuid
|
|
2
|
+
from sqlmodel import SQLModel,Field
|
|
3
|
+
from typing import Optional
|
|
4
|
+
|
|
5
|
+
class City(SQLModel,table=True):
|
|
6
|
+
__tablename__ = "city"
|
|
7
|
+
|
|
8
|
+
city_id:uuid.UUID=Field(default_factory=uuid.uuid4,primary_key=True)
|
|
9
|
+
name:str
|
|
10
|
+
state_id: Optional[uuid.UUID] = Field(default=None, foreign_key="state.state_id")
|
|
11
|
+
is_active: bool = Field(default=True)
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import uuid
|
|
2
|
+
from datetime import datetime
|
|
3
|
+
from typing import Optional, TYPE_CHECKING
|
|
4
|
+
from sqlmodel import SQLModel, Field, Relationship
|
|
5
|
+
|
|
6
|
+
if TYPE_CHECKING:
|
|
7
|
+
from .address import Address
|
|
8
|
+
from .gender import Gender
|
|
9
|
+
|
|
10
|
+
class Client(SQLModel):
|
|
11
|
+
__abstract__ = True
|
|
12
|
+
|
|
13
|
+
client_id: uuid.UUID = Field(default_factory=uuid.uuid4, primary_key=True)
|
|
14
|
+
first_name: str
|
|
15
|
+
birth_date: Optional[datetime] = Field(default=None)
|
|
16
|
+
identification: str
|
|
17
|
+
|
|
18
|
+
gender_id: Optional[uuid.UUID] = Field(default=None, foreign_key="gender.gender_id")
|
|
19
|
+
address_id: Optional[uuid.UUID] = Field(default=None, foreign_key="address.address_id")
|
|
20
|
+
|
|
21
|
+
blood_type: Optional[str] = None
|
|
22
|
+
is_active: bool = Field(default=True)
|
|
23
|
+
|
|
24
|
+
Client.gender = Relationship()
|
|
25
|
+
Client.address = Relationship()
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import uuid
|
|
2
|
+
from sqlmodel import SQLModel,Field, Relationship
|
|
3
|
+
from typing import Optional
|
|
4
|
+
|
|
5
|
+
from healthdatalayer.models.client.px import Px
|
|
6
|
+
|
|
7
|
+
class EmergencyContact(SQLModel,table=True):
|
|
8
|
+
__tablename__ = "emergency_contact"
|
|
9
|
+
|
|
10
|
+
emergency_contact_id:uuid.UUID=Field(default_factory=uuid.uuid4,primary_key=True)
|
|
11
|
+
|
|
12
|
+
client_id:Optional[uuid.UUID]=Field(default=None,foreign_key="px.client_id")
|
|
13
|
+
client: Optional[Px] = Relationship()
|
|
14
|
+
|
|
15
|
+
name:str
|
|
16
|
+
phone:str
|
|
17
|
+
is_active: bool = Field(default=True)
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import uuid
|
|
2
|
+
from sqlmodel import SQLModel,Field
|
|
3
|
+
|
|
4
|
+
class MarriageStatus(SQLModel,table=True):
|
|
5
|
+
__tablename__ = "marriage_status"
|
|
6
|
+
|
|
7
|
+
marriage_status_id:uuid.UUID=Field(default_factory=uuid.uuid4,primary_key=True)
|
|
8
|
+
name:str
|
|
9
|
+
is_active: bool = Field(default=True)
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import uuid
|
|
2
|
+
from sqlmodel import SQLModel,Field
|
|
3
|
+
|
|
4
|
+
class Nationality(SQLModel,table=True):
|
|
5
|
+
__tablename__ = "nationality"
|
|
6
|
+
|
|
7
|
+
nationality_id:uuid.UUID=Field(default_factory=uuid.uuid4,primary_key=True)
|
|
8
|
+
name:str
|
|
9
|
+
code:str
|
|
10
|
+
is_active: bool = Field(default=True)
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import uuid
|
|
2
|
+
from sqlmodel import SQLModel,Field,Relationship
|
|
3
|
+
from typing import Optional
|
|
4
|
+
|
|
5
|
+
from healthdatalayer.models.client.px import Px
|
|
6
|
+
|
|
7
|
+
class PathologicalHistory(SQLModel,table=True):
|
|
8
|
+
__tablename__ = "pathological_history"
|
|
9
|
+
|
|
10
|
+
pathological_history_id:uuid.UUID=Field(default_factory=uuid.uuid4,primary_key=True)
|
|
11
|
+
|
|
12
|
+
client_id:Optional[uuid.UUID]=Field(default=None,foreign_key="px.client_id")
|
|
13
|
+
client: Optional[Px] = Relationship()
|
|
14
|
+
|
|
15
|
+
type_name:str
|
|
16
|
+
|
|
17
|
+
heart_disease: Optional[bool] = Field(default=None)
|
|
18
|
+
hypertension: Optional[bool] = Field(default=None)
|
|
19
|
+
cardiovascular_disease: Optional[bool] = Field(default=None)
|
|
20
|
+
endocrine_metabolic: Optional[bool] = Field(default=None)
|
|
21
|
+
cancer: Optional[bool] = Field(default=None)
|
|
22
|
+
tuberculosis: Optional[bool] = Field(default=None)
|
|
23
|
+
mental_illness: Optional[bool] = Field(default=None)
|
|
24
|
+
malformation: Optional[bool] = Field(default=None)
|
|
25
|
+
other: Optional[bool] = Field(default=None)
|
|
26
|
+
|
|
27
|
+
comment:str
|
|
28
|
+
|
|
29
|
+
is_active: bool = Field(default=True)
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import uuid
|
|
2
|
+
from healthdatalayer.models import Client
|
|
3
|
+
from typing import Optional
|
|
4
|
+
from sqlmodel import Field, Relationship
|
|
5
|
+
|
|
6
|
+
from .client_type import ClientType
|
|
7
|
+
from .px import Px
|
|
8
|
+
|
|
9
|
+
class Pet(Client, table=True):
|
|
10
|
+
__tablename__ = "pet"
|
|
11
|
+
|
|
12
|
+
parent_id:Optional[uuid.UUID]=Field(default=None,foreign_key="px.client_id")
|
|
13
|
+
parent: Optional[Px] = Relationship()
|
|
14
|
+
|
|
15
|
+
client_type_id:Optional[uuid.UUID]=Field(default=None,foreign_key="client_type.client_type_id")
|
|
16
|
+
client_type: Optional[ClientType] = Relationship()
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
from typing import Optional, TYPE_CHECKING
|
|
2
|
+
from sqlmodel import Field, Relationship
|
|
3
|
+
import uuid
|
|
4
|
+
|
|
5
|
+
from healthdatalayer.models import Client
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
if TYPE_CHECKING:
|
|
9
|
+
from healthdatalayer.models import ClientLab
|
|
10
|
+
from healthdatalayer.models import PathologicalHistory
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
class Px(Client, table=True):
|
|
14
|
+
__tablename__ = "px"
|
|
15
|
+
|
|
16
|
+
last_name: str
|
|
17
|
+
phone: Optional[str] = None
|
|
18
|
+
email: Optional[str] = None
|
|
19
|
+
medical_record_number: Optional[str] = None
|
|
20
|
+
marriage_status_id: Optional[uuid.UUID] = Field(default=None, foreign_key="marriage_status.marriage_status_id")
|
|
21
|
+
profession_id: Optional[uuid.UUID] = Field(default=None, foreign_key="profession.profession_id")
|
|
22
|
+
education_id: Optional[uuid.UUID] = Field(default=None, foreign_key="education.education_id")
|
|
23
|
+
user_id: Optional[uuid.UUID] = Field(default=None, foreign_key="user.user_id")
|
|
24
|
+
nationality_id: Optional[uuid.UUID] = Field(default=None, foreign_key="nationality.nationality_id")
|
|
25
|
+
|
|
26
|
+
Px.marriage_status = Relationship()
|
|
27
|
+
Px.profession = Relationship()
|
|
28
|
+
Px.education = Relationship()
|
|
29
|
+
Px.user = Relationship()
|
|
30
|
+
Px.nationality = Relationship()
|
|
31
|
+
Px.medical_labs = Relationship(back_populates="pxs", link_model="ClientLab")
|
|
32
|
+
Px.pathological_histories = Relationship(
|
|
33
|
+
back_populates="client",
|
|
34
|
+
link_model="PathologicalHistory"
|
|
35
|
+
)
|
|
File without changes
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import uuid
|
|
2
|
+
from typing import Optional, List, TYPE_CHECKING
|
|
3
|
+
from sqlmodel import SQLModel, Field, Relationship
|
|
4
|
+
|
|
5
|
+
from healthdatalayer.models import User
|
|
6
|
+
from healthdatalayer.models import CollaboratorSpeciality
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
if TYPE_CHECKING:
|
|
10
|
+
from healthdatalayer.models import Speciality
|
|
11
|
+
from healthdatalayer.models import CollaboratorType
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
class Collaborator(SQLModel, table=True):
|
|
15
|
+
__tablename__ = "collaborator"
|
|
16
|
+
|
|
17
|
+
collaborator_id: uuid.UUID = Field(default_factory=uuid.uuid4, primary_key=True)
|
|
18
|
+
name: str
|
|
19
|
+
ruc: str
|
|
20
|
+
code: str
|
|
21
|
+
|
|
22
|
+
collaborator_type_id: Optional[uuid.UUID] = Field(default=None, foreign_key="collaborator_type.collaborator_type_id")
|
|
23
|
+
collaborator_type: Optional["CollaboratorType"] = Relationship()
|
|
24
|
+
|
|
25
|
+
user_id: Optional[uuid.UUID] = Field(default=None, foreign_key="user.user_id")
|
|
26
|
+
user: Optional[User] = Relationship()
|
|
27
|
+
|
|
28
|
+
is_active: bool = Field(default=True)
|
|
29
|
+
|
|
30
|
+
specialties: List["Speciality"] = Relationship(
|
|
31
|
+
back_populates="collaborators",
|
|
32
|
+
link_model=CollaboratorSpeciality
|
|
33
|
+
)
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import uuid
|
|
2
|
+
from sqlmodel import SQLModel,Field
|
|
3
|
+
|
|
4
|
+
class CollaboratorSpeciality(SQLModel,table=True):
|
|
5
|
+
__tablename__ = "collaborator_speciality"
|
|
6
|
+
|
|
7
|
+
speciality_id: uuid.UUID = Field(foreign_key="speciality.speciality_id", primary_key=True)
|
|
8
|
+
collaborator_id: uuid.UUID = Field(foreign_key="collaborator.collaborator_id", primary_key=True)
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import uuid
|
|
2
|
+
from sqlmodel import SQLModel,Field
|
|
3
|
+
|
|
4
|
+
class CollaboratorType(SQLModel,table=True):
|
|
5
|
+
__tablename__ = "collaborator_type"
|
|
6
|
+
|
|
7
|
+
collaborator_type_id:uuid.UUID=Field(default_factory=uuid.uuid4,primary_key=True)
|
|
8
|
+
name:str
|
|
9
|
+
is_active: bool = Field(default=True)
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import uuid
|
|
2
|
+
from sqlmodel import SQLModel,Field
|
|
3
|
+
from typing import List, TYPE_CHECKING
|
|
4
|
+
from sqlmodel import Relationship
|
|
5
|
+
|
|
6
|
+
from .collaborator_speciality import CollaboratorSpeciality
|
|
7
|
+
|
|
8
|
+
if TYPE_CHECKING:
|
|
9
|
+
from .collaborator import Collaborator
|
|
10
|
+
|
|
11
|
+
class Speciality(SQLModel,table=True):
|
|
12
|
+
__tablename__ = "speciality"
|
|
13
|
+
|
|
14
|
+
speciality_id:uuid.UUID=Field(default_factory=uuid.uuid4,primary_key=True)
|
|
15
|
+
subspeciality:str
|
|
16
|
+
name:str
|
|
17
|
+
|
|
18
|
+
is_active: bool = Field(default=True)
|
|
19
|
+
|
|
20
|
+
collaborators: List["Collaborator"] = Relationship(
|
|
21
|
+
back_populates="specialties",
|
|
22
|
+
link_model=CollaboratorSpeciality
|
|
23
|
+
)
|
|
File without changes
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import uuid
|
|
2
|
+
from sqlmodel import SQLModel,Field,Relationship
|
|
3
|
+
from typing import Optional, TYPE_CHECKING
|
|
4
|
+
|
|
5
|
+
if TYPE_CHECKING:
|
|
6
|
+
from healthdatalayer.models.client.px import Px
|
|
7
|
+
|
|
8
|
+
class ClientLab(SQLModel,table=True):
|
|
9
|
+
__tablename__ = "client_lab"
|
|
10
|
+
|
|
11
|
+
client_id: uuid.UUID = Field(foreign_key="px.client_id", primary_key=True)
|
|
12
|
+
client: Optional["Px"] = Relationship()
|
|
13
|
+
medical_lab_id: uuid.UUID = Field(foreign_key="medical_lab.medical_lab_id", primary_key=True)
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import uuid
|
|
2
|
+
from sqlmodel import SQLModel, Field, Relationship
|
|
3
|
+
|
|
4
|
+
class MeasureLab(SQLModel, table=True):
|
|
5
|
+
__tablename__ = "measure_lab"
|
|
6
|
+
|
|
7
|
+
measure_lab_id: uuid.UUID = Field(default_factory=uuid.uuid4, primary_key=True)
|
|
8
|
+
name: str
|
|
9
|
+
is_active: bool = Field(default=True)
|
|
10
|
+
|
|
11
|
+
MeasureLab.medical_labs = Relationship(back_populates="measure_lab")
|