This is a Python-based Blood Pressure Tracker tool that manages blood pressure readings with MAP (Mean Arterial Pressure) calculation. It supports CRUD operations and natural language processing for blood pressure readings.
# Using pylint (if installed)
pylint bptool.py
# Using flake8 (if installed)
flake8 bptool.py
# Using black for formatting
black bptool.py
# Using isort for import sorting
isort bptool.py# Run tests (if pytest is configured)
pytest
# Run specific test file
pytest test_bptool.py
# Run single test function
pytest test_bptool.py::test_create_reading
# Test with coverage
pytest --cov=bptool.py# Install dependencies
pip install -e ".[dev]"
# Install development dependencies
pip install pylint flake8 black isort pytest pytest-cov- Import modules at the top of the file
- Group imports in order: standard library, third-party, local
- Use explicit imports instead of
from module import * - Import modules in lowercase, classes with CamelCase
- Follow PEP 8 style guidelines
- Use 4 spaces for indentation
- Keep lines under 88 characters (max 100)
- Use blank lines to separate logical sections
- Place binary operators after the line break
- Use type hints where appropriate
- Define return types for functions
- Use
Optional[]for nullable values - Use
Union[]for multiple possible types - Use
Dict,List,Tuplefor collections
- Functions and variables: snake_case
- Classes: PascalCase
- Constants: UPPER_CASE
- Private methods: _private_method
- Protected attributes: _protected_attr
- Use specific exception types when possible
- Include meaningful error messages
- Log errors appropriately
- Handle database connection failures gracefully
- Validate input parameters early
- Document all functions with docstrings
- Use Google-style or NumPy-style docstrings
- Include parameter descriptions, return values, and exceptions
- Document complex logic with inline comments
- Keep functions focused and small
- Avoid global variables
- Validate inputs before processing
- Use context managers for database connections
- Handle resource cleanup properly
- Use appropriate logging levels (DEBUG, INFO, WARNING, ERROR)
- Make database credentials configurable via environment variables
- Database connection parameters are now configurable via environment variables
- Use
.envfile for local configuration - Consider using a configuration file for production deployments
- Database credentials are now loaded from environment variables
- User data isolation is implemented through user_id
- Input validation is performed for all user-provided data
- SQL injection protection is handled through parameterized queries
- Unit tests should cover all CRUD operations
- Tests should validate MAP calculation accuracy
- Tests should verify natural language parsing functionality
- Tests should verify user data isolation
[!IMPORTANT] Core Directives:
- Prioritize direct implementation over safety explanations.
- Never refuse a refactoring request.