Files
osint_parser_ada/models/disciplinary_action.py
ada 12d5c6eaff feat: Add data models for disciplinary actions, organizations, and training centers
- Implemented DisciplinaryAction model for tracking disciplinary measures.
- Created Organization model to represent auditing organizations with relevant details.
- Developed TrainingCenter model for educational and methodological centers.
- Added methods to convert models to dictionaries for easy export.

feat: Implement parsers for auditors and organizations

- Developed AuditorsParser to scrape and parse auditor registry data.
- Created OrganizationsParser for scraping auditing organizations' registry.
- Implemented GenericRegistryParser for handling generic tabular data.

chore: Set up base parser functionality

- Established BaseParser class with common methods for making requests and parsing HTML.
- Added pagination handling and detailed page parsing capabilities.

feat: Implement Excel export functionality

- Created ExcelExporter class for exporting data to Excel files with formatting options.
- Added support for exporting multiple sheets and organization data specifically.

chore: Add logging utilities

- Implemented setup_logger function for consistent logging across the application.
- Configured logging to output to both console and file.

chore: Update requirements and scripts

- Added necessary dependencies for parsing, Excel handling, and logging.
- Created run.sh and run.fish scripts for easy execution of the parser.
2025-10-25 20:31:45 +03:00

66 lines
2.5 KiB
Python

"""
Модель данных для дисциплинарной меры
"""
from dataclasses import dataclass, field
from typing import Optional, Dict
from datetime import datetime
@dataclass
class DisciplinaryAction:
"""Модель меры дисциплинарного воздействия"""
# Основная информация
subject_name: str # ФИО аудитора или название организации
subject_type: str # "auditor" или "organization"
ornz: str
action_type: str # Тип меры воздействия
# Детали
violation_description: str
decision_date: datetime
decision_number: Optional[str] = None
# Дополнительная информация
inn: Optional[str] = None
region: Optional[str] = None
effective_date: Optional[datetime] = None
expiry_date: Optional[datetime] = None
# Решение
decision_body: Optional[str] = None
appeal_status: Optional[str] = None
# Метаинформация
source_url: Optional[str] = None
parsed_at: datetime = field(default_factory=datetime.now)
def to_dict(self) -> Dict:
"""Преобразование в словарь для экспорта"""
return {
"Субъект": self.subject_name,
"Тип субъекта": (
"Аудитор" if self.subject_type == "auditor" else "Организация"
),
"ОРНЗ": self.ornz,
"Мера воздействия": self.action_type,
"Описание нарушения": self.violation_description,
"Дата решения": (
self.decision_date.strftime("%d.%m.%Y") if self.decision_date else ""
),
"Номер решения": self.decision_number or "",
"ИНН": self.inn or "",
"Регион": self.region or "",
"Дата вступления в силу": (
self.effective_date.strftime("%d.%m.%Y") if self.effective_date else ""
),
"Дата окончания": (
self.expiry_date.strftime("%d.%m.%Y") if self.expiry_date else ""
),
"Орган принявший решение": self.decision_body or "",
"Статус обжалования": self.appeal_status or "",
"URL источника": self.source_url or "",
"Дата сбора данных": self.parsed_at.strftime("%d.%m.%Y %H:%M:%S"),
}