Skip to content

AI-School-F5-P3/ChatbotGrants

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

An intelligent chat system for grant identification and evaluation, designed to help sales representatives and customers find and assess funding opportunities.

🎯 Main Objective

Develop an intelligent chat system that allows sales representatives and clients to:

  • Identify available grants
  • Evaluate eligibility for specific projects
  • Determine the suitability of grants
  • Maximize possible financing returns
  • Interact naturally with queries about grants

πŸ—οΈ Architecture

The system consists of the following main components:

Frontend

  • Interactive chat interface
  • Developed in React with Material Tailwind
  • Responsive design
  • Authentication system
  • Markdown rendering for rich responses

Backend

  • FastAPI containerized services
  • Integration with Fandit grants API
  • LangGraph state machine for conversation flow
  • ETL system for data management
  • Intermediate database for efficient filtering

AWS Services

  • Bedrock: AI engine for natural language processing
  • DynamoDB: High-speed database for chat history
  • Aurora: MySQL database for grant information
  • EC2: Instances for service deployment

⚑ Key Features

  1. Intelligent Chat Interface

    • Natural language interaction
    • Contextualized responses
    • Automatic eligibility assessment
    • Conversation history
  2. Data Management

    • Integration with Fandit API
    • Intermediate database for efficient filtering
    • Automatic information updates via ETL
    • TTL-based expiration for conversation data
  3. Grant Analysis

    • Filtering by region, company type, and budget
    • Detailed grant information
    • Eligibility criteria matching
    • Grant comparison
  4. Session Management

    • Concurrent user sessions
    • Conversation persistence
    • Automatic cleanup of inactive sessions
    • Chat history retrieval

πŸš€ Technical Requirements

Functional

  • User authentication
  • Natural language interaction
  • Advanced filtering system
  • Intermediate database
  • Query processing
  • Conversation management

Non-Functional

  • High availability
  • Optimized performance
  • Responsive design
  • Data security
  • Scalability

πŸ’» Technologies

  • Frontend: React, Material Tailwind, Markdoc
  • Backend: Python, FastAPI, LangGraph
  • AI: AWS Bedrock
  • Databases: Aurora MySQL, DynamoDB
  • ETL: Custom Python pipeline
  • Authentication: Context-based with JWT
  • Containers: Docker
  • Deployment: Docker Compose

πŸ› οΈ Installation and Development

Prerequisites

  • AWS Account
  • Docker and Docker Compose
  • Node.js and npm
  • Python 3.9+
  • Git

Environment Configuration

  1. Clone the repository

    git clone https://github.com/AI-School-F5-P3/ChatbotGrants.git
    cd ChatbotGrants
  2. Configure environment variables

    # In backend directory
    cp .env.example .env
    # Edit .env with your credentials
    
    # In etl_fandit directory
    cp .env.example .env
    # Edit .env with your Fandit API credentials
  3. Start the services

    docker-compose up -d

Project Structure

ChatbotGrants/
β”œβ”€β”€ README.md                   # This documentation
β”œβ”€β”€ docker-compose.yml          # Main Docker composition file
β”œβ”€β”€ requirements.txt            # Root level dependencies
β”‚
β”œβ”€β”€ backend/                    # Backend Python code
β”‚   β”œβ”€β”€ aws_connect.py          # AWS services connection module
β”‚   β”œβ”€β”€ Dockerfile              # Backend container definition
β”‚   β”œβ”€β”€ dynamodb.py             # DynamoDB integration for chat history
β”‚   β”œβ”€β”€ grants_bot.py           # Core chatbot logic using LangGraph
β”‚   β”œβ”€β”€ main.py                 # FastAPI application with endpoints
β”‚   β”œβ”€β”€ requirements.txt        # Backend dependencies
β”‚   └── tools_aurora.py         # Database operations for grants
β”‚
β”œβ”€β”€ frontend/                   # React application
β”‚   β”œβ”€β”€ Dockerfile              # Frontend container definition
β”‚   β”œβ”€β”€ package.json            # Frontend dependencies
β”‚   β”œβ”€β”€ public/                 # Static assets
β”‚   β”‚   └── img/                # Image assets
β”‚   └── src/                    # Source code
β”‚       β”œβ”€β”€ components/         # UI components
β”‚       β”œβ”€β”€ context/            # React contexts
β”‚       β”œβ”€β”€ pages/              # Application pages
β”‚       β”œβ”€β”€ services/           # API services
β”‚       └── assets/             # Styles and images
β”‚
└── etl_fandit/                 # ETL system for Fandit API
    β”œβ”€β”€ clase_apifandit.py      # Fandit API client
    β”œβ”€β”€ db_setup.py             # Database initialization
    β”œβ”€β”€ etl_fandit.py           # Main ETL process implementation
    β”œβ”€β”€ Dockerfile              # ETL container definition
    β”œβ”€β”€ requirements.txt        # ETL dependencies
    β”œβ”€β”€ README.md               # ETL documentation
    └── tests/                  # ETL test directory

πŸ“ API and Resources

Fandit API

  • Endpoint: https://ayming.api.fandit.es/api/v2
  • Update frequency: Daily
  • Grant filters supported:
    • is_open
    • start_date
    • end_date
    • provinces
    • communities
    • action_items
    • activities
    • region_types

Backend API Endpoints

  • /start_session: Initialize a chat session
  • /chat: Process messages
  • /end_session/{user_id}: End a user session
  • /save_chat: Save conversation to DynamoDB
  • /get_chat_messages: Get messages for a conversation
  • /get_user_conversations/{user_id}: List user conversations

πŸ”„ Workflow

  1. User Input

    • Natural language query
    • Basic information collection
    • Grant selection
  2. Processing

    • Query analysis
    • Database search
    • Eligibility evaluation
    • LangGraph state transitions
  3. Response

    • Relevant grants
    • Suitability analysis
    • Recommendations
    • Rich text formatting

πŸ“Š Monitoring and Maintenance

  • System logs
    • Backend logs
    • ETL process logs
    • DynamoDB TTL enforcement
  • API quota control
  • Database backups
  • Inactive session cleanup

πŸ‘₯ Team and Support

  • Frontend Development
  • Backend Development
  • DevOps
  • Business Team

πŸ“« Contact and Help

For support and inquiries:

  • Create an issue in the repository
  • Contact the development team
  • Consult internal documentation

πŸ“œ License

This is a public educational project.

About

Smart chat system that allows salespeople and customers to identify and evaluate available grants

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 2

  •  
  •