Open omukhtar opened 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.
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.
_generateWave()
function in D3WAVEduration
and a function
. These values are stored in the params
object. z
is the miscellaneous segment. The durations should add up to 100. I don't remember exactly why, but it has to do with the rate at which the animation plays. drawPQRSTZ()
on the params object. The wave then gets scaled by D3 and visualized.scalingConstant
,tpInterpolation
,breathConstant
). The most important, for PQRST waves, is tpInterpolation. I had to manually vary the tp segment on my sinus wave and see how it affected the heart rate. I then used a third party calculator to derive a function that would allow the user to set, say, sinus at 100 and have the tp segment vary appropriately. The scaling constant comes into play with tachycardia; had to find a way to shrink the wave realistically when the rate went high. updateHR
function. I don't like that it's in the _generateWave function. I feel like it's fairly flexible the way it's set up but does require some experimentation.
Let me give you some examples:
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)
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
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'.
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.
Waw, great idea. I want to add more waveforms, including ART and PAP. How you do code the waveforms?