Files
init_dataParser/app/monir/base_model.py
T
2025-11-08 09:11:44 +03:30

164 lines
3.0 KiB
Python

from pydantic import BaseModel, Field
from typing import Optional, List, Dict
from datetime import datetime
# فیلد اجباری:
# str = Field(..., description="")
# فیلد اختیاری:
# Optional[str] = Field(None, description="")
class Properties(BaseModel):
"""
Standard Form Of Foreign Key To Other Index
"""
id: str = Field(..., description="شناسه یکتا")
title: str = Field(..., description="عنوان")
author: str = Field(..., description="سازنده")
sub_type: str = Field(..., description="نوع دوم")
class TreeInfo(BaseModel):
title: str
parent_id: str = Field(..., description="")
child_order: int
level: int
full_path: Optional[str] = Field(None, description="")
path_headings: str
class NlpParses(BaseModel):
main_type: str
nlp_type: str
begin: int
end: int
text: str
referes: str
dependency_infos:str # nested
class Embeddings(BaseModel):
type: Optional[str] = Field(None, description=""),
dims: Optional[int] = Field(1024, description=""),
index: Optional[bool] = Field(True, description=""),
similarity: Optional[str] = Field(None, description="")
class FileLinks(BaseModel):
title: str
link: str
type: str
description: str
class UserLogs(BaseModel):
id: str
user_id: int
username: str
time_edit: datetime
property: str
class MnSection(BaseModel):
id: str
main_type: str
html: str
content: str
meet_info: Properties
term_info: Properties
tree_info: TreeInfo
content_len: int
word_len: int
tags: str
keywords: str
sort_date_timestamp: int
nlp_parses: NlpParses
embeddings: Embeddings
file_links: FileLinks
time_edit: datetime
user_edit: int
user_logs: UserLogs
class MnTerm(BaseModel):
id: str
main_type: str
sub_type: str
title: str
content: str
author: str
begin_date: datetime
end_date: datetime
begin_year: int
tags: str
keywords: str
class MnMeetEntity(BaseModel):
id: str
main_type: str
sub_type: str
title: str
content: str
permit_tags: str
search_state: str
user_create: str
time_create: datetime
time_edit: datetime
file_links: FileLinks
meet_info: Properties
term_info: Properties
class Subjects(BaseModel):
id: int
title: str
class ReportInfo(BaseModel):
film_count: int
sound_count: int
photo_count: int
file_count: int
is_address: int
is_mindex: int
is_mintro: int
is_sanad_data1: int
is_sanad_data2: int
class MnMeet(BaseModel):
"""
Monir Meet Standard fields foramt
"""
id: str
main_type: str
sub_type: str
person_code: str
research_code: str
meet_code: str
old_meet_id: int
title: str
meet_no: int
author: str
term_info: Properties
subtitle: str
subjects: Subjects
allwords: str
tags: str
keywords: str
verb: str
sanad_year: int
sanad_date: datetime
amplify: str
ralation: str
city: str
place: str
address: str
audience: str
attendees: str
report_info: ReportInfo
mindex: str
mintro: str
content: str
completion: Optional[str] = Field(None, description="type: completion")
sort_date_timestamp: int
permit_tags: str
resource_info: str