> ## Documentation Index
> Fetch the complete documentation index at: https://docs.open-metadata.org/llms.txt
> Use this file to discover all available pages before exploring further.

# Data Insight Mixin

[<img src="https://img.shields.io/badge/-source-cccccc?style=flat-square" />](https://github.com/open-metadata/OpenMetadata/tree/main/ingestion/src/metadata/ingestion/ometa/mixins/data_insight_mixin.py#L0")

# module `data_insight_mixin`

Mixin class containing data specific methods

To be used by OpenMetadata class

***

[<img src="https://img.shields.io/badge/-source-cccccc?style=flat-square" />](https://github.com/open-metadata/OpenMetadata/tree/main/ingestion/src/metadata/ingestion/ometa/mixins/data_insight_mixin.py#L36")

## class `DataInsightMixin`

data insight mixin used to write results

***

[<img src="https://img.shields.io/badge/-source-cccccc?style=flat-square" />](https://github.com/open-metadata/OpenMetadata/tree/main/ingestion/src/metadata/ingestion/ometa/mixins/data_insight_mixin.py#L39")

### method `add_data_insight_report_data`

```python theme={null}
add_data_insight_report_data(record: 'ReportData') → ReportData
```

Given a ReportData object convert it to a json payload and send a POST request to the report data endpoint

**Args:**

* `record` (ReportData):  report data

***

[<img src="https://img.shields.io/badge/-source-cccccc?style=flat-square" />](https://github.com/open-metadata/OpenMetadata/tree/main/ingestion/src/metadata/ingestion/ometa/mixins/data_insight_mixin.py#L51")

### method `add_kpi_result`

```python theme={null}
add_kpi_result(fqn: 'str', record: 'KpiResult') → KpiResult
```

Given a ReportData object convert it to a json payload and send a POST request to the report data endpoint

**Args:**

* `record` (ReportData):  report data

***

[<img src="https://img.shields.io/badge/-source-cccccc?style=flat-square" />](https://github.com/open-metadata/OpenMetadata/tree/main/ingestion/src/metadata/ingestion/ometa/mixins/data_insight_mixin.py#L63")

### method `add_web_analytic_events`

```python theme={null}
add_web_analytic_events(
    event_data: 'WebAnalyticEventData'
) → List[WebAnalyticEventData]
```

Get web analytic event

***

[<img src="https://img.shields.io/badge/-source-cccccc?style=flat-square" />](https://github.com/open-metadata/OpenMetadata/tree/main/ingestion/src/metadata/ingestion/ometa/mixins/data_insight_mixin.py#L148")

### method `create_kpi`

```python theme={null}
create_kpi(create: 'CreateKpiRequest') → Kpi
```

***

[<img src="https://img.shields.io/badge/-source-cccccc?style=flat-square" />](https://github.com/open-metadata/OpenMetadata/tree/main/ingestion/src/metadata/ingestion/ometa/mixins/data_insight_mixin.py#L191")

### method `delete_report_data`

```python theme={null}
delete_report_data(report_data_type: 'ReportDataType') → None
```

Delete report data for a specific report data type

**Args:**

* `report_data_type` (ReportDataType):  report date type to delete

***

[<img src="https://img.shields.io/badge/-source-cccccc?style=flat-square" />](https://github.com/open-metadata/OpenMetadata/tree/main/ingestion/src/metadata/ingestion/ometa/mixins/data_insight_mixin.py#L178")

### method `delete_report_data_at_date`

```python theme={null}
delete_report_data_at_date(
    report_data_type: 'ReportDataType',
    date: 'str'
) → None
```

Delete report data at a specific date for a specific report data type

**Args:**

* `report_data_type` (ReportDataType):  report date type to delete
* `date` (str):  date for which to delete the report data

***

[<img src="https://img.shields.io/badge/-source-cccccc?style=flat-square" />](https://github.com/open-metadata/OpenMetadata/tree/main/ingestion/src/metadata/ingestion/ometa/mixins/data_insight_mixin.py#L166")

### method `delete_web_analytic_event_before_ts_exclusive`

```python theme={null}
delete_web_analytic_event_before_ts_exclusive(
    event_type: 'WebAnalyticEventType',
    tmsp: 'int'
)
```

Deletes web analytics events before a timestamp

**Args:**

* `event_type` (WebAnalyticEventData):  web analytic event type
* `tmsp` (int):  timestamp

***

[<img src="https://img.shields.io/badge/-source-cccccc?style=flat-square" />](https://github.com/open-metadata/OpenMetadata/tree/main/ingestion/src/metadata/ingestion/ometa/mixins/data_insight_mixin.py#L94")

### method `get_aggregated_data_insight_results`

```python theme={null}
get_aggregated_data_insight_results(
    start_ts: 'int',
    end_ts: 'int',
    data_insight_chart_name: 'str',
    data_report_index: 'str',
    params: 'Optional[dict]' = None
) → DataInsightChartResult
```

*summary*

**Args:**

* `start_ts` (int):  *description*
* `end_ts` (int):  *description*
* `data_insight_chart_name` (str):  *description*
* `data_report_index` (str):  *description*
* `params` (Optional\[dict], optional):  *description*. Defaults to None.

**Returns:**

* `DataInsightChartResult`:  *description*

***

[<img src="https://img.shields.io/badge/-source-cccccc?style=flat-square" />](https://github.com/open-metadata/OpenMetadata/tree/main/ingestion/src/metadata/ingestion/ometa/mixins/data_insight_mixin.py#L73")

### method `get_data_insight_report_data`

```python theme={null}
get_data_insight_report_data(
    start_ts: 'int',
    end_ts: 'int',
    report_data_type: 'str'
) → dict[str, list[ReportData]]
```

Return dict with a list of report data given a start and end date

**Args:**

* `start_ts` (*type*):  start\_timestamp
* `end_ts` (*type*):  end timestampe
* `report_data_type` (ReportDataType):  report data type

**Returns:**
List\[ReportData]:

***

[<img src="https://img.shields.io/badge/-source-cccccc?style=flat-square" />](https://github.com/open-metadata/OpenMetadata/tree/main/ingestion/src/metadata/ingestion/ometa/mixins/data_insight_mixin.py#L132")

### method `get_kpi_result`

```python theme={null}
get_kpi_result(fqn: 'str', start_ts, end_ts) → list[KpiResult]
```

Given FQN return KPI results

**Args:**

* `fqn` (str):  fullyQualifiedName

***

[<img src="https://img.shields.io/badge/-source-cccccc?style=flat-square" />](https://github.com/open-metadata/OpenMetadata/tree/main/ingestion/src/metadata/ingestion/ometa/mixins/data_insight_mixin.py#L153")

### method `get_web_analytic_events`

```python theme={null}
get_web_analytic_events(
    event_type: 'WebAnalyticEventType',
    start_ts: 'int',
    end_ts: 'int'
) → List[WebAnalyticEventData]
```

Get web analytic event

***
