A comprehensive Geographic Information System (GIS) and property assessment platform for the Benton County Assessor's Office, featuring advanced data quality management, validation capabilities, and integration with Supabase. Part of the TerraFusion Platform.
TerraFlow provides a sophisticated platform for managing Geographic Information System (GIS) data with enhanced data quality monitoring, valuation capabilities, and Supabase integration. The application supports multiple environments (development, training, production) and serves as a central hub that coordinates with specialized modules for property assessment tasks.
- Python-based backend with Flask
- PostgreSQL GIS database integration
- Advanced data quality monitoring
- Machine learning property assessment
- Interactive data visualization
- Comprehensive regional property knowledge base
- Secure authentication (LDAP and Supabase)
- API for third-party applications and microservices
A docker-compose.yml is provided for local and CI parity. It includes:
web: Flask appdb: PostGIS-enabled PostgreSQLredis: Cachingprometheus: Metrics collection (seemonitoring/prometheus.yml)grafana: Dashboards (default login: admin/admin)
Start all services:
docker compose up --build- Prometheus and Grafana are included for metrics and dashboards.
- See
monitoring/README.mdfor setup and next steps. - Add
/metricsendpoint to Flask app usingprometheus_flask_exporterfor full observability.
- GitHub Actions workflows in
.github/workflowsfor linting, testing, accessibility, and deployment. - Accessibility and performance checks (axe-core, Lighthouse) run automatically.
- Visual regression and PR deploy previews are stubbed for future expansion.
- All secrets should be stored in GitHub Secrets or a cloud secrets manager.
- Never commit sensitive info to the repo.
- Enable secret scanning (git-secrets, TruffleHog) and dependency scanning (Dependabot, Snyk).
- See this README and
monitoring/README.mdfor setup. - Automate local setup scripts as needed.
- Create a Supabase account at https://supabase.io
- Create a new Supabase project
- Get your Supabase URL and API key from the project settings
Set the following environment variables:
# Supabase configuration
export SUPABASE_URL=https://your-project-id.supabase.co
export SUPABASE_KEY=your-supabase-api-key
# Enable Supabase integration
export USE_SUPABASE=trueThe system will automatically create tables in Supabase based on the SQLAlchemy models. Additionally, ensure your Supabase project has the PostgreSQL extensions enabled for spatial data:
- Go to your Supabase project dashboard
- Select "Database" from the sidebar
- Click on "Extensions"
- Enable the following extensions:
postgisuuid-ossppg_stat_statements
To use Supabase for authentication:
- Go to your Supabase project dashboard
- Select "Authentication" from the sidebar
- Configure the desired sign-in methods (email, OAuth providers, etc.)
- Set the proper redirect URLs in the Authentication settings
For local development, set the redirect URL to http://localhost:5000/auth/callback.
The system provides a comprehensive API for third-party applications and microservices to interact with the Benton County GIS system. See the API Documentation for details.
For microservices and third-party applications that need database access, the system provides a connection management facility to ensure proper connection pooling, load balancing, and security. See the API Documentation for details on integrating with this system.
The system supports both local file storage and Supabase Storage. When Supabase integration is enabled, all files will be stored in Supabase Storage buckets, providing:
- Automatic backup
- Enhanced security
- CDN delivery
- Easy access control
TerraFlow supports multiple environments for development, training, and production deployments. Each environment can have its own database, Supabase project, and configuration settings.
To set up a new environment:
# Initialize a development environment (default)
python initialize_environment.py development
# Initialize a training environment
python initialize_environment.py training --database-url postgresql://user:pass@host:port/training_db
# Initialize a production environment
python initialize_environment.py production --database-url postgresql://user:pass@host:port/production_dbYou can also provide Supabase configuration for each environment:
python initialize_environment.py training \
--database-url postgresql://user:pass@host:port/training_db \
--supabase-url https://your-training-project.supabase.co \
--supabase-key your_supabase_key \
--supabase-service-key your_supabase_service_keyTo switch between environments:
# Switch to development environment
python switch_environment.py development
# Switch to training environment
python switch_environment.py training
# Switch to production environment
python switch_environment.py productionFor deploying to different environments:
# Deploy to development (runs migrations and restarts the application)
python deploy.py development
# Deploy to training
python deploy.py training
# Deploy to production
python deploy.py production --skip-migrationsYou can customize the deployment process with flags:
# Skip database migrations
python deploy.py production --skip-migrations
# Skip restarting the application
python deploy.py training --skip-restart
# Skip deployment verification
python deploy.py training --skip-verify- Python 3.9+
- Flask
- PostgreSQL with PostGIS extensions
- SQLAlchemy
- Supabase Python client (for Supabase integration)
# Clone the repository
git clone https://github.com/benton-county/terraflow.git
cd terraflow
# Install dependencies
pip install -r requirements.txt
# Set up environment variables
cp .env.template .env
# Edit .env with your configuration
# Initialize development environment
python initialize_environment.py development
# Start the application
gunicorn --bind 0.0.0.0:5000 --reload main:app# Run the test suite
pytest
# Run tests with coverage report
pytest --cov=app tests/For production deployment, we recommend using Gunicorn:
# Initialize production environment
python initialize_environment.py production
# Deploy to production
python deploy.py production
# Start the server manually if needed
gunicorn --bind 0.0.0.0:5000 --workers 4 --threads 2 main:appCopyright 2025 Benton County. All rights reserved.