The NeuroApp is an application designed to list, edit, and predict tumors in patients. It provides a user-friendly interface for medical professionals to manage potential tumor patients. With the NeuroApp, users can easily input and update patient information, view and edit tumor details, and utilize predictive algorithms to predict tumor's presence.
To install the requirements, follow these steps:
- Clone the repository:
git clone https://github.com/kstarkiller/simplon_brief14_NeuroApp.git
- Install the requirements using
pip install -r requirements.txt
This backend is implemented using FastAPI and integrates with MongoDB for data management. It serves various endpoints for handling patient data and performing AI-based predictions for brain tumor diagnosis.
- Patient data management (add, update, view, search)
- Image-based AI prediction for brain tumor detection
- Real-time feedback and validation of predictions
- PredictionModel: Manages AI predictions.
- ScannerModel: Handles scanner image data.
- PatientModel: Represents a patient's data.
- PatientUpdateModel: Used for updating patient data.
- PatientViewModel: Used for viewing patient data.
- Validations, such as rounding off confidence scores in
PredictionModel
, are implemented using Pydantic validators.
GET /
: The home page.GET /add_patient
: Form to add a new patient.POST /add_patient
: Endpoint to submit new patient data.GET /view_patients
: View all patients with optional filtering.
GET /full_view_patient/{patient_id}
: Detailed view of a specific patient.GET /edit_patient/{patient_id}
: Form to edit patient data.POST /edit_patient/{patient_id}
: Submit updated patient data.GET /search_patient
: Search for patients by ID or name.
GET /predict_patient/{patient_id}
: Trigger AI prediction for a patient.GET /check_predict
: Interface to check prediction results.POST /check_predict_post/{patient_id}
: Submit prediction validation.
GET /feed_back
: View feedback and error reports.
trigger_prediction(image_data)
: Function to trigger AI prediction requests to a model API.
- Configured to run locally, accessible via port
3000
. cd braintumor-ui
- run
python app.py
This API, built with FastAPI, integrates machine learning (ML) for brain tumor predictions and connects to a MongoDB database for handling patient data. It's designed to predict brain tumors using scanned images.
- Integration with MLflow for model management.
- Image processing for preparing data for ML predictions.
- Real-time prediction on patient scanned images.
- Utilizes MLflow to load the pre-trained model, which is used for making predictions.
normalize_image(img, target_size)
: Function to process and normalize images, including grayscale conversion, denoising, contour detection, and resizing.
- Establishes a connection to MongoDB for accessing and storing patient data.
POST /predict/
: Receives a patient ID and returns the AI model's prediction. It involves:- Fetching patient data from MongoDB.
- Image decoding and processing for the prediction.
- Applying the ML model to predict the presence of a tumor.
- Returning the prediction result with confidence levels.
- Configured to run locally, accessible via port
8000
. cd api
- run
python model_api.py