Skip to content

pedro-alvesjr/traffic_monitor

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

29 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Traffic Monitor API

A REST API built with Django and Django REST Framework for monitoring road traffic on local road segments.

Features

  • Full CRUD for road segments (RoadSegment)
  • Full CRUD for average speed readings (TrafficReading)
  • Dynamic traffic intensity calculation based on speed
  • Total readings count per segment
  • User-based permissions:
    • Admin: can create, edit, and delete
    • Anonymous: read-only access
  • Admin interface via Django Admin
  • Interactive API documentation at /api/docs

How to Run the Project

Prerequisites

  • Python 3.12 or higher
  • pip

Installation

  1. Clone the repository:

    git clone https://github.com/pedro-alvesjr/traffic_monitor
    cd traffic_monitor
  2. (Optional) Create and activate a virtual environment:

    python -m venv venv
    venv\Scripts\activate  # On Windows

    or

    source venv/bin/activate  # On Linux/macOS
  3. Install the dependencies:

    pip install -r requirements.txt
  4. Apply the migrations:

    python manage.py migrate
  5. Create a superuser:

    python manage.py createsuperuser
  6. Start the development server:

    python manage.py runserver

Useful Endpoints:

  • API (road segments): [/api/roadsegments/]
  • API (readings): [/api/readings/]
  • Swagger Documentation: [/api/docs/]
  • Django Admin: [/admin/]

About

API REST for a Traffic Monitoring system using Django Rest Framework

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages