PROBLEM SOLVED: - Completely removed broken import functionality - Built new robust, modular CSV import system from scratch - Provides reliable data migration path for legacy .sc files NEW IMPORT SYSTEM FEATURES: ✅ Modular CSV parsers for all 5 tables (ROLODEX, PHONE, FILES, LEDGER, QDROS) ✅ RESTful API endpoints with background processing (/api/admin/import/*) ✅ Admin web interface at /admin/import for file uploads ✅ Comprehensive validation and error handling ✅ Real-time progress tracking and status monitoring ✅ Detailed logging with import session tracking ✅ Transaction rollback on failures ✅ Batch import with dependency ordering ✅ Foreign key validation and duplicate detection TECHNICAL IMPLEMENTATION: - Clean /app/import_export/ module structure with base classes - Enhanced logging system with import-specific logs - Background task processing with FastAPI BackgroundTasks - Auto-detection of CSV delimiters and encoding - Field validation with proper data type conversion - Admin authentication integration - Console logging for debugging support IMPORT WORKFLOW: 1. Admin selects table type and uploads CSV file 2. System validates headers and data structure 3. Background processing with real-time status updates 4. Detailed error reporting and success metrics 5. Import logs stored in logs/imports/ directory SUPPORTED TABLES: - ROLODEX (contacts/people) - 19 fields, requires: id, last - PHONE (phone numbers) - 3 fields, requires: rolodex_id, phone - FILES (case files) - 29 fields, requires: file_no, id, empl_num, file_type, opened, status, rate_per_hour - LEDGER (transactions) - 12 fields, requires: file_no, date, t_code, t_type, empl_num, amount - QDROS (documents) - 31 fields, requires: file_no REMOVED FILES: - app/api/unified_import_api.py - app/services/unified_import.py - app/api/flexible.py - app/models/flexible.py - templates/unified_import.html - templates/flexible.html - static/js/flexible.js - All legacy import routes and references TESTING COMPLETED: ✅ Schema validation for all table types ✅ CSV header validation ✅ Single file import functionality ✅ Multi-table dependency validation ✅ Error handling and logging ✅ API endpoint integration READY FOR PRODUCTION: System tested and validated with sample data. Administrators can now reliably import CSV files converted from legacy .sc files. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
75 lines
3.7 KiB
Python
75 lines
3.7 KiB
Python
"""
|
|
Import all models for easy access
|
|
"""
|
|
from .base import BaseModel
|
|
from .user import User
|
|
from .rolodex import Rolodex, Phone
|
|
from .files import File
|
|
from .ledger import Ledger
|
|
from .qdro import QDRO, QDROVersion, QDROCommunication
|
|
from .audit import AuditLog, LoginAttempt, ImportAudit, ImportAuditFile
|
|
from .auth import RefreshToken
|
|
from .additional import Deposit, Payment, FileNote, FormVariable, ReportVariable, Document
|
|
from .support import SupportTicket, TicketResponse, TicketStatus, TicketPriority, TicketCategory
|
|
from .pensions import (
|
|
Pension, PensionSchedule, MarriageHistory, DeathBenefit,
|
|
SeparationAgreement, LifeTable, NumberTable, PensionResult
|
|
)
|
|
from .templates import DocumentTemplate, DocumentTemplateVersion, TemplateKeyword
|
|
from .template_variables import (
|
|
TemplateVariable, VariableContext, VariableAuditLog,
|
|
VariableTemplate, VariableGroup, VariableType
|
|
)
|
|
from .document_workflows import (
|
|
DocumentWorkflow, WorkflowAction, WorkflowExecution, EventLog,
|
|
WorkflowTemplate, WorkflowSchedule, WorkflowTriggerType, WorkflowActionType,
|
|
ExecutionStatus, WorkflowStatus
|
|
)
|
|
from .billing import (
|
|
BillingBatch, BillingBatchFile, StatementTemplate, BillingStatement,
|
|
BillingStatementItem, StatementPayment, StatementStatus
|
|
)
|
|
from .timers import (
|
|
Timer, TimeEntry, TimerSession, TimerTemplate, TimerStatus, TimerType
|
|
)
|
|
from .file_management import (
|
|
FileStatusHistory, FileTransferHistory, FileArchiveInfo,
|
|
FileClosureChecklist, FileAlert, FileRelationship
|
|
)
|
|
from .jobs import JobRecord
|
|
from .deadlines import (
|
|
Deadline, DeadlineReminder, DeadlineTemplate, DeadlineHistory,
|
|
CourtCalendar, DeadlineType, DeadlinePriority, DeadlineStatus, NotificationFrequency
|
|
)
|
|
from .sessions import UserSession, SessionActivity, SessionConfiguration, SessionSecurityEvent
|
|
from .lookups import (
|
|
Employee, FileType, FileStatus, TransactionType, TransactionCode,
|
|
State, GroupLookup, Footer, PlanInfo, FormIndex, FormList,
|
|
PrinterSetup, SystemSetup, FormKeyword
|
|
)
|
|
|
|
__all__ = [
|
|
"BaseModel", "User", "Rolodex", "Phone", "File", "Ledger", "QDRO", "QDROVersion", "QDROCommunication",
|
|
"AuditLog", "LoginAttempt", "ImportAudit", "ImportAuditFile", "RefreshToken",
|
|
"Deposit", "Payment", "FileNote", "FormVariable", "ReportVariable", "Document",
|
|
"SupportTicket", "TicketResponse", "TicketStatus", "TicketPriority", "TicketCategory",
|
|
"Pension", "PensionSchedule", "MarriageHistory", "DeathBenefit",
|
|
"SeparationAgreement", "LifeTable", "NumberTable", "PensionResult",
|
|
"Employee", "FileType", "FileStatus", "TransactionType", "TransactionCode",
|
|
"State", "GroupLookup", "Footer", "PlanInfo", "FormIndex", "FormList",
|
|
"PrinterSetup", "SystemSetup", "FormKeyword", "TemplateKeyword",
|
|
"BillingBatch", "BillingBatchFile", "StatementTemplate", "BillingStatement",
|
|
"BillingStatementItem", "StatementPayment", "StatementStatus",
|
|
"Timer", "TimeEntry", "TimerSession", "TimerTemplate", "TimerStatus", "TimerType",
|
|
"FileStatusHistory", "FileTransferHistory", "FileArchiveInfo",
|
|
"FileClosureChecklist", "FileAlert", "FileRelationship",
|
|
"Deadline", "DeadlineReminder", "DeadlineTemplate", "DeadlineHistory",
|
|
"CourtCalendar", "DeadlineType", "DeadlinePriority", "DeadlineStatus", "NotificationFrequency",
|
|
"JobRecord",
|
|
"UserSession", "SessionActivity", "SessionConfiguration", "SessionSecurityEvent",
|
|
"TemplateVariable", "VariableContext", "VariableAuditLog",
|
|
"VariableTemplate", "VariableGroup", "VariableType",
|
|
"DocumentWorkflow", "WorkflowAction", "WorkflowExecution", "EventLog",
|
|
"WorkflowTemplate", "WorkflowSchedule", "WorkflowTriggerType", "WorkflowActionType",
|
|
"ExecutionStatus", "WorkflowStatus"
|
|
] |