Skip to content

hleve/AI_Assisted_Analysis_Tool

Repository files navigation

AI Assisted Analysis Tool

This project is an open-source, locally run AI-assisted analysis tool powered by Ollama. The tool is designed to run AI-assisted analysis on an entire bibliography exported from Zotero. Users who want to use this tool should have Zotero installed and export a collection they want to perform the AI analysis on as a .csv file.

This tool is based on Ollama and is structured to work with bibliographic data exported from Zotero to query abstracts. This code can also be used to query other types of data in .csv or .xls format using the custom_analysis.py file.

Key Features

  • Designed to work with Zotero exports (CSV/Excel).
  • Uses replication to mitigate potential errors with a consensus-based approach.
  • Maintains local control of data to ensure compliance with data-handling requirements.
  • Provides an open-source, reproducible method for analysis.

Prompts

Identify Urban Planning Theory

Provide the text of an abstract. The tool will identify the urban planning theory used in the abstract. If no urban planning theory was used, it will say "none."

Identify Themes

Provide the text of an abstract. The tool will identify three themes from the abstract.

Identify Methods

Provide the text of an abstract. The tool will identify the methods used in the abstract.

Identify Results

Provide the text of an abstract. The tool will identify the results from the abstract.

Identify Location

Provide the text of an abstract. The tool will identify where the research was conducted. If no location is mentioned, it will say "none."

How to Use

  1. Export from Zotero: Export the collection you want to analyze from Zotero as a CSV or Excel file.
  2. Run the Python files: Use the provided Python code to run a specific AI analysis on the exported file (e.g., methods, results, location).
  3. Analyze Results: The tool will process each item in the bibliography, using Ollama to extract specific data from the bibliographic items. The code uses replication to account for any potential errors, employing a consensus-based approach to pull data from the bibliographic items.
  4. Aggregate AI Results for Consensus: Run the ai_response_aggregation.py file to aggregate the AI responses and get the result of the consensus and a rating for how strong the consensus is.

Flow Diagram

graph LR
    A[Start] --> B[Read CSV/Excel File]
    B --> C[Initialize Responses List]
    C --> D{Loop Through Runs}
    D --> E[Run 1]
    D --> F[Run 2]
    D --> G[Run N]
    E --> H{Loop Through Rows}
    F --> H
    G --> H
    H --> I[Append Title and Abstract]
    I --> J[Parse prompt]
    J --> K[Send to AI Model]
    K --> L[Receive Response]
    L --> M[Append Response to List]
    M --> H
    H --> N[Ensure Correct Number of Elements]
    N --> O[Create DataFrame]
    O --> P[Write to Excel File]
    P --> Q[End]
Loading

Directions

  1. Navigate to the parent directory:

    cd /path/to/your/directory
  2. Create the virtual environment:

    python -m venv venv
  3. Activate the virtual environment:

    • On Windows:
      .\venv\Scripts\activate
    • On macOS/Linux:
      source venv/bin/activate
  4. Install Requirements:

    pip install -r requirements.txt
  5. Install Chosen LLM:

    ollama pull gemma2

Cloning the Repository

  1. Open a terminal or command prompt.
  2. Navigate to the directory where you want to clone the repository:
    cd /path/to/your/directory
  3. Clone the repository:
    git clone https://github.com/hleve/AI_Analysis_Tool.git
  4. Navigate to the cloned repository directory:
    cd AI_Analysis_Tool

Running a Python File

  1. Ensure the virtual environment is activated:

    • On Windows:
      .\venv\Scripts\activate
    • On macOS/Linux:
      source venv/bin/activate
  2. Run the desired Python file:

    python <filename>.py

    Replace <filename> with the name of the Python file you want to run. For example, to run custom_analysis.py, use:

    python custom_analysis.py
  3. Follow any additional prompts or instructions provided by the script to complete the analysis.

About

Local AI Assisted Analysis Powered by Ollama

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages