Automated commit
This commit is contained in:
parent
21ff817a1a
commit
faa4637b20
|
|
@ -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)
|
class Permit(Base):
|
||||||
name = Column(String(100), nullable=False)
|
__tablename__ = "permits"
|
||||||
|
|
||||||
|
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)
|
||||||
|
|
||||||
|
# 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)
|
||||||
|
|
||||||
|
# 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))
|
created_at = Column(DateTime, default=lambda: datetime.now(timezone.utc))
|
||||||
"""
|
|
||||||
|
|
||||||
from datetime import datetime, timezone # noqa: F401
|
|
||||||
from uuid import uuid4 # noqa: F401
|
|
||||||
|
|
||||||
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
|
|
||||||
|
|
||||||
from app.database import Base # noqa: F401
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue