# Manage Rules

## Introduction

Define one or more rules for a specific nutrition program. Each program contains a ruleset that determines the foods to avoid, increase or decrease for that program.

{% hint style="info" %}
Rules can be added to either active or inactive programs.
{% endhint %}

## Rule Components

A rule has the following components:

### Action Type

There are three types of actions within a rule:

![](/files/dQeKSfkt6EgfXLDslikj)

* **Avoid:** Use this rule to indicate that it is necessary to avoid the intake of certain ingredients in a nutrition program. In the following example, avoid the sugar foods selected within the Ingredient Groups:

![](/files/UH0MWh2GmWuJj8i4bAbT)

* **Decrease:**  Use this rule to indicate that it is necessary to decrease the intake of certain ingredients in a nutrition program. In the following example, decrease the salt intake within the Ingredient Groups:

![](/files/FR0Buq6yDbRf08fKeVg2)

* **Increase:** Use this rule to indicate that it is necessary to increase the intake of certain ingredients in a nutrition program. In the following example, increase the omega-3 intake foods selected within the Ingredient Groups:

![](/files/WlaQGpK9bj6fFjn3N8pb)

### Ingredient group&#x20;

Choose one or more ingredient groups to be targeted within the rule.

To add ingredient groups, click on the down arrow. Two ingredient sections are displayed:

![](/files/-Mf-EHh03GeRZtS0ewSK)

* **Your ingredient groups** section lists all the custom ingredient groups [created by a user](https://docs.suggestic.com/console/access-the-main-menu/access-the-main-menu/programs/ingredient-groups/create-ingredient-groups).
* **Ingredient groups by Suggestic** section list all the predefined ingredient groups [created by Suggestic](https://docs.suggestic.com/console/access-the-main-menu/access-the-main-menu/programs/ingredient-groups#created-by-suggestic).

Search for an ingredient by entering its name. For instance, introduce milk as an ingredient, and all the ingredients that contain milk will be displayed:

![](/files/-Mf-gDtMCnljngzb9rwd)

As in the example below and depending on the rule, one or more ingredient groups can be added:

![](/files/-Mf-KVZGU7Bf6R804fNI)

### Order

The order in which the rule will appear in the API.

### Rule Priority

The rule priority is the weight of the rule. The more priority number selected, the more priority the rule has.&#x20;

For instance, if there are the following rules defined:

&#x20;**Rule #1**

![](/files/foEOmTVP7uYEJQAZymwP)

**Rule #2**

![](/files/hmeKPjckst5YTbwizQSc)

Even though both action rules are defined as **Avoid,** **Rule #2** will be prioritized because its priority is defined as 8. Therefore, it will be more important to avoid alcoholic beverages on the nutrition program than avoid sugary **foods**.

### User Segment

Select the user segment the rule is applied. [User Segments](https://docs.suggestic.com/console/access-the-main-menu/access-the-main-menu/programs/user-segments/create-a-segment) are created by users.

Click on the down arrow to list all the available user segments&#x20;

![](/files/-Mf-QpGVybc5txNqunm2)

If you cannot find a user segment that fits the rule, click on the **Edit user segments** option to open the Segments editor:

![](/files/-Mf-RV0FfkhJdE6APySl)

### **Rule** Information

At the right side of the screen, the information of the rule must be filled in:

![](/files/fwM9Jm9GP9fjgKEHLYOK)

## Create a Rule

As follows find an example of how to create a rule.

1. Go to the **Programs** section and choose a program from the list of active or inactive programs:

![](/files/D85LaO35hpsAtZLAzdrx)

&#x20;   2\. Click on the **Add Rule** option:

![](/files/JbnXJWC2ussBBEUjDCdK)

Fill in the information as in the example below where a rule that avoids milk is created and add the program information. Finally, click on the **Create** button:

![](/files/tuyND4rcNlpXzWyc3MvK)

Create as many rules as needed.

## Edit a rule

{% hint style="info" %}
Rules can be edited either on active or inactive programs
{% endhint %}

To edit a rule, select the program and click on the  <img src="/files/KN2J0okcaZPrBH5NY7nk" alt="" data-size="line">icon, the rule information is displayed:

![](/files/8o2j7r5Fu8AmiS6LbJX5)

Modify the information and then click on the **Save Changes** button.

## Delete a Rule

To delete a rule, select the program and click on the ![](/files/2kYJwYRasc1Uk5y0O10D) icon.&#x20;

![](/files/o9TMM6d2BK6wTTtGM0HM)

The following message is displayed:

![](/files/GUrFuFLf0SQZsuhqVQAu)

A message indicating that the rule has been deleted is displayed at the bottom right side of the screen:

![](/files/91SONUqc7Y4WguEHSnNU)

{% hint style="info" %}
Once a rule is deleted, it cannot be recovered.
{% endhint %}


---

# 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.suggestic.com/console/accessing-the-console/advanced-options/manage-rules.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.
