Skip to content

[Good First Issue] Wire carbon analytics into API response and add impact report endpoint #14

@Oshgig

Description

@Oshgig

Overview

When a deforestation run completes, the API should include carbon loss estimates in the response. The src/climatevision/analytics/carbon.py module exists but is not wired into the API response.

Scope

  • Review src/climatevision/analytics/carbon.py for production readiness
  • If not ready, wrap carbon estimation behind a feature flag (e.g., enable_carbon: true in request)
  • Integrate carbon computation into run_inference() or post-processing step for analysis_type=deforestation
  • Add carbon_tonnes and hectares_lost to the API response schema
  • Add GET /api/reports/{run_id} endpoint returning structured impact report:
    • hectares_lost
    • carbon_tonnes
    • confidence_interval
    • region_bbox
  • Wire the report endpoint to the frontend dashboard

Acceptance Criteria

  • Deforestation API response includes carbon_estimation field
  • /api/reports/{run_id} returns a complete impact report
  • Feature flag gracefully degrades if carbon module is unavailable
  • At least one test validates carbon math against known values

Resources

  • src/climatevision/analytics/carbon.py — existing carbon module
  • src/climatevision/api/main.py — API endpoints
  • src/climatevision/inference/pipeline.py — inference flow
  • team_docs/PM_ROLE_UPDATES_FOR_GAPS.md — Francis' tasks

Difficulty: Intermediate
Labels: help wanted, backend, analytics, api

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions