# Tutorials and Examples

All workflows in DOVU OS follow a consistent structure based on **data blocks** and **approval blocks**, assigned to specific actors with defined roles in the system. This flow is linked to our **DOVU standard process**, providing a robust and repeatable approach.&#x20;

While this example showcases a typical use case, the platform offers complete flexibility to adapt and create unique processes tailored to specific supply chain or workflow requirements in the future. For now, this serves as an excellent example to guide you through the key functionalities of the system.

{% hint style="info" %}
For more information on how DOVU can model different process flows please read our section on our [template language](https://docs.dovu.earth/workflow-engine/broken-reference).
{% endhint %}

***

### 1. **Register Users**

To begin, register three users with roles: **Registry**, **Supplier**, and **Verifier**. These roles are critical in enabling different permissions and interactions with the workflow. Follow the registration routes previously detailed in the API reference.

{% content-ref url="editor/actor-registration-and-roles" %}
[actor-registration-and-roles](https://docs.dovu.earth/workflow-engine/editor/actor-registration-and-roles)
{% endcontent-ref %}

<figure><img src="https://116257023-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FMgfYR4iNMhdWqFrJ1ibn%2Fuploads%2Fxqy0M0ZXbGDUW3QvGCfG%2FScreenshot%202024-12-10%20at%2017.24.06.png?alt=media&#x26;token=318121f9-df5a-48d5-a447-37c4bdecb05a" alt=""><figcaption><p>Example: Registering A new user</p></figcaption></figure>

***

### 2. **Search for Workflows**

Use the **Workflow Index** route to search for workflows available in the system. Here you will find two key workflows:

* **`example_workflow (recommended to test)`**: A generic example showcasing how to process data through a workflow without external integrations.
* **`mmcm_elv_2024 (alpha)`**: A specific example tied to end-of-life vehicles, this is connected to a guardian instance behind the scenes.

{% content-ref url="editor/workflow-blueprints" %}
[workflow-blueprints](https://docs.dovu.earth/workflow-engine/editor/workflow-blueprints)
{% endcontent-ref %}

<figure><img src="https://116257023-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FMgfYR4iNMhdWqFrJ1ibn%2Fuploads%2FnTBK7hyvKkHiLJyRR714%2FScreenshot%202024-12-10%20at%2017.28.22.png?alt=media&#x26;token=2163c66a-3976-4e0c-84ea-d947cc86d6ad" alt=""><figcaption><p>Example: List all Workflow blueprints that exist in system</p></figcaption></figure>

From this you may extract out the **id** value to use for publishing.

***

### 3. **Publish a Workflow**

Once you’ve identified your workflow, **publish** it while logged in as a **registry** actor to create your own **unique instance**. This isolates your workflow and republishes the associated Guardian policy (if applicable), ensuring it is tied exclusively to your user account.

See: **the workflow blueprint publish endpoint.**

{% content-ref url="editor/workflow-blueprints" %}
[workflow-blueprints](https://docs.dovu.earth/workflow-engine/editor/workflow-blueprints)
{% endcontent-ref %}

<figure><img src="https://116257023-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FMgfYR4iNMhdWqFrJ1ibn%2Fuploads%2FfT5ZFsCCKaFDTwdsJWe8%2FScreenshot%202024-12-10%20at%2017.31.33.png?alt=media&#x26;token=af57d2b5-a344-4dcd-9385-d514b968d77a" alt=""><figcaption><p>Example: publishing a workflow</p></figcaption></figure>

**Next,** you may scan for the individual instance of the workflow to understand its ongoing status, if it is connected to Guardian, integrations, it will be in an "**Importing"** state while underlying policies, are imported and published.

<figure><img src="https://116257023-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FMgfYR4iNMhdWqFrJ1ibn%2Fuploads%2Fi0qQX1FFiNYPeBKab72Q%2FScreenshot%202024-12-10%20at%2017.33.42.png?alt=media&#x26;token=04a699f7-f08e-4557-97a9-4e8d9412907b" alt=""><figcaption><p>Example: a workflow instance currently importing its downstream dependencies.</p></figcaption></figure>

After a few minutes, the status of the workflow should update to "**Ready**", at this point, you can attach your verifier and supplier to the workflow itself so that they may process actions.<br>

<figure><img src="https://116257023-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FMgfYR4iNMhdWqFrJ1ibn%2Fuploads%2FMnFLtrMRPwPFg3PApOyn%2FScreenshot%202024-12-10%20at%2017.35.16.png?alt=media&#x26;token=b569ae5e-9b7b-450b-ac90-0491c2a995b8" alt=""><figcaption><p>Example: a workflow instance in a Ready state</p></figcaption></figure>

{% hint style="info" %}
Note: The publishing and Guardian policy import process may take a few minutes. Ensure the workflow instance is ready before proceeding to user attachment.
{% endhint %}

***

### 4. **Attach Users to the Workflow**

After the workflow instance has reached the **Ready** state, attach the previously registered users (supplier, verifier) to your workflow.&#x20;

{% content-ref url="editor/actor-registration-and-roles" %}
[actor-registration-and-roles](https://docs.dovu.earth/workflow-engine/editor/actor-registration-and-roles)
{% endcontent-ref %}

{% hint style="warning" %}
If you attempt to attach users to a workflow instance, before it is ready, you will receive a warning from the system.

*"The workflow instance is currently not ready yet, this is usually related to the import and publishing of related Guardian policies."*
{% endhint %}

***

### 5. **Submit Data to Blocks**

With the workflow ready and users attached, start pushing data to the initial **Data Block**. Ensure the data aligns with the **schema formats** provided during workflow publishing. Proper schema compliance is necessary for successful data submission.

{% content-ref url="editor/workflow-block-instance-processing" %}
[workflow-block-instance-processing](https://docs.dovu.earth/workflow-engine/editor/workflow-block-instance-processing)
{% endcontent-ref %}

***

### 6. **Approval Block Workflow**

Switch to the **Registry** role to approve the submitted Data Block. This process will repeat across subsequent data and approval blocks as the workflow progresses.

{% content-ref url="editor/workflow-block-instance-processing" %}
[workflow-block-instance-processing](https://docs.dovu.earth/workflow-engine/editor/workflow-block-instance-processing)
{% endcontent-ref %}

***

### 7. **Final Submission and Claim Approval**

After submitting the "claim" Data Block, the **Verifier** role is required to approve the final Approval Block. This step ensures compliance and verification of the entire workflow.

{% content-ref url="editor/workflow-block-instance-processing" %}
[workflow-block-instance-processing](https://docs.dovu.earth/workflow-engine/editor/workflow-block-instance-processing)
{% endcontent-ref %}

***

### 8. **Issuing Credits and Querying Assets**

Upon successful verification:

* The system generates credits in the background using Guardian.
* Audit trails are created to track all actions and data points within the workflow.
* Issued assets can be queried via the **Credit Warehouse System**, allowing for comprehensive reporting and tracking.

{% content-ref url="editor/audit-trails" %}
[audit-trails](https://docs.dovu.earth/workflow-engine/editor/audit-trails)
{% endcontent-ref %}

{% content-ref url="editor/credit-warehouse-queries" %}
[credit-warehouse-queries](https://docs.dovu.earth/workflow-engine/editor/credit-warehouse-queries)
{% endcontent-ref %}


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.dovu.earth/workflow-engine/tutorials-and-examples.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
