> For the complete documentation index, see [llms.txt](https://docs.extrahorizon.com/extrahorizon/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.extrahorizon.com/extrahorizon/services/manage-data/data-service.md).

# Data Service

## **Intro** <a href="#intro" id="intro"></a>

Data is managed using structured documents, written in JSON. These documents rely on data schemas which determine the structure, behaviour, and logic of the documents in a schema collection. The purpose of a data schema is twofold:

1. **Define Data structure:** Data Schemas define the structure of a document using properties. This ensures uniform structuring of documents across the service and provides input validation for API interactions. Data structure definitions in schemas are inspired by [JSON-schemas](http://json-schema.org/) and adhere to the same syntax.
2. **Define behavioural logic:** Data Schemas define the behavioural logic of a document using states and transitions. When a document transitions from one status to another, actions are triggered such as sending an email or running a small piece of code in other services.

{% embed url="<https://www.youtube.com/watch?v=YvjHxZC9hjo>" %}
ExH Explainer - Data Service Basics
{% endembed %}

### Data Structure <a href="#data-structure" id="data-structure"></a>

Schema validation is based on the open-source JSON schema specification. This allows you to create complex data structures that you can configure yourself. Besides defining field types, you can create complex fields with constraints like: minimum, maximum, regex, maxItems, minItems, …

<figure><img src="/files/LXmFtKXnP3vu7XkTXBMr" alt=""><figcaption></figcaption></figure>

### States & Transitions <a href="#states-and-transitions" id="states-and-transitions"></a>

The data service allows you to configure workflows that match your exact business need. You can mark your documents with specific states and create transitions between these states, these can be manual or automatic.

E.g. you can easily create a workflow responsible for capturing the data of your measurement, triggering your algorithm to make a diagnosis, notify the physician if when a review is necessary and generate and send a report back to the patient.

<figure><img src="/files/6pf3ooSW8dnjoZ3ZhaKa" alt=""><figcaption></figcaption></figure>

### Conditions & Actions <a href="#conditions-and-actions" id="conditions-and-actions"></a>

In many cases you will want to restrict transitions from happening. Using conditions you can define limitations to when a transition can be triggered and who can trigger them. E.g. you can make automated transitions only trigger under specific circumstances. (Field value, the person executing the transition, …). When a transition does trigger or is executed you can attach actions. These actions can range from sending events, sending text messages, push notifications, email, starting a script and so much more…

<figure><img src="/files/1RdxbrNlnGcSJ5POjCOi" alt=""><figcaption></figcaption></figure>


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## 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, and the optional `goal` query parameter:

```
GET https://docs.extrahorizon.com/extrahorizon/services/manage-data/data-service.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

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.
