Table of Contents

ELF - Elfish Log Factory

“Commercial traffic shouldn’t be this hard”

Overview

ELF (Elfish Log Factory) is a modern, web-based commercial traffic scheduling system designed specifically for broadcast radio stations. It provides comprehensive tools for managing advertisers, campaigns, commercials, and daily schedules with seamless integration to Rivendell Radio Automation.

The project was created to provide small and medium-sized radio stations with a free, professional-grade traffic scheduling solution that can be self-hosted or offered as a cloud-based SaaS service. ELF handles the complete workflow from campaign creation through auto-scheduling to exporting logs in Rivendell-compatible formats.

Key Capabilities:

Status

Item Value
Current Phase Active Development (MVP Phase 1)
Platform Cross-platform (Linux primary, Ubuntu 24.04 recommended)
Backend Language Python 3.11+ (Django 5.0)
Frontend Language JavaScript (React 18)
Database PostgreSQL 16
License MIT (intended for open-source release)
Version 1.0.0-alpha
Primary Integration Rivendell Radio Automation

Goals

Primary Goals

Secondary Goals

Long-Term Goals

Architecture

System Design

ELF follows a modern, decoupled three-tier architecture:

┌─────────────┐      ┌──────────────┐      ┌─────────────┐
│   React     │─────▶│    Django    │─────▶│ PostgreSQL  │
│  Frontend   │ HTTP │  REST API    │ SQL  │  Database   │
│  (Port 5173)│◀─────│  (Port 9000) │◀─────│             │
└─────────────┘ JSON └──────────────┘      └─────────────┘
                            │
                            │ MySQL
                            ▼
                      ┌──────────────┐
                      │  Rivendell   │
                      │   Database   │
                      └──────────────┘
                            │
                            ▼
                      ┌──────────────┐
                      │  Export Logs │
                      │  (ASCII)     │
                      └──────────────┘

Technology Stack

Backend:

Frontend:

Infrastructure:

Database Schema

Core Models:

API Structure

RESTful Endpoints:

Stations:          /api/stations/
Advertisers:       /api/advertisers/
Campaigns:         /api/campaigns/
Commercials:       /api/commercials/
DayParts:          /api/dayparts/
Daily Schedules:   /api/daily-schedules/
Scheduled Spots:   /api/scheduled-spots/
Rivendell Carts:   /api/rivendell-carts/
Separation Rules:  /api/separation-rules/

Custom Actions:
  POST /api/sync-rivendell/      - Sync cart inventory
  POST /api/export-log/          - Export daily log
  POST /api/auto-schedule/       - Auto-schedule campaign

Rivendell Integration

Cart Synchronization:

Export Format (Column-Aligned ASCII):

HH:MM:SS CCCCCC TITLE_60_CHARS_WIDE                            MM:SS
08:15:00 001234 Joe's Pizza - February Special                 00:30
08:47:00 001235 Smith Auto - Winter Clearance Sale             01:00
09:23:00 001236 Main Street Restaurant - Lunch Special         00:30

Import Process:

  1. ELF exports to configured path (e.g., /var/elf/exports/20240208.txt)
  2. Rivendell's RDLogManager imports via configured template
  3. Merges with music schedule from RDLibrary

Development

Prerequisites

System Requirements:

Optional:

Quick Start

Clone and Setup:

# Clone repository
git clone <repository-url>
cd elf-project
 
# Run quick start script
chmod +x quickstart.sh
./quickstart.sh
 
# Start backend (Terminal 1)
cd backend
source venv/bin/activate
python manage.py runserver 0.0.0.0:9000
 
# Start frontend (Terminal 2)
cd frontend
npm run dev

Access Points:

Development Setup

Backend Setup:

cd backend
 
# Create virtual environment
python3 -m venv venv
source venv/bin/activate
 
# Install dependencies
pip install -r requirements.txt
 
# Configure database
cp .env.example .env
# Edit .env with your settings
 
# Initialize database
python manage.py migrate
python manage.py createsuperuser
python manage.py collectstatic --noinput

Frontend Setup:

cd frontend
 
# Install dependencies
npm install
 
# Configure API endpoint
echo "VITE_API_URL=http://localhost:9000/api" > .env.local
 
# Start development server
npm run dev

Project Structure

elf-project/
├── backend/                    # Django backend
│   ├── config/                 # Django configuration
│   │   ├── settings.py        # Application settings
│   │   ├── urls.py            # URL routing
│   │   └── wsgi.py            # WSGI configuration
│   ├── elf/                   # Main application
│   │   ├── models.py          # Database models
│   │   ├── api/               # REST API layer
│   │   │   ├── serializers.py # Data serialization
│   │   │   └── views.py       # API endpoints
│   │   └── services/          # Business logic
│   │       ├── rivendell_service.py     # Rivendell sync
│   │       ├── export_service.py        # Log export
│   │       └── scheduling_service.py    # Auto-scheduler
│   ├── requirements.txt       # Python dependencies
│   └── manage.py              # Django CLI
├── frontend/                  # React frontend
│   ├── src/
│   │   ├── components/        # Reusable components
│   │   ├── pages/             # Page components
│   │   ├── services/          # API client
│   │   └── App.jsx            # Main application
│   ├── package.json           # Node dependencies
│   └── vite.config.js         # Build configuration
├── docker-compose.yml         # Docker orchestration
├── README.md                  # Project overview
├── SETUP_GUIDE.md            # Installation guide
├── DEVELOPMENT_GUIDE.md      # Developer documentation
└── TODO.md                   # Development roadmap

Coding Standards

Python (Backend):

JavaScript (Frontend):

Database:

Testing

Backend Tests:

# Run all tests
python manage.py test
 
# Run specific test
python manage.py test elf.tests.test_models
 
# With coverage
coverage run manage.py test
coverage report

Frontend Tests:

# Run tests
npm run test
 
# Run with coverage
npm run test:coverage

Common Commands

Database Management:

# Create migrations
python manage.py makemigrations
 
# Apply migrations
python manage.py migrate
 
# Access database shell
python manage.py dbshell

Rivendell Integration:

# Sync cart inventory
python manage.py sync_rivendell_carts --station 1 --group-name COMM
 
# Export daily log
python manage.py export_log --date 2024-02-08 --station 1

Roadmap

Phase 1: MVP Foundation (Current)

Status: In Progress

Phase 2: Core Features (Next 2 Months)

Status: Planned

Scheduling Enhancements:

User Interface:

Integration:

Phase 3: Advanced Features (Months 3-6)

Status: Planned

Business Features:

Reporting:

Scheduling Intelligence:

Phase 4: Cloud & SaaS (Months 6-12)

Status: Future

Infrastructure:

SaaS Features:

Mobile:

Future Enhancements

Additional Integrations:

Advanced Features:

Notes

Design Decisions

Why Django + React?

Why PostgreSQL?

Why Column-Aligned ASCII Export?

Auto-Scheduling Algorithm:

Technical Constraints

Database Connections:

Port Configuration:

File System:

Historical Context

Project Origin:

Development Philosophy:

Known Issues

Current Limitations:

Workarounds:

Contributing

How to Contribute:

Priority Areas:

Contact & Support

Project Resources:

Related Projects:

References

Documentation:

Standards:


Last Updated: February 19, 2024 Version: 1.0.0-alpha Maintainer: Rich Lawrence