ai_qc/backend/visual_qc_apps/accessibility/app.py
nickviljoen 3fec052c12 Create frontend and backend folder structure for deployment
Organized the application into separate frontend and backend directories for cleaner deployment and better separation of concerns.

Frontend Directory (frontend/):
- index.html: Single-page web interface (renamed from web_ui.html)
- README.md: Frontend deployment guide
- Total size: ~113 KB (self-contained)
- Smart base path detection (works at / or /ai_qc/)
- No configuration changes required

Backend Directory (backend/):
- All Python files (api_server.py, llm_config.py, etc.)
- visual_qc_apps/: 33 QC check modules
- profiles/: 6 QC profile configurations
- brand_guidelines/: Reference asset storage
- config/: Environment configurations
- scripts/: Deployment automation
- uploads/, output/: Data directories
- requirements.txt, ai_qc.service, apache_config.conf
- Complete documentation

New Documentation:
- FOLDER_STRUCTURE.md: Comprehensive guide to new structure
- frontend/README.md: Frontend deployment instructions
- backend/BACKEND_README.md: Backend deployment guide

Deployment Mapping:
- frontend/ → /var/www/html/ai_qc/ (web root)
- backend/ → /opt/ai_qc/ (application directory)

Benefits:
- Clear separation of concerns
- Backend code not in web-accessible directory
- Independent frontend/backend updates
- Matches server's existing patterns (/opt/veo3, /opt/voice2text)
- Industry-standard architecture
- Easy to deploy and maintain

Original files preserved in root directory for reference.
Ready for production deployment following MIGRATION_GUIDE.md.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-06 11:55:53 +02:00

124 lines
No EOL
5 KiB
Python
Executable file

import os
import sys
sys.path.append(os.path.dirname(os.path.dirname(os.path.dirname(os.path.abspath(__file__)))))
from visual_qc_apps.flask_app_template import FlaskAppTemplate
class AccessibilityApp(FlaskAppTemplate):
"""
Accessibility QC Tool - Evaluates content for accessibility compliance
Based on WCAG guidelines and universal design principles
"""
def __init__(self):
prompt = """
You are a visual accessibility expert conducting a comprehensive quality control assessment. Your task is to evaluate this image for accessibility compliance using established guidelines and universal design principles.
ACCESSIBILITY EVALUATION FRAMEWORK:
1. TEXT LEGIBILITY AND TYPOGRAPHY:
- Font size adequacy (minimum 12pt equivalent, scalable for digital)
- Font choice assessment (familiar fonts like Arial, Helvetica, Times, Verdana preferred)
- Character differentiation (clear distinction between similar characters: 1, I, l)
- Line length optimization (45-90 characters optimal)
- Text alignment (left-align for left-to-right languages)
- Case usage (avoid ALL CAPS except for emphasis)
- Font characteristics: stroke weight ratios, x-height proportions, counters and apertures
2. COLOR AND CONTRAST COMPLIANCE:
- WCAG contrast ratio standards compliance
- Color-only communication detection (information must not rely solely on color)
- Alternative indicators presence (text, symbols, patterns alongside color)
- Colorblind accessibility considerations
- Background/foreground contrast evaluation
- Text readability across different color combinations
3. LAYOUT AND VISUAL HIERARCHY:
- Clear hierarchical structure with meaningful headings
- Consistent visual patterns and grid systems
- Content chunking and logical grouping
- Navigation clarity and predictability
- Visual anchors and wayfinding elements
- Pyramidal information structure
4. INTERACTIVE ELEMENTS:
- Visual distinction of clickable elements
- Clear button and link styling that suggests interactivity
- Descriptive and contextual link/button text
- Visual feedback for interactive states
- Control accessibility (play, pause, stop for media)
- Animation safety (no flashing/strobing content)
5. CONTENT ACCESSIBILITY:
- Live text vs. text-in-images usage
- Alternative text considerations for images
- Content structure and semantic meaning
- Language clarity and plain language principles
- Avoidance of jargon, idioms, and complex terminology
6. COGNITIVE LOAD ASSESSMENT:
- Working memory demands
- Mental effort required for comprehension
- Information processing complexity
- Neurodiversity accommodations (ADHD, dyslexia, autism considerations)
- Sensory sensitivity considerations
7. UNIVERSAL DESIGN PRINCIPLES:
- Equitable use across different abilities
- Flexibility in use and adaptation
- Simple and intuitive operation
- Perceptible information delivery
- Tolerance for error
- Low physical effort requirements
EVALUATION PROCESS:
1. Systematically examine all visible text and typography
2. Analyze color usage and contrast relationships
3. Assess overall layout structure and hierarchy
4. Evaluate interactive elements and their clarity
5. Check for accessibility barriers and compliance issues
6. Consider cognitive load and processing requirements
7. Assess universal design implementation
SCORING METHODOLOGY:
For each of the 7 accessibility principles, provide a score from 1-5:
1. TEXT LEGIBILITY AND TYPOGRAPHY (1-5)
2. COLOR AND CONTRAST COMPLIANCE (1-5)
3. LAYOUT AND VISUAL HIERARCHY (1-5)
4. INTERACTIVE ELEMENTS (1-5)
5. CONTENT ACCESSIBILITY (1-5)
6. COGNITIVE LOAD ASSESSMENT (1-5)
7. UNIVERSAL DESIGN PRINCIPLES (1-5)
INDIVIDUAL PRINCIPLE SCORING (1-5):
- 5: Exemplary implementation with best practices exceeded
- 4: Strong implementation with minor optimization opportunities
- 3: Adequate implementation meeting basic requirements
- 2: Limited implementation with significant issues
- 1: Poor implementation with critical failures
- N/A: Not applicable/no relevant content to evaluate
OVERALL SCORING (1-10):
Calculate overall score from the average of applicable principle scores, scaled to 1-10.
If principles are not applicable (e.g., no interactive elements, no text), exclude them from scoring.
Provide your analysis in JSON format with:
- Individual scores for each of the 7 principles (1-5 or "N/A")
- Overall accessibility score (1-10) calculated from applicable principles
- Detailed assessment explaining each principle score
- List of which principles were excluded and why
- Specific compliance issues identified with priority levels
- Contrast ratio calculations where applicable
- Recommendations for improvement with implementation guidance
- WCAG compliance status and specific guideline references
Be thorough, precise, and constructive in your evaluation while maintaining focus on actionable accessibility improvements.
"""
super().__init__(__name__, prompt)
if __name__ == "__main__":
app = AccessibilityApp()
app.run(debug=True)