Skip to content

bruhdev1290/Quality-control-Portal-

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

45 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

πŸ›‘οΈ The quality control Portal

"They don't do it like they used to..."

Open-source government transparency platform tracking quality decline and consumer protection issues across industries using real-time federal data and AI-powered analysis.

Netlify Status License: MIT Open Source

cosmic-faloodeh-5b8113 netlify app-Quality Control Portal - Consumer Protection Data-fpscreenshot

🎯 Open Source Hackfest 2025

This project is built for Open Source Hackfest, competing in:

  • πŸ† Code for Good - Using open source tools for consumer protection and social impact
  • πŸ€– Best Use of Gemini API - AI-powered complaint analysis and trend prediction
  • πŸ“š Best Documentation - Comprehensive docs following government design standards

πŸ” What Problem Does This Solve?

  • Consumers lack centralized access to government complaint data across agencies
  • Quality decline goes unnoticed until it's too late
  • No AI-powered tools to predict emerging consumer issues and fraud patterns
  • Fraud and scams are hard to track across multiple federal databases

✨ Features

Core Platform

  • πŸ“Š Live Data Dashboard - Real-time statistics from 4 major federal agencies (CFPB, NHTSA, CPSC, FTC)
  • πŸ” Enhanced Smart Search - Advanced search with filtering, sorting, and live API integration
  • πŸ“ˆ Sector Analysis - Visual charts showing complaint trends by industry
  • 🏒 Company Rankings - Grade-based rankings with detailed metrics
  • ⚠️ Recent Alerts - Latest complaints and recalls with severity indicators

Enhanced Search Capabilities

  • 🎯 Advanced Filters - Filter by sector (Financial, Automotive, Consumer Products, Technology, Healthcare)
  • πŸ“Š Dynamic Sorting - Sort results by Most Complaints, Most Recalls, or Company Name
  • πŸ”„ Real-Time Search - Instant results as you type with result counters
  • ⌨️ Keyboard Navigation - Press Enter to search quickly
  • πŸ“‘ Live API Integration - Fetches real-time data from CFPB, NHTSA, FTC, and CPSC federal databases
  • 🎨 Collapsible Filters - Toggle advanced filters panel for cleaner interface
  • ⚑ Loading States - Visual feedback during API calls and processing

AI-Powered Features (Google Gemini API)

  • πŸ€– AI Complaint Analyzer - Analyzes trends and identifies recurring issues
  • πŸ’¬ Natural Language Search - Ask questions in plain English like "Which financial companies have the most complaints?"
  • 🚨 Fraud Pattern Detection - Identifies emerging scam types and vulnerable demographics
  • 🀝 Consumer Protection Chatbot - Personalized advice based on complaint data
  • ✨ AI Search Toggle - Enable/disable AI-powered search with visual indicator
  • 🧠 Smart Intent Detection - AI understands search context and provides relevant results

Design & Accessibility

  • 🎨 Government Design Systems - Follows USWDS, GOV.UK, and California DS standards
  • β™Ώ WCAG 2.1 AA Compliant - Fully accessible interface
  • πŸ“± Responsive Design - Works seamlessly on desktop, tablet, and mobile

πŸš€ Quick Start

Prerequisites

  • Node.js 18 or higher
  • npm or yarn
  • Google Gemini API Key - Get it here

Local Development

  1. Clone the repository

    git clone https://github.com/bruhdev1290/Quality-control-Portal-
    cd Quality-control-Portal
  2. Install dependencies

    npm install
  3. Set up environment variables

    cp .env.example .env

    Edit .env and add your API keys:

    VITE_GEMINI_API_KEY=your_gemini_api_key_here
    VITE_FTC_API_KEY=DEMO_KEY  # Optional
  4. Start development server

    npm run dev
  5. Open your browser Navigate to http://localhost:5173

Build for Production

npm run build

The production-ready files will be in the dist/ directory.

Preview Production Build

npm run preview

🌐 Deploy to Netlify

One-Click Deploy

Click the button below to deploy this project to Netlify instantly:

Deploy to Netlify

Manual Deployment

  1. Fork this repository to your GitHub account

  2. Sign up/Login to Netlify

  3. Create a new site from Git

    • Click "Add new site" β†’ "Import an existing project"
    • Choose "GitHub" and authorize Netlify
    • Select your forked repository
  4. Configure build settings (these are already set in netlify.toml):

    • Build command: npm install && npm run build
    • Publish directory: dist
    • Node version: 18
  5. Deploy!

    • Click "Deploy site"
    • Your site will be live in minutes with a unique URL
    • You can customize the domain in site settings

Continuous Deployment

