# Edge365 Data Management Doc
---
## :small_orange_diamond: Data Management
### :small_blue_diamond: Add Group
The first thing to user Data Management function is to define your own field site topology. We call one site as the name **"Group"**. A new tenant comes with a root group, which has the same name with tenant name. Under this root group, you can define your own field site topology by **add child group**.
1. Click `Add child group` of a group

2. Fill up the `basic information` of a group, which contains with the following attributes:
- Group name
- Description
- Address
- Postal code
- City
- Longitude
- Latitude
- Time Zone
- Group Image

3. Click `Submit` to add this child group

4. Check the group tree, you can find that a new child group has been created

5. Keep adding child group to generate your own field site topology

### :small_blue_diamond: Add Object
After creating the topology, users can define the assets, such as "Pump", "Meter",...etc, of each group. We call an assert as an **Object**. To add an object, please refer to the following steps:
#### Create and edit object basic information
1. On `Object list`, click the `Add/Import` button

2. Select `New object`

3. Edit object's basic information, includes
- Object name
- Description
- Object type
- Additional message URL ()
- Days to keep object data
- Alarm code file
- Machine index
- Serial number
- Object image

4. `Submit` the result

5. A new object has been created

### :small_blue_diamond: Add Parameters
After creating an object, users can define parameters of this object, such as "Voltage", "Temperature", "Switch"...etc. To add parameters, please refer to the following steps:
#### Basic flow
1. Edit an existing object

2. Select `Parameter list` of this object

3. Select `+` button, you can see that three kinds of parameters can be added:
- **Constant parameter**
- A parameter that with constant value.
- **Primitive parameter**
- A parameter, also called as I/O Parameter, that can bind with device tag and record tag value.
- **Calculation parameter**
- A parameter that can process simple arithmetic formula and system defined functions.

4. Select one kind of parameter and fill up `Basic information` and `Alarm/Event`(if necessary).

5. Select `Submit` to add a Parameter

6. Repeat step 4~5 to add more parameters

7. Click `Cancel` or back symbol `<` to go back to previous page

8. In Object list page, click `object name` or `parameter count` to go to Parameter list page.

10. In Parameter list page, you can check all parameters of this object.

#### Data type of parameters
You need to specify a data type of a parameter:
- Number
- Parameter value in 64bit double or 64bit integer format
- Discrete
- Parameter value in digital state, integer format, started from 0
- String
- Parameter value in string format

1. Data type - **Number**
- Specify the following attributes in Number data type

- Parameter name
- Description
- Data type = Number
- Decimal places
- Unit
- Span low
- Span high
- Recording rate
- Rate to record historical data
- Do not record (default value)
- 1 min
- 5 min
- 15 min
- 30 min
- 60 min
- if user open the recording rate, Edge365 will also record the hourly and daily data into database.
- Recording type
- **Current**
- The original data of this parameter is randomly distributed between span high and span low. Such as "Temperature", "humidity", "Voltage"...
- Edge365 will record Maximum, Minimum, Last, and Average value of "Recording Rate", "Hourly", "Daily" data.
- **Cumulative** :
- The original data of this parameter is continuously growing, such as "Meter value".
- Edge365 will record Maximum, Minimum, Last, and Difference value of "Recording Rate", "Hourly", "Daily" data.
- Maximum change rate / min(%) or Maximum change / min
- Specify this value to prevent the abnormal data glitch.
- Give Maximum change rate / min(%) in "Current" type.
- Give Maximum change / min in "Cumulative" type.
- Recording rate
- Rate to record historical data
- Do not record (default value)
- 1 min
- 5 min
- 15 min
- 30 min
- 60 min
- if user open the recording rate, Edge365 will also record the hourly and daily data into database.
- In each time interval, Edge365 records:
- Duration of each stage.
- Occurrance of each stage.
2. Data type - **Discrete**
- Specify the following attributes in Discrete data type

- Parameter name
- Description
- Data type = Discrete
- State list
- Define the digital state of this discrete parameter.
- Specify the descriptor of each state.
3. Data type - **String**
- Specify the following attributes in String data type

- Parameter name
- Description
- Data type = String
- Recording data
- Yes
- No (default value)
#### Parameter type
1. Parameter type - **Constant**
- Supported data type

- Number
- Discrete
- String
- Additional attributes

- Default value
- Default value of this parameter.
- Reload data
- Only shown in edit mode
- You can specify whether to set the current value as default value or not.
- Yes
- No (default value)
2. Parameter type - **Primitive**
- Supported data type

- Number
- Discrete
- String
- Additional attributes
- Data source
- You need to select a device tag to bind with this primitive parameter.
- Click `+` in Data source field and select a device (the device must be created in **Device Management** or **Data Connectors** functions before)

- Select a tag of the above device

- Fill the rest of attribute field and click `Submit` to add this primitive parameter

3. Parameter type - **Calculation**
- Supported data type

