version: "1.0"

service:
  name: citizen-bird-survey
  environment: production
  region: ca-central-1
  timezone: America/Toronto
  public_url: https://birds.example.org

survey:
  project_id: spring-migration-2026
  title: Spring Migration Bird Survey
  season:
    starts_at: "2026-03-15T00:00:00-04:00"
    ends_at: "2026-06-15T23:59:59-04:00"
  protocol:
    type: stationary_point_count
    duration_minutes: 10
    radius_meters: 100
    minimum_observers: 1
    allow_incidental_observations: true
    require_complete_checklist: true
  observation_fields:
    required:
      - species
      - count
      - observed_at
      - latitude
      - longitude
      - detection_method
    optional:
      - age
      - sex
      - breeding_code
      - habitat
      - notes
      - media

species:
  taxonomy: ebird-clements
  taxonomy_version: "2025"
  accepted_regions:
    - CA
    - US
  sensitive_species:
    location_precision_meters: 10000
    visibility: project_coordinators

quality_control:
  coordinate_accuracy_meters:
    preferred: 30
    maximum: 500
  count_thresholds:
    warn_above: 250
    review_above: 1000
  automated_checks:
    - valid_coordinates
    - season_window
    - regional_species_range
    - duplicate_submission
    - count_outlier
    - media_metadata
  expert_review:
    enabled: true
    triggers:
      - rare_species
      - unusual_date
      - unusual_location
      - high_count
      - observer_flagged
    review_sla_hours: 72

privacy:
  minimum_participant_age: 13
  parental_consent_required_under: 16
  collect_precise_locations: true
  public_location_precision_meters: 1000
  retain_contact_information_days: 730
  anonymize_exports: true
  consent:
    required: true
    policy_version: "2026-01"

storage:
  database:
    engine: postgresql
    host: bird-survey-db.internal
    port: 5432
    name: bird_survey
    ssl_mode: require
    credentials_secret: bird-survey/database
  media:
    provider: s3
    bucket: citizen-bird-survey-media
    prefix: observations/
    encryption: AES256
    allowed_types:
      - image/jpeg
      - image/png
      - audio/mpeg
      - audio/wav
    maximum_file_size_mb: 50
  backups:
    enabled: true
    schedule: "0 3 * * *"
    retention_days: 35

api:
  listen_address: 0.0.0.0
  port: 8080
  request_timeout_seconds: 30
  rate_limits:
    anonymous_per_minute: 30
    authenticated_per_minute: 180
  cors:
    allowed_origins:
      - https://birds.example.org
      - https://admin.birds.example.org
  authentication:
    provider: oidc
    issuer: https://auth.example.org
    audience: citizen-bird-survey
    client_secret: bird-survey/oidc-client

workers:
  validation:
    replicas: 3
    queue: observation-validation
    maximum_retries: 5
  media_processing:
    replicas: 2
    queue: media-processing
    generate_thumbnails: true
    extract_audio_spectrograms: true
  exports:
    replicas: 1
    queue: dataset-exports
    formats:
      - csv
      - geojson
      - darwin-core

notifications:
  email:
    enabled: true
    sender: survey@birds.example.org
  events:
    submission_received: true
    observation_approved: true
    observation_needs_review: true
  coordinator_alerts:
    rare_species: immediate
    validation_backlog: hourly
    service_errors: immediate

monitoring:
  health_endpoint: /health
  metrics_endpoint: /metrics
  log_level: info
  structured_logging: true
  alerts:
    error_rate_percent: 2
    validation_queue_depth: 500
    database_connection_usage_percent: 85

exports:
  public_dataset:
    enabled: true
    schedule: "0 6 * * 1"
    license: CC-BY-4.0
    exclude:
      - participant_email
      - participant_name
      - exact_sensitive_species_coordinates
  partner_delivery:
    enabled: true
    destination: s3://bird-research-partners/weekly/
    schedule: "0 7 * * 1"