Skip to main content

AI-powered data insights and anomaly detection

Project description

🚀 AI DataSense AI-powered data insights, anomaly detection, and visualization across diverse data formats.

📖 Overview AI DataSense is an AI-driven Python package designed to seamlessly analyze data, detect anomalies, generate insights, and recommend visualizations using any AI API (OpenAI, Azure OpenAI, Anthropic, etc.). It supports a variety of data formats including:

📊 CSV 📄 Excel 📝 Text Files 📷 Images 📑 PDF 📂 Word Documents No more complex configurations! Just connect your AI API and start analyzing.

🛠️ Key Features ✅ AI-Powered Insights: Automatically extracts key insights from your data. ✅ Anomaly Detection: Detects unusual patterns using adaptive AI logic. ✅ Visualization Suggestions: AI recommends the best visual charts for your data. ✅ Multi-File Support: Supports one or multiple files across different formats in a single analysis. ✅ Flexible API Integration: Works seamlessly with OpenAI, Azure OpenAI, Anthropic, and more.

📦 Installation Ensure you have Python 3.7+ installed.

pip install ai-datasense

🚀 Quick Start Guide 1️⃣ Setup Your API Details Create a Python script (test.py) in your project directory and add the following:

from ai_datasense.core import DataAnalyzer

Initialize DataAnalyzer with API details

analyzer = DataAnalyzer( api_provider="openai", # or azure_openai, anthropic, etc. api_key="your_api_key_here", # Replace with your actual API key api_url="your_api_url_here", model="gpt-4o-mini" )

List of files to analyze (Uncomment other file types as needed)

file_paths = [ "test_data.csv", # CSV file # "data.xlsx", # Excel file # "report.pdf", # PDF file # "notes.txt", # Text file # "image.png" # Image file ]

Analyze files

results = analyzer.analyze(file_paths)

Iterate through results

for file, result in results.items(): print(f"\n📂 Results for {file}:")

try:
    # Extract content from AI response
    content = result['choices'][0]['message']['content']
    
    # Parse Key Insights
    if "### Key Insights" in content:
        insights = content.split("### Key Insights")[1].split("###")[0].strip()
        print("\n🧠 **Key Insights:**")
        print(insights)
    else:
        print("\n🧠 **Key Insights:** No insights provided.")
    
    # Parse Anomalies
    if "### Anomalies" in content:
        anomalies = content.split("### Anomalies")[1].split("###")[0].strip()
        print("\n🚨 **Anomalies:**")
        print(anomalies)
    else:
        print("\n🚨 **Anomalies:** No anomalies detected.")
    
    # Parse Visualization Recommendations
    if "### Visualization Recommendations" in content:
        visualizations = content.split("### Visualization Recommendations")[1].strip()
        print("\n📊 **Visualization Recommendations:**")
        print(visualizations)
    else:
        print("\n📊 **Visualization Recommendations:** No visualization suggestions provided.")

except (KeyError, IndexError, AttributeError) as e:
    print(f"\n❌ Error extracting data from {file}: {e}")

2️⃣ Run the Script Make sure you're in your project directory and your virtual environment is activated:

venv\Scripts\activate # For Windows source venv/bin/activate # For macOS/Linux

Run the script

python test.py 3️⃣ Expected Output 📂 Results for test_data.csv: 🧠 Key Insights:

Top-performing categories (e.g., Electronics, Home Appliances). Regional trends and sales behaviors. 🚨 Anomalies:

High sales from low quantities sold. Discount irregularities impacting sales patterns. 📊 Visualization Recommendations:

Bar charts for category-wise sales. Scatter plots for discount vs. sales trends. Line charts for sales over time. 4️⃣ Switch Between AI Providers You can easily switch to another AI provider by updating the api_provider, api_key, api_url, and model parameters.

📂 Test Data File

  • test_data.csv: A sample dataset included for demonstration and quick testing of the AI DataSense package.
  • Users can replace it with their own data files for analysis.

Azure OpenAI Example: python Copy code analyzer = DataAnalyzer( api_provider="azure_openai", api_key="your_azure_api_key", api_url="your_azure_api_endpoint", model="gpt-4" ) Anthropic Example: python Copy code analyzer = DataAnalyzer( api_provider="anthropic", api_key="your_anthropic_api_key", api_url="https://api.anthropic.com/v1/complete", model="claude-2" )

📂 Supported Data Formats CSV: Spreadsheets with comma-separated values. Excel: Complex data sheets (.xlsx). Text Files: Plain text data analysis (.txt). PDF: Document analysis and text extraction (.pdf). Word: Document insights (.docx). Images: Visual data extraction (.png, .jpg). 🧠 API Providers Supported OpenAI Azure OpenAI Anthropic HuggingFace API Simply provide your API key, endpoint, and model.

📊 Example Output 🧠 Insights Example: text Copy code Key Insights:

  • Electronics dominates sales with high-ticket items.
  • South region leads in home appliance sales.
  • Discounts on Accessories category increased sales volume. 📊 Visualization Suggestions: 📊 Bar Chart: Sales by Category 📈 Line Chart: Sales Trends Over Time 🌍 Heatmap: Regional Sales Performance 🤝 Contributing Contributions are welcome!

Fork the repository. Create a new branch (git checkout -b feature-new-feature). Commit your changes (git commit -am 'Add some feature'). Push to the branch (git push origin feature-new-feature). Open a Pull Request.

📄 License This project is licensed under the MIT License.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

ai_datasense-0.1.0.tar.gz (5.5 kB view details)

Uploaded Source

Built Distribution

ai_datasense-0.1.0-py3-none-any.whl (6.1 kB view details)

Uploaded Python 3

File details

Details for the file ai_datasense-0.1.0.tar.gz.

File metadata

  • Download URL: ai_datasense-0.1.0.tar.gz
  • Upload date:
  • Size: 5.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.0.1 CPython/3.9.4

File hashes

Hashes for ai_datasense-0.1.0.tar.gz
Algorithm Hash digest
SHA256 1ee7f1823c15bf6a9bb9c4e89f618e002a50707a1ecf654e72e6856c6293f839
MD5 4dadafc74e99abee67227f7ce3d13edd
BLAKE2b-256 3f7637cc21e5abddc3855eeedccf5b216ea265f3a7742482c08a093ef434dc2a

See more details on using hashes here.

File details

Details for the file ai_datasense-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: ai_datasense-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 6.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.0.1 CPython/3.9.4

File hashes

Hashes for ai_datasense-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 faf797999d26bb0aea980ec37dcc13a3b930a69ecae22e4ff63992298a72b858
MD5 532698cfa317dd7a03f35aae599661b7
BLAKE2b-256 c422f72b17e9f7917cb9d31d28f4ff14db3fa2603bf06fbad8161b7348ce0d6e

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page