Skip to content

Introduce componentized generic workflow orchestration for gridded data to DHIS2 DataValueSet [CLIM-523] #23

Open
abyot wants to merge 5 commits intomainfrom
fastapi-generic-workflow
Open

Introduce componentized generic workflow orchestration for gridded data to DHIS2 DataValueSet [CLIM-523] #23
abyot wants to merge 5 commits intomainfrom
fastapi-generic-workflow

Conversation

@abyot
Copy link
Member

@abyot abyot commented Mar 12, 2026

Summary

This PR introduces a componentized, generic FastAPI workflow pipeline to fetch gridded datasets and generate DHIS2-compatible dataValueSet output through a single workflow endpoint.

The workflow is built from reusable components:

  1. feature_source
  2. download_dataset
  3. temporal_aggregation
  4. spatial_aggregation
  5. build_datavalueset

Each component is also discoverable and executable via dedicated component endpoints.

What’s Included

1) Generic workflow orchestration

  • Added single end-to-end workflow endpoint:
    • POST /workflows/dhis2-datavalue-set
  • Added workflow discovery endpoint:
    • GET /workflows
  • Added workflow definition support via YAML (data/workflows/*.yaml) with workflow_id selection.

2) Componentization

  • Added reusable component layer and catalog:
    • GET /components
  • Added dedicated component execution endpoints:
    • POST /components/feature-source
    • POST /components/download-dataset
    • POST /components/temporal-aggregation
    • POST /components/spatial-aggregation
    • POST /components/build-datavalue-set
  • Reused existing data_xxx services under component wrappers (no data-layer duplication).

3) Request normalization and generic mapping

  • Kept a simple flat public request payload.
  • Normalized to internal execution model for component orchestration.
  • Supports dataset-aware date normalization and org-unit feature sourcing.

4) Runtime and observability

  • Added per-component runtime tracking:
    • start/end timestamp
    • duration
    • status
    • summarized inputs/outputs
  • Added run IDs and persisted run logs under downloads workflow run directory.
  • Added response controls for component run details:
    • include_component_run_details
    • component_run_details_included
    • component_run_details_available

5) Robust validation and error contracts

  • Added step-level workflow validation (component, version, config).
  • Added stable error metadata in failure responses/logs:
    • error_code
    • failed_component
    • failed_component_version
    • run_id
  • Maintained explicit error classes:
    • 422 validation/config issues
    • 503 upstream connectivity issues
    • 500 execution failures

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant