A proof of concept on how we can leverage LLM to automate data entry faster.

Dr-Swopt 1e8302dab1 Update imports and README to use 'backend' folder name 1 week geleden
ai-data-entry-ui 1e8302dab1 Update imports and README to use 'backend' folder name 1 week geleden
backend 1e8302dab1 Update imports and README to use 'backend' folder name 1 week geleden
sample_medical_receipts 0973cdb88a Initial commit: AI-Assisted Data Entry Backend 1 week geleden
.gitignore 0973cdb88a Initial commit: AI-Assisted Data Entry Backend 1 week geleden
README.md 1e8302dab1 Update imports and README to use 'backend' folder name 1 week geleden
requirements.txt 767dfdbfc9 Add backend enhancements: AsyncOpenAI, image compression, refined prompts, and logging 1 week geleden

README.md

AI-Assisted Smart Data Entry Backend

This project provides a FastAPI-based backend for extracting structured data from medical receipts using OpenAI's GPT-4o model with structured outputs.

Features

  • FastAPI: Modern, fast web framework for building APIs.
  • Structured Extraction: Uses OpenAI's beta.chat.completions.parse to ensure extracted data adheres to a Pydantic schema.
  • CORS Enabled: Configured to allow access from frontend applications (e.g., Angular).
  • Health Check: Simple endpoint to verify server status.

Setup

Backend (FastAPI)

  1. Initialize Virtual Environment: ```bash

    Create environment

    python -m venv venv

# Activate environment (Windows) .\venv\Scripts\activate

# Activate environment (Mac/Linux) # source venv/bin/activate


2. **Install Dependencies**:
   ```bash
   pip install -r requirements.txt
  1. Configure Environment: Create a .env file in the root directory and add your OpenAI API key:

    OPENAI_API_KEY=your_api_key_here
    
    1. Run the Server: bash uvicorn backend.main:app --reload

Frontend (Angular)

  1. Install Dependencies:

    cd ai-data-entry-ui
    npm install --legacy-peer-deps
    
    1. Run the UI: bash npm start

API Endpoints

GET /health

Returns the status of the server.

POST /api/v1/extract

Extracts data from a medical receipt image.

Request Body:

  • file: Multipart image file.
  • user_name (optional): Name of the employee.
  • department (optional): Department of the employee.

Response: Returns a structured JSON matching the ExtractionResponse schema.

Project Structure

  • backend/
    • main.py: Entry point and API endpoints.
    • schemas.py: Pydantic models for data validation and structured output.
    • services/:
    • openai_service.py: Logic for interacting with OpenAI API.
  • ai-data-entry-ui/: Angular frontend.
  • requirements.txt: Python dependencies.
  • .env: Environment variables (not tracked by git).