Pain Management Support Group Platform

A comprehensive digital platform for running evidence-based pain management support groups with participant tracking, assessments, analytics, and educational resources.

🎯 Project Overview

This platform supports an 8-week pain management curriculum with: - 32 Sessions (4 sessions per week, 2.5 hours each) - Evidence-based content on pain neuroanatomy, medications, and holistic approaches - Participant empowerment through education and self-advocacy - Safe forum for discussing pain management without fear of retaliation - Comprehensive tracking of pain levels, assessments, and progress

πŸ“ Project Structure

psmg_platform/
β”œβ”€β”€ api/                          # Flask REST API
β”‚   β”œβ”€β”€ app.py                    # Main application
β”‚   β”œβ”€β”€ models/                   # Database models
β”‚   β”‚   └── models.py
β”‚   └── routes/                   # API endpoints
β”‚       β”œβ”€β”€ auth_routes.py        # Authentication
β”‚       β”œβ”€β”€ participant_routes.py # Participant management
β”‚       β”œβ”€β”€ assessment_routes.py  # Assessments
β”‚       └── analytics_routes.py   # Analytics & reporting
β”œβ”€β”€ docs/                         # Documentation
β”‚   β”œβ”€β”€ Facilitator_Scripts_Week1.md
β”‚   β”œβ”€β”€ Week1_Daily_Workbook.md
β”‚   β”œβ”€β”€ Week2_Daily_Workbook.md
β”‚   └── Complete_Facilitators_Guide.md
β”œβ”€β”€ config/                       # Configuration files
β”œβ”€β”€ tests/                        # Test suite
β”œβ”€β”€ requirements.txt              # Python dependencies
β”œβ”€β”€ docker-compose.yml            # Docker orchestration
β”œβ”€β”€ Dockerfile                    # Container definition
β”œβ”€β”€ .env.example                  # Environment variables template
β”œβ”€β”€ run.sh                        # macOS execution script
└── README.md                     # This file

πŸš€ Quick Start (macOS)

Prerequisites

  • macOS 10.15 or later
  • Homebrew installed
  • Python 3.11+ (installed via dev-setup.sh)
  • PostgreSQL 15+ (installed via dev-setup.sh)

Option 2: Docker Setup

# Start all services
docker-compose up -d

# View logs
docker-compose logs -f

# Stop services
docker-compose down

πŸ› οΈ Available Commands (run.sh)

./run.sh check         # Check prerequisites
./run.sh setup         # Complete project setup
./run.sh start         # Start backend + frontend servers
./run.sh stop          # Stop all services
./run.sh test          # Run test suite
./run.sh analytics     # Generate analytics reports
./run.sh docker-build  # Build Docker images
./run.sh docker-up     # Start Docker containers
./run.sh docker-down   # Stop Docker containers
./run.sh clean         # Remove build artifacts
./run.sh help          # Show all commands

πŸ“Š Core Features

1. Participant Management

  • User registration and authentication (JWT)
  • Participant profiles with medical history
  • Cohort enrollment tracking
  • Session attendance monitoring

2. Assessment System

  • PHQ-9: Depression screening
  • GAD-7: Anxiety assessment
  • BPI: Brief Pain Inventory
  • PDI: Pain Disability Index
  • PSQI: Sleep quality
  • SF-36: Quality of life

3. Pain Tracking

  • Daily pain logs with 0-10 scale
  • Body location mapping
  • Sleep quality and mood tracking
  • Activity level monitoring
  • Trigger and relief method documentation

4. Analytics & Reporting

  • Real-time dashboard with trends
  • Pain pattern analysis
  • Assessment progress tracking
  • Improvement percentages
  • Exportable reports

5. Educational Resources

  • 8-week curriculum materials
  • Weekly workbooks with daily exercises
  • Visual aids (anatomy, pain pathways, nutrition)
  • Facilitator scripts and guides

πŸ“š Documentation

πŸ—οΈ Technology Stack

Backend

  • Flask - Python web framework
  • SQLAlchemy - ORM for database operations
  • PostgreSQL - Primary database
  • Flask-JWT-Extended - Authentication
  • Flask-CORS - Cross-origin resource sharing

Analytics

  • Python - Data analysis scripts
  • Pandas - Data manipulation
  • NumPy - Numerical computing
  • R - Statistical analysis (optional)

DevOps

  • Docker - Containerization
  • Docker Compose - Multi-container orchestration
  • Gunicorn - Production WSGI server

Planned Integrations

  • LangChain - RAG for document Q&A
  • Pinecone/ChromaDB - Vector database for embeddings
  • OpenAI API - AI-powered insights

πŸ”’ Security

  • JWT-based authentication
  • Password hashing with Werkzeug
  • CORS protection
  • SQL injection prevention via SQLAlchemy ORM
  • Environment variable configuration
  • HTTPS recommended for production

πŸ§ͺ Testing

# Run all tests
./run.sh test

# Run specific test file
pytest tests/test_auth.py

# Run with coverage
pytest --cov=api tests/

πŸ“ˆ Database Schema

Core Tables

  • users - Authentication and user accounts
  • participants - Participant profiles and medical info
  • facilitators - Facilitator profiles
  • cohorts - 8-week program groups
  • cohort_enrollments - Participant-cohort relationships
  • sessions - Individual session records
  • session_attendance - Attendance tracking
  • assessments - All assessment responses
  • pain_logs - Daily pain tracking
  • resources - Educational materials

🎨 Curriculum Overview

8-Week Program Structure

  1. Week 1: Understanding Pain - Neuroanatomy and pain science
  2. Week 2: Medication Safety - Opioids, NSAIDs, and toxicity
  3. Week 3: Mind-Body Connection - Autonomic nervous system
  4. Week 4: Movement Medicine - Tai Chi, Qi Gong, Yoga
  5. Week 5: Nutrition & Inflammation - Anti-inflammatory diet
  6. Week 6: Alternative Therapies - Acupuncture, essential oils
  7. Week 7: Self-Advocacy - Communication with providers
  8. Week 8: Sustainability - Long-term pain management strategies

🀝 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 LICENSE file for details.

πŸ“ž Support

For technical support or questions: - Email: - Documentation: API_DOCUMENTATION.md - Issues: GitHub Issues (if repository is public)

πŸ™ Acknowledgments

  • Developed with evidence from AAFP journals and pain research
  • Curriculum based on international best practices
  • Inspired by UK NHS Pain Management Programs
  • Built with support from chronic pain advocacy communities

Version: 1.0.0
Last Updated: January 2026
Status: Production Ready βœ