The Urban Traffic Monitoring System is a comprehensive solution designed to help urban authorities monitor and manage traffic in real-time. It consists of a backend API built with Django and a mobile client application developed using React Native. The system integrates data visualization through Power BI to provide detailed analytics and insights.
- Python
- Django
- Django REST Framework
- Django REST Framework SimpleJWT
- drf-yasg for API documentation
- SQLite (for development)
-
Clone the repository:
git clone https://github.com/dcosodev/urban_traffic_monitoring.git cd urban_traffic_monitoring/backend
-
Create and activate a virtual environment:
python -m venv venv source venv/bin/activate # On Windows use `venv\Scripts\activate`
-
Install the dependencies:
pip install -r requirements.txt
-
Apply migrations:
python manage.py migrate
-
Run the development server:
python manage.py runserver
Endpoint | Method | Description |
---|---|---|
/api/trafficflow/ | GET | Get all traffic flows |
/api/trafficflow/ | POST | Create a new traffic flow |
/api/trafficflow/{id}/ | GET | Get a specific traffic flow |
/api/trafficflow/{id}/ | PUT | Update a specific traffic flow |
/api/trafficflow/{id}/ | DELETE | Delete a specific traffic flow |
/api/trafficincident/ | GET | Get all traffic incidents |
/api/trafficincident/ | POST | Create a new traffic incident |
/api/trafficincident/{id}/ | GET | Get a specific traffic incident |
/api/trafficincident/{id}/ | PUT | Update a specific traffic incident |
/api/trafficincident/{id}/ | DELETE | Delete a specific traffic incident |
/api/trafficsensor/ | GET | Get all traffic sensors |
/api/trafficsensor/ | POST | Create a new traffic sensor |
/api/trafficsensor/{id}/ | GET | Get a specific traffic sensor |
/api/trafficsensor/{id}/ | PUT | Update a specific traffic sensor |
/api/trafficsensor/{id}/ | DELETE | Delete a specific traffic sensor |
- React Native
- Expo
- React Navigation
- Axios
- React Native Chart Kit
-
Navigate to the mobile app directory:
cd ../mobile_app_new_version
-
Install the dependencies:
npm install
-
Start the Expo development server:
npx expo start
-
Open the app:
- For web: Press
w
to open in a web browser. - For Android: Press
a
to open in an Android emulator or scan the QR code with the Expo Go app.
- For web: Press
Power BI is used to create interactive and detailed dashboards for analyzing traffic data. Below are examples of visualizations created using Power BI:
- Traffic Flow by Hour: A line chart showing the number of vehicles detected per hour on different streets.
- Traffic Incidents and Response Times: A bar chart showing the number of incidents and average response times.
- Traffic Sensor Status: A column chart displaying the status of different traffic sensors.
- Heat Map of Traffic Incidents: A heat map showing the density of traffic incidents in various areas of the city.
The mobile app includes various charts to visualize traffic data in real-time. These charts are implemented using the react-native-chart-kit
library.
- Line Chart: Displays traffic flow over time.
- Bar Chart: Shows the number of traffic incidents.
- Pie Chart: Visualizes the distribution of traffic sensor statuses.
The Urban Traffic Monitoring System provides a robust solution for urban authorities to monitor and manage traffic effectively. By combining a powerful backend, a user-friendly mobile app, and advanced data visualization techniques, this system aims to improve traffic flow and reduce incidents in urban areas.
This project is licensed under the MIT License.