This repository contains the codebase for the Open Data Challenge hackathon project. The goal of this project is to create a seamless event management system leveraging Telegram as a platform for communication and integration with a backend service for storing and retrieving event data.
- Overview
- Features
- Architecture
- Getting Started
- Usage
- Technologies Used
- Folder Structure
- Future Improvements
This system automates the process of creating, retrieving, and managing events shared on Telegram channels or chats. It uses NLP to extract event details and stores them in a backend system, allowing for quick event dissemination and user interaction. The backend also manages user-event relationships and supports a real-time WebSocket connection for updates.
- Telegram Integration:
Automatically listens for new Telegram messages, extracts event data using NLP, and processes it. - Event Parsing:
Extracts event details such as date, time, location, and description from text messages. - Real-Time Backend:
A FastAPI-based backend for storing events, user data, and managing interactions through APIs and WebSockets. - Data Cleaning:
Utilizes advanced text preprocessing to filter out noise and ensure consistent data formats. - Strapi Integration:
Events and user data are synced with a Strapi-based CMS for centralized management. - WebSocket Updates:
Maintains real-time connections to update the user interface with live data.
- Telegram Bot:
The bot listens to incoming messages and triggers an event handler for message parsing. - FastAPI Backend:
Handles user management, event storage, and real-time WebSocket updates. - NLP Utilities:
Processes raw message text to extract structured event data. - Strapi CMS:
Provides a central location to manage event data, including user-event relationships.
- Python 3.8+
- Node.js and npm (for Strapi setup)
- Telegram API credentials (API ID, API HASH, and Bot Token)
.env
file with the following keys:API_ID=your_telegram_api_id API_HASH=your_telegram_api_hash PHONE=your_telegram_phone_number STRAPI_BASE_URL=your_strapi_base_url
- Clone the repository:
git clone https://github.com/your-username/open-data-challenge.git cd open-data-challenge
- Install Python dependencies:
pip install -r requirements.txt
- Set up the
.env
file as described in Prerequisites. - Start the Telegram client:
python main.py
- Set up and run the FastAPI server:
cd server uvicorn server:app --reload --host 127.0.0.1 --port 8020
- (Optional) Install and set up Strapi for managing backend data.
-
Telegram Client:
- The bot listens to messages and extracts event data.
- Parsed data is sent to the FastAPI backend for processing and storage.
-
FastAPI Backend:
- Exposes API endpoints for managing users and events.
- Supports WebSocket connections for real-time updates.
-
Processing Pipeline:
- Incoming Telegram messages are cleaned, parsed, and transformed into structured JSON data.
- Python: Core programming language for the Telegram bot and FastAPI backend.
- FastAPI: Web framework for API and WebSocket functionality.
- httpx: Asynchronous HTTP client for API requests.
- Telethon: Telegram client library for handling incoming messages.
- Strapi: Headless CMS for managing event and user data.
- NLP Tools:
cleantext
for text preprocessing.
.
├── main.py # Telegram bot client
├── process_raw_data.py # Data cleaning and NLP utilities
├── server.py # FastAPI backend server
├── utils/ # Shared utility functions
├── data/ # Input and output files (e.g., parsed messages)
├── requirements.txt # Python dependencies
└── .env # Environment variables
- Enhanced NLP:
Improve event data extraction using machine learning models. - User-Friendly Interface:
Develop a web-based frontend for managing events and user interactions. - Analytics Dashboard:
Provide insights on events and user engagement. - Localization:
Support multiple languages for better accessibility.