A secure Django application for extracting Business Motivation Model (BMM) elements from technical documents using Perplexity AI.
- Extract BMM elements (Drivers, Assessments, Goals, Objectives, Strategies, Requirements) from uploaded documents
- Support for PDF, DOCX, and TXT file formats
- Secure single-user authentication with Django admin
- Perplexity AI integration for intelligent extraction using state-of-the-art language models
- Confidence scoring and validation workflow
- Export results as PDF reports or JSON data
- Python 3.8+
- Perplexity AI API key (get one at https://www.perplexity.ai/)
-
Clone the repository and navigate to the project directory
-
Create and activate a virtual environment:
python3 -m venv venv
source venv/bin/activate # On Windows: venv\Scripts\activate- Install dependencies:
pip install -r requirements.txt- Set up environment variables:
cp .env.example .env
# Edit .env and add your Perplexity API key- Run migrations:
python manage.py migrate- Create a superuser:
python manage.py createsuperuser
# Or use the provided script: python create_superuser.py- Run the development server:
python manage.py runserver- Access the application:
- Admin interface: http://localhost:8090/admin/
- Default credentials (if using create_superuser.py): admin/admin123
bmm_analyzer/
├── bmm_analyzer/ # Main Django project settings
├── analysis/ # Core BMM analysis app
├── accounts/ # User authentication
├── static/ # Static files (CSS, JS)
├── templates/ # HTML templates
├── media/documents/ # Uploaded documents storage
├── requirements.txt # Python dependencies
├── .env # Environment variables (create from .env.example)
└── README.md # This file
- Environment-based configuration for sensitive data
- Secure file upload with validation and scanning
- CSRF protection enabled
- Security headers configured
- Session-based authentication
- Rate limiting on API operations
Key settings in .env:
PERPLEXITY_API_KEY: Your Perplexity AI API key (required)SECRET_KEY: Django secret key (auto-generated for development)DEBUG: Set to False for productionMAX_UPLOAD_SIZE: Maximum file upload size in bytes (default: 10MB)ALLOWED_FILE_EXTENSIONS: Comma-separated list of allowed file types
After setting up your API key, test the connection:
python manage.py test_perplexityThis will verify your API key and perform a sample BMM extraction.
The application currently has:
- ✅ Django project structure with apps
- ✅ Database models for BMM analysis
- ✅ Secure configuration with environment variables
- ✅ Perplexity AI integration for BMM extraction
- ⏳ File upload functionality (in progress)
- ⏳ Text extraction pipeline
- ⏳ Background task processing
- ⏳ UI templates
- ⏳ Authentication system
- ⏳ Export functionality
- Load the provided sample documents:
python manage.py load_sample_data- Run a quick demonstration:
python demo_extraction.py-
Access the admin interface at http://localhost:8090/admin/
- Username: admin
- Password: admin123
-
View the pre-loaded analyses:
- Example: Pre-Analyzed Security Requirements - Shows extracted BMM elements
- Cybersecurity Policy Analysis - Ready to process
- Digital Transformation Strategy Analysis - Ready to process
- NIST Authentication Standards Analysis - Ready to process
See USAGE_GUIDE.md for detailed explanations of:
- What each BMM element type means
- How to interpret extraction results
- Best practices for document analysis
- Create a new Document Analysis
- Upload a technical document (PDF, DOCX, or TXT)
- Configure extraction preferences
- Process the document to extract BMM elements
- Review and validate results
- Export findings as PDF or JSON
git init
git add .
git commit -m "Initial commit: BMM Analyzer application"
git remote add origin YOUR_REPOSITORY_URL
git push -u origin main- The
.envfile is excluded from Git (contains API keys) - Always use
.env.exampleas a template - Generate a new SECRET_KEY for production deployments
- Review
SECURITY.mdfor security best practices
See CONTRIBUTING.md for guidelines on how to contribute to this project.
This project is licensed under the MIT License - see the LICENSE file for details.