Once connected to Netlify, every push to the main branch automatically triggers a new deployment. No manual intervention needed!

πŸ” Enhanced Search Features

Overview

The search functionality has been completely overhauled with advanced features, live API integration, and AI-powered natural language processing.

Key Features

1. Advanced Filtering & Sorting

  • Sector Filter: Filter results by Financial, Automotive, Consumer Products, Technology, or Healthcare sectors
  • Dynamic Sorting: Sort by Most Complaints, Most Recalls, or Company Name (A-Z)
  • Collapsible Panel: Toggle advanced filters to keep the interface clean
  • Real-time Updates: Filters apply instantly as you change selections

2. Live API Integration

The search now queries real federal databases:

  • CFPB API (src/services/cfpbAPI.ts): Fetches live consumer complaint data
  • NHTSA API (src/services/nhtsaAPI.ts): Retrieves current vehicle recall information
  • Automatic Fetching: APIs are called automatically when you search
  • Error Handling: Graceful fallbacks if APIs are unavailable

3. AI-Powered Natural Language Search

When enabled (requires Gemini API key):

  • Conversational Queries: Ask questions like "show me automotive recalls"
  • Intent Detection: AI understands what you're looking for
  • Smart Results: Get contextually relevant data
  • Visual Feedback: See AI's interpretation of your search

4. User Experience Enhancements

  • Keyboard Support: Press Enter to trigger search
  • Loading States: Visual spinner during API calls
  • Result Counters: See how many companies, events, and sectors match
  • Empty States: Clear messaging when no results found
  • Responsive Design: Works perfectly on mobile devices

Search Interface Screenshots

Enhanced Search with Advanced Filters

Enhanced Search Interface

Toggle filters to refine your search by sector and sort results dynamically

Live Search Results

Search Results for Wells Fargo

Real-time filtering showing companies, events, and sectors matching your query

How to Use the Search

  1. Basic Search: Type a company name or sector in the search box
  2. Advanced Filters: Click the "Filters" button to show filtering options
  3. AI Search: Click the sparkles ✨ button to enable natural language queries
  4. Sort Results: Use the "Sort Results By" dropdown to organize data
  5. View Results: See filtered companies, events, and sectors below

Example Queries

Standard Search:

  • Wells Fargo - Find all data related to Wells Fargo
  • Financial - Show all financial sector companies
  • NHTSA recalls - Filter by NHTSA recall events

AI-Powered Search (requires Gemini API key):

  • Which financial companies have the most complaints?
  • Show me automotive recalls
  • What are recent fraud reports?

πŸ“ Project Structure

Enshitification-V2/
β”œβ”€β”€ src/
β”‚   β”œβ”€β”€ enshitification-portal.tsx  # Main application component with enhanced search
β”‚   β”œβ”€β”€ services/
β”‚   β”‚   β”œβ”€β”€ geminiAI.ts            # Google Gemini AI integration
β”‚   β”‚   β”œβ”€β”€ cfpbAPI.ts             # CFPB API service (live data)
β”‚   β”‚   β”œβ”€β”€ nhtsaAPI.ts            # NHTSA API service (live data)
β”‚   β”‚   β”œβ”€β”€ ftcAPI.ts              # FTC API service (live data)
β”‚   β”‚   β”œβ”€β”€ cpscAPI.ts             # CPSC Recall Retrieval API service (NEW!)
β”‚   β”‚   └── cpscAPI.demo.ts        # CPSC API usage examples
β”‚   β”œβ”€β”€ main.tsx                    # Application entry point
β”‚   └── index.css                   # Global styles
β”œβ”€β”€ docs/
β”‚   β”œβ”€β”€ API_INTEGRATION.md          # Complete API integration guide
β”‚   β”œβ”€β”€ CPSC_API_INTEGRATION.md     # CPSC API documentation (NEW!)
β”‚   └── CPSC_INTEGRATION_EXAMPLE.md # CPSC integration examples (NEW!)
β”œβ”€β”€ dist/                           # Production build (generated)
β”œβ”€β”€ index.html                      # HTML template
β”œβ”€β”€ netlify.toml                    # Netlify configuration
β”œβ”€β”€ package.json                    # Dependencies and scripts
β”œβ”€β”€ vite.config.ts                  # Vite bundler configuration
β”œβ”€β”€ tailwind.config.js              # Tailwind CSS configuration
β”œβ”€β”€ tsconfig.json                   # TypeScript configuration
β”œβ”€β”€ .env.example                    # Environment variables template
β”œβ”€β”€ CODE_OF_CONDUCT.md              # Community standards
β”œβ”€β”€ CONTRIBUTING.md                 # Contribution guidelines
β”œβ”€β”€ DEPLOYMENT.md                   # Deployment guide
└── README.md                       # You are here!

