Update app.py
Browse files
app.py
CHANGED
@@ -500,23 +500,34 @@ def process_complete_consultation(name, age, sex, weight, height, complaint,
|
|
500 |
waveform_plot = None
|
501 |
if audio_file is not None:
|
502 |
results, plot_path = analyze_heartbeat(audio_file)
|
503 |
-
if
|
504 |
-
|
505 |
-
|
506 |
-
- Normal: {results.get('normal', 0)*100:.1f}%
|
507 |
-
- Murmur: {results.get('murmur', 0)*100:.1f}%
|
508 |
-
- Artifact: {results.get('artifact', 0)*100:.1f}%
|
509 |
-
"""
|
510 |
-
waveform_plot = plot_path
|
511 |
|
512 |
# Analyze investigation image if provided
|
513 |
investigation_analysis = ""
|
514 |
if investigation_image is not None:
|
515 |
investigation_analysis = analyze_medical_image(investigation_image)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
516 |
|
517 |
# Save patient data
|
518 |
-
|
519 |
-
|
|
|
520 |
|
521 |
# Generate comprehensive assessment
|
522 |
comprehensive_assessment = generate_comprehensive_assessment(patient_data)
|
|
|
500 |
waveform_plot = None
|
501 |
if audio_file is not None:
|
502 |
results, plot_path = analyze_heartbeat(audio_file)
|
503 |
+
heartbeat_results = results_text if results_text else ""
|
504 |
+
waveform_plot = plot_path
|
505 |
+
|
|
|
|
|
|
|
|
|
|
|
506 |
|
507 |
# Analyze investigation image if provided
|
508 |
investigation_analysis = ""
|
509 |
if investigation_image is not None:
|
510 |
investigation_analysis = analyze_medical_image(investigation_image)
|
511 |
+
|
512 |
+
|
513 |
+
patient_data_dict = {
|
514 |
+
'name': name if name else 'Not provided',
|
515 |
+
'age': age if age else 'Not provided',
|
516 |
+
'sex': sex if sex else 'Not provided',
|
517 |
+
'weight': weight if weight else 'Not provided',
|
518 |
+
'height': height if height else 'Not provided',
|
519 |
+
'complaint': complaint if complaint else 'Not provided',
|
520 |
+
'medical_history': medical_history if medical_history else 'Not provided',
|
521 |
+
'examination': examination if examination else 'Not provided',
|
522 |
+
'heartbeat_analysis': heartbeat_results if heartbeat_results else 'Not performed',
|
523 |
+
'investigation_analysis': investigation_analysis if investigation_analysis else 'Not provided'
|
524 |
+
}
|
525 |
+
|
526 |
|
527 |
# Save patient data
|
528 |
+
global patient_data
|
529 |
+
patient_data = patient_data_dict.copy()
|
530 |
+
patient_data['timestamp'] = datetime.now().strftime('%Y-%m-%d %H:%M:%S')
|
531 |
|
532 |
# Generate comprehensive assessment
|
533 |
comprehensive_assessment = generate_comprehensive_assessment(patient_data)
|