***
title: Data Structure Definition
description: Learn how to define data structure in Fynapse.
subtitle: Configure data structure for entities.
------------------------------------------------
## Overview
The **Data Structure Definition** screen allows you to upload files with definitions of Entities and their attributes.
For more details on the Data Structure, refer to [Data Structure](/docs/instance-management/bulk-operations/data-structure/overview).
We recommend that you upload the entire configuration via [Configuration Data](/docs/instance-management/bulk-operations/configuration-data) JSON file.
## General Information
Note that uploading Fynapse configuration using the Bulk Upload functionality will cause all transaction data to be wiped out from the system.
This is temporary until a validation is implemented in the screen.
### File Format
The **Data Structure Definition** screen allows the upload of files in a JSON format.
```json
[
{
"name": "legalEntity",
"temporalityType": "Reference",
"description": "Legal Entity",
"type": "DefinedEntity",
"primaryKeyAttributeNames": [
"company"
],
"attributes": [
{
"name": "company",
"label": "Company",
"mandatory": true,
"type": {
"typeName": "PrimitiveType",
"primitive": "TEXT"
}
},
{
"name": "costCentre",
"label": "Cost Centre",
"mandatory": false,
"type": {
"typeName": "PrimitiveType",
"primitive": "TEXT"
}
},
{
"name": "transactionCurrency",
"label": "Transaction Currency",
"mandatory": false,
"type": {
"typeName": "PrimitiveType",
"primitive": "TEXT"
}
},
{
"name": "product",
"label": "Product",
"mandatory": false,
"type": {
"typeName": "PrimitiveType",
"primitive": "TEXT"
}
},
{
"name": "partyIdentifier",
"label": "Party Identifier",
"mandatory": false,
"type": {
"typeName": "PrimitiveType",
"primitive": "TEXT"
}
},
{
"name": "sourceSystem",
"label": "Source System",
"mandatory": false,
"type": {
"typeName": "PrimitiveType",
"primitive": "TEXT"
}
}
],
"databaseConfiguration": [
{
"databaseProfile": "fds"
}
],
"references": [
{
"name": "vendor",
"label": "Vendor",
"entity": "organisationUnit",
"namespace": "fynapse",
"definition": [
{
"typeName": "Attribute",
"referencedAttribute": "organisationUnitIdentifier",
"attributeName": "company"
},
{
"typeName": "Const",
"referencedAttribute": "organisationUnitIdentifierType",
"value": "Cost Centre"
}
]
}
],
"validations": [
{
"name": "Mandatory Vendor",
"type": "MANDATORY",
"attributeName": "vendor.organisationUnitIdentifier"
}
]
}
]
```
### Constraints on File Upload
An upload file can contain many Entities, but all of them must be unique for the upload to be successful. If your file comprises of both new Entities and Entities which have been previously uploaded, the upload will fail because you cannot re-upload the same Entities.
To upload only new Entities from a file containing a mix of new and already existing Entities, remove the Entities which have already been uploaded to Fynapse from the file and upload the modified file with only the new Entities.
The maximum numbers of user defined Entities stored in Fynapse in Finance Data Service is 50.
### Definition Constraints
The definitions uploaded in a JSON file have to meet the following prerequisites:
#### Entity
* name:
* Has to be unique.
* Has to be composed using the following rules: start with letter, which can be followed by alphanumeric characters and an underscore.
* Has the maximum length of 128 characters.
* temporalityType - what kind of data are contained in this Entity:
* Reference - determines that the entity has a reference data type
* Transaction - determines that the entity has a transactional data type; these are accounting data that cannot be changed
* description - you can add an optional description
* type - determines what type of an Entity this is:
* ProtectedEntity - this is an entity which is created by the system when you define configurations that are necessary for the functioning of the system.
* DefinedEntity - this is an entity defined by the user, you can create as many or as little defined entities as required by your data architecture.
* primaryKeyAttributeNames - this is the definition of Attributes which will constitute the Primary Key and allow to identify the record in the system\
The Primary Key has to:
* Be unique
* Consist of only mandatory Attributes
* Consist of a minimum of 1 Attribute
* Consist of a maximum of 5 Attributes (this requirement is valid for Defined Entities only)
* Consist only of primitive attributes
When defining an Entity to be used as target for an extract, remember to add *extractId* to the Primary Key for Transaction type transient Entities to ensure correct deduplication of data.
For more details, refer to [Flow](/docs/processing-configuration/flow/overview).
The maximum number of Entities that you can create in Fynapse is set to 100.
#### Attribute
An Entity has to have at least one Attribute.
Defined Entities can have up to 100 attributes (including Inline Entities).
* name - unique name:
* Has to be unique.
* Has to be composed using the following rules: start with letter, which can be followed by alphanumeric characters and an underscore.
* Has the maximum length of 128 characters.
* label:
* Has to be unique
* Has the maximum length of 128 characters
* No constraints on syntax
* mandatory - determines if an attribute is mandatory:
* true
* false
* type - determines whether this is a Primitive or a Complex Attribute:
* Primitive attributes:
* UUID
Please note that the UUID inputs are not generated automatically. You need to generate them either via a third party generator or in your upstream system and include them in the ingest file with the rest of the input data.
* BOOLEAN
* TIMESTAMP - the format used in Fynapse is: yyyy-mm-dd HH:mm:ss. This format is hardcoded and cannot be changed.
* DATE - the date format Fynapse is: yyyy-mm-dd. This format is hardcoded and cannot be changed.
* TEXT
* INT
* DECIMAL - the decimal attribute operates with the following parameters: scale 18 digits and precision 3 digits. This format is hardcoded and cannot be changed.
* HIGH-PRECISION DECIMAL
* Complex attributes:
* Inline Entity - this is an entity attribute type, i.e. a child entity nested within another entity.
* List - this is an attribute type which can store an ordered collection of data, primitive or complex, e.g. Inline Entities. The data contained within the List will be ordered in accordance with the order they were supplied to Fynapse. An example of this is a ‘person’ Entity with list of ‘children’, ordered from youngest to oldest.\
A special example of this are Protected entities Journal and Journal Line, with Journal Entity containing a list of Journal Line Entities. Their order is determined by Fynapse.
Please note:
* InLine type complex attribute can only be defined as a nested attribute of a List type attribute; you cannot define InLine type attribute as a standalone attribute
* It is not possible to define a List type attribute as nested attribute of another List type attribute
**Validations**
Validations - you can define your own validations for Business Events\
For more details, refer to [Validations](/docs/instance-management/bulk-operations/data-structure/validations).
### Examples of Attribute Definitions:
**Primitive Attributes**
```json
{
"name": "company",
"label": "Company",
"mandatory": true,
"type": {
"typeName": "PrimitiveType",
"primitive": "TEXT"
}
}
```
```json
{
"name": "glAccount",
"label": "GL Account",
"mandatory": false,
"type": {
"typeName": "PrimitiveType",
"primitive": "INT"
}
}
```
```json
{
"name": "timeOfAdmission",
"label": "A timestamp of the record's admission to the organization",
"mandatory": true,
"type": {
"typeName": "PrimitiveType",
"primitive": "TIMESTAMP"
}
}
```
**Complex Attributes**
```json
{
"name": "personal",
"label": "Personal data (names, etc.)",
"mandatory": true,
"type": {
"typeName": "InlineEntityType",
"definition": {
"name": "PersonalData",
"description": "A personal data record",
"type": "DefinedEntity",
"primaryKeyAttributeNames": [
"id"
],
"attributes": [
{
"name": "id",
"label": "Record ID",
"mandatory": true,
"type": {
"typeName": "PrimitiveType",
"primitive": "UUID"
}
},
{
"name": "familyName",
"label": "Family name",
"mandatory": true,
"type": {
"typeName": "PrimitiveType",
"primitive": "TEXT"
}
},
{
"name": "firstName",
"label": "First name",
"mandatory": true,
"type": {
"typeName": "PrimitiveType",
"primitive": "TEXT"
}
},
{
"name": "middleNames",
"label": "Middle names",
"mandatory": false,
"type": {
"typeName": "ListType",
"itemType": {
"typeName": "PrimitiveType",
"primitive": "TEXT"
}
}
}
]
}
}
}
```
```json
{
"name": "children",
"label": "List of children",
"mandatory": false,
"type": {
"typeName": "ListType",
"itemType": {
"typeName": "InlineEntityType",
"definition": {
"name": "Child",
"description": "Record about a child",
"type": "DefinedEntity",
"primaryKeyAttributeNames": [
"childId"
],
"attributes": [
{
"name": "childId",
"label": "Child ID",
"mandatory": true,
"type": {
"typeName": "PrimitiveType",
"primitive": "UUID"
}
},
{
"name": "gender",
"label": "Gender",
"mandatory": true,
"type": {
"typeName": "PrimitiveType",
"primitive": "TEXT"
}
},
{
"name": "personal",
"label": "Personal data (names, etc.)",
"mandatory": true,
"type": {
"typeName": "InlineEntityType",
"definition": {
"name": "PersonalChildData",
"description": "A personal data record of a child",
"type": "DefinedEntity",
"primaryKeyAttributeNames": [
"id"
],
"attributes": [
{
"name": "id",
"label": "ID",
"mandatory": true,
"type": {
"typeName": "PrimitiveType",
"primitive": "UUID"
}
},
{
"name": "familyName",
"label": "Family name",
"mandatory": true,
"type": {
"typeName": "PrimitiveType",
"primitive": "TEXT"
}
},
{
"name": "firstName",
"label": "First name",
"mandatory": true,
"type": {
"typeName": "PrimitiveType",
"primitive": "TEXT"
}
},
{
"name": "middleNames",
"label": "Middle names",
"mandatory": false,
"type": {
"typeName": "ListType",
"itemType": {
"typeName": "PrimitiveType",
"primitive": "TEXT"
}
}
}
]
}
}
}
]
}
}
}
}
```
## Data Structure Definition Screen
The **Data Structure Definition** screen comprises the following sections:
* The work pane:
* The **Upload** button - click it to upload a JSON file with data structure
* The **Refresh** button - click it to check:
* If any new Entities appeared
* If any of the Entities were deleted
* If statuses of the Entities changed
* The **Delete** button - click it to delete a selected Entity from the database using the Schema Repository
Note that deleting an Entity cannot be reverted.
* The **Delete all** button - click it to delete all the Entities from the database using the Schema Repository
Note that deleting an Entity cannot be reverted.
* The grid - where you can see information about the Entities. One row in a grid represents one row in a database. The grid comprises the following columns:
* **Entity name** - a unique name of the uploaded Entity
* **Entity status** - a status of a particular Entity
Entities' Statuses
* CREATE\_REQUESTED - a request for creating an Entity in a database was sent
* CREATING - a temporary status displayed in the grid when creating is in progress
* CREATED - the Entity has been created
* CREATE\_ERROR - an error occurred during creating the Entity
* DELETE\_REQUESTED - a request for deleting the Entity from a database was sent
* DELETING - a temporary status displayed when deleting is in progress
* DELETED - the Entity is about to be deleted from the database. You will not be able to see this status because the row with the Entity you scheduled for deletion is also deleted from the grid.
* DELETE\_ERROR - an error occurred during deleting the Entity
* UNKNOWN - the status of the Entity is not known. Contact the system administrator to find out more.
* EMPTY - no provisioning was requested
* EDIT\_REQUESTED - provisioning request for EDIT was sent
## Tutorials
Currently, you cannot edit an Entity directly from UI.
1. Go to **Configuration > Bulk Operations > Configuration Data**.
2. Upload a new Configuration Data JSON file containing the modified Entity using the **Upload** button.
3. Go to **Configuration > Bulk Operations > Data Structure Definition**. Click the **Refresh** button to see the new Entity in the grid.
1. Go to **Configuration > Bulk Operations > Data Structure Definition**.
2. In the grid, click the row containing an Entity you want to delete.
Note that deleting an Entity cannot be reverted.
3. Click the **Delete** button.
4. Confirm your action. The selected Entity will be deleted using Schema Repository from the database and as a result from the grid as well.
5. Click the **Refresh** button to see the results of deletion.
1. Go to **Configuration > Bulk Operations > Data Structure Definition**.
Note that deleting an Entity cannot be reverted.
2. Click the **Delete** **all** button.
3. Confirm your action. All Entities will be deleted using Schema Repository from the database and as a result from the grid as well.
4. Click the **Refresh** button to see the results of deletion.