Skip to content
This repository was archived by the owner on Aug 10, 2026. It is now read-only.

Repository files navigation

Archived: This repository is a historical academic artifact and is no longer actively maintained. It is public solely for reference purposes and is published without an open-source license. Public availability should not be interpreted as permission to use, modify, or redistribute the material.

LEIA A VERSÃO FINAL DO TCC EM PORTUGUÊS

Bus PIS System

A bus passenger information system with location tracking, API services, and real-time data processing.

Architecture

The Compose stack contains the following services and supporting tools:

  • BusAPI: Ingests vehicle location updates and publishes them to RabbitMQ
  • BusLocationHandler: Processes location messages and stores them in PostgreSQL/PostGIS
  • BusPredictionHandler: Consumes processed location updates and writes arrival predictions to Redis
  • PisAPI: Client-facing API for locations, schedules, and predictions
  • PisWebFrontend: React web application for bus tracking and stop information
  • BusPlaybackSimulator: Replays historical parquet data
  • BusSqlDatabase (PostgreSQL/PostGIS): Manages GTFS schedule database
  • Redis Stack: Provides the Redis cache and RedisInsight UI
  • RabbitMQ: Message broker for real-time communication
  • PgAdmin: Database administration interface

The primary data flow is:

flowchart TB
  subgraph Input["Data Input"]
    simulator[BusPlaybackSimulator]
    api[BusAPI]
  end

  subgraph Messaging["Messaging"]
    rabbit[RabbitMQ]
  end

  subgraph Processing["Processing"]
    location[BusLocationHandler]
    prediction[BusPredictionHandler]
  end

  subgraph Storage["Storage"]
    postgres[(PostgreSQL)]
    redis[(Redis)]
  end

  subgraph Client["Client Access"]
    pis[PisAPI]
    frontend[PisWebFrontend]
  end

  simulator --> api --> rabbit
  rabbit --> location --> redis
  location --> rabbit
  rabbit --> prediction --> redis
  postgres --> pis
  redis --> pis
  pis --> frontend
Loading

Quick Start

Prerequisites

  • Docker and Docker Compose installed
  • Git with submodules initialized
  • Python 3.8+ and the GTFS import tool dependencies (only when generating the schedule schema)
  • AWS CLI (optional; only required to download parquet files from S3)

1. Clone and Initialize Submodules

git clone --recursive https://github.com/Bollos00/BusPisSystem.git
cd BusPisSystem

# If already cloned, initialize submodules:
git submodule update --init --recursive

2. Environment Configuration

Copy and modify the environment file:

cp .env.example .env
# Edit .env with your preferred settings

3. Prepare the Schedule Schema

See BusSqlDatabase/README.md for instructions on preparing GTFS data and generating the schedule schema.

4. Start All Services

# Start all services
docker compose up -d

# Start infrastructure services only (if needed)
docker compose up -d postgres_db rabbitmq_mq redis_stack

5. Verify Services

The externally published services are available at the following URLs:

6. Basic Operations

# View service status
docker compose ps

# View logs for all services
docker compose logs -f

# View logs for specific service
docker compose logs -f bus_api

# Stop all services
docker compose down

# Restart specific service
docker compose restart bus_api

# Build all services
docker compose build

# Build specific service
docker compose build bus_api

# Clean up (removes Compose-managed named volumes and stored database data)
docker compose down -v --remove-orphans

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages