Spaces:
Runtime error
Runtime error
Download utils/blueprints/enhancer.py from Darshankumarr03/Swift-Query: direct link, hf CLI and curl.
- Browser
- Download file 843 Bytes
-
https://huggingface.co/spaces/Darshankumarr03/Swift-Query/resolve/main/utils/blueprints/enhancer.py
- Command line
-
hf download hf://spaces/Darshankumarr03/Swift-Query/utils/blueprints/enhancer.py
-
curl -L -o enhancer.py https://huggingface.co/spaces/Darshankumarr03/Swift-Query/resolve/main/utils/blueprints/enhancer.py
843 Bytes
| from flask import Blueprint, jsonify, current_app | |
| from ai_agents.clinical_summarizer import ClinicalNoteEnhancer | |
| from utils.db.db import mongo | |
| enhancer_bp = Blueprint("enhancer", __name__, url_prefix="/api/enhancer") | |
| def enhance_patient_records(patient_id): | |
| """ | |
| API endpoint to trigger the enhancement of a patient's clinical notes. | |
| """ | |
| try: | |
| enhancer = ClinicalNoteEnhancer(mongo) | |
| result = enhancer.enhance_patient_records(patient_id) | |
| return jsonify(result), 200 | |
| except ValueError as e: | |
| return jsonify({"error": str(e)}), 404 | |
| except Exception as e: | |
| current_app.logger.error(f"An unexpected error occurred during enhancement: {e}") | |
| return jsonify({"error": "An unexpected error occurred."}), 500 | |