# \[SI] Data Standardization and Index

The 2PM.Network Data Standardization and Index contract is designed to facilitate the secure and standardized registration, storage, and verification of datasets on the blockchain. This enables users to maintain the integrity and consistency of data used within the 2PM.Network, ensuring that data contributions are reliable and verifiable.&#x20;

### Key Features

1. **Dataset Registration**: Allows users to register datasets with specified field names and types, ensuring that all data adheres to a predefined structure.
2. **Data Field Type Retrieval**: Provides functionality to retrieve the data type of specific fields within registered datasets.
3. **Data Upload and Verification**: Supports the secure upload of data hashes along with validation of the data against the registered dataset structure.

### Functions

**1. `registerDataset`**

* **Description**: Registers a new dataset with the given name, field names, and field types.
* **Parameters**:
  * `name` (string): The name of the dataset.
  * `fieldNames` (string\[]): An array of field names.
  * `fieldTypes` (string\[]): An array of field types corresponding to the field names.
* **Events Triggered**:
  * `DatasetRegistered`: Emitted when a dataset is successfully registered.

**2. `getFieldType`**

* **Description**: Retrieves the type of a specific field from a registered dataset.
* **Parameters**:
  * `datasetId` (uint): The identifier of the dataset.
  * `fieldName` (string): The name of the field.
* **Returns**: The type of the specified field as a string.

**3. `uploadData`**

* **Description**: Uploads and validates data against the registered dataset structure.
* **Parameters**:
  * `datasetId` (uint): The identifier of the dataset.
  * `dataHash` (bytes32): The hash of the data being uploaded.
  * `fieldNames` (string\[]): An array of field names used in the data.
  * `fieldValues` (string\[]): An array of field values corresponding to the field names.
* **Events Triggered**:
  * `DataUploaded`: Emitted when data is successfully uploaded and validated.
  * `DataValidationFailed`: Emitted if the validation fails for any reason (e.g., mismatch in field names, field not found).
  * `DataValidationPassed`: Emitted when data successfully passes all validations.

### Events

* **DatasetRegistered**
  * Emitted when a new dataset is registered. Includes the dataset ID and name.
* **DataUploaded**
  * Emitted when data is successfully uploaded. Includes the uploader's address, dataset ID, and the data hash.
* **DataValidationFailed**
  * Emitted when data fails to pass validation. Includes the uploader's address, dataset ID, and a message describing the reason for failure.
* **DataValidationPassed**
  * Emitted when data passes all validations. Includes the uploader's address and dataset ID.


---

# 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.2pm.network/2pm-data-vsies-service/si-data-standardization-and-index.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.
