ai_assisted_analysis_tool
Local AI Assisted Analysis Powered by Ollama
Science Score: 44.0%
This score indicates how likely this project is to be science-related based on various indicators:
-
✓CITATION.cff file
Found CITATION.cff file -
✓codemeta.json file
Found codemeta.json file -
✓.zenodo.json file
Found .zenodo.json file -
○DOI references
-
○Academic publication links
-
○Academic email domains
-
○Institutional organization owner
-
○JOSS paper metadata
-
○Scientific vocabulary similarity
Low similarity (12.7%) to scientific vocabulary
Repository
Local AI Assisted Analysis Powered by Ollama
Basic Info
Statistics
- Stars: 2
- Watchers: 1
- Forks: 0
- Open Issues: 0
- Releases: 2
Metadata Files
README.md
AI Assisted Analysis Tool
This project is an open-source, locally run AI-assisted text analysis tool powered by Ollama. It now supports two distinct workflows:
1. Analysis Workflow
Purpose: Analyze any tabular data (Excel or CSV) using AI, not limited to abstracts. This workflow is flexible and user-friendly, allowing you to select which columns to analyze and how the results are reported.
Key Features: - Works with any Excel or CSV file (not just abstracts) - Lists all columns and lets you select identifier and content columns by name - Lets you define what you want the AI to identify in your data (custom prompt) - Allows you to set the number of analysis runs for each row - Optionally aggregates AI responses for consensus and confidence - Optionally appends all reporting info (prompt, LLM, runs, hardware, consensus summary, etc.) to the bottom of the Excel output file - Enhanced reporting: includes prompt, LLM used, number of runs, analysis duration, CPU/GPU info - Cross-platform: Windows, macOS, Linux
How to Use:
1. Prepare your Excel or CSV file and place it in your chosen data input folder.
2. Make sure you also have a data output folder for your file to be saved in after the analysis.
3. Run the script:
python ai_assisted_analysis.py
4. Follow the prompts:
- Select the AI model (or press Enter for the recommended model)
- Enter what you want the program to identify in your data (custom prompt)
- Choose columns for identifier and content by name
- Set the number of runs for analysis
- Optionally aggregate AI responses for consensus and confidence
- Optionally append all reporting info to the bottom of the output Excel file
5. Review your results in the output Excel file (includes consensus columns and reporting info if selected)
2. Zotero Abstracts Workflow
Purpose: Analyze bibliographic abstracts exported from Zotero. This workflow is designed for users working specifically with Zotero data and abstracts.
Key Features:
How to Use:
1. Export your collection from Zotero as a CSV or Excel file
2. Use the provided scripts (e.g., methods.py, results.py, location.py, theory.py, n_themes.py) in the python_for_Zotero_abstracts folder to run targeted analyses on your exported data
3. Follow the prompts in each script for results and consensus aggregation
4. Review your results in the output Excel file
Key Features
Requirements
Requirements
ollama- Python client for Ollama- Ollama for Windows
- Ollama for Mac
- Ollama for Linux
pandas- Data manipulation and analysistqdm- Progress barsopenpyxl- Excel file handling
AI Assisted Analysis Tool
Project Goals
This project aims to provide tools for AI-assisted analysis and aggregation of responses, supporting research workflows and data exploration.
Features
- Aggregates AI responses from various sources
- Modular analysis methods (see
other_analysis/andpython_for_Zotero_abstracts/) - Extensible for new data formats and sources
Installation
- Clone the repository:
powershell git clone https://github.com/hleve/AI_Assisted_Analysis_Tool.git - Install dependencies:
powershell pip install -r requirements.txt
Usage Example
Run the main analysis script:
powershell
python ai_assisted_analysis.py
Getting Started
See documentation.md for a step-by-step guide.
Contributing
Contributions are welcome! Please see CONTRIBUTING.md for contribution guidelines, issue templates, and the code of conduct.
License
See LICENSE for details.
Project Logic and Methodology
This tool is designed to leverage AI models for research analysis, with a focus on reliability and reproducibility. The core logic includes:
Replication for Error Minimization:
- Analyses are run multiple times (replicated) to reduce the impact of random errors or outlier responses from AI models.
- Aggregation and consensus algorithms are used to combine results, improving reliability and confidence in findings.
Prompt Engineering for Quantitative Analysis:
- Prompts can be crafted to request numerical values from AI models (e.g., ratings, counts, scores).
- These outputs can be collected across replications and subjected to standard statistical analyses, such as ANOVA or T-tests, to assess differences, trends, or significance.
This approach allows researchers to harness the flexibility of AI while maintaining scientific rigor and transparency in their workflows.
Prompts (Zotero Abstracts Workflow)
The following scripts in python_for_Zotero_abstracts are designed for specific types of analysis:
theory.py: Identify urban planning theory used in abstractsn_themes.py: Identify three themes from abstractsmethods.py: Identify methods used in abstractsresults.py: Identify results from abstractslocation.py: Identify where the research was conducted
Each script will prompt you for the required input and provide results in the output Excel file.
How to Use
Custom Analysis Workflow (aiassistedanalysis.py)
- Prepare Your Data: Place your CSV or Excel file in the data input folder.
- Run the Script:
python ai_assisted_analysis.py - Follow Prompts:
- Select the model to use (or press Enter for the recommended model).
- Define what you want the program to identify within the text.
- Choose columns for identifier and content by name.
- Set the number of runs for analysis.
- Consensus & Reporting:
- Optionally aggregate AI responses for consensus and confidence.
- Optionally append all reporting info to the bottom of the output Excel file.
- Review Output:
- Results are saved to an Excel file in the specified output folder.
- Consensus columns and reporting info are included if selected.
Zotero Abstracts Workflow
The workflow for analyzing Zotero abstracts and bibliographies remains unchanged. Export your collection from Zotero as a CSV or Excel file and use the provided scripts (e.g., methods.py, results.py, location.py, theory.py, n_themes.py) to run targeted analyses on your exported data. Follow the prompts in each script for results and consensus aggregation as before.
Flow Diagram
mermaid
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]
Directions
Navigate to the parent directory:
sh cd /path/to/your/directoryCreate the virtual environment:
sh python -m venv venvActivate the virtual environment:
- On Windows:
sh .\venv\Scripts\activate - On macOS/Linux:
sh source venv/bin/activate
- On Windows:
Install Requirements:
sh pip install -r requirements.txtInstall Chosen LLM (gemma2 is the recommended model):
sh ollama pull gemma2
Troubleshooting
Import Errors
If you encounter import errors for ollama, pandas, or tqdm, ensure that:
- Virtual environment is activated: Make sure you've activated your virtual environment before installing packages or running scripts.
- Correct package installation: Run
pip install -r requirements.txtin your activated virtual environment. - VS Code Python interpreter: If using VS Code, ensure it's using the Python interpreter from your virtual environment:
- Open Command Palette (Ctrl+Shift+P)
- Type "Python: Select Interpreter"
- Choose the interpreter from your
venvfolder
Common Package Issues
- ollama package: The correct package name is
ollama, notollama_python - Excel support:
openpyxlis required for writing Excel files with pandas - Progress bars:
tqdmprovides the progress bars shown during analysis
Virtual Environment Issues on Windows
If you encounter PowerShell execution policy errors when activating the virtual environment: ```powershell
Use the batch file instead
.\venv\Scripts\activate.bat
Or bypass execution policy temporarily
powershell -ExecutionPolicy Bypass -File .\venv\Scripts\Activate.ps1 ```
Cloning the Repository
- Open a terminal or command prompt.
- Navigate to the directory where you want to clone the repository:
sh cd /path/to/your/directory - Clone the repository:
sh git clone https://github.com/hleve/AI_Analysis_Tool.git - Navigate to the cloned repository directory:
sh cd AI_Analysis_Tool
Running a Python File
Ensure the virtual environment is activated:
- On Windows:
sh .\venv\Scripts\activate - On macOS/Linux:
sh source venv/bin/activate
- On Windows:
Run the desired Python file:
sh python <filename>.pyReplace<filename>with the name of the Python file you want to run. For example, to runai_assisted_analysis.py, use:sh python ai_assisted_analysis.pyFollow any additional prompts or instructions provided by the script to complete the analysis.
Owner
- Login: hleve
- Kind: user
- Repositories: 1
- Profile: https://github.com/hleve
Citation (CITATION.cff)
cff-version: 1.2.0 message: "If you use this software, please cite it as below." authors: - family-names: "Levesque" given-names: "Henry" orcid: "https://orcid.org/0009-0008-5636-1143" title: "AI_Assisted_Analysis_Tool" version: 1.2-beta doi: 10.5281/zenodo.14932653 date-released: 2025-02-26 url: "https://github.com/hleve/AI_Analysis_Tool"
GitHub Events
Total
- Release event: 1
- Watch event: 3
- Push event: 22
- Create event: 1
Last Year
- Release event: 1
- Watch event: 3
- Push event: 22
- Create event: 1
Dependencies
- ollama *