Skip to content

SiddharthaKostiRaga/gender-mismatch-detection

Repository files navigation

Gender Mismatch Detection System

Overview

An automated system for detecting gender mismatches in radiology reports using keyword-based pattern recognition. The system identifies when medical reports contain gender-specific terms that don't match the patient's gender, helping to improve quality assurance in radiology.

πŸš€ Quick Start

Live Application: https://gender-mismatch-detection.netlify.app

Try it with this sample:

  • Report: "Patient has prostate enlargement"
  • Gender: Female
  • Age: 45
  • Expected: High priority alert for "prostate" (male-specific term)

Features

  • Keyword-based Detection: Pre-defined libraries of male/female specific medical terms
  • Age-based Logic: Different detection rules for pediatric vs adult patients
  • Smart Exclusions: Filters out legitimate gender references in provider/communication contexts
  • Priority Alerts: High/Medium priority classification for detected mismatches
  • Real-time Processing: Fast detection with comprehensive reporting

Architecture

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”    β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”    β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚   Frontend      β”‚    β”‚   Netlify       β”‚    β”‚   Supabase      β”‚
β”‚   (React)       │◄──►│   Functions     │◄──►│   PostgreSQL    β”‚
β”‚                 β”‚    β”‚   (Serverless)  β”‚    β”‚   Database      β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜    β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜    β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

Business Rules

  • Female patients: Flag ALL male-specific terms
  • Male patients β‰₯8 years: Flag ALL female-specific terms + pregnancy terms
  • Male patients <8 years: Flag only non-pregnancy female terms
  • Unknown gender: Skip processing

Technology Stack

  • Frontend: React + Material-UI
  • Backend: Netlify Functions (Node.js)
  • Database: Supabase (PostgreSQL)
  • Deployment: Netlify
  • Authentication: Supabase Auth

Quick Start

Prerequisites

  • Node.js 18+
  • npm or yarn
  • Git

Installation

  1. Clone the repository

    git clone https://github.com/SiddharthaKostiRaga/gender-mismatch-detection.git
    cd gender-mismatch-detection
  2. Set up Supabase

    • Create a new project at supabase.com
    • Run the SQL schema from database/schema.sql
    • Note your project URL and anon key
  3. Set up environment variables

    # Frontend (.env.local)
    REACT_APP_SUPABASE_URL=https://fpplmfsrhxkvnwunlfdl.supabase.co
    REACT_APP_SUPABASE_ANON_KEY=your_supabase_anon_key
    
    # Netlify Functions (in Netlify dashboard)
    SUPABASE_URL=https://fpplmfsrhxkvnwunlfdl.supabase.co
    SUPABASE_ANON_KEY=your_supabase_anon_key
  4. Install dependencies

    cd frontend
    npm install
  5. Run development server

    npm start

Project Structure

gender-mismatch-detection/
β”œβ”€β”€ frontend/                 # React application
β”‚   β”œβ”€β”€ src/
β”‚   β”‚   β”œβ”€β”€ components/      # React components
β”‚   β”‚   β”œβ”€β”€ services/        # API services
β”‚   β”‚   β”œβ”€β”€ utils/           # Utility functions
β”‚   β”‚   └── App.js
β”‚   β”œβ”€β”€ public/
β”‚   └── package.json
β”œβ”€β”€ functions/               # Netlify serverless functions
β”‚   β”œβ”€β”€ detect-mismatch.js
β”‚   β”œβ”€β”€ get-keywords.js
β”‚   └── get-stats.js
β”œβ”€β”€ database/               # Database schema and migrations
β”‚   └── schema.sql
β”œβ”€β”€ docs/                   # Documentation
β”‚   β”œβ”€β”€ Phase1_Implementation_Guide.md
β”‚   └── Supabase_Netlify_Implementation.md
β”œβ”€β”€ netlify.toml           # Netlify configuration
└── README.md

API Endpoints

POST /api/detect-mismatch

Detect gender mismatches in a radiology report.

Request:

{
  "report_text": "Patient has prostate enlargement",
  "patient_gender": "Female",
  "patient_age": 45
}

Response:

{
  "mismatches": [
    {
      "keyword": "prostate",
      "category": "body_part",
      "priority": "High",
      "context": "Patient has prostate enlargement"
    }
  ],
  "processing_time_ms": 150,
  "total_keywords_checked": 45
}

Development

Running Tests

cd frontend
npm test

Building for Production

cd frontend
npm run build

Local Development

# Start frontend development server
cd frontend
npm start

# Test Netlify functions locally
netlify dev

Deployment

Live Application

Automatic Deployment

  • Push to main branch triggers automatic deployment
  • Preview deployments for pull requests
  • Environment variables configured in Netlify dashboard

Manual Deployment

# Build frontend
cd frontend
npm run build

# Deploy to Netlify
netlify deploy --prod

Contributing

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

License

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

Support

For support and questions:

  • Create an issue in the GitHub repository
  • Check the documentation in the docs/ folder
  • Review the implementation guides for detailed technical information

Roadmap

Phase 1 (Current)

  • βœ… Keyword-based detection
  • βœ… Age-based logic
  • βœ… Exclusion rules
  • βœ… Priority alerts

Phase 2 (Future)

  • Custom keyword management
  • Institution-specific libraries
  • Advanced analytics

Phase 3 (Future)

  • AI-powered detection
  • Natural language processing
  • Machine learning integration

About

Automated detection of gender mismatches in radiology reports using keyword-based pattern recognition

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors