feat: add animal cohort creation projection and service

Implements Step 3.3: Animal Cohort Creation

- Add AnimalRegistryProjection for animal_registry and live_animals_by_location
- Add EventAnimalsProjection for event_animals link table
- Add IntervalProjection for location and attribute intervals
- Add AnimalService with create_cohort() for coordinating event + projections
- Add seeded_db fixture to conftest.py
- Update projections/__init__.py with new exports

All operations atomic within single transaction. Includes validation for
location (exists, active) and species (exists, active).

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
2025-12-29 06:52:23 +00:00
parent bd09c99366
commit 876e8174ee
11 changed files with 1637 additions and 1 deletions

View File

@@ -26,6 +26,15 @@ def temp_migrations_dir(tmp_path):
return migrations_path
@pytest.fixture
def seeded_db(migrated_db):
"""Database with migrations and seed data applied."""
from animaltrack.seeds import run_seeds
run_seeds(migrated_db)
return migrated_db
@pytest.fixture
def fresh_db_path(tmp_path):
"""Provide a path for a non-existent database file.