# otp.Source.intercept_heartbeats

#### Source.intercept_heartbeats(inplace=False)

Intercepts heartbeats (timer events), leaving all other events of the time series unchanged.

* **Parameters:**
  * **inplace** ([*bool*](https://docs.python.org/3/builtins/functions.html#bool)) -- The flag controls whether operation should be applied inplace or not.
    If `inplace=True`, then it returns nothing.
    Otherwise, method returns a new modified object.
  * **self** ([*Source*](https://docs.pip.distribution.sol.onetick.com/api/source/root.html.md#onetick.py.Source))
* **Return type:**
  [`Source`](https://docs.pip.distribution.sol.onetick.com/api/source/root.html.md#onetick.py.Source) or `None`

### Examples

Assume we have heartbeats and data quality events in the data flow:

```pycon
>>> data = otp.DataSource(db='US_COMP_SAMPLE', tick_type='TRD', symbols='AAPL')
>>> data = data[['PRICE', 'SIZE']]
>>> data = data.insert_heartbeat(where=data['SIZE'] > 1000)
>>> data = data.insert_data_quality_event('OK', where=data['SIZE'] > 5000)
```

Intercepting heartbeats removes only heartbeats, data quality events are left unchanged:

```pycon
>>> data = data.intercept_heartbeats()
>>> otp.run(data.show_heartbeats(), date=otp.dt(2024, 2, 1))
Empty DataFrame
...
```

```pycon
>>> otp.run(data.show_data_quality(), date=otp.dt(2024, 2, 1))
                             Time  DATA_QUALITY_TYPE DATA_QUALITY_NAME
0   2024-02-01 08:00:00.074574483                  0                OK
1   2024-02-01 08:00:00.074937867                  0                OK
2   2024-02-01 08:00:00.075738202                  0                OK
3   2024-02-01 09:00:06.565175834                  0                OK
4   2024-02-01 09:24:20.329799843                  0                OK
...
```

#### SEE ALSO
**INTERCEPT_HEARTBEATS** OneTick event processor
<br/>
[`insert_heartbeat()`](https://docs.pip.distribution.sol.onetick.com/api/source/hidden/heartbeats/insert_heartbeat.html.md#onetick.py.Source.insert_heartbeat)
<br/>
[`show_heartbeats()`](https://docs.pip.distribution.sol.onetick.com/api/source/hidden/heartbeats/show_heartbeats.html.md#onetick.py.Source.show_heartbeats)
<br/>
