first commit
This commit is contained in:
0
backend/app/schemas/__init__.py
Normal file
0
backend/app/schemas/__init__.py
Normal file
14
backend/app/schemas/analysis.py
Normal file
14
backend/app/schemas/analysis.py
Normal file
@@ -0,0 +1,14 @@
|
||||
from pydantic import BaseModel
|
||||
|
||||
|
||||
class AnalysisStatusOut(BaseModel):
|
||||
case_id: str
|
||||
status: str
|
||||
progress: int = 0
|
||||
current_step: str = ""
|
||||
message: str = ""
|
||||
|
||||
|
||||
class AnalysisTriggerOut(BaseModel):
|
||||
task_id: str
|
||||
message: str
|
||||
39
backend/app/schemas/assessment.py
Normal file
39
backend/app/schemas/assessment.py
Normal file
@@ -0,0 +1,39 @@
|
||||
from datetime import datetime
|
||||
from uuid import UUID
|
||||
|
||||
from pydantic import BaseModel
|
||||
|
||||
from app.models.assessment import ConfidenceLevel, ReviewStatus
|
||||
from app.schemas.transaction import TransactionOut
|
||||
|
||||
|
||||
class AssessmentOut(BaseModel):
|
||||
id: UUID
|
||||
case_id: UUID
|
||||
transaction_id: UUID
|
||||
transaction: TransactionOut | None = None
|
||||
confidence_level: ConfidenceLevel
|
||||
assessed_amount: float
|
||||
reason: str
|
||||
exclude_reason: str
|
||||
review_status: ReviewStatus
|
||||
review_note: str
|
||||
reviewed_by: str
|
||||
reviewed_at: datetime | None = None
|
||||
|
||||
model_config = {"from_attributes": True}
|
||||
|
||||
|
||||
class AssessmentListOut(BaseModel):
|
||||
items: list[AssessmentOut]
|
||||
total: int
|
||||
|
||||
|
||||
class ReviewSubmit(BaseModel):
|
||||
review_status: ReviewStatus
|
||||
review_note: str = ""
|
||||
reviewed_by: str = "demo_user"
|
||||
|
||||
|
||||
class InquirySuggestionOut(BaseModel):
|
||||
suggestions: list[str]
|
||||
40
backend/app/schemas/case.py
Normal file
40
backend/app/schemas/case.py
Normal file
@@ -0,0 +1,40 @@
|
||||
from datetime import datetime
|
||||
from uuid import UUID
|
||||
|
||||
from pydantic import BaseModel
|
||||
|
||||
from app.models.case import CaseStatus
|
||||
|
||||
|
||||
class CaseCreate(BaseModel):
|
||||
case_no: str
|
||||
title: str
|
||||
victim_name: str
|
||||
handler: str = ""
|
||||
|
||||
|
||||
class CaseUpdate(BaseModel):
|
||||
title: str | None = None
|
||||
victim_name: str | None = None
|
||||
handler: str | None = None
|
||||
status: CaseStatus | None = None
|
||||
|
||||
|
||||
class CaseOut(BaseModel):
|
||||
id: UUID
|
||||
case_no: str
|
||||
title: str
|
||||
victim_name: str
|
||||
handler: str
|
||||
status: CaseStatus
|
||||
image_count: int
|
||||
total_amount: float
|
||||
created_at: datetime
|
||||
updated_at: datetime
|
||||
|
||||
model_config = {"from_attributes": True}
|
||||
|
||||
|
||||
class CaseListOut(BaseModel):
|
||||
items: list[CaseOut]
|
||||
total: int
|
||||
40
backend/app/schemas/image.py
Normal file
40
backend/app/schemas/image.py
Normal file
@@ -0,0 +1,40 @@
|
||||
from datetime import datetime
|
||||
from uuid import UUID
|
||||
|
||||
from pydantic import BaseModel
|
||||
|
||||
from app.models.evidence_image import SourceApp, PageType, OcrStatus
|
||||
|
||||
|
||||
class ImageOut(BaseModel):
|
||||
id: UUID
|
||||
case_id: UUID
|
||||
url: str = ""
|
||||
thumb_url: str = ""
|
||||
source_app: SourceApp
|
||||
page_type: PageType
|
||||
ocr_status: OcrStatus
|
||||
file_hash: str
|
||||
uploaded_at: datetime
|
||||
|
||||
model_config = {"from_attributes": True}
|
||||
|
||||
|
||||
class OcrBlockOut(BaseModel):
|
||||
id: UUID
|
||||
content: str
|
||||
bbox: dict
|
||||
seq_order: int
|
||||
confidence: float
|
||||
|
||||
model_config = {"from_attributes": True}
|
||||
|
||||
|
||||
class ImageDetailOut(ImageOut):
|
||||
ocr_blocks: list[OcrBlockOut] = []
|
||||
|
||||
|
||||
class OcrFieldCorrection(BaseModel):
|
||||
field_name: str
|
||||
old_value: str
|
||||
new_value: str
|
||||
33
backend/app/schemas/report.py
Normal file
33
backend/app/schemas/report.py
Normal file
@@ -0,0 +1,33 @@
|
||||
from datetime import datetime
|
||||
from uuid import UUID
|
||||
|
||||
from pydantic import BaseModel
|
||||
|
||||
from app.models.report import ReportType
|
||||
|
||||
|
||||
class ReportCreate(BaseModel):
|
||||
report_type: ReportType
|
||||
include_summary: bool = True
|
||||
include_transactions: bool = True
|
||||
include_flow_chart: bool = True
|
||||
include_timeline: bool = True
|
||||
include_reasons: bool = True
|
||||
include_inquiry: bool = False
|
||||
include_screenshots: bool = False
|
||||
|
||||
|
||||
class ReportOut(BaseModel):
|
||||
id: UUID
|
||||
case_id: UUID
|
||||
report_type: ReportType
|
||||
file_path: str
|
||||
version: int
|
||||
created_at: datetime
|
||||
|
||||
model_config = {"from_attributes": True}
|
||||
|
||||
|
||||
class ReportListOut(BaseModel):
|
||||
items: list[ReportOut]
|
||||
total: int
|
||||
52
backend/app/schemas/transaction.py
Normal file
52
backend/app/schemas/transaction.py
Normal file
@@ -0,0 +1,52 @@
|
||||
from datetime import datetime
|
||||
from uuid import UUID
|
||||
|
||||
from pydantic import BaseModel
|
||||
|
||||
from app.models.evidence_image import SourceApp
|
||||
from app.models.transaction import Direction
|
||||
|
||||
|
||||
class TransactionOut(BaseModel):
|
||||
id: UUID
|
||||
case_id: UUID
|
||||
source_app: SourceApp
|
||||
trade_time: datetime
|
||||
amount: float
|
||||
direction: Direction
|
||||
counterparty_name: str
|
||||
counterparty_account: str
|
||||
self_account_tail_no: str
|
||||
order_no: str
|
||||
remark: str
|
||||
evidence_image_id: UUID | None = None
|
||||
confidence: float
|
||||
cluster_id: UUID | None = None
|
||||
is_duplicate: bool
|
||||
is_transit: bool
|
||||
|
||||
model_config = {"from_attributes": True}
|
||||
|
||||
|
||||
class TransactionListOut(BaseModel):
|
||||
items: list[TransactionOut]
|
||||
total: int
|
||||
|
||||
|
||||
class FlowNodeOut(BaseModel):
|
||||
id: str
|
||||
label: str
|
||||
type: str
|
||||
|
||||
|
||||
class FlowEdgeOut(BaseModel):
|
||||
source: str
|
||||
target: str
|
||||
amount: float
|
||||
count: int
|
||||
trade_time: str
|
||||
|
||||
|
||||
class FlowGraphOut(BaseModel):
|
||||
nodes: list[FlowNodeOut]
|
||||
edges: list[FlowEdgeOut]
|
||||
Reference in New Issue
Block a user