πŸ”§ Technology Stack

  • Framework: React 18 with TypeScript
  • AI Integration: Google Gemini API for intelligent analysis
  • Build Tool: Vite 5
  • Styling: Tailwind CSS
  • Charts: Recharts
  • Icons: Lucide React
  • APIs: CFPB, NHTSA, CPSC, FTC federal databases
  • Deployment: Netlify (optimized configuration included)
  • Design Systems: USWDS, GOV.UK, California DS, Massachusetts Mayflower

πŸ“Š Data Sources

This platform aggregates data from four major U.S. federal agencies:

1. CFPB - Consumer Financial Protection Bureau

2. NHTSA - National Highway Traffic Safety Administration

  • API: NHTSA Datasets and APIs
  • Data: Vehicle safety recalls, defect investigations
  • Stats: 14K+ recalls tracked
  • No API key required

3. CPSC - Consumer Product Safety Commission

  • API: CPSC Recall Retrieval API
  • Data: Product recalls, hazards, injuries, manufacturer information
  • Implementation: Full TypeScript support with XML/JSON formats in src/services/cpscAPI.ts
  • Stats: 8K+ violations tracked
  • No API key required
  • Documentation: See CPSC API Integration Guide

4. FTC - Federal Trade Commission

  • API: FTC Consumer Sentinel API
  • Data: HSR Early Termination Notices and robocall complaints
  • Stats: 5.8M+ fraud/scam complaints
  • DEMO_KEY available for testing

πŸ”§ CORS Proxy Configuration

To enable browser-based access to federal APIs, we use a CORS proxy service:

  • Proxy Service: corsproxy.io
  • Affected APIs: CFPB, FTC (and potentially CPSC for some endpoints)
  • Why Needed: Federal government APIs don't include CORS headers, preventing direct browser access
  • Implementation: See src/services/cfpbAPI.ts and src/services/ftcAPI.ts

For Production Deployment: Consider setting up your own CORS proxy or backend service for better reliability and performance. Alternative proxy services include:

πŸ€– AI Features Powered by Google Gemini

Implementation Status

All AI features are fully implemented in src/services/geminiAI.ts with complete error handling and graceful fallbacks.

1. AI Complaint Analyzer

Analyzes consumer complaints to identify:

  • Top 3 recurring issues for any company
  • Severity assessment (Low/Medium/High/Critical)
  • Trend analysis (Improving/Stable/Worsening)
  • Personalized consumer recommendations

Usage: Enable AI search toggle and query company complaint data

2. Natural Language Search (Implemented)

Ask questions in plain English and get intelligent results:

  • "What are the most common complaints about Wells Fargo?"
  • "Show me recent recalls in the automotive sector"
  • "Which companies have the worst fraud records?"
  • "Which financial companies have the most complaints?"

How it works: AI parses your natural language query, detects intent, and filters results accordingly

3. Fraud Pattern Detection

AI-powered analysis of FTC data to identify:

  • Emerging scam types
  • Geographic hotspots
  • Most vulnerable demographics
  • Preventive recommendations

Usage: Query fraud-related data from FTC database

4. Consumer Protection Chatbot

Get personalized advice based on real complaint data:

  • Risk assessments for specific companies
  • Guidance on filing complaints
  • Understanding your consumer rights

Usage: Ask questions about specific companies or consumer protection topics

Using AI Features

To enable AI-powered features:

  1. Get API Key: Sign up for Google Gemini API
  2. Add to .env: Set VITE_GEMINI_API_KEY=your_key_here
  3. Toggle AI Search: Click the sparkles ✨ icon in the search interface
  4. Ask Questions: Use natural language queries

Note: The app works without AI features but provides enhanced intelligence when configured.

🎨 Design Philosophy

Built following government design system principles inspired by:

  • U.S. Web Design System (USWDS)
  • GOV.UK Design System
  • California Design System
  • Massachusetts Mayflower Design System

Design Highlights

  • Color Palette: Unit-Connect green gradient hero, CFPB professional tables, Massachusetts bay blue accents
  • Typography: Public Sans (California DS standard)
  • Accessibility: WCAG 2.1 AA compliance
  • Components: UK GOV.UK beta banner, left-bordered cards, government-style data tables

Focus on:

  • βœ… Accessibility (WCAG 2.1 AA compliance)
  • βœ… Usability and clarity
  • βœ… Trust and transparency
  • βœ… Mobile-first responsive design

πŸ† Why This Project Matters

