Skip to content

Commit

Permalink
Working on Sound card volume control from backend PART-1
Browse files Browse the repository at this point in the history
  • Loading branch information
Kumar-laxmi committed Feb 8, 2024
1 parent 08d5b9e commit 7e0dd79
Show file tree
Hide file tree
Showing 5 changed files with 40 additions and 2 deletions.
Binary file modified app/__pycache__/views.cpython-311.pyc
Binary file not shown.
2 changes: 1 addition & 1 deletion app/templates/elements/Scripts/volumeUpdate.html
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
$.ajax({
url: 'mitralVolumeChange/', // Replace with your backend endpoint
method: 'POST',
data: {'csrfmiddlewaretoken': '{{ csrf_token }}', value: rangeValue}, // Send the range value as data
data: {'csrfmiddlewaretoken': '{{ csrf_token }}', identifier:'normal_heart', rangeValue: rangeValue}, // Send the range value as data
success: function (response) {
// Handle success response
console.log('POST request successful:', response);
Expand Down
36 changes: 35 additions & 1 deletion app/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
import io
import threading
import time
import os

from .models import heartAudio, lungAudio
from .forms import heartAudioForms, lungAudioForm
Expand Down Expand Up @@ -114,7 +115,40 @@ def breathUpdate(request):

def mitralVolumeChange(request):
if request.method == 'POST':
print('Range value transfer successful')
if request.POST['identifier'] == 'normal_heart':
volume = request.POST['rangeValue']
return JsonResponse({'message': 'Success!'})
else:
return HttpResponse("Request method is not a POST")

def aorticVolumeChange(request):
if request.method == 'POST':
if request.POST['identifier'] == 'normal_heart':
volume = request.POST['rangeValue']
return JsonResponse({'message': 'Success!'})
else:
return HttpResponse("Request method is not a POST")

def pulmonaryVolumeChange(request):
if request.method == 'POST':
if request.POST['identifier'] == 'normal_heart':
volume = request.POST['rangeValue']
return JsonResponse({'message': 'Success!'})
else:
return HttpResponse("Request method is not a POST")

def tricuspidVolumeChange(request):
if request.method == 'POST':
if request.POST['identifier'] == 'normal_heart':
volume = request.POST['rangeValue']
return JsonResponse({'message': 'Success!'})
else:
return HttpResponse("Request method is not a POST")

def erbVolumeChange(request):
if request.method == 'POST':
if request.POST['identifier'] == 'normal_heart':
volume = request.POST['rangeValue']
return JsonResponse({'message': 'Success!'})
else:
return HttpResponse("Request method is not a POST")
Expand Down
Binary file modified core/__pycache__/urls.cpython-311.pyc
Binary file not shown.
4 changes: 4 additions & 0 deletions core/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,10 @@
path('heartUpdate/', heartUpdate),
path('breathUpdate/', breathUpdate),
path('mitralVolumeChange/', mitralVolumeChange),
path('aorticVolumeChange/', aorticVolumeChange),
path('pulmonaryVolumeChange/', pulmonaryVolumeChange),
path('tricuspidVolumeChange/', tricuspidVolumeChange),
path('erbVolumeChange/', erbVolumeChange),
path('django_plotly_dash/', include('django_plotly_dash.urls')),
]

Expand Down

0 comments on commit 7e0dd79

Please sign in to comment.