Интеграции погоды#

Документ фиксирует рабочий baseline интеграции двух источников осадков для D-008.

1. Источники и приоритет#

  • primary: локальная метеостанция (station)

  • fallback: внешний погодный сервис (external_weather_service)

  • anomaly control: сравнение station_precip_mm vs service_precip_mm с флагом anomaly_flag

2. Adapter profiles#

2.1 Локальная метеостанция#

  • adapter_profile_id: melioration-weather-station-v1

  • ingress endpoint: POST /api/v1/melioration-weather/commands/ingest

  • обязательные поля:

    • field_id

    • station_precip_mm

    • service_precip_mm (для anomaly-control)

    • observed_at (RFC3339)

2.2 Внешний weather service#

  • adapter_profile_id: melioration-weather-service-v1

  • режим: fallback при telemetry_healthy=false

  • ingress endpoint: POST /api/v1/melioration-weather/commands/ingest

  • обязательные поля:

    • field_id

    • service_precip_mm

    • observed_at (RFC3339)

3. Runtime policy#

  • Контур health: POST /api/v1/melioration-weather/commands/telemetry

  • При healthy=true:

    • source_mode=station_primary

    • used_precip_mm=station_precip_mm

  • При healthy=false:

    • source_mode=external_fallback

    • used_precip_mm=service_precip_mm

  • Для режима управления C: автоматическая деградация в fallback_mode (B по умолчанию).

4. Контрольный прогон#

  1. Выполнить POST /api/v1/melioration-weather/commands/telemetry с healthy=false.

  2. Выполнить POST /api/v1/melioration-weather/commands/ingest.

  3. Проверить GET /api/v1/melioration-weather/list:

    • source_mode=external_fallback

    • used_precip_mm=service_precip_mm

  4. Проверить GET /api/v1/melioration-field/list:

    • rain_mm и volume_mm пересчитаны с учетом fallback-осадков.