I handled the backend api calling using fastapi. All the files that are used to prepare and maintain the chatbot can be found here. I'm adding a short description of all the files and folders.
๐ main.py
This is the main .py file from where the backend handling starts.
๐ generic_helpers.py
There are some values, dictionaries and methods that are used in many files. So, all of them are placed here and those are imported from this file.
๐ config.py
As the conversation progresses, some parameters are to be stored, that are needed to fetch final data. These are saved in a dictionary with the session id as the key.
๐ db_helpers
All these *.py files within this folder are used to fetch data from the database server. Different files contain methods that read from the database and returns relatable data needed.
File Name
Fetch Handling to database
db_connection
Creates and close connection to the database.
dates_db
Particular session start date and end date.
match_db
toss decision, winning runs, winning wickets, match result type and dls method.
player_of_the_match_db
player of the match.
seasons_db
available unique sessions.
teams_db
both teams, match winner and toss winner teams.
umpires_db
first umpire, second umpire and both umpires.
venues_db
venues for the particular session and date.
๐ intent_helpers
*.py Files here are used to handling data fetching and generating responses of the chatbot based on particular intent.
File Name
Backend handling for intent
date_helper
Date
match_info_helper
Match Info and Match Info Next.
player_of_the_match_helper
Player of the Match.
season_helper
Season.
team_info_helper
Team Info and Team Info Next.
umpire_info_helper
Umire Info and Umpire Info Next.
venues_helper
Venue.
๐ requirements.txt
It contains information of all the dependencies with their particular versions installed and used to create and maintain the app.
๐ .gitignore
It has all the file patterns that needs to be ignored while pushing to the github.
Integration
I integrated my chatbot using google dialoglfow messenger api. I created a basic UI just for the sake of chatbot testing and deployed the website in huggingface. You can check it out here. Below the code snippet is given, in case you want to integrate and test: -