Source: data_layer/docs/README-STRUCTURE.md
Database Directory Structure
Purpose: Data, prompts, schemas, and templates ONLY - NO Python code
Python code belongs in: apps/backend/
π What Belongs in database/
β YES (Data & Configuration)
database/
βββ output-styles/ # Prompt components, schemas, templates
β βββ prompts/
β β βββ workflows/*.md # Workflow definitions
β β βββ agents/*.md # Agent definitions
β β βββ components/*.md # Reusable prompt components
β βββ schemas/
β β βββ seeds/*.json # JSON schemas
β βββ examples/
β β βββ seeds/*.json # Few-shot examples
β βββ templates/
β βββ html/*.html # HTML templates
β βββ contracts/*.md # Contract templates
βββ kb_catalog/ # Knowledge base catalog (data)
βββ scripts/ # Data processing scripts (OK if needed)β NO (Python Application Logic)
β MOVED todatabase/services/apps/backend/services/database_services/β MOVED todatabase/retrieval/apps/backend/services/retrieval/
π What Belongs in apps/backend/
β ALL Python Application Code
apps/backend/
βββ services/ # Business logic services
β βββ database_services/ # β
MOVED FROM database/services/
β β βββ league_storage.py
β β βββ user_preferences.py
β βββ retrieval/ # β
MOVED FROM database/retrieval/
β β βββ prompt_intelligence.py
β βββ workflow_orchestrator.py
β βββ dynamic_workflow_builder.py
β βββ betting_service.py
β βββ pipeline_service.py
β βββ ...
βββ models/ # Pydantic models
βββ routers/ # FastAPI routers
βββ stores/ # InMemoryStore, prompt store
βββ agents/ # Agent coordinators
βββ server.py # FastAPI appπ― Principle
database/ = Data files only (prompts, schemas, templates, examples)
apps/backend/ = All Python code (services, models, routers, etc.)
This separation ensures:
- β Clear what's data vs code
- β Data can be updated without touching Python
- β Python code is all in one place
- β No confusion about where logic lives
π Import Updates Needed
After moving files, update imports:
# OLD:
from database.services.league_storage import LeagueStorage
from database.retrieval.prompt_intelligence import PromptIntelligence
# NEW:
from apps.backend.services.database_services.league_storage import LeagueStorage
from apps.backend.services.retrieval.prompt_intelligence import PromptIntelligenceβ Migration Complete
- β
database/services/βapps/backend/services/database_services/ - β
database/retrieval/βapps/backend/services/retrieval/ - β
database/now contains only data files - β
apps/backend/contains all Python application logic