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
- Primary request: Fetches assets with
include=normalised_data,assessments - After-response script: Chains six additional requests via
bru.sendRequest() - Two visualizations rendered via
bru.visualize('html', { ... })
โถVisualization 1: Summary + Facility Cards + Table (assetsTable)
assetsTable)Summary Statistics Bar (7 cards):
| Card | Description |
|---|---|
| Commodity | Commodity type from entity data |
| Non-Compliant Plots | Plots with noncompliance_area > 0.5 ha |
| Deforestation Rate | (total_noncompliance_area / total_area) * 100 |
| Total Plots | All plots in the task |
| Valid Facilities | Entities with confidence "high" or "medium" |
| Total Area | Sum of all areas in hectares |
| Emissions Metrics | Count 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)
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.