Initial commit
This commit is contained in:
52
email_dlp/models.py
Normal file
52
email_dlp/models.py
Normal file
@ -0,0 +1,52 @@
|
||||
"""Pydantic output schema for DLP analysis results."""
|
||||
|
||||
from enum import Enum
|
||||
from pydantic import BaseModel, Field
|
||||
|
||||
|
||||
class RiskLevel(str, Enum):
|
||||
CRITICAL = "CRITICAL"
|
||||
HIGH = "HIGH"
|
||||
MEDIUM = "MEDIUM"
|
||||
LOW = "LOW"
|
||||
|
||||
|
||||
class ViolationType(str, Enum):
|
||||
PII = "PII"
|
||||
FINANCIAL_DATA = "FINANCIAL_DATA"
|
||||
SOURCE_CODE = "SOURCE_CODE"
|
||||
REGULATORY_DOCUMENT = "REGULATORY_DOCUMENT"
|
||||
LEGAL_CONTRACT = "LEGAL_CONTRACT"
|
||||
PAYROLL_RECORD = "PAYROLL_RECORD"
|
||||
CUSTOMER_LIST = "CUSTOMER_LIST"
|
||||
INTERNAL_MEMO = "INTERNAL_MEMO"
|
||||
NONE = "NONE"
|
||||
|
||||
|
||||
class ActionClass(str, Enum):
|
||||
PASS_ = "PASS"
|
||||
ALERT = "ALERT"
|
||||
BLOCK = "BLOCK"
|
||||
|
||||
|
||||
class AttachmentResult(BaseModel):
|
||||
filename: str
|
||||
content_type: str
|
||||
extracted_text_chars: int = 0
|
||||
conversion_status: str = "ok" # "ok" | "failed" | "skipped"
|
||||
|
||||
|
||||
class DLPResult(BaseModel):
|
||||
email_file: str
|
||||
subject: str
|
||||
sender: str
|
||||
recipient: str
|
||||
date: str
|
||||
risk_level: RiskLevel
|
||||
risk_score: int = Field(ge=0, le=100)
|
||||
violation_types: list[ViolationType]
|
||||
action: ActionClass
|
||||
summary: str
|
||||
evidence: list[str]
|
||||
attachments: list[AttachmentResult]
|
||||
processing_errors: list[str] = Field(default_factory=list)
|
||||
Reference in New Issue
Block a user