Database Models
Overview
Database models are organized into domain-specific modules under ai4drpm.db.models:
auth/ - User and authentication models (User, RefreshToken)
resources/ - Legal resources and provisions (LegalResource, LegalProvision, LegalProvisionClassification)
analyses/ - Analysis types (DescriptionAnalysis, DataAnalysis, SolutionsAnalysis, InteroperabilityAnalysis, DataFlowsAnalysis)
categories/ - Hierarchical category taxonomy
classifiers/ - ML classifier metadata and training data
prompts/ - LLM prompt templates
pipelines/ - Haystack pipeline definitions and executions
queries/ - SPARQL query storage
tasks/ - Celery task tracking
token_usage - LLM token usage tracking
Model Architecture
Base Model
All models inherit from SQLAlchemy’s declarative base defined in ai4drpm.db.base.
Relationships
Models use SQLAlchemy relationships for:
Foreign key relationships
One-to-many and many-to-one associations
Many-to-many through association tables
Lazy and eager loading configurations
Association Tables
Many-to-many relationships are managed through association tables defined alongside their related models.