maybe good

This commit is contained in:
HotSwapp
2025-08-08 15:55:15 -05:00
parent ab6f163c15
commit b257a06787
80 changed files with 19739 additions and 0 deletions

228
app/models/lookups.py Normal file
View File

@@ -0,0 +1,228 @@
"""
Lookup table models based on legacy system analysis
"""
from sqlalchemy import Column, Integer, String, Text, Boolean, Float
from app.models.base import BaseModel
class Employee(BaseModel):
"""
Employee/Staff information
Corresponds to EMPLOYEE table in legacy system
"""
__tablename__ = "employees"
empl_num = Column(String(10), primary_key=True, index=True) # Employee number
first_name = Column(String(50)) # First name
last_name = Column(String(100), nullable=False) # Last name
title = Column(String(100)) # Job title
initials = Column(String(10)) # Initials for billing
rate_per_hour = Column(Float, default=0.0) # Default hourly rate
active = Column(Boolean, default=True) # Is employee active
email = Column(String(100)) # Email address
phone = Column(String(20)) # Phone number
def __repr__(self):
return f"<Employee(empl_num='{self.empl_num}', name='{self.first_name} {self.last_name}')>"
class FileType(BaseModel):
"""
File/Case types (areas of law)
Corresponds to FILETYPE table in legacy system
"""
__tablename__ = "file_types"
type_code = Column(String(45), primary_key=True, index=True) # Type code
description = Column(String(200), nullable=False) # Description
default_rate = Column(Float, default=0.0) # Default hourly rate
active = Column(Boolean, default=True) # Is type active
def __repr__(self):
return f"<FileType(code='{self.type_code}', description='{self.description}')>"
class FileStatus(BaseModel):
"""
File status codes
Corresponds to FILESTAT table in legacy system
"""
__tablename__ = "file_statuses"
status_code = Column(String(45), primary_key=True, index=True) # Status code
description = Column(String(200), nullable=False) # Description
active = Column(Boolean, default=True) # Is status active
sort_order = Column(Integer, default=0) # Display order
def __repr__(self):
return f"<FileStatus(code='{self.status_code}', description='{self.description}')>"
class TransactionType(BaseModel):
"""
Transaction types for ledger entries
Corresponds to TRNSTYPE table in legacy system
"""
__tablename__ = "transaction_types"
t_type = Column(String(1), primary_key=True, index=True) # Transaction type code
description = Column(String(100), nullable=False) # Description
debit_credit = Column(String(1)) # D=Debit, C=Credit
active = Column(Boolean, default=True) # Is type active
def __repr__(self):
return f"<TransactionType(type='{self.t_type}', description='{self.description}')>"
class TransactionCode(BaseModel):
"""
Transaction codes for ledger entries
Corresponds to TRNSLKUP table in legacy system
"""
__tablename__ = "transaction_codes"
t_code = Column(String(10), primary_key=True, index=True) # Transaction code
description = Column(String(200), nullable=False) # Description
t_type = Column(String(1)) # Associated transaction type
default_rate = Column(Float, default=0.0) # Default rate
active = Column(Boolean, default=True) # Is code active
def __repr__(self):
return f"<TransactionCode(code='{self.t_code}', description='{self.description}')>"
class State(BaseModel):
"""
US States and territories
Corresponds to STATES table in legacy system
"""
__tablename__ = "states"
abbreviation = Column(String(2), primary_key=True, index=True) # State abbreviation
name = Column(String(100), nullable=False) # Full state name
active = Column(Boolean, default=True) # Is state active for selection
def __repr__(self):
return f"<State(abbrev='{self.abbreviation}', name='{self.name}')>"
class GroupLookup(BaseModel):
"""
Customer group categories
Corresponds to GRUPLKUP table in legacy system
"""
__tablename__ = "group_lookups"
group_code = Column(String(45), primary_key=True, index=True) # Group code
description = Column(String(200), nullable=False) # Description
active = Column(Boolean, default=True) # Is group active
def __repr__(self):
return f"<GroupLookup(code='{self.group_code}', description='{self.description}')>"
class Footer(BaseModel):
"""
Statement footer templates
Corresponds to FOOTERS table in legacy system
"""
__tablename__ = "footers"
footer_code = Column(String(45), primary_key=True, index=True) # Footer code
content = Column(Text) # Footer content/template
description = Column(String(200)) # Description
active = Column(Boolean, default=True) # Is footer active
def __repr__(self):
return f"<Footer(code='{self.footer_code}', description='{self.description}')>"
class PlanInfo(BaseModel):
"""
Retirement plan information
Corresponds to PLANINFO table in legacy system
"""
__tablename__ = "plan_info"
plan_id = Column(String(45), primary_key=True, index=True) # Plan identifier
plan_name = Column(String(200), nullable=False) # Plan name
plan_type = Column(String(45)) # Type of plan (401k, pension, etc.)
sponsor = Column(String(200)) # Plan sponsor
administrator = Column(String(200)) # Plan administrator
address1 = Column(String(100)) # Address line 1
address2 = Column(String(100)) # Address line 2
city = Column(String(50)) # City
state = Column(String(2)) # State abbreviation
zip_code = Column(String(10)) # ZIP code
phone = Column(String(20)) # Phone number
active = Column(Boolean, default=True) # Is plan active
notes = Column(Text) # Additional notes
def __repr__(self):
return f"<PlanInfo(id='{self.plan_id}', name='{self.plan_name}')>"
class FormIndex(BaseModel):
"""
Form templates index
Corresponds to FORM_INX table in legacy system
"""
__tablename__ = "form_index"
form_id = Column(String(45), primary_key=True, index=True) # Form identifier
form_name = Column(String(200), nullable=False) # Form name
category = Column(String(45)) # Form category
active = Column(Boolean, default=True) # Is form active
def __repr__(self):
return f"<FormIndex(id='{self.form_id}', name='{self.form_name}')>"
class FormList(BaseModel):
"""
Form template content
Corresponds to FORM_LST table in legacy system
"""
__tablename__ = "form_list"
id = Column(Integer, primary_key=True, autoincrement=True)
form_id = Column(String(45), nullable=False) # Form identifier
line_number = Column(Integer, nullable=False) # Line number in form
content = Column(Text) # Line content
def __repr__(self):
return f"<FormList(form_id='{self.form_id}', line={self.line_number})>"
class PrinterSetup(BaseModel):
"""
Printer configuration
Corresponds to PRINTERS table in legacy system
"""
__tablename__ = "printers"
printer_name = Column(String(100), primary_key=True, index=True) # Printer name
description = Column(String(200)) # Description
driver = Column(String(100)) # Print driver
port = Column(String(20)) # Port/connection
default_printer = Column(Boolean, default=False) # Is default printer
active = Column(Boolean, default=True) # Is printer active
def __repr__(self):
return f"<Printer(name='{self.printer_name}', description='{self.description}')>"
class SystemSetup(BaseModel):
"""
System configuration settings
Corresponds to SETUP table in legacy system
"""
__tablename__ = "system_setup"
setting_key = Column(String(100), primary_key=True, index=True) # Setting key
setting_value = Column(Text) # Setting value
description = Column(String(200)) # Description of setting
setting_type = Column(String(20), default="STRING") # DATA type (STRING, INTEGER, FLOAT, BOOLEAN)
def __repr__(self):
return f"<SystemSetup(key='{self.setting_key}', value='{self.setting_value}')>"