From faa4637b207f18592ee1144a3b959cfa6ca9e30a Mon Sep 17 00:00:00 2001 From: gitea_admin Date: Thu, 11 Jun 2026 11:04:33 +0000 Subject: [PATCH] Automated commit --- app/models.py | 60 +++++++++++++++++++++++++++++++-------------------- 1 file changed, 37 insertions(+), 23 deletions(-) diff --git a/app/models.py b/app/models.py index f149266..bdac2ab 100644 --- a/app/models.py +++ b/app/models.py @@ -1,30 +1,44 @@ -"""Database models. +from datetime import datetime, date, timezone -Define your SQLAlchemy models here. They will be auto-created on startup. +from sqlalchemy import Column, Date, DateTime, Integer, String, Text -Example: +from app.database import Base - class Category(Base): - __tablename__ = "categories" - id = Column(UUID(as_uuid=True), primary_key=True, default=uuid4) - name = Column(String(100), nullable=False) - created_at = Column(DateTime, default=lambda: datetime.now(timezone.utc)) -""" +class Permit(Base): + __tablename__ = "permits" -from datetime import datetime, timezone # noqa: F401 -from uuid import uuid4 # noqa: F401 + id = Column(Integer, primary_key=True, autoincrement=True) + # Core identification + permit_number = Column(String(100), nullable=True, index=True) + source_file = Column(String(500), nullable=True) + source_system = Column(String(100), nullable=True) -from sqlalchemy import ( # noqa: F401 - Boolean, - Column, - DateTime, - ForeignKey, - Integer, - String, - Text, -) -from sqlalchemy.dialects.postgresql import UUID # noqa: F401 -from sqlalchemy.orm import relationship # noqa: F401 + # Extracted metadata (FR-03) + applicant_name = Column(String(200), nullable=True, index=True) + permit_holder_name = Column(String(200), nullable=True) + issuer_name = Column(String(200), nullable=True) + location = Column(String(300), nullable=True, index=True) + issue_date = Column(Date, nullable=True) + expiry_date = Column(Date, nullable=True) + applicable_law = Column(String(200), nullable=True) + work_type = Column(String(200), nullable=True) + water_type = Column(String(200), nullable=True) + embankment_type = Column(String(200), nullable=True) -from app.database import Base # noqa: F401 + # AI classification + permit_type = Column(String(100), nullable=True, index=True) + + # Archive compliance (FR-09/10/11, BR-01 to BR-06) + archive_nomination = Column(String(50), nullable=True) # bewaren / vernietigen + retention_years = Column(Integer, nullable=True) + archive_status = Column(String(100), nullable=True) + + # Full text + extracted_text = Column(Text, nullable=True) + + # Processing + status = Column(String(50), default="processing") + error_message = Column(Text, nullable=True) + upload_date = Column(DateTime, default=lambda: datetime.now(timezone.utc)) + created_at = Column(DateTime, default=lambda: datetime.now(timezone.utc))