# dhana123-m/movie-box-revenue-forecast architecture

> Architecture diagram of the GitHub repository dhana123-m/movie-box-revenue-forecast, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-12-01). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/dhana123-m/movie-box-revenue-forecast
- Repository: https://github.com/dhana123-m/movie-box-revenue-forecast

## Overview

This is a full-stack movie box-office revenue forecasting product. A user enters movie characteristics in the forecast UI; the frontend sends requests to the FastAPI backend, which preprocesses inputs, runs the trained model, and returns a revenue estimate and performance category. Separate branches provide batch predictions, explanations, analytics, movie search, model diagnostics, and retraining. Training and preprocessing form an internal model-development layer. Some backend route-to-service details were not sampled, so those links are documented at the product level rather than asserting unverified calls.

Main entry points: [`backend/app/main.py`](https://github.com/dhana123-m/movie-box-revenue-forecast/blob/main/backend/app/main.py) (FastAPI application), [`frontend/src/App.tsx`](https://github.com/dhana123-m/movie-box-revenue-forecast/blob/main/frontend/src/App.tsx) (Page routing), [`frontend/src/services/api.ts`](https://github.com/dhana123-m/movie-box-revenue-forecast/blob/main/frontend/src/services/api.ts) (API client), [`backend/app/services/model_service.py`](https://github.com/dhana123-m/movie-box-revenue-forecast/blob/main/backend/app/services/model_service.py) (Model runtime)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_web["Web experience"]
  node_app["Page routing<br/>[App.tsx]"]
  node_forecast["Forecast form<br/>[ForecastPage.tsx]"]
  node_prediction_ui["Prediction result"]
  node_analytics_ui["Analytics view<br/>[AnalyticsPage.tsx]"]
  node_explorer_ui["Movie explorer"]
  node_model_ui["Model hub"]
  node_settings_ui["Settings<br/>[SettingsPage.tsx]"]
  node_api_client["API client<br/>[api.ts]"]
end

subgraph group_api["API and services"]
  node_backend["FastAPI application<br/>[main.py]"]
  node_predict_route["Prediction endpoints<br/>[predict.py]"]
  node_analytics_route["Analytics endpoints<br/>[analytics.py]"]
  node_movies_route["Movie endpoints<br/>[movies.py]"]
  node_model_route["Model info endpoints<br/>[model_info.py]"]
  node_training_route["Retraining endpoint<br/>[training.py]"]
  node_prediction_service["Prediction service"]
  node_analytics_service["Analytics service"]
  node_training_service["Training service"]
end

subgraph group_data["Movie data"]
  node_database[("SQLite database<br/>[database.py]")]
  node_db_service["Database seeding<br/>[db_service.py]"]
end

subgraph group_ml["Model runtime"]
  node_model_service["Model runtime<br/>[model_service.py]"]
  node_preprocessor["Revenue preprocessor<br/>[preprocessor.py]"]
  node_explain["Sensitivity analysis<br/>[explain.py]"]
end

subgraph group_training["Model development"]
  node_feature_engineering["Feature engineering"]
  node_trainer["Training pipeline<br/>[train.py]"]
  node_evaluation["Model evaluation<br/>[evaluate.py]"]
end

node_user(("Movie user"))

node_user -->|"uses"| node_app
node_app -->|"routes to"| node_forecast
node_app -->|"routes to"| node_analytics_ui
node_app -->|"routes to"| node_explorer_ui
node_app -->|"routes to"| node_model_ui
node_app -->|"routes to"| node_settings_ui
node_forecast -.->|"requests"| node_api_client
node_api_client -->|"sends API requests"| node_backend
node_backend -->|"registers"| node_predict_route
node_backend -->|"registers"| node_analytics_route
node_backend -->|"registers"| node_movies_route
node_backend -->|"registers"| node_model_route
node_backend -->|"registers"| node_training_route
node_predict_route -.->|"dispatches"| node_prediction_service
node_prediction_service -.->|"predicts with"| node_model_service
node_model_service -->|"transforms inputs"| node_preprocessor
node_model_service -.->|"uses for explanations"| node_explain
node_predict_route -->|"returns estimates"| node_prediction_ui
node_analytics_route -.->|"dispatches"| node_analytics_service
node_analytics_ui -->|"requests analytics"| node_api_client
node_explorer_ui -->|"requests movie data"| node_api_client
node_model_ui -->|"requests model metrics"| node_api_client
node_training_route -.->|"dispatches"| node_training_service
node_settings_ui -->|"triggers retraining"| node_api_client
node_movies_route -->|"queries"| node_database
node_backend -->|"seeds database"| node_db_service
node_db_service -->|"writes movies"| node_database
node_feature_engineering -->|"provides processed data"| node_trainer
node_trainer -->|"evaluates model"| node_evaluation
node_trainer -->|"uses feature pipeline"| node_preprocessor
node_backend -->|"loads model at startup"| node_model_service

click node_app "https://github.com/dhana123-m/movie-box-revenue-forecast/blob/main/frontend/src/App.tsx"
click node_forecast "https://github.com/dhana123-m/movie-box-revenue-forecast/blob/main/frontend/src/pages/ForecastPage.tsx"
click node_prediction_ui "https://github.com/dhana123-m/movie-box-revenue-forecast/blob/main/frontend/src/components/forecast/PredictionResultCard.tsx"
click node_analytics_ui "https://github.com/dhana123-m/movie-box-revenue-forecast/blob/main/frontend/src/pages/AnalyticsPage.tsx"
click node_explorer_ui "https://github.com/dhana123-m/movie-box-revenue-forecast/blob/main/frontend/src/pages/MovieExplorerPage.tsx"
click node_model_ui "https://github.com/dhana123-m/movie-box-revenue-forecast/blob/main/frontend/src/pages/ModelPerformancePage.tsx"
click node_settings_ui "https://github.com/dhana123-m/movie-box-revenue-forecast/blob/main/frontend/src/pages/SettingsPage.tsx"
click node_api_client "https://github.com/dhana123-m/movie-box-revenue-forecast/blob/main/frontend/src/services/api.ts"
click node_backend "https://github.com/dhana123-m/movie-box-revenue-forecast/blob/main/backend/app/main.py"
click node_predict_route "https://github.com/dhana123-m/movie-box-revenue-forecast/blob/main/backend/app/routes/predict.py"
click node_analytics_route "https://github.com/dhana123-m/movie-box-revenue-forecast/blob/main/backend/app/routes/analytics.py"
click node_movies_route "https://github.com/dhana123-m/movie-box-revenue-forecast/blob/main/backend/app/routes/movies.py"
click node_model_route "https://github.com/dhana123-m/movie-box-revenue-forecast/blob/main/backend/app/routes/model_info.py"
click node_training_route "https://github.com/dhana123-m/movie-box-revenue-forecast/blob/main/backend/app/routes/training.py"
click node_prediction_service "https://github.com/dhana123-m/movie-box-revenue-forecast/blob/main/backend/app/services/prediction_service.py"
click node_analytics_service "https://github.com/dhana123-m/movie-box-revenue-forecast/blob/main/backend/app/services/analytics_service.py"
click node_training_service "https://github.com/dhana123-m/movie-box-revenue-forecast/blob/main/backend/app/services/training_service.py"
click node_database "https://github.com/dhana123-m/movie-box-revenue-forecast/blob/main/backend/app/database.py"
click node_db_service "https://github.com/dhana123-m/movie-box-revenue-forecast/blob/main/backend/app/services/db_service.py"
click node_feature_engineering "https://github.com/dhana123-m/movie-box-revenue-forecast/blob/main/backend/training/feature_engineering.py"
click node_trainer "https://github.com/dhana123-m/movie-box-revenue-forecast/blob/main/backend/training/train.py"
click node_evaluation "https://github.com/dhana123-m/movie-box-revenue-forecast/blob/main/backend/training/evaluate.py"
click node_model_service "https://github.com/dhana123-m/movie-box-revenue-forecast/blob/main/backend/app/services/model_service.py"
click node_preprocessor "https://github.com/dhana123-m/movie-box-revenue-forecast/blob/main/backend/app/ml/preprocessor.py"
click node_explain "https://github.com/dhana123-m/movie-box-revenue-forecast/blob/main/backend/app/ml/explain.py"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_app,node_forecast,node_prediction_ui,node_analytics_ui,node_explorer_ui,node_model_ui,node_settings_ui,node_api_client,node_user toneBlue
class node_backend,node_predict_route,node_analytics_route,node_movies_route,node_model_route,node_training_route,node_prediction_service,node_analytics_service,node_training_service toneAmber
class node_database,node_db_service toneMint
class node_model_service,node_preprocessor,node_explain toneRose
class node_feature_engineering,node_trainer,node_evaluation toneIndigo
```

## Components

### Web experience

- [Page routing](https://github.com/dhana123-m/movie-box-revenue-forecast/blob/main/frontend/src/App.tsx): `frontend/src/App.tsx`
- [Forecast form](https://github.com/dhana123-m/movie-box-revenue-forecast/blob/main/frontend/src/pages/ForecastPage.tsx): `frontend/src/pages/ForecastPage.tsx`
- [Prediction result](https://github.com/dhana123-m/movie-box-revenue-forecast/blob/main/frontend/src/components/forecast/PredictionResultCard.tsx): `frontend/src/components/forecast/PredictionResultCard.tsx`
- [Analytics view](https://github.com/dhana123-m/movie-box-revenue-forecast/blob/main/frontend/src/pages/AnalyticsPage.tsx): `frontend/src/pages/AnalyticsPage.tsx`
- [Movie explorer](https://github.com/dhana123-m/movie-box-revenue-forecast/blob/main/frontend/src/pages/MovieExplorerPage.tsx): `frontend/src/pages/MovieExplorerPage.tsx`
- [Model hub](https://github.com/dhana123-m/movie-box-revenue-forecast/blob/main/frontend/src/pages/ModelPerformancePage.tsx): `frontend/src/pages/ModelPerformancePage.tsx`
- [Settings](https://github.com/dhana123-m/movie-box-revenue-forecast/blob/main/frontend/src/pages/SettingsPage.tsx): `frontend/src/pages/SettingsPage.tsx`
- [API client](https://github.com/dhana123-m/movie-box-revenue-forecast/blob/main/frontend/src/services/api.ts): `frontend/src/services/api.ts`

### API and services

- [FastAPI application](https://github.com/dhana123-m/movie-box-revenue-forecast/blob/main/backend/app/main.py): `backend/app/main.py`
- [Prediction endpoints](https://github.com/dhana123-m/movie-box-revenue-forecast/blob/main/backend/app/routes/predict.py): `backend/app/routes/predict.py`
- [Analytics endpoints](https://github.com/dhana123-m/movie-box-revenue-forecast/blob/main/backend/app/routes/analytics.py): `backend/app/routes/analytics.py`
- [Movie endpoints](https://github.com/dhana123-m/movie-box-revenue-forecast/blob/main/backend/app/routes/movies.py): `backend/app/routes/movies.py`
- [Model info endpoints](https://github.com/dhana123-m/movie-box-revenue-forecast/blob/main/backend/app/routes/model_info.py): `backend/app/routes/model_info.py`
- [Retraining endpoint](https://github.com/dhana123-m/movie-box-revenue-forecast/blob/main/backend/app/routes/training.py): `backend/app/routes/training.py`
- [Prediction service](https://github.com/dhana123-m/movie-box-revenue-forecast/blob/main/backend/app/services/prediction_service.py): `backend/app/services/prediction_service.py`
- [Analytics service](https://github.com/dhana123-m/movie-box-revenue-forecast/blob/main/backend/app/services/analytics_service.py): `backend/app/services/analytics_service.py`
- [Training service](https://github.com/dhana123-m/movie-box-revenue-forecast/blob/main/backend/app/services/training_service.py): `backend/app/services/training_service.py`

### Movie data

- [SQLite database](https://github.com/dhana123-m/movie-box-revenue-forecast/blob/main/backend/app/database.py): `backend/app/database.py`
- [Database seeding](https://github.com/dhana123-m/movie-box-revenue-forecast/blob/main/backend/app/services/db_service.py): `backend/app/services/db_service.py`

### Model runtime

- [Model runtime](https://github.com/dhana123-m/movie-box-revenue-forecast/blob/main/backend/app/services/model_service.py): `backend/app/services/model_service.py`
- [Revenue preprocessor](https://github.com/dhana123-m/movie-box-revenue-forecast/blob/main/backend/app/ml/preprocessor.py): `backend/app/ml/preprocessor.py`
- [Sensitivity analysis](https://github.com/dhana123-m/movie-box-revenue-forecast/blob/main/backend/app/ml/explain.py): `backend/app/ml/explain.py`

### Model development

- [Feature engineering](https://github.com/dhana123-m/movie-box-revenue-forecast/blob/main/backend/training/feature_engineering.py): `backend/training/feature_engineering.py`
- [Training pipeline](https://github.com/dhana123-m/movie-box-revenue-forecast/blob/main/backend/training/train.py): `backend/training/train.py`
- [Model evaluation](https://github.com/dhana123-m/movie-box-revenue-forecast/blob/main/backend/training/evaluate.py): `backend/training/evaluate.py`

### Other components

- **Movie user**

## Connections

- Movie user → Page routing: uses (evidence: `README.md`)
- Page routing → Forecast form: routes to (evidence: `frontend/src/App.tsx`)
- Page routing → Analytics view: routes to (evidence: `frontend/src/App.tsx`)
- Page routing → Movie explorer: routes to (evidence: `frontend/src/App.tsx`)
- Page routing → Model hub: routes to (evidence: `frontend/src/App.tsx`)
- Page routing → Settings: routes to (evidence: `frontend/src/App.tsx`)
- Forecast form → API client: requests
- API client → FastAPI application: sends API requests (evidence: `README.md`)
- FastAPI application → Prediction endpoints: registers (evidence: `backend/app/main.py`)
- FastAPI application → Analytics endpoints: registers (evidence: `backend/app/main.py`)
- FastAPI application → Movie endpoints: registers (evidence: `backend/app/main.py`)
- FastAPI application → Model info endpoints: registers (evidence: `backend/app/main.py`)
- FastAPI application → Retraining endpoint: registers (evidence: `backend/app/main.py`)
- Prediction endpoints → Prediction service: dispatches
- Prediction service → Model runtime: predicts with
- Model runtime → Revenue preprocessor: transforms inputs (evidence: `backend/app/services/model_service.py`)
- Model runtime → Sensitivity analysis: uses for explanations (evidence: `backend/app/services/model_service.py`)
- Prediction endpoints → Prediction result: returns estimates (evidence: `README.md`)
- Analytics endpoints → Analytics service: dispatches
- Analytics view → API client: requests analytics (evidence: `README.md`)
- Movie explorer → API client: requests movie data (evidence: `README.md`)
- Model hub → API client: requests model metrics (evidence: `frontend/src/pages/ModelPerformancePage.tsx`)
- Retraining endpoint → Training service: dispatches
- Settings → API client: triggers retraining (evidence: `README.md`)
- Movie endpoints → SQLite database: queries (evidence: `backend/app/routes/movies.py`)
- FastAPI application → Database seeding: seeds database (evidence: `backend/app/main.py`)
- Database seeding → SQLite database: writes movies (evidence: `backend/app/services/db_service.py`)
- Feature engineering → Training pipeline: provides processed data (evidence: `README.md`)
- Training pipeline → Model evaluation: evaluates model (evidence: `backend/training/train.py`)
- Training pipeline → Revenue preprocessor: uses feature pipeline (evidence: `backend/training/train.py`)
- FastAPI application → Model runtime: loads model at startup (evidence: `backend/app/main.py`)
