Skip to content

☁️ Darukaa.earth — Cloud Functions

This page documents every Google Cloud Function (GCF) that powers the Darukaa.earth data pipeline. It replaces the previous placeholder file that didn’t reflect our current architecture.

Last updated: 23 June 2025


🌿 Function Catalogue

# Function Runtime Region Trigger Purpose
1 process-site-boundary Python 3.11 (GCF 2nd gen) us‑central1 HTTP Ingest user‑uploaded site shapefile (ZIP), convert to WKT, calculate centroid & area, persist to DB.
2 download-satellite-images Python 3.11 us‑central1 HTTP Fetch multi‑temporal satellite mosaics from Google Earth Engine; return signed URLs that render directly on the client map.
3 biodiversity-analysis Python 3.11 us‑central1 HTTP Core eco‑AI model: compute species richness, Shannon index, keystone species presence, habitat fragmentation scores for a site. Writes metrics back to DB.
4 carbon-analysis Python 3.11 us‑central1 HTTP Estimate above‑ground biomass, soil organic carbon, and avoided deforestation tCO₂e for a site; store outputs in DB.
5 env Python 3.11 (Cloud Run) us‑central1 HTTP Generate environmental reporting KPIs (e.g., temperature anomaly, precipitation trend) using site centroid + climate reanalysis data.

Note: All GCF URLs are secured by IAM; Cloud Run env will be migrated behind IAP in Q3 2025.


🔄 Execution Flow

sequenceDiagram
  participant User as Front‑end User
  participant API as Backend API (FastAPI)
  participant F1 as process‑site‑boundary
  participant F2 as download‑satellite‑images
  participant F3 as biodiversity‑analysis
  participant F4 as carbon‑analysis
  participant F5 as env

  User->>API: Create Site + upload shapefile (.zip)
  API->>F1: HTTP POST shapefile
  F1-->>API: centroid, area, WKT saved to DB
  API->>F2: HTTP POST site_id (WKT)
  F2-->>API: signed GEE URLs (per date range)
  Note over API,F3,F4,F5: Functions below run **only if enabled** for the site
  API->>F3: site_id (WKT)
  F3-->>API: biodiversity metrics
  API->>F4: site_id (WKT)
  F4-->>API: carbon metrics
  API->>F5: site_id (centroid)
  F5-->>API: climate KPIs
  API-->>User: Dashboard & report data ready

⚙️ Deployment & CI/CD

  • Source‑of‑truth repo: Product_backend/cloud_functions/*
  • Deployed via GitHub Actions → Cloud Build with pinned Python 3.11 runtime.
  • Secrets: Accessed via Secret Manager.

Questions? Ping @Guneet (infra) or @Jaya (data science).