Skip to content

Tusm11/smart-doc-checker-1

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Smart Doc Checker

A document analysis tool that checks for contradictions and inconsistencies in uploaded files using AI-powered natural language processing.

Project Structure

  • backend/: Python FastAPI server that handles file uploads, AI analysis, and report generation
  • frontend/: Simple HTML/CSS/JavaScript frontend for user interaction
  • uploads/: Storage directory for uploaded documents
  • reports/: Storage directory for generated reports
  • .env: Environment variables for API keys and configuration
  • requirements.txt: Python dependencies

Prerequisites

  • Python 3.8 or higher
  • Node.js (for the frontend development server)
  • OpenRouter API key (for AI functionality)

Setup Instructions

1. Clone the Repository

# Clone your repository if needed
# git clone <repository-url>
cd smart-doc-checker

2. Set Up Environment Variables

Create a .env file in the root directory with the following variables:

OPENROUTER_API_KEY=your_openrouter_api_key_here
SITE_URL=http://localhost:5173
SITE_NAME=Smart Doc Checker
OPENMETER_API_URL=http://localhost:8888
OPENMETER_API_KEY=your_openmeter_api_key_here

3. Install Dependencies

Backend Dependencies

pip install -r requirements.txt

4. Run the Application

Start the Backend Server

# From the root directory
cd backend
uvicorn app:app --reload --port 8000

Start the Frontend (Development)

You can serve the frontend files using a simple HTTP server. For example:

# From the root directory
cd frontend
python -m http.server 5173

Usage

  1. Open your browser and navigate to http://localhost:5173
  2. Upload documents using the file upload interface
  3. Click "Analyze" to check for contradictions
  4. View the analysis results
  5. Generate a PDF report of the findings

Features

  • Document upload and processing
  • AI-powered contradiction detection
  • PDF report generation
  • User-friendly interface
  • Error handling for policy restrictions and other issues

Error Handling

  • The application has been enhanced with robust error handling for external service failures (like OpenMeter)
  • All operations continue to work even when external services are unavailable
  • Detailed logging helps track and debug issues
  • Frontend includes comprehensive error handling with clear messages for users
  • OpenMeter integration features automatic retries with exponential backoff for transient failures
  • Monitor.py includes detailed error handling for URL monitoring with specific exception handling
  • All API errors are properly logged with consistent format

Verification Script

A verification script is included to test all endpoints and confirm the application is working correctly:

python verification.py

Enhanced Debugging

The frontend includes detailed logging of requests, responses, and form data to help diagnose issues.

Notes

  • The application uses OpenRouter's API for AI functionality
  • Ensure your API key has the necessary permissions
  • Large files may take longer to process

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages

  • Python 61.6%
  • CSS 21.6%
  • JavaScript 14.7%
  • HTML 2.1%