A web application that analyzes and displays data about accidents on federal highways in Brazil through interactive charts and visualizations.
The project is divided into two main parts:
client/- React frontend applicationserver/- Python Flask backend APIdatabase/- SQLite database files containing accident data from 2007-2024
- View accident statistics across different Brazilian regions and states
- Filter data by:
- Year (2007-2024)
- Region (North, Northeast, South, Southeast, Center-West)
- State
- Visualize data through multiple chart types:
- Accident causes
- Accident classification
- Distribution by state/city
- Time of day analysis
- Weather conditions
- Zone analysis (Rural/Urban)
- React
- React Router
- Chart.js
- Tailwind CSS
- Vite
- Axios
- Python
- Flask
- SQLite3
- Clone the repository:
git clone <repository-url>
cd iacidente- Install backend dependencies
cd server
pip install -r requirements.txt- Install frontend dependencies
cd ../client
npm install- Start the backend server
cd server
python app.py
# The Flask server will run on http://localhost:5000- Start the frontend development server
# You need to open a new terminal
cd client
npm run dev
# The Vite server will run on http://localhost:5173GET /visaogeral
Returns accident statistics based on query parameters:
- year: Year of accidents (2007-2024)
- region: Brazilian region name
- state: State abbreviation (optional)
Example response:
{
"quant_acidents": 1234,
"cause": [...],
"classification": [...],
"moment_day": [...],
"weather_condition": [...],
"acident_zone": [...],
"states/cities": [...],
"coordenates": [...], # Only for years > 2016
}
client/: Frontend React applicationsrc/:assets/: Static assets (images, CSS and etc...)components/: Reusable React componentscontexts/: React contextshooks/: Custom React hookspages/: Page componentsreducers/: State management reducersroutes/: Route componentsmain.jsx/: Application entry pointRoutes.jsx/: Route definitions
index.html/:
server/: Frontend React applicationapp.py: Main application filetraffic_data.py: Data processing logic
database/: SQLite database files (2007-2024)
The data used in this application comes from PRF (Federal highway Police)
This project is open source and available under the MIT License
