Skip to content

Latest commit

 

History

History
134 lines (94 loc) · 3.7 KB

CONTRIBUTING.md

File metadata and controls

134 lines (94 loc) · 3.7 KB

CONTRIBUTING

Thank you for your interest in contributing to the FertiScan backend project! Your contributions help make this project better for everyone. This guide will help you get started with contributing.

Table of Contents

  1. Code of Conduct
  2. How to Contribute
  3. Development Setup
  4. Style Guides
  5. Additional Resources

Code of Conduct

This project adheres to the Code of Conduct. By participating, you are expected to uphold this code.

How to Contribute

Reporting Bugs

If you find a bug, please create an issue and provide detailed information about the bug, including steps to reproduce it, the expected behavior, and the actual behavior.

Suggesting Enhancements

We welcome suggestions for new features and enhancements. Please create an issue to discuss your ideas and explain the benefits and potential use cases.

Submitting Pull Requests

Follow the guidelines in dev-rel-docs.

Development Setup

Prerequisites

  • Python 3.11+
  • pip
  • virtualenv
  • Azure Document Intelligence and OpenAI API keys

Running Locally

  1. Clone the repository:

    git clone https://github.com/ai-cfia/fertiscan-backend.git
    cd fertiscan-backend
  2. Install dependencies:

    pip install -r requirements.txt
  3. Start the server in development mode:

    fastapi dev app/main.py --port 5000

Running with Docker

  1. Build the Docker image:

    docker build -t fertiscan-backend \
    --build-arg ARG_AZURE_API_ENDPOINT=your_azure_form_recognizer_endpoint \
    --build-arg ARG_AZURE_API_KEY=your_azure_form_recognizer_key \
    --build-arg ARG_AZURE_OPENAI_API_ENDPOINT=your_azure_openai_endpoint \
    --build-arg ARG_AZURE_OPENAI_API_KEY=your_azure_openai_key \
    --build-arg ARG_PROMPT_PATH=path/to/prompt_file \
    --build-arg ARG_UPLOAD_PATH=path/to/upload_file \
    --build-arg ALLOWED_ORIGINS=["http://url.to_frontend/"] \
    .
  2. Run the Docker container:

    docker run -p 5000:5000 fertiscan-backend

Environment Variables

Create a .env file from .env.template:

AZURE_API_ENDPOINT=your_azure_form_recognizer_endpoint
AZURE_API_KEY=your_azure_form_recognizer_key
AZURE_OPENAI_API_ENDPOINT=your_azure_openai_endpoint
AZURE_OPENAI_API_KEY=your_azure_openai_key
AZURE_OPENAI_DEPLOYMENT=your_azure_openai_deployment

FERTISCAN_DB_URL=your_fertiscan_db_url
FERTISCAN_SCHEMA=your_fertiscan_schema

UPLOAD_PATH=path/to/file
ALLOWED_ORIGINS=["http://url.to_frontend/"]

Style Guides

Python Style Guide

  • Follow PEP 8 for Python code.
  • Use black for code formatting.

Git Commit Messages

Follow Conventional Commits for writing commit messages.

Additional Resources

Thank you for contributing to FertiScan!