Back to Projects

Busway Ticket Chatbot

A Spring Boot web app for busway ticket reservations using a Neo4j graph database and an AIML-powered chatbot.

2024

Duration

Feb 2024 – Mar 2024

Contributors

2 contributors

Technologies

5+ tech

Busway Ticket Chatbot

Busway Ticket Chatbot is a Spring Boot web application for busway ticket reservations. It models the transit network as a graph in Neo4j and lets travellers book through a conversational, AIML-powered chatbot instead of a stack of forms.

The idea#

Ticket booking interfaces are usually a sequence of dropdowns: departure, arrival, date, time, seat. That works for people who know exactly what they want and are comfortable with web forms. It works less well for someone who just wants to ask "is there a bus to the university after 6?"

This project explored a more natural interface — a chatbot that understands booking questions — and paired it with a data model that matches how a transit network actually looks: not tables, but a graph of stations, buses, drivers and trips.

What it does#

  • Conversational booking — the chatbot handles requests like "Book me a seat from Casablanca to Rabat tomorrow at 10am" and travel questions about routes and schedules
  • Trip browser — a table of available trips with route, departure and arrival times, driver and seats left
  • Online reservation — pick a trip, choose a seat, and confirm in one flow, at any hour
  • Graph-based data — Neo4j models the relationships between stations, buses, drivers and trips
  • Schedule management — an admin interface to add and update trips and stations
  • Server-rendered UI — Thymeleaf templates with Bootstrap

Architecture#

Browser
  │  HTTP
  ▼
Spring Boot (MVC)
  ├── Thymeleaf controllers
  ├── BookingService
  ├── ChatbotService (AIML engine)
  └── Spring Data Neo4j
         │
       Neo4j (graph database)

The chatbot is not a separate system: it is a service inside the same Spring Boot application, which means a recognized intent can call exactly the same booking service the forms use.

Modeling transit as a graph#

A transit network is a graph whether you store it as one or not. Storing it in a relational database means expressing "find every trip from A to B" as a chain of joins, and every extra hop is another join. In Neo4j, the relationships are first-class:

(Station)-[:SERVED_BY]->(Bus)-[:DRIVEN_BY]->(Driver)
(Bus)-[:OPERATES]->(Trip)-[:DEPARTS_FROM]->(Station)
(Trip)-[:ARRIVES_AT]->(Station)
(Ticket)-[:FOR_TRIP]->(Trip)
(Passenger)-[:HOLDS]->(Ticket)

With that model, route and schedule lookups become traversals: start at a station, follow the trips that depart from it, keep the ones that arrive where the passenger is going. Spring Data Neo4j maps these nodes and relationships to Java entities, so services work with objects while the queries stay graph-shaped.

Integrating the chatbot#

AIML (Artificial Intelligence Markup Language) describes a conversation as patterns and templates: when a message matches a pattern, the bot answers with the template. On its own, that gives canned replies. The useful part is what happens between match and reply:

  1. The user's message is matched against AIML pattern files.
  2. A matched intent — search trips, book a seat, ask for a schedule — is dispatched to a Spring service method.
  3. The service runs the corresponding Neo4j query.
  4. The result is formatted back into a conversational response.

The hardest part was keeping answers contextually accurate during a booking. A booking takes several turns — where from, where to, when, which seat — and the bot has to remember what was already said. AIML's conversation context, combined with state held on the server side of the session, keeps those turns tied together so "the 10am one" refers to the trip the bot just listed.

Running it#

bash
git clone https://github.com/ismailza/Busway-TicketChatBot
cd Busway-TicketChatBot

# Start Neo4j and the app
docker compose up --build

# App:            http://localhost:8080
# Neo4j Browser:  http://localhost:7474

The database is seeded on first startup with sample stations, buses, drivers and trips, so the chatbot has something to talk about straight away.

Results#

  • A conversational booking interface that lowers the barrier for non-technical users
  • Graph traversal makes multi-hop route and schedule lookups simple to express and fast to run
  • A Dockerized setup reproduces the full stack — app and database — in a single command

Team#

Built with Oumaima OUASLI.

Share:Share on Twitter / XShare on LinkedInShare on Facebook

Busway Ticket ChatBot

Overview

The Busway Ticket ChatBot is an innovative web application created during the Object Technology/IoT Workshop. It's designed to streamline the busway ticket reservation process, leveraging the power of Neo4j to manage complex data relationships. This project aims to provide users with a seamless and intuitive ticket booking experience.

Features

  • Trip Visualization: Users can view available trips and detailed information about bus routes, including departure and arrival times.
  • Online Reservation: Allows users to book tickets online, providing a hassle-free reservation experience.
  • Dynamic Data Management: Utilizes Neo4j for sophisticated management of buses, drivers and stations.
  • User-Friendly Interface: Designed with the end-user in mind, ensuring easy navigation and interaction.
  • Chatbot: Provides a conversational interface for users to interact with the system, making ticket booking more engaging.

Technologies Used

  • Frontend: Employs Thymeleaf and JavaScript for crafting a dynamic and engaging user interface, complemented by Bootstrap for responsive design.
  • Backend: Developed with Java, leveraging the Spring Boot framework for robust backend services.
  • Database: Implements Neo4j, a graph database, for sophisticated data relationship management.
  • Chatbot: Utilizes the AIML library for creating a conversational interface, enhancing user interaction.
  • Tools: Developed with IntelliJ IDEA, designed with StarUML, and version-controlled on GitHub for collaboration and development.

Contributors

This project is the culmination of efforts by a team engaged in the Object Technology/IoT Workshop, committed to innovating technological solutions that simplify everyday activities. The team members include:

  • Ismail ZAHIR: Software Engineering Student at FST Mohammedia - UH2C
  • Oumaima OUASLI: Software Engineering Student at FST Mohammedia - UH2C

License

This project is distributed under the MIT License - see the LICENSE file for more details.

MIT LicenseView on GitHub
MIT License

Copyright (c) 2024 Ismail ZAHIR & Oumaima OUASLI

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

More Projects

Dr Maroc
2024Current
A healthcare SaaS live at drmaroc.com, grown from a single app into a platform: four Angular portals in one Nx monorepo, a modular Spring Boot backend, self-hosted Keycloak, shared contracts, and a delivery pipeline where GitHub is the source of truth.
AngularNxNext.js+8
ngx-auth-client
2026Current
A published npm package that exposes Angular authentication as signals instead of getters, ships Keycloak and HTTP adapters behind a provider-agnostic port, and keeps tokens out of localStorage entirely.
AngularTypeScriptKeycloak+7