A FastAPI-based reconciliation service for SEAD (Strategic Environmental Archaeology Database) entities, providing OpenRefine-compatible reconciliation endpoints for archaeological and environmental data.
- Entity Reconciliation: Support for sites and taxonomic entities
- OpenRefine Integration: Full compatibility with OpenRefine reconciliation protocol
- Fuzzy Matching: Advanced text matching with similarity scoring
- Geographic Queries: Location-based search capabilities
- Property-based Filtering: Enhanced reconciliation using entity properties
- Python 3.13+
- UV package manager
- PostgreSQL database with SEAD data
git clone <repository-url>
cd sead_authority_service
uv installCopy the configuration template and adjust database settings:
cp config/config.yml.template config/config.yml
# Edit config/config.yml with your database credentials# Development mode with auto-reload
make serve
# Or manually
uv run uvicorn main:app --reloadThe service will be available at http://localhost:8000
- Open OpenRefine and go to your project
- Click on the dropdown arrow next to a column you want to reconcile
- Select "Reconcile" → "Start reconciling..."
- Click "Add Standard Service"
- Enter the service URL:
http://localhost:8000/reconcile - Click "Add Service"
http://localhost:8000/reconcile
The service supports reconciliation for these entity types:
- site - Archaeological/geographic sites and locations
- taxon - Taxonomic entities (species, genera, etc.)
When reconciling, you can use additional properties to improve matching accuracy:
latitude- Decimal latitude coordinatelongitude- Decimal longitude coordinatecountry- Country nameregion- Administrative regionelevation- Elevation in meters
kingdom- Taxonomic kingdomphylum- Taxonomic phylumclass- Taxonomic classorder- Taxonomic orderfamily- Taxonomic family
- Service Metadata:
GET /reconcile- Returns service information and available entity types - Reconciliation:
POST /reconcile- Performs entity reconciliation queries - Properties:
GET /reconcile/properties- Returns available properties for entity types - Preview:
GET /reconcile/preview- Returns entity preview information
-
Start the service:
make serve
-
In OpenRefine, add the service URL:
http://localhost:8000/reconcile -
Select your entity type (site or taxon) when configuring reconciliation
-
Add property constraints if available to improve matching accuracy
make testmake lint
make formatThis project uses semantic-release for automated versioning and releases. See SEMANTIC_RELEASE.md for detailed information on:
- Commit message conventions
- Release workflow
- Version management
- Troubleshooting
Quick guide:
# Features (minor version bump)
git commit -m "feat: add new reconciliation strategy"
# Bug fixes (patch version bump)
git commit -m "fix: correct database connection timeout"
# Breaking changes (major version bump)
git commit -m "feat!: redesign API
BREAKING CHANGE: The reconciliation endpoint now uses a different format."src/
├── api/ # FastAPI routes and endpoints
├── configuration/ # Configuration management
├── strategies/ # Entity-specific reconciliation strategies
└── utility/ # Helper functions and utilities
The service uses YAML configuration files. Key settings:
options:
database:
host: localhost
port: 5432
database: sead_db
username: your_user
password: your_password
default_query_limit: 10
id_base: "https://w3id.org/sead/id/"Once running, visit http://localhost:8000/docs for interactive API documentation.
The service includes comprehensive Docker support with multiple deployment strategies. All Docker-related files are in the docker/ directory.
Development:
cd docker
cp .env.example .env
# Edit .env with your credentials
docker-compose up --buildProduction:
cd docker
cp .env.production.example .env.production
# Edit .env.production with your credentials
docker-compose -f docker-compose.prod.yml pull
docker-compose -f docker-compose.prod.yml up -dSee docker/QUICKSTART.md for detailed quick start instructions.
The project uses GitHub Actions for automated Docker image builds and deployment.
- Automated Builds: On every push to
mainordevbranches, or when creating version tags - Multi-Architecture: Builds for both
linux/amd64andlinux/arm64 - Container Registry: Images published to GitHub Container Registry (GHCR)
- Version Tags: Automatic tagging based on git tags and branches
The GitHub Actions workflow (.github/workflows/docker-build.yml) is triggered by:
- Push to main/dev: Builds and pushes with
latestordevtag - Version tags: Push tags like
v1.0.0to build versioned images - Pull requests: Builds image for testing (doesn't push)
- Manual dispatch: Trigger builds manually from GitHub UI
Images are available at ghcr.io/humlab-sead/sead_authority_service with these tags:
latest- Latest stable release from main branchdev- Latest development version from dev branchv*- Specific version tags (e.g.,v0.1.0,v1.2.3)main-sha-<commit>- Specific commit from main branchdev-sha-<commit>- Specific commit from dev branch
# Pull latest stable version
docker pull ghcr.io/humlab-sead/sead_authority_service:latest
# Pull specific version
docker pull ghcr.io/humlab-sead/sead_authority_service:v0.1.0
# Pull development version
docker pull ghcr.io/humlab-sead/sead_authority_service:dev
# Run the image
docker run -d \
-p 8000:8000 \
-v $(pwd)/docker/config.yml:/app/config/config.yml:ro \
-v $(pwd)/docker/logs:/app/logs \
--env-file docker/.env \
ghcr.io/humlab-sead/sead_authority_service:latestTo create a new release and trigger automated builds:
# Create and push a version tag
git tag -a v0.1.0 -m "Release version 0.1.0"
git push origin v0.1.0
# GitHub Actions will:
# 1. Build the Docker image
# 2. Tag it as v0.1.0, v0.1, v0, and latest
# 3. Push to ghcr.io/humlab-sead/sead_authority_service
# 4. Generate build attestation for securityFor development:
# Automatic on every push to dev branch
git checkout dev
git push origin dev
# Image built and tagged as 'dev'For production:
# 1. Create release tag
git tag v1.0.0
git push origin v1.0.0
# 2. GitHub Actions builds and pushes automatically
# 3. Deploy on server
cd docker
docker-compose -f docker-compose.prod.yml pull
docker-compose -f docker-compose.prod.yml up -dThe CI/CD pipeline uses a multi-stage Docker build:
- Builder Stage: Installs dependencies and builds application
- Runtime Stage: Minimal runtime image with only necessary components
- Security: Runs as non-root user, includes health checks
- Optimization: Layer caching for faster builds, minimal image size
- GitHub Actions: View build status at
https://github.com/humlab-sead/sead_authority_service/actions - Container Registry: View published images at
https://github.com/humlab-sead/sead_authority_service/pkgs/container/sead_authority_service
The service supports multiple deployment strategies:
-
Local Build - Build Docker image from local source code
- Best for: Development and testing
- See:
docker/Dockerfile
-
GitHub Build - Build from specific GitHub tag/branch
- Best for: Reproducible builds from releases
- See:
docker/Dockerfile.github
-
Pre-built Images - Use images from GHCR
- Best for: Production deployments
- See:
docker/docker-compose.prod.yml
-
CI/CD Pipeline - Automated builds via GitHub Actions (Recommended)
- Best for: Continuous deployment
- See:
.github/workflows/docker-build.yml
The Docker deployment uses environment variables for configuration:
# Required environment variables
SEAD_AUTHORITY_OPTIONS_DATABASE_HOST=your-db-host
SEAD_AUTHORITY_OPTIONS_DATABASE_DBNAME=sead_staging
SEAD_AUTHORITY_OPTIONS_DATABASE_USER=your-db-user
SEAD_AUTHORITY_OPTIONS_DATABASE_PORT=5432
OPENAI_API_KEY=your-openai-key
GEONAMES_USERNAME=your-geonames-usernameConfiguration file (config.yml) is mounted from the host as a read-only volume for security and easy updates without rebuilding images.
- Configure production environment variables in
docker/.env.production - Review and customize
docker/config.ymlfor production settings - Set up reverse proxy (nginx/traefik) for HTTPS
- Configure log rotation and monitoring
- Set up automated backups for logs and data
- Configure resource limits in docker-compose
- Set up monitoring and alerting (Prometheus, Grafana)
- Review security settings (firewall, access controls)
- Test health checks and auto-restart behavior
- Configure SSL/TLS certificates
For detailed deployment information, see:
- docker/README.md - Comprehensive deployment guide
- docker/QUICKSTART.md - Quick start guide
- .github/workflows/docker-build.yml - CI/CD workflow definition
[Add your license information here]