4 Combined Visualization

Step 4: Combined Visualization

Chains all data-fetching endpoints (4aโ€“4d) using bru.sendRequest() and renders two visualizations using bru.visualize().

What this step does

In one run it fetches the entities plus six related collections (facilities, plots, sheds, and facility/plot deforestation + emissions metrics), all filtered by the same asset_task_id, then stitches them into two rendered HTML views: a compliance summary + facility-card table, and an interactive Leaflet map. The after-response script builds lookup maps to join metrics onto their facilities and plots, so you see geometry and risk together rather than as disconnected lists.

Why it's needed

Steps 4aโ€“4d each return one slice of the picture โ€” locations here, metrics there โ€” but the story a reviewer wants (which facilities are non-compliant, where they sit on a map, how much deforestation and emissions each carries) only emerges when those slices are joined. This step is the convenience aggregation: rather than making you fire the four requests and merge the results by hand, it chains them and renders the joined output directly. It is the natural end of the quick flow โ€” the point where the upload becomes something a human can look at and act on.

When you can skip it

This step is purely presentational. Automated pipelines that consume the data programmatically don't need the rendered HTML โ€” they can call 4aโ€“4d (or their own equivalents) directly and skip the visualization entirely. Run it when a person needs to eyeball the result; skip it when a machine is the only reader.

How It Works

  1. Primary request: Fetches assets with include=normalised_data,assessments
  2. After-response script: Chains six additional requests via bru.sendRequest()
  3. Two visualizations rendered via bru.visualize('html', { ... })

Visualization 1: Summary + Facility Cards + Table (assetsTable)

Summary Statistics Bar (7 cards):

CardDescription
CommodityCommodity type from entity data
Non-Compliant PlotsPlots with noncompliance_area > 0.5 ha
Deforestation Rate(total_noncompliance_area / total_area) * 100
Total PlotsAll plots in the task
Valid FacilitiesEntities with confidence "high" or "medium"
Total AreaSum of all areas in hectares
Emissions MetricsCount of emissions metric records

Facility Detail Cards (sorted by risk score descending):

  • Name, country, risk score badge (color-coded)
  • Non-compliance area, total area
  • Expandable plot details on click

Visualization 2: Map (facilitiesMap)

Leaflet.js interactive map with three layer types:

  • Facilities โ€” polygons colored by deforestation risk (green <2%, yellow 2-10%, red >10%)
  • Supply Sheds โ€” purple dashed boundary polygons
  • Plots โ€” polygons colored by compliance status (green/red/gray)

Click popups show deforestation details and emissions metrics.

Key Difference from Full Workflow

This visualization uses asset_task_id (from Step 1) for all requests, since there is no separate process task ID in the quick ingestion flow.