# Unity - ECG data

**URL:** https://discourse.kitware.com/t/unity-ecg-data/1027
**Category:** Pulse Physiology Engine
**Created:** [May 5, 2023, 7:48pm UTC](https://discourse.kitware.com/t/unity-ecg-data/1027 "2023-05-05T19:48:12Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![lennart](https://discourse.kitware.com/letter_avatar_proxy/v4/letter/l/b9bd4f/32.png) [@lennart](https://discourse.kitware.com/u/lennart)
#### Post date: [May 5, 2023, 7:48pm UTC](https://discourse.kitware.com/t/unity-ecg-data/1027/1 "2023-05-05T19:48:12Z")

</div>

Hello,

I am trying to implement a 12-lead ECG device for my Unity project. In the planning of the project, I found [these](https://pulse.kitware.com/group___electro_cardio_gram_data.html) modules and later tried to add them in the data\_requests in the PulseEngineDriver.  
I was only able to get output by lead3, which seems to be the only one working as stated [here](https://discourse.kitware.com/t/advanced-cardiac-life-support-scenarios/49). I tried to duplicate the lead3 data in the StandardECG.json and rename it to lead2, to get an output for lead2 but this did not work.  
Maybe someone already figured out how to add new data or has an idea of how to do it.

---

<div class="post-metadata">

### Author: ![abray](https://discourse.kitware.com/user_avatar/discourse.kitware.com/abray/32/12_2.png) [@abray](https://discourse.kitware.com/u/abray)
#### Post date: [May 5, 2023, 9:25pm UTC](https://discourse.kitware.com/t/unity-ecg-data/1027/2 "2023-05-05T21:25:13Z")

</div>

Hi @lennart

Since you are running in Unity, I assume you are loading a state json file via `SerializeFromFile` or `SerializeFromString` when you setup the engine. A state file already contains the contents of the StandardECG.json, so it does not load that file. States are fully self contained. Those files are only used to initialize an engine stabilizing a patient specification. So you will need to open up your state json file and modify it to have Lead 2, very similar to what you did in your StandardECG.json. Just copy the 3 Leads and rename then to Lead2

 ![image](https://discourse.kitware.com/uploads/default/original/1X/f041577f403c8988e834c610a5ac185d44170d22.png)

If you want to generate states with the new ECG waveforms, you will need to update the StandardECG.json with the new waveforms, then execute your scenarios so they stabilize first instead of loading a state. I can help walk you through that part when/if you get to it.

For now, you really should just need to edit that state file with the new data.

Our Lead 3 ECG consists of a Lead 3 Normal Sinus waveform retrieved from Physionet  
Specifically, the waveform used is from the Stress Recognition in Automobile Drivers study done by Healey and Picard, file drive04.dat, the ECG output from time 1:58.772 - 1:59.349. This data was chosen because of its clear display of all features seen in a Normal Sinus rhythm.

So you can go here :  
[https://physionet.org/about/database/#ecg](https://physionet.org/about/database/#ecg)  
and search for the Stress (It’s the 11th bullet down)  
You can click on that link and visualize the waveforms (choose drive04.dat)

Plotted in excel it looks like this:  
 ![image](https://discourse.kitware.com/uploads/default/original/1X/b979c4b6f700910590dc8deca077d433f9a31d43.png)
