Skip to content

Latest commit

 

History

History
121 lines (94 loc) · 3.32 KB

AGENTS.md

File metadata and controls

121 lines (94 loc) · 3.32 KB

AGENTS.md

Project Overview

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.

Build/Lint/Test Commands

Linting

# 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

Testing

# 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

Development Setup

# Install dependencies
pip install -e ".[dev]"

# Install development dependencies
pip install pylint flake8 black isort pytest pytest-cov

Code Style Guidelines

Imports

  • 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

Formatting

  • 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

Types

  • Use type hints where appropriate
  • Define return types for functions
  • Use Optional[] for nullable values
  • Use Union[] for multiple possible types
  • Use Dict, List, Tuple for collections

Naming Conventions

  • Functions and variables: snake_case
  • Classes: PascalCase
  • Constants: UPPER_CASE
  • Private methods: _private_method
  • Protected attributes: _protected_attr

Error Handling

  • Use specific exception types when possible
  • Include meaningful error messages
  • Log errors appropriately
  • Handle database connection failures gracefully
  • Validate input parameters early

Documentation

  • 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

Best Practices

  • 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

Additional Guidelines

Database Configuration

  • Database connection parameters are now configurable via environment variables
  • Use .env file for local configuration
  • Consider using a configuration file for production deployments

Security Considerations

  • 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

Testing Approach

  • 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.