6 Combined Visualization

Step 5: Combined Visualization

Fetches sheds, their plots, and deforestation metrics, then renders two HTML visualizations:

  1. shedsTable โ€” Summary stats, shed overview cards, and per-shed plot tables
  2. shedsMap โ€” Interactive Leaflet map showing shed boundaries (purple dashed), plots colored by compliance status, and click popups with deforestation metrics

What this step does

It reads the processed results back out of the API and draws them. The after-response script issues three follow-on reads scoped by filter[assets.task_id]=eq:{{shed_task_id}} โ€” the sheds (/locations/sheds), the plots the processing run generated inside them (/locations/plots), and the per-plot deforestation metrics (/metrics/plots/deforestation) โ€” then joins them into the table and map visualisations.

Why it's needed

This is the payoff of the workflow: it turns the raw shed boundaries plus the plots and metrics that Step 4 produced into a portfolio-level view of a sourcing region โ€” which sheds contain which plots, and how each plot scores on deforestation. It reads from the durable locations and metrics endpoints (not the ingestion task), so it reflects the persisted result, not the in-flight task. It only tells a complete story once Step 5 reports completed; run earlier and the plots/metrics reads come back empty.

When you can skip it

This step is presentation only โ€” it writes no data and drives no further processing. If your integration consumes shed results programmatically (e.g. straight from /locations/sheds, /locations/plots, and /metrics/plots/deforestation), you can skip the visualisation entirely and query those endpoints directly. Keep it when a human wants to review the sourcing region on a map.