Spaces:
Sleeping
Sleeping
| from sqlalchemy import Column, Integer, String, Float, DateTime, Text | |
| from sqlalchemy.sql import func | |
| from .database import Base | |
| class LoanApplication(Base): | |
| __tablename__ = "loan_applications" | |
| id = Column(Integer, primary_key=True, index=True) | |
| applicant_name = Column(String, default="Applicant") | |
| # Financial Inputs (Stored as stringified JSON or separate columns, but columns are safer for SQLite) | |
| gender = Column(String) | |
| married = Column(String) | |
| dependents = Column(String) | |
| education = Column(String) | |
| self_employed = Column(String) | |
| applicant_income = Column(Float) | |
| coapplicant_income = Column(Float) | |
| loan_amount = Column(Float) | |
| loan_amount_term = Column(Float) | |
| credit_history = Column(Float) | |
| property_area = Column(String) | |
| # Processed Results | |
| prediction = Column(String) # "Y" or "N" | |
| confidence = Column(Float) | |
| dti_ratio = Column(Float) | |
| # AI & Explanation Outputs | |
| explanation_text = Column(Text, nullable=True) | |
| optimized_suggestion = Column(Text, nullable=True) | |
| feature_importance_json = Column(Text, nullable=True) # stringified JSON | |
| benchmarks_json = Column(Text, nullable=True) # stringified JSON | |
| created_at = Column(DateTime(timezone=True), server_default=func.now()) | |