4 Process Shed With Stats

Step 4: Process Shed With Stats

Trigger metrics processing on the validated/staged sheds. This sends the shed geometries to the sco2 API which generates plots within each shed boundary and computes the requested metrics (e.g. deforestation).

The PUT request reuses the staged entities from the upload task. A new processing task is created and returned.

What this step does

It PUTs to /ingestions/assets, scoped by filter[assets.task_id]=eq:{{shed_task_id}}, to promote the staged sheds into a processing run. The body names the metrics to compute (deforestation here) and the end_date window. The server hands the shed boundaries to the sco2 API, which generates the plots that fall inside each shed and computes the requested metrics against them, then returns a new processing task id (captured into {{shed_process_task_id}}).

Why it's needed

This is where the shed workflow actually produces analysis. Upload and validation (Steps 1โ€“3) only prove the geometries are sound; no metrics, and no per-plot detail, exist until this trigger fires. Because it reuses the already-staged entities rather than re-uploading, it is also what keeps the two-phase design cheap โ€” you pay for the expensive plot generation and deforestation compute exactly once, on input you have already confirmed.

Why it's a separate task

Processing returns its own task id rather than reusing the upload's, because it is a distinct asynchronous run with its own lifecycle. That matters for the next step: you poll {{shed_process_task_id}} (not the upload's {{shed_task_id}}) to watch processing complete. Choose the metrics list to match the analysis you need โ€” each metric adds work, so request only what you will use.