Python 3.7 or higher
Visual Studio Code (or any Python IDE)
SQL Server Management Studio (SSMS)
Microsoft ODBC Driver for SQL Server
Required Python libraries:
Standard Python libraries (no installation needed): datetime, re, json, os, sys, collections, logging
Third-party libraries (install with pip): torch, transformers, emoji, pyodbc, pandas, tqdm, langdetect, numpy, plotly
user should create an empty database in ssms called airline_tweets, in db_repository the user should change the server name to their own
This Python module provides a collection of utility functions to interact with the airline_tweets SQL Server database. It enables querying tweet and conversation data, issue counts, sentiment metrics, and inserting conversation records. It is designed for analysis and reporting on airline-related Twitter conversations.
airline_tweets database using ODBC.Set the database connection parameters:
Update the server and database variables inside get_connection() if needed.
Call functions as needed:
Import this script or run interactively to use functions such as:
get_issue_counts()get_tweet_count(conn)get_conversation_text_by_id(conn, conversation_id)get_sentiment_data(issue_type, selected_airlines=None)insert_conversation(conn, user_id, airline_id, root_tweet_id)This script processes large collections of tweet JSON files and stores their content efficiently in a SQL Server database. The data is processed in three structured stages: users, tweets, and tweet entities (hashtags and mentions). It includes progress tracking, batch processing, and indexing for performance.
MERGElogging moduleconnection = pyodbc.connect("DRIVER={ODBC Driver 17 for SQL Server};SERVER=localhost;DATABASE=TwitterDB;Trusted_Connection=yes;") data_directory = "data"
Place your JSON tweet files in the specified data_directory.
Run the script:
python process_tweets.py
This script analyzes and extracts Twitter conversations involving specific airline accounts. It retrieves relevant tweets from a database, reconstructs conversations, stores them, and optionally prints or writes them to a file.
tqdm.plots_presentation_1.py — Contains functions to generate visual plotsdb_repository.py — Manages database connections and queriesdemo_util.py — Utility helpers such as saving plotsrequirements.txt — Lists all required Python packagespython creating_conversations.py
Supported airlines include:
KLM, AirFrance, British_Airways, AmericanAir, Lufthansa, AirBerlin, AirBerlin_assist, easyJet, RyanAir, SingaporeAir, Qantas, EtihadAirways, VirginAtlantic
Script to create and populate tables for sentiment analysis and issue detection.
python sentiment_and_issues.py
This file contains the save_plot utility function, which saves a Matplotlib figure as a high-resolution PNG file. It automatically creates the output directory if it doesn't exist and appends the .png extension to the filename if missing.
Function: save_plot
save_plot(fig, filename, output_dir="plots")
This script generates key visualizations from the airline_tweets database, including:
Plots are saved as PNG files in the plots directory using demo_util.save_plot().
Call the plotting functions:
plot_effect_on_data()
plot_top_10_languages()
plot_conversation_count_per_airline()
plot_tweet_volume_over_time()
Generates donut charts for:
Run the script to save charts as PNG files in the plots folder. Requires a working database connection via db_repository.get_connection().
plot_conversation_donuts()plot_response_time_donut()Generates the following plots for the poster:
save_plot() utility.Analyzes hourly tweet counts for users and airlines from a database.
Run the script (requires get_connection() from db_repository).
Python
100.0%
Python 3.7 or higher
Visual Studio Code (or any Python IDE)
SQL Server Management Studio (SSMS)
Microsoft ODBC Driver for SQL Server
Required Python libraries:
Standard Python libraries (no installation needed): datetime, re, json, os, sys, collections, logging
Third-party libraries (install with pip): torch, transformers, emoji, pyodbc, pandas, tqdm, langdetect, numpy, plotly
user should create an empty database in ssms called airline_tweets, in db_repository the user should change the server name to their own
This Python module provides a collection of utility functions to interact with the airline_tweets SQL Server database. It enables querying tweet and conversation data, issue counts, sentiment metrics, and inserting conversation records. It is designed for analysis and reporting on airline-related Twitter conversations.
airline_tweets database using ODBC.Set the database connection parameters:
Update the server and database variables inside get_connection() if needed.
Call functions as needed:
Import this script or run interactively to use functions such as:
get_issue_counts()get_tweet_count(conn)get_conversation_text_by_id(conn, conversation_id)get_sentiment_data(issue_type, selected_airlines=None)insert_conversation(conn, user_id, airline_id, root_tweet_id)This script processes large collections of tweet JSON files and stores their content efficiently in a SQL Server database. The data is processed in three structured stages: users, tweets, and tweet entities (hashtags and mentions). It includes progress tracking, batch processing, and indexing for performance.
MERGElogging moduleconnection = pyodbc.connect("DRIVER={ODBC Driver 17 for SQL Server};SERVER=localhost;DATABASE=TwitterDB;Trusted_Connection=yes;") data_directory = "data"
Place your JSON tweet files in the specified data_directory.
Run the script:
python process_tweets.py
This script analyzes and extracts Twitter conversations involving specific airline accounts. It retrieves relevant tweets from a database, reconstructs conversations, stores them, and optionally prints or writes them to a file.
tqdm.plots_presentation_1.py — Contains functions to generate visual plotsdb_repository.py — Manages database connections and queriesdemo_util.py — Utility helpers such as saving plotsrequirements.txt — Lists all required Python packagespython creating_conversations.py
Supported airlines include:
KLM, AirFrance, British_Airways, AmericanAir, Lufthansa, AirBerlin, AirBerlin_assist, easyJet, RyanAir, SingaporeAir, Qantas, EtihadAirways, VirginAtlantic
Script to create and populate tables for sentiment analysis and issue detection.
python sentiment_and_issues.py
This file contains the save_plot utility function, which saves a Matplotlib figure as a high-resolution PNG file. It automatically creates the output directory if it doesn't exist and appends the .png extension to the filename if missing.
Function: save_plot
save_plot(fig, filename, output_dir="plots")
This script generates key visualizations from the airline_tweets database, including:
Plots are saved as PNG files in the plots directory using demo_util.save_plot().
Call the plotting functions:
plot_effect_on_data()
plot_top_10_languages()
plot_conversation_count_per_airline()
plot_tweet_volume_over_time()
Generates donut charts for:
Run the script to save charts as PNG files in the plots folder. Requires a working database connection via db_repository.get_connection().
plot_conversation_donuts()plot_response_time_donut()Generates the following plots for the poster:
save_plot() utility.Analyzes hourly tweet counts for users and airlines from a database.
Run the script (requires get_connection() from db_repository).
Python
100.0%