Skip to content

mach1el/billsec-portal

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

11 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

πŸ“ž Django CDR Reporting Service

A Django-based Call Detail Record (CDR) Reporting Service that:

  • Filters CDRs by date range & project.
  • Displays a full CDR report with all columns.
  • Exports data to CSV.
  • Visualizes SIP reason distribution using a pie chart.
  • Runs inside Docker with PostgreSQL support.

πŸ“‘ Table of Contents


πŸš€ Features

  • πŸ“Š Full CDR Reporting with all fields.
  • πŸ” Filter by Date & Project Schema.
  • πŸ“‚ Export to CSV.
  • 🐳 Runs in Docker with PostgreSQL.

πŸ—‚ Database Design

1️⃣ Main Django Database

  • Stores:
    • User auth & admin accounts
    • Project schema connection info
    • UI configuration
    • Filtered queries

2️⃣ CDR Data Warehouse (central_data)

  • Stores CDR data per project.
  • Each project gets its own table under the same schema:
    • Table name = project schema field
  • Populated by a separate Go service at the end of each day.

πŸ› οΈ Go-based CDR Import Service

  • Polls all registered project databases.
  • Aggregates daily CDR records.
  • Imports the data into central_data under a table named after the project schema.
  • Django UI queries from these tables on demand.

βš™οΈ Installation

1️⃣ Clone the Repository

git clone https://github.com/yourusername/django-cdr-service.git
cd django-cdr-service

2️⃣ Set Up Virtual Environment (Optional)

python -m venv venv
source venv/bin/activate  # macOS/Linux
venv\Scripts\activate     # Windows

3️⃣ Install Dependencies

pip install -r requirements.txt

4️⃣ Run Migrations

python manage.py migrate

5️⃣ Create a Superuser

python manage.py createsuperuser

6️⃣ Run Development Server

python manage.py runserver

Then, visit http://localhost:8000.

🐳 Docker Deployment

1️⃣ Build Docker Image

docker build -t django-cdr .

2️⃣ Run Docker Container

docker run -p 8000:8000 django-cdr

3️⃣ Using Docker Compose

docker-compose up -d --build

πŸ”§ Configuration

1️⃣ Database Setup

  • Uses PostgreSQL (default) or MySQL.
  • Set variables in .env or docker-compose.yml.

Example .env file:

# Main database
DB_NAME=billsec_portal
DB_USER=billsec_portal
DB_PASSWORD=billsec_portal
DB_HOST=localhost
DB_PORT=5432

# Data Central for store cdr
DC_DB_NAME=data_central
DC_DB_USER=data_central
DC_DB_PASSWORD=data_central
DC_DB_HOST=localhost
DC_DB_PORT=2345

2️⃣ Modify Settings

Edit settings.py:

DATABASES = {
  'default': dj_database_url.config(default=os.getenv('DATABASE_URL'))
}

πŸ“Š CDR Report Filtering

The report supports:

  • Date Range Selection (From & To).
  • Project Schema Selection.
  • Full Table Display (All Fields).
  • CSV Export.

🎨 Technologies Used

  • Django (Python)
  • PostgreSQL (Database)
  • Gunicorn (Production WSGI Server)
  • Docker & Docker Compose (Containerization)

πŸ“œ API Endpoints

Method Endpoint Description
GET /cdr View full CDR report
POST /cdr/export Export report as CSV
GET /projects Manage Projects
GET /billing View Fare Report

πŸ›  Development & Contribution

  1. Fork & Clone the Repo.
  2. Set up a virtual environment.
  3. Submit a Pull Request with improvements.

πŸ”₯ Future Enhancements

  • πŸ“₯ CDR Data Import (SFTP, API).
  • πŸ“Š Advanced Analytics & Charts.
  • πŸ”„ Live CDR Updates.

πŸ“ž Support

For issues, create a GitHub issue or contact [email protected].

πŸš€ Enjoy your fully Dockerized Django CDR Reporting Service! πŸŽ‰