A Flask-based application for managing laboratory experiments and device control.
π Documentation
- Clone the repository:
git clone github.com/ef-lab/ethopy_control
cd ethopy_control- Create and activate virtual environment:
python3 -m venv .venv
source .venv/bin/activate # On Windows: .venv\Scripts\activate- Install dependencies:
# Using pip (standard installation)
pip install .- Complete setup and database initialization:
# Single command setup - handles environment and database setup
python3 app_setup.pyThis interactive script will:
- Create .env file if it doesn't exist (prompts for database, SSH, and admin credentials)
- Generate secure SECRET_KEY automatically
- Validate your configuration and test database connectivity
- Inspect your existing database structure
- Create the Users table if it doesn't exist
- Verify that required tables (#control, #task) exist
- Create an admin user if no users exist
- Provide detailed diagnostics if any issues occur
What you'll be prompted for:
- Database credentials (host, username, password)
- SSH configuration (optional, for remote reboot functionality)
- Authentication preferences (local vs LDAP)
- Admin user configuration
- Never commit .env files to version control
- Store credentials securely (password manager recommended)
- Run the development server:
python3 main.pyThe application will be available at http://localhost:5000.
ethopy_control/
βββ main.py # Primary application entry point
βββ app.py # Flask application definition and routes
βββ app_setup.py # Interactive setup with validation
βββ models.py # Database models (User, ControlTable, Task)
βββ pyproject.toml # Python project configuration and dependencies
β
βββ utils/ # Utility modules
β βββ __init__.py # Package initialization
β βββ init_db.py # Centralized database initialization
β βββ config.py # Configuration management and validation
β βββ setup_env.py # Environment variable template generation
β
βββ templates/ # Jinja2 HTML templates
β βββ base.html # Base template with navigation
β βββ index.html # Main control table interface
β βββ login.html # Authentication page
β βββ tasks.html # Task management interface
β βββ activity_monitor.html # Activity monitoring dashboard
β
βββ static/ # Static web assets
β βββ css/ # Stylesheets
β βββ js/ # JavaScript files
β β βββ table.js # DataTables implementation
β βββ favicon.ico # Site favicon
β
βββ real_time_plot/ # Real-time data visualization
β βββ get_activity.py # Database activity queries
β βββ real_time_events.py # Dash-based real-time plotting
β
βββ tests/ # Test suite
β βββ conftest.py # pytest configuration
β βββ test_api.py # API endpoint tests
β βββ test_models.py # Database model tests
β
βββ docs/ # Documentation
βββ setup.md # This setup guide
βββ mkdocs.yml # Documentation configuration
- Real-time status monitoring of lab setups
- Bulk operations for updating multiple setups
- User assignment and access control
- Remote reboot capability via SSH
- CRUD operations for experimental tasks
- Task assignment to specific setups
- Task history and tracking
- Live event plotting using Dash and Plotly
- Lick port and proximity sensor data visualization
- Configurable time windows (30s, 60s, 5min, all)
- Multi-setup monitoring
- Local authentication: Database-stored user accounts
- Role-based access: Admin and regular users
- Session management with Flask sessions
# Build documentation
mkdocs build
# Serve documentation locally
mkdocs serveThis project uses modern Python packaging with pyproject.toml:
- For users: Use
pip install . - For developers: Use
pip install -e .[dev] - For documentation: Use
pip install -e .[docs] - For testing only: Use
pip install -e .[test]
- Fork the repository
- Create a feature branch:
git checkout -b feature-name - Make your changes following the code style guidelines
- Submit a pull request
- Use Ruff for code formatting (line length: 88)
- Follow PEP 8 naming conventions
- Add type hints for function parameters and return values
- Write docstrings for public functions and classes
- Keep imports organized (standard library, third-party, local)
- Use pytest for testing with descriptive test names
- Environment Variables - Configuration guide
- Setup Guide - Installation instructions
- User Management - Authentication setup
# Clone the repository
git clone <repository-url>
cd ethopy_control
# Install using modern packaging
pip install .# Clone the repository
git clone https://github.com/ef-lab/ethopy_control
cd ethopy_control
# Install in development mode with all tools
pip install -e .[dev]
# Or install with specific dependency groups
pip install -e .[test] # Testing dependencies only
pip install -e .[docs] # Documentation dependencies onlyThis project is licensed under the MIT License - see the LICENSE file for details.


