Files
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

60 lines
2.2 KiB
Python

"""
Модель данных для квалификационного аттестата
"""
from dataclasses import dataclass, field
from typing import Optional, Dict
from datetime import datetime
@dataclass
class Certificate:
"""Модель квалификационного аттестата аудитора"""
# Основная информация
certificate_number: str
auditor_full_name: str
issue_date: datetime
status: str
# Дополнительная информация
qualification_type: Optional[str] = None
issuer: Optional[str] = None
validity_period: Optional[str] = None
# Данные аудитора
auditor_inn: Optional[str] = None
auditor_snils: Optional[str] = None
# Причина аннулирования (для аннулированных)
cancellation_reason: Optional[str] = None
cancellation_date: Optional[datetime] = None
# Метаинформация
source_url: Optional[str] = None
parsed_at: datetime = field(default_factory=datetime.now)
def to_dict(self) -> Dict:
"""Преобразование в словарь для экспорта"""
return {
"Номер аттестата": self.certificate_number,
"ФИО аудитора": self.auditor_full_name,
"Дата выдачи": (
self.issue_date.strftime("%d.%m.%Y") if self.issue_date else ""
),
"Статус": self.status,
"Тип квалификации": self.qualification_type or "",
"Выдан": self.issuer or "",
"Срок действия": self.validity_period or "",
"ИНН аудитора": self.auditor_inn or "",
"СНИЛС аудитора": self.auditor_snils or "",
"Причина аннулирования": self.cancellation_reason or "",
"Дата аннулирования": (
self.cancellation_date.strftime("%d.%m.%Y")
if self.cancellation_date
else ""
),
"URL источника": self.source_url or "",
"Дата сбора данных": self.parsed_at.strftime("%d.%m.%Y %H:%M:%S"),
}