- Number
- Discrete
- Additional attributes
- Calculation frequency (second)
- The frequency to execute the formula and calculate the result for this calculation parameter

- formula
- Read only, the value will be displayed after finishing Formula & code setting.
- Additional setting - **Formula & code**
- User can define their own mathematical formula in this tab page.

- In `Formula settings` field, write down your mathematical expression with variables, such as `(a+1)%60`

- Click `Check formula` to check if this expression is valid or not

- if valid, it will parse the variables and display them in `Code list`.

- You need to specify the data source, which will be a parameter, of the variable, click `+` and pop out the data source list.

- Select a parameter of this object or other objects

- Switch back to `Basic Information` tab, you can see the `formula` field has been assigned. Fill the rest of attribute fields and click `Submit` to add this Calculation parameter

### :small_blue_diamond: Import / Export Object
#### Export
1. On `Object list` page, click the `Export Objects` button on the top right

2. Select the download path of the export excel

3. Export excel should start download

#### Import
1. On `Object list`, click the `Add/Import` button

2. Select `Import`

3. The import dialog should pop up

4. Click the `Guide` link to get excel's field documentation, Click the `Template` link to get the excel template

5. Drop your excel into this area

6. The upload process should be starting

7. If your excel is not valid, the errors will be displayed as a list to let you know

### :small_blue_diamond: Event and Action
### :small_blue_diamond: Alarm Setting
### :small_blue_diamond: Data Connector
## :small_orange_diamond: User Management
This function is used to manage the permissions of Tenant Users and Group Users within a Tenant. When a Tenant is created, a Tenant Admin account will be assigned by default. This account will be the first user of this Tenant. Use this account to log in and start adding more Tenant Users and Group Users

### :small_blue_diamond: Tenant User
Tenant user is used to define who can enter the tenant space and use various functions in the tenant. For each added Tenant user, **role** can be set to limit the user's access to each function.Tenant admin can use the function `User Management -> Tenant Users` to add or edit Tenant User and User's Role.
#### Add / Edit tenant user
1. Click `Add` button of Tenant users page

2. Fill up the basic information of this user

3. If the user is already existed in edge365 platform, the portal will automatically fill up the basic information.

4. Set the tenant role of this user. Edge365 provide five default roles
- Admin
- Editor
- Engineer
- Operator
- Viewer
We will discuss about the relationship between role and Edge365 function in next section.

5. Click `Next` to set Group permission

6. Set this user's group role in each group. In this example, we add this user into all group and give the user a group role as **Admin** for each group.

7. Click `submit` to add this user

8. Create user successfully.

9. In Tenant user list, you can click `edit` button to edit a user

10. In `Edit tenant user` page, you can change role of this user

11. Same as step 6, you can change group role of this user. In this example, we change some group's role as **Editor** for this user.

12. Click `Submit` to modify this user.

#### Tenant Role & Edge365 Functionalities
For the five default roles provided by Edge365, each role will have corresponding Permission Scopes configuration, which include:
| Scope Display Name | Description |
| -------- | -------- |
| Group, Object, and Parameter | Group/object/parameter related operation |
| Alarm and Event | Alarm related operation |
| Profile Management | Operation of Profile Management (Not yet available) |
| Machine Status | Operation of Machine Status (Not yet available) |
| Rule Management | Operation of Rule Management (Not yet available) |
| In-Outbound Settings | Data connectors operation |
| Others (Organizer) | (System usage) |
| Others (Data Hub) | (System usage) |
| Others (Rule Engine) | (System usage) |
| User List | User related operation in User management |
| Client List | (System usage) |
| Role List | Role related operation in User management (Not yet available) |
| Command Center Settings | Command Center operation |
| Dashboard & Menu List | Dashboard & Menu operation in Command center |
| License | License in Advance Settings |
| Value and Alarm | Operate value & alarm in Dashboard (Not yet available) |
| Operation Log | Operation Log in Dashboard (Not yet available) |
The value of the scope affect the usability of the corresponding Edge365 functions.
- The value of the scope include:
- Manage (CRUD)
- View (View only)
- None (No permission)

In this section, we talk about the relationship between **tenant role** and **Edge365 functionalities**
1. Home Page

Tenant role of a user affect that whether this user can **access into** the function on Home page or not. Affected functions includes:
- Data Management
- The user, whose tenant role has one of the following scope permissions (Manage or View), can access this funciton.
- Group, Object, and Parameter
- Alarm and Event
- Profile Management
- Machine Status
- Rule Management
- In-Outbound Settings
- User Management
- The user, whose tenant role has one of the following scope permissions (Manage or View), can access this funciton.
- User List
- Client List
- Role List
- Command Center
- The user, whose tenant role has one of the following scope permissions (Manage or View), can access this funciton.
- Command Center Settings
- Dashboard & Menu List
- Advanced settings
- The user, whose tenant role has one of the following scope permissions (Manage or View), can access this funciton.
- License
- Manage my services
- The user who has the tenant role of **Admin** can access this funciton.
2. Data Management
Some functions's accessability are affected by tenant role, includes:
| Function | Related scope | Admin | Engineer | Editor | Operator | Viewer |
| -------- | -------- | -------- | -------- | -------- | -------- | -------- |
| Alarm setting |Alarm and Event | Manage | Manage| Manage | None | View |
| Data connectors | In-Outbound Settings | Manage | Manage | Manage | None | View |

