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

Dr-Swopt d6120f16ed Reorganize project structure: move source code to src/ folder 1 viikko sitten
sample_medical_receipts 0973cdb88a Initial commit: AI-Assisted Data Entry Backend 1 viikko sitten
src d6120f16ed Reorganize project structure: move source code to src/ folder 1 viikko sitten
.gitignore 0973cdb88a Initial commit: AI-Assisted Data Entry Backend 1 viikko sitten
README.md d6120f16ed Reorganize project structure: move source code to src/ folder 1 viikko sitten
requirements.txt 0973cdb88a Initial commit: AI-Assisted Data Entry Backend 1 viikko sitten

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

  1. Install Dependencies:

    pip install -r requirements.txt
    
    1. Configure Environment: Create a .env file in the root directory and add your OpenAI API key: env OPENAI_API_KEY=your_api_key_here
  2. Run the Server:

    uvicorn src.main:app --reload
    

    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

    • src/
    • 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.
    • requirements.txt: Python dependencies.
    • .env: Environment variables (not tracked by git).