FeedbackTrail is a legacy automated, client-to-cloud citizen feedback management prototype designed for smart city public transit systems. The system provides an automated pipeline from public terminal data entry to real-time administrative analytics using Casablanca's tramway network (Casatramways) as an operational baseline
The application is structured into three decoupled pillars connected by a centralized cloud database:
[Tkinter Panel Kiosk] ──(Logs real-time transit data)──► [Google Drive CSV]
│
[Analytical Dashboard] ◄──(Pulls & aggregates live data)───────┘
-
Interactive Client Kiosk (
main.py):- Simulates stationary terminals deployed at tram stops.
- Multi-language interface supporting French, Arabic, and English configurations.
- Voice Dictation: Integrates Speech-to-Text recording and Google Speech Recognition to ensure accessibility for non-literate citizens.
- AI Classification: Passes natural language input (text or transcribed voice) to the OpenAI API to categorize complaints into standardized categories in real-time.
-
Cloud Database Pipeline (
Google Drive API):- Acts as a serverless, shared relational datastore.
- Leverages a secure Google Service Account to download, append, and update a centralized CSV log in-memory.
-
Operational Analytics Dashboard (
app.py):- A single-page, real-time web application built using Dash and Plotly.
- KPI Indicators: Displays aggregated metrics including Total Complaints, Active Kiosks, and Top Complaint Category.
- Analytical Charts: Features time-series charts showing Daily Complaint Intensity and vertical bar charts mapping Category Distribution.
- Casablanca Hotspot Map: Plots geospatial density coordinates over Casablanca using Plotly's open-source maps. Bubbles scale in size and color based on localized complaint volume.
- Unified Callback Engine: Sidebar dropdowns for Category, Tram ID, and Date Ranges instantly filter the dataset and animate all visuals in real-time.
In order to demonstrate the dashboard's analytical capabilities without exposing sensitive production logs, the repository includes an offline data generator (generate_data.py). It populates the database with 2,000 historical records designed to mirror actual transit operations:
- Commute Spikes: Timestamps are weighted to peak during morning (07:30–09:30) and evening (17:00–19:30) rush hours, and restricted strictly to active tramway operating hours (06:00 to 23:30).
- Language Weights: Distributed proportionally to reflect Casablanca's user demographics (60% French, 35% Arabic, 5% English).
- Station Hotspots: Distributes volume to create high-density intersections on the Mapbox map (Abdelmoumen and Casa Voyageurs representing high-traffic transfer hubs).
- Pre-Planted Anomalies: Injects specific vehicle and seasonal trends (e.g., elevated delay records on
Tram12and a summer equipment stressor spike onTram05) to test administrative drill-down filters.
To run this project locally, you will need:
- Python 3.8+
- An OpenAI API Key (configured for text classification).
- A Google Cloud Service Account credential file (
credentials.json) with Google Drive API access enabled. - A shared CSV file hosted on your Google Drive.
-
Clone the repository:
git clone https://github.com/ALZ-11/FeedbackTrail.git cd FeedbackTrail -
Install dependencies:
pip install -r requirements.txt
(Note:
pyaudiomay require manual system-level installation depending on your operating system). -
Configure Environment Variables:
- Copy the template environment file:
cp .env.example .env
- Open
.envand fill in yourOPENAI_API_KEY, your Google DriveGOOGLE_DRIVE_FILE_ID, and make sure your Service Account JSON file is saved ascredentials.jsonin your root folder.
- Copy the template environment file:
To populate your Google Drive CSV with the 2,000-row historical baseline:
python generate_data.py(Make sure to upload the resulting reclamations_history.csv to Google Drive and configure your .env with its File ID, sharing Editor access with your service account email).
To run the terminal terminal and submit complaints:
python main.pyTo boot up the analytical server:
python app.pyOpen your browser and navigate to: http://127.0.0.1:8050/