Skip to content

[Good First Issue] Extend /api/health with model load diagnostics #20

@Oshgig

Description

@Oshgig

Overview

The API currently returns a generic {"status": "ok"} from /api/health. We want a lightweight self-check endpoint that verifies the inference pipeline can actually load a model, so ops knows if the system is truly ready or just running.

Scope

  • Extend /api/health in src/climatevision/api/main.py to run a diagnostics check
  • Try loading each enabled analysis type's model via _load_model(analysis_type)
  • Report per-analysis-type status:
    • "model_loaded": true/false
    • "model_path": "models/unet_deforestation.pth" (or null if missing)
    • "config_valid": true/false
  • If any model fails to load, return HTTP 200 with "status": "degraded" (do not crash)
  • Add pytest test in tests/test_api.py verifying health returns expected shape

Acceptance Criteria

  • GET /api/health returns model load status for all enabled analysis types
  • Missing weights result in "model_loaded": false, not a 500 error
  • Response shape is consistent and documented

Resources

  • src/climatevision/api/main.py — existing /api/health
  • src/climatevision/inference/pipeline.py_load_model()
  • config.yaml — enabled analysis types

Difficulty: Beginner-friendly
Labels: good first issue, backend, api, observability

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions