th3o6a1d / monitor

D3/React-powered cardiac monitor simulator
https://monitorsim.com
MIT License
3 stars 0 forks source link

ART Waveforms #1

Open omukhtar opened 4 years ago

omukhtar commented 4 years ago

Waw, great idea. I want to add more waveforms, including ART and PAP. How you do code the waveforms?

th3o6a1d commented 4 years ago

Hey my friend,

Awesome! Are you proficient in JavaScript and git? If so, download the source code and modify the generateWave function, then submit a github pull request.

If not, I’d be happy to add those when I’m in front of a computer (currently on road trip) You’re the first to take an interest in the site. Would love to have some overall feedback.

Jason

Sent from my iPhone

On Jul 20, 2020, at 7:26 PM, omukhtar notifications@github.com wrote:

 Waw, great idea. I want to add more waveforms, including ART and PAP. How you do code the waveforms?

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub, or unsubscribe.

omukhtar commented 4 years ago

I’m a physician too and I want to create PAC (Swanz Ganz) simulator using a Raspberry Pi. Your design and code are great for such a project. I modified the height to from 200 to 120 and was able to add two waveforms (ART & PAP) both displayed as Sys/Dias (MAP) but found it difficult to understand how waveforms are generated. For such a project, I have to add ART, CVP, RA, RV, PA and PAWP waveforms. For case scenarios probably I need to add the abnormal waveforms too. Raspberry Pi will calculate the depth of catheter and provide the value to monitor and based on depth the monitor will display different PAP waveform. Enjoy your trip man.

th3o6a1d commented 4 years ago

Creating New Waves

I feel like it's fairly flexible the way it's set up but does require some experimentation.

Let me give you some examples:

Oxygen pleth

The oxygen pleth wave, which is similar to the first half of the CVP wave, with it's dicrotic notch: 1) Set all durations of PQRST wave to 0. 2) Set the z duration to, in this case, the tpInterpolation constant + 50. I think I had to add 50 because the wave was 1/2 the frequency I needed. 3) Define the function of z as the sum of two sin functions that I found by experimenting with something similar to this. 4) Generate the wave by calling drawPQRSTZ

case "pleth":
                    Object.values(params).map((i) => i.duration = () => 0)
                    params.z.duration = () => tpInterpolation + 50
                    params.z.fx = (x) => -Math.sin(x*Math.PI*2)/2 - 2*Math.sin(12.5*x-Math.PI)/2 +1
                    this.updateHR(params)
                    return this.drawPQRSTZ(params)

Vtach -- can crudely be simulated with just a wide Q and R wave.

1) Set all PQRSTZ durations to 0 2) Set Q segment to a new function and duration. 3) Set R segment to a new function and duration 4) Generate the wave by calling drawPQRSTZ

case "vtach":
                    Object.values(params).map((i) => i.duration = () => 0)
                    params.q = { duration: () => 8 + 26, fx: (x) => -1 * Math.pow(2, Math.sin(x, Math.PI)) + 1 }
                    params.r = { duration: () => 16, fx: (x) =>  Math.pow(7, Math.sin(x, Math.PI)) - 1}
                    params.z.duration = () =>  tpInterpolation
                    this.updateHR(params)
                    return this.drawPQRSTZ(params)

If you can think of a better way to modify the code and allow for diverse waveforms, let me know, otherwise I think this is an OK system.

Jason

omukhtar commented 4 years ago

I had the idea to store waveforms in audio files! This will be very customizable and easy to do. Another arrhythmia that you can add is 'torsades'.

th3o6a1d commented 4 years ago

I initially thought it might be easiest to just generate a bunch of .gif images with different wave forms and rates to choose from but that would make it difficult to update the tracing in real time.