-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmodels.py
More file actions
63 lines (42 loc) · 1.19 KB
/
models.py
File metadata and controls
63 lines (42 loc) · 1.19 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
from pydantic import BaseModel, validator, Field
from typing import List, Optional
from enum import Enum
from datetime import datetime
class Token(BaseModel):
sub: str # ayur_id or staff_id
aud: str # issued to whom (hospital or user)
expire: int
class UserToken(Token):
phone_number: Optional[str]
class StaffToken(Token):
hospital_id: Optional[str]
is_admin: bool = False
access: List[str]
class ReportTypeEnum(str, Enum):
report = "report"
scan = "scan"
class BaseCheckup(BaseModel):
name: str # default name will be f"{ayur_id} - {created_on}"
reason_to_visit: str
deduction: Optional[str]
doctor_id: str
class BaseReport(BaseModel):
checkup_id: str
typ: ReportTypeEnum
class Config:
use_enum_values = True
class Report(BaseReport):
report_id: str
files: List[str]
class AddReport(BaseReport):
...
class AddCheckup(BaseCheckup): # model to add checkup
...
class Checkup(BaseCheckup): # model to return checkup response
ayur_id: str
hospital_id: str
checkup_id: str
created_by: str
created_on: datetime
next_checkup: Optional[datetime] = datetime.now()
reports: List[Report]