3. User Management
Some functions's accessability are affected by tenant role, includes:
| Function | Related scope | Admin | Engineer | Editor | Operator | Viewer |
| -------- | -------- | -------- | -------- | -------- | -------- | -------- |
| Tenant Users | User List | Manage | None | View | None | View |
| Roles | Role List | Manage | None | View | None | View |

Note: The **Roles** function currently only supports displaying the Role list. Other functions (add, edit, delete roles) are not yet supported.
4. Command Center
Some functions's accessability are affected by tenant role, includes:
| Function | Related scope | Admin | Engineer | Editor | Operator | Viewer |
| -------- | -------- | -------- | -------- | -------- | -------- | -------- |
| Command center | Command Center Settings | Manage | Manage| Manage | None | View |
| Dashboard (Access in) | Dashboard & Menu List | Manage | Manage| Manage | None | View |
| Menu list | Dashboard & Menu List | Manage | Manage| Manage | None | View |

Note: For Dashboard functionality, the tenant role only be used to determine whether this user can access into this function or not. The inner function of dashboard operation is affected by **Group role** of this user.
### :small_blue_diamond: Group User
Group user is used to define who can enter a group and use various functions in this group. Same as tenant user, **role** can be set on a group user to limit the user's access to each function.
#### Add / Edit group user
A user, who has tenant admin role or a group's admin role, can add / edit the group user of that group.
1. Choose a group to display the user list of this group

2. Click `Add` button on the user list page of this group

3. Fill up the basic information of this user

4. If the user is already existed in edge365 platform, the portal will automatically fill up the basic information.

5. Set the group role of this user. Same as tenant role, Edge365 provide five default roles
- Admin
- Editor
- Engineer
- Operator
- Viewer

6. Click `Submit` to add this user

7. Create user successfully and return back to the user list.

8. If this user hasn't been created in this tenant before, Edge365 will give this user a "Viewer" role of this tenant.

9. In group user list, you can click `edit` button to edit a user

10. In `Edit group user` page, you can change role of this user

11. Click `Submit` to modify this user.

12. Please noted that the **group role** will be inherited by its sub-group. After you added or updated a user's role of a group, all roles of this user in sub-group will be change as well.

#### Relation with tenant role
1. While adding a user to a tenant with Tenant role = Admin, automatically add this user to all groups in this tenant and give this user group role = Admin in all groups.
2. If a user (with Tenant role = Admin) try to access a group that was created after this user been created, Edge365 will determine that this user didn't have the permission of this group and display `Join to group` button in Data management functionality.

3. After click `Join to group`, this tenant admin user will be added into this group with Admin group role and can start to access this group.

#### Group Role & Edge365 Functionalities
Same as tenant role, a user's group role will affect the acessability of the group related functionalities. In this section, we talk about the relationship between **Group role** and **Edge365 functionalities**
1. Data Management
Same like tenant role, when a user was given a group role on a group, The scopes of this group role will affect the accessability of this group's functions. The affected functions include:
| Function | Related scope | Admin | Engineer | Editor | Operator | Viewer |
| -------- | -------- | -------- | -------- | -------- | -------- | -------- |
| groups operation | Group, Object, and Parameter | Manage | Manage| Manage | None | View |
| Objects operation | Group, Object, and Parameter | Manage | Manage| Manage | None | View |
| Parameter operation | Group, Object, and Parameter | Manage | Manage| Manage | None | View |
| Event & actions | Alarm and Event | Manage | Manage| Manage | None | View |
| Parameter Alarm | Alarm and Event | Manage | Manage| Manage | None | View |
2. User Management
The following functions's accessability are affected by group role, including:
| Function | Related scope | Admin | Engineer | Editor | Operator | Viewer |
| -------- | -------- | -------- | -------- | -------- | -------- | -------- |
| Group user | User List | Manage | None | View | None | View |
3. Command Center
The following functions's accessability are affected by group role, including:
| Function | Related scope | Admin | Engineer | Editor | Operator | Viewer |
| -------- | -------- | -------- | -------- | -------- | -------- | -------- |
| Manipulate Dashboard of a group | Dashboard & Menu List | Manage | Manage| Manage | None | View |
4. Device Management
In current version, the limitation for a user to access Device Management functionality is:
- This user must be added into root group with any kinds of group role.
## :small_orange_diamond: Command Center
### :small_blue_diamond: Dashboard
### :small_blue_diamond: Menu list
### :small_blue_diamond: Command center
### :small_blue_diamond: Open grafana
---
###### tags: `Edge365`