# How the engine works

## Scheme of system action <a href="#scheme-of-system-action" id="scheme-of-system-action"></a>

Client's application sends statements (events) to the engine in JSON format through HTTP connection (REST API). Events get to the engine through Kafka queue. Each event is saved to repository in order to enable off-line processing.

## **On-line mode**

* An event is transformed into variables (see [chapter 3](/algolytics/event-engine-user/events.md))
* Values of given user aggregates are refreshed
* Scoring conditions are checked for each model (conditions starting evaluation of scoring and conditions checking, whether the given user should be scored by a given model)
* For every model fulfilling scoring conditions a line of data is prepared
* Score calculation
* Returning score to the client

## **Off-line mode (automatic process, running at set time intervals)**

* Counting of aggregates (based on saved events) for each user and each model
* In analytical table containing calculated aggregates and target value a line of data may be created for each user. For some users this line will not be created, since:
  * Scoring condition will not be fulfilled
  * Conditions of target window calculating will not be fulfilled (for example: the target window counts for 3 days, while data contain events happening in only 2 days)
* For each model a separate analytical table is created
* The analytical table is an input to an ABM model counting process
* Chosen models are automatically deployed

#### **Graphical diagram of system action**

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


---

# 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://algolytics-technologies.gitbook.io/algolytics/event-engine-user/how-the-engine-works.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.