Code for Good Impact

  • Real consumer protection - Helps vulnerable populations avoid fraud and unsafe products
  • Open source tools - Built entirely with open source technologies
  • Social impact - Empowers millions of consumers with government data
  • Community driven - Welcomes contributors and scales to additional data sources

Innovation with AI

  • First of its kind - Only platform combining 4 federal agencies with AI analysis
  • Predictive insights - Gemini AI identifies emerging issues before they escalate
  • Natural language - Makes complex government data accessible to everyone
  • Personalized advice - Tailored recommendations based on real complaint patterns

πŸ”’ Security & Privacy

  • No user data collection
  • No tracking or analytics
  • All data sourced from public government databases
  • Open source and transparent

🀝 Contributing

Contributions are welcome! We're building a platform to empower consumers through transparency.

How to Contribute

  1. Fork the repository
  2. Create your feature branch (git checkout -b feature/AmazingFeature)
  3. Commit your changes (git commit -m 'Add some AmazingFeature')
  4. Push to the branch (git push origin feature/AmazingFeature)
  5. Open a Pull Request

Areas We Need Help

  • πŸ”Œ Additional data source integrations (FDA, EPA, etc.)
  • πŸ€– AI model improvements and new Gemini features
  • β™Ώ Accessibility enhancements
  • 🌍 Translation/internationalization
  • πŸ“Š Data visualization improvements
  • πŸ§ͺ Test coverage expansion

See CONTRIBUTING.md for detailed guidelines.

πŸ› Troubleshooting

Common Issues and Solutions

CORS Policy Errors

Problem: Access to fetch has been blocked by CORS policy

Solution: The application now uses a CORS proxy (corsproxy.io) to handle this automatically. If you still see CORS errors:

  1. Check your browser's network tab to ensure the proxy is being used
  2. Try clearing browser cache and reloading
  3. For production deployments, consider setting up a custom backend proxy

Gemini API Errors

Problem: Error 404: models/gemini-2.5-flash is not found for API version v1

Solution: This has been fixed by updating to @google/generative-ai v0.24.1+ and using the gemini-2.5-flash model. To enable AI features:

  1. Get an API key from Google Gemini
  2. Add it to your .env file: VITE_GEMINI_API_KEY=your_key_here
  3. Restart the development server

Problem: Gemini API not configured

Solution: This is expected behavior when no API key is provided. The app will work without AI features using standard search.

FTC API Certificate Errors

Problem: ERR_CERT_AUTHORITY_INVALID when accessing FTC API

Solution: This has been fixed by routing FTC API calls through the CORS proxy, which also handles SSL certificate issues.

API Rate Limits

Problem: Too many requests to federal APIs

Solution:

  • CFPB, NHTSA: No rate limits on public APIs
  • FTC: Use DEMO_KEY for testing, get a real API key for production
  • Gemini: Free tier has usage limits, upgrade for production use

Build Warnings

Problem: "Some chunks are larger than 500 kB after minification"

Solution: This is a warning, not an error. The app builds successfully. To optimize:

  • Consider code splitting with dynamic imports (future enhancement)
  • Use build.rollupOptions.output.manualChunks in vite.config.ts

πŸ“‹ Code of Conduct

We are committed to providing a welcoming and inclusive environment for all contributors. Please read our Code of Conduct before participating.

πŸ“ License

This project is licensed under the MIT License - see the LICENSE file for details.

πŸ™ Acknowledgments

  • Data provided by U.S. federal agencies (CFPB, NHTSA, CPSC, FTC)
  • AI powered by Google Gemini API
  • Design inspired by government design systems (USWDS, GOV.UK, California DS, Massachusetts Mayflower)
  • Built for Open Source Hackfest 2024
  • Built for transparency and citizen empowerment

πŸ“Ί Demo Video

Watch our 2-minute demo showcasing the platform's features and AI capabilities: https://vimeo.com/1128404863?fl=pl&fe=sh

🎯 Project Goals

This project was created for Open Source Hackfest 2024 with these goals:

  1. Empower Consumers - Provide free access to critical government safety and complaint data
  2. Democratize AI - Make advanced AI analysis accessible for consumer protection
  3. Open Source Impact - Build a scalable, community-driven platform for social good
  4. Government Transparency - Aggregate and visualize data from multiple federal agencies
  5. Prevent Harm - Help consumers avoid fraud, recalls, and unsafe products

πŸ“§ Support

If you have questions or need help:


Made for government transparency and citizen empowerment πŸ‡ΊπŸ‡Έ

Built for Open Source Hackfest 2024 | Version 2.0.0

About

No description, website, or topics provided.

Resources

License

Code of conduct

Contributing

Security policy

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages