This document describes the modular structure implemented for the BRAIN Expression Template Decoder application.
The application has been refactored to use Flask blueprints for better code organization and maintainability. The paper analysis functionality has been separated into its own module.
BRAINProject/
├── app.py # Main Flask application
├── blueprints/ # Blueprint modules
│ ├── __init__.py # Package initialization
│ └── paper_analysis.py # Paper analysis blueprint
├── templates/
│ ├── index.html # Main page template
│ └── paper_analysis.html # Paper analysis page template
├── static/
│ ├── script.js # Main application JavaScript
│ ├── paper_analysis.js # Paper analysis JavaScript
│ ├── brain.js # BRAIN API functions
│ ├── decoder.js # Template decoder functions
│ └── styles.css # Application styles
└── requirements.txt # Python dependencies
blueprints/paper_analysis.py)The paper analysis functionality has been moved to a separate blueprint that includes:
GET /paper-analysis/ - Paper analysis pagePOST /paper-analysis/api/test-deepseek - Test Deepseek API connectionPOST /paper-analysis/api/analyze-paper - Analyze uploaded papersapp.py)The main application now focuses on:
/paper-analysis - Paper analysis page/api/test-deepseek - Test Deepseek API/api/analyze-paper - Analyze paper/paper-analysis/ - Paper analysis page (blueprint)/paper-analysis/api/test-deepseek - Test Deepseek API (blueprint)/paper-analysis/api/analyze-paper - Analyze paper (blueprint)To add a new blueprint:
blueprints/ directoryDefine your blueprint:
from flask import Blueprint
new_blueprint = Blueprint('new_feature', __name__, url_prefix='/new-feature')
@new_blueprint.route('/')
def index():
return render_template('new_feature.html')
Import and register the blueprint in app.py:
from blueprints.new_feature import new_blueprint
app.register_blueprint(new_blueprint)
static/paper_analysis.js) has been updated to use the new blueprint URLs