Operations Database (ops-db)#
The ops-db package provides the core PostgreSQL database schema and SQLAlchemy ORM layer for the CCAT Data Center operations database. This is the single source of truth for all operational metadata: from observation planning through execution, data transfer, archival, to final publication.
This documentation covers the DATABASE SCHEMA ONLY - not infrastructure deployment (see CCAT System Integration Documentation) or the REST API layer (see Operations Database API (ops-db-api)) or the web interface (see Operations Database UI (ops-db-ui)). /docs/operations/index explains how all these components work together and are deployed and maintained.
The database serves as the backend for:
ops-db-ui - Web interface for browsing observations and monitoring system state
ops-db-api - RESTful API for instruments to register observations and data
data-transfer - Automated workflows that move data through its lifecycle
What’s in the Database#
The ops-db tracks:
Observatory Infrastructure - Observatories, telescopes, instruments, and modules
Scientific Programs - Observing programs, sub-programs, and observation units
Observation Execution - Executed observation units with timing and conditions
Data Files and Packages - Raw data files, packages, and physical copies across locations
Transfer Infrastructure - Sites, locations, routes, and transfer records
Long-Term Archive - Archive transfers and staging jobs for processing
Access Control - Users, roles, and API tokens
Future Extensions - Reduction pipelines and workflows, Scientific Data Products, Publications, etc.
For complete details on all models, see the Table Reference and Models API Reference documentation.
Documentation Structure#
Concepts
Understanding the database design and entity relationships
Schema Reference
Database diagram and auto-generated table documentation
API Reference
Python API for working with the database
Configuration
How to configure database connections and settings
Integration
How this fits with other CCAT components
Quick Links#
Operations Database API (ops-db-api) - RESTful API for programmatic access
Operations Database UI (ops-db-ui) - Web interface for browsing and management
Data Transfer System - Automated data transfer workflows
CCAT System Integration Documentation - Deployment and infrastructure
/docs/source/operations/index - Operations of the CCAT Data Center
Getting Started for Developers#
To use ops-db in your Python code:
Install the package:
pip install -e /path/to/ops-db
Initialize a database connection:
from ccat_ops_db import init_ccat_ops_db session, engine = init_ccat_ops_db()
Use the ORM models:
from ccat_ops_db.models import ObsUnit, ExecutedObsUnit obs_unit = session.query(ObsUnit).filter_by(name="my_obs").first()
For detailed function documentation, see the Core Database Functions section.
To set up a fresh database instance, use the opsdb_init command-line tool. See
Utilities for details.