Skip to content

Commit

Permalink
Backend for Lungs Anterior completed
Browse files Browse the repository at this point in the history
  • Loading branch information
Kumar-laxmi committed Feb 19, 2024
1 parent a5469b7 commit 41d3a00
Show file tree
Hide file tree
Showing 3 changed files with 410 additions and 18 deletions.
Binary file modified app/__pycache__/views.cpython-311.pyc
Binary file not shown.
168 changes: 168 additions & 0 deletions app/templates/elements/Scripts/soundPlay.html
Original file line number Diff line number Diff line change
Expand Up @@ -290,4 +290,172 @@
});
});
});

// Trigger Left Lower Lobe Sound Play at the Backend
$(document).ready(function () {
// Function to handle range input change for different lungs sounds
const lungsSounds = [
/* Normal Breath Sound */
"brochial_respiration_front", "bronchovesicular_respiration_front", "vesicular_respiration_front", "diminished_vescicular_respiration_front",
/* Adventitious Sound */
"coarse_crackles_front", "fine_crackles_front", "wheezes_front", "rhonchi_front", "gurgling_rhonchi_front", "stridor_front", "pleural_friction_rub_front", "amphoric_respiration_front", "harsh_respiration_front",
/* Pathologies */
"asthma_front", "covid19_front", "right_sided_pneumothorax_front", "left_sided_pneumothorax_front", "pneumonia_front",
];

lungsSounds.forEach(function (identifier) {
$('#' + identifier + '_sound_LLL').click(function () {
// Check if hbr_btn is active
if ($('#hbr_btn').hasClass('active')) {
// Set the style of div1 to block
$('#hbr_div').css('display', 'none');
$('#mitral_div').css('display', 'block');
$('#aortic_div').css('display', 'none');
$('#pulmonary_div').css('display', 'none');
$('#tricuspid_div').css('display', 'none');
$('#erb_div').css('display', 'none');
}

$.ajax({
type: 'POST',
url: 'soundPlay/',
data: {'csrfmiddlewaretoken': '{{ csrf_token }}', [identifier + '_sound_LLL']: true},
success: function (response) {
// Handle success response
console.log('POST request successful for ' + identifier + '_sound_LLL' + ':', response);
},
error: function (error) {
// Handle error response
console.error('Error in POST request for ' + identifier + '_sound_LLL' + ':', error);
}
});
});
});
});

// Trigger Right Upper Lobe Sound Play at the Backend
$(document).ready(function () {
// Function to handle range input change for different lungs sounds
const lungsSounds = [
/* Normal Breath Sound */
"brochial_respiration_front", "bronchovesicular_respiration_front", "vesicular_respiration_front", "diminished_vescicular_respiration_front",
/* Adventitious Sound */
"coarse_crackles_front", "fine_crackles_front", "wheezes_front", "rhonchi_front", "gurgling_rhonchi_front", "stridor_front", "pleural_friction_rub_front", "amphoric_respiration_front", "harsh_respiration_front",
/* Pathologies */
"asthma_front", "covid19_front", "right_sided_pneumothorax_front", "left_sided_pneumothorax_front", "pneumonia_front",
];

lungsSounds.forEach(function (identifier) {
$('#' + identifier + '_sound_RUL').click(function () {
// Check if hbr_btn is active
if ($('#hbr_btn').hasClass('active')) {
// Set the style of div1 to block
$('#hbr_div').css('display', 'none');
$('#mitral_div').css('display', 'block');
$('#aortic_div').css('display', 'none');
$('#pulmonary_div').css('display', 'none');
$('#tricuspid_div').css('display', 'none');
$('#erb_div').css('display', 'none');
}

$.ajax({
type: 'POST',
url: 'soundPlay/',
data: {'csrfmiddlewaretoken': '{{ csrf_token }}', [identifier + '_sound_RUL']: true},
success: function (response) {
// Handle success response
console.log('POST request successful for ' + identifier + '_sound_RUL' + ':', response);
},
error: function (error) {
// Handle error response
console.error('Error in POST request for ' + identifier + '_sound_RUL' + ':', error);
}
});
});
});
});

// Trigger Right Middle Lobe Sound Play at the Backend
$(document).ready(function () {
// Function to handle range input change for different lungs sounds
const lungsSounds = [
/* Normal Breath Sound */
"brochial_respiration_front", "bronchovesicular_respiration_front", "vesicular_respiration_front", "diminished_vescicular_respiration_front",
/* Adventitious Sound */
"coarse_crackles_front", "fine_crackles_front", "wheezes_front", "rhonchi_front", "gurgling_rhonchi_front", "stridor_front", "pleural_friction_rub_front", "amphoric_respiration_front", "harsh_respiration_front",
/* Pathologies */
"asthma_front", "covid19_front", "right_sided_pneumothorax_front", "left_sided_pneumothorax_front", "pneumonia_front",
];

lungsSounds.forEach(function (identifier) {
$('#' + identifier + '_sound_RML').click(function () {
// Check if hbr_btn is active
if ($('#hbr_btn').hasClass('active')) {
// Set the style of div1 to block
$('#hbr_div').css('display', 'none');
$('#mitral_div').css('display', 'block');
$('#aortic_div').css('display', 'none');
$('#pulmonary_div').css('display', 'none');
$('#tricuspid_div').css('display', 'none');
$('#erb_div').css('display', 'none');
}

$.ajax({
type: 'POST',
url: 'soundPlay/',
data: {'csrfmiddlewaretoken': '{{ csrf_token }}', [identifier + '_sound_RML']: true},
success: function (response) {
// Handle success response
console.log('POST request successful for ' + identifier + '_sound_RML' + ':', response);
},
error: function (error) {
// Handle error response
console.error('Error in POST request for ' + identifier + '_sound_RML' + ':', error);
}
});
});
});
});

// Trigger Right Lower Lobe Sound Play at the Backend
$(document).ready(function () {
// Function to handle range input change for different lungs sounds
const lungsSounds = [
/* Normal Breath Sound */
"brochial_respiration_front", "bronchovesicular_respiration_front", "vesicular_respiration_front", "diminished_vescicular_respiration_front",
/* Adventitious Sound */
"coarse_crackles_front", "fine_crackles_front", "wheezes_front", "rhonchi_front", "gurgling_rhonchi_front", "stridor_front", "pleural_friction_rub_front", "amphoric_respiration_front", "harsh_respiration_front",
/* Pathologies */
"asthma_front", "covid19_front", "right_sided_pneumothorax_front", "left_sided_pneumothorax_front", "pneumonia_front",
];

lungsSounds.forEach(function (identifier) {
$('#' + identifier + '_sound_RLL').click(function () {
// Check if hbr_btn is active
if ($('#hbr_btn').hasClass('active')) {
// Set the style of div1 to block
$('#hbr_div').css('display', 'none');
$('#mitral_div').css('display', 'block');
$('#aortic_div').css('display', 'none');
$('#pulmonary_div').css('display', 'none');
$('#tricuspid_div').css('display', 'none');
$('#erb_div').css('display', 'none');
}

$.ajax({
type: 'POST',
url: 'soundPlay/',
data: {'csrfmiddlewaretoken': '{{ csrf_token }}', [identifier + '_sound_RLL']: true},
success: function (response) {
// Handle success response
console.log('POST request successful for ' + identifier + '_sound_RLL' + ':', response);
},
error: function (error) {
// Handle error response
console.error('Error in POST request for ' + identifier + '_sound_RLL' + ':', error);
}
});
});
});
});
</script>
Loading

0 comments on commit 41d3a00

Please sign in to comment.