Architecture
Database Directory Structure

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)

  • database/services/ β†’ MOVED to apps/backend/services/database_services/
  • database/retrieval/ β†’ MOVED to 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

Platform

Documentation

Community

Support

partnership@altsportsdata.comdev@altsportsleagues.ai

2025 Β© AltSportsLeagues.ai. Powered by AI-driven sports business intelligence.

πŸ€– AI-Enhancedβ€’πŸ“Š Data-Drivenβ€’βš‘ Real-Time