Skip to content

nhillemann/Leichte_Sprache_Medizin

Repository files navigation

Overview

This is a medical text translation application that converts German medical texts into "Leichte Sprache" (Easy Language) using Googles's Gemini 2.5 API. The application is designed to make complex medical information accessible to people with learning difficulties or limited German language skills. It features a Flask-based web interface where users can input medical text and receive simplified translations following strict Leichte Sprache guidelines.

User Preferences

Preferred communication style: Simple, everyday language.

System Architecture

Frontend Architecture

  • Technology: HTML5, Bootstrap 5, vanilla JavaScript
  • Design Pattern: Single-page application with responsive design
  • UI Components: Two-column layout with input/output cards, character counter, loading states
  • Accessibility: Medical-themed styling with clear visual hierarchy and user feedback

Backend Architecture

  • Framework: Flask web framework with SQLAlchemy ORM
  • Application Structure: Modular design with separated concerns:
    • app.py: Application factory and configuration
    • routes.py: Request handling and API endpoints
    • models.py: Database models
    • gemini_service.py: External AI service integration
  • Database: SQLite for development with configurable DATABASE_URL for production
  • Session Management: Flask sessions with configurable secret key

Data Storage Solutions

  • Primary Database: SQLite (development) with PostgreSQL support via environment configuration
  • ORM: SQLAlchemy with DeclarativeBase pattern
  • Schema: Simple Translation model storing original text, translated text, and timestamps
  • Connection Pooling: Configured with pool recycling and pre-ping for reliability

Authentication and Authorization

  • Current State: No authentication implemented
  • Session Security: Configurable session secret key via environment variables
  • Security Middleware: ProxyFix for handling reverse proxy headers

API Design

  • Endpoints:
    • GET /: Main application interface
    • POST /translate: Text translation processing
    • GET /history: Translation history retrieval
  • Data Format: JSON for API communication
  • Error Handling: Structured error responses with user-friendly messages
  • Input Validation: Text length limits (5000 characters) and content validation

External Dependencies

AI Services

  • Google Gemini API: Gemini-2.5-flash model for text translation
  • Configuration: API key via GEMINI_API_KEY environment variable
  • Usage: Complex prompt engineering for Leichte Sprache conversion with specific linguistic rules
  • Benefits: Generous free tier, reliable performance for German medical text translation

Frontend Libraries

  • Bootstrap 5: UI framework for responsive design
  • Font Awesome 6: Icon library for visual elements
  • CDN Delivery: External CSS/JS resources loaded via CDN

Python Dependencies

  • Flask: Web framework
  • Flask-SQLAlchemy: Database ORM integration
  • google-genai: Official Google Gemini Python client
  • Werkzeug: WSGI utilities and middleware

Infrastructure

  • WSGI: ProxyFix middleware for deployment behind reverse proxies
  • Environment Configuration: Database URL and API keys via environment variables
  • Logging: Python logging module for debugging and error tracking

Development Tools

  • Database: SQLite for local development
  • Debug Mode: Flask debug mode enabled for development
  • Hot Reload: Development server with auto-restart capabilities

About

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published