MCPcopy Create free account

hub / github.com/aliviahossain/Disease-prediction / functions

Functions597 in github.com/aliviahossain/Disease-prediction

↓ 28 callersFunctionbayesian_survival
Calculate posterior probability using Bayes' Theorem. Args: prior: Prior probability sensitivity: Test sensitivity s
backend/src/calculator.py:18
↓ 24 callersFunction_form_has_field
True when the field was included in the POST (disabled inputs are omitted).
backend/routes/auth_routes.py:37
↓ 22 callersFunctionbayes_theorem
Calculate the posterior probability of disease given a test result, using Bayes' theorem, with input validation.
app.py:6
↓ 19 callersFunctionsave_history
Persist a single PatientHistory row. Returns the created entry, or None if the user is anonymous or if the database write fails. Anonymous us
backend/services/history_service.py:49
↓ 17 callersMethodevaluate
Decide if the prediction is reliable. Parameters ---------- confidence_score : float Top prediction's confide
backend/utils/uncertainty_handler.py:68
↓ 16 callersMethoderror
Log error message.
backend/middleware/logger.py:131
↓ 15 callersFunctionupdateSliderValue
(elementId, value)
backend/static/script.js:791
↓ 14 callersFunction_clean_form_value
(name)
backend/routes/auth_routes.py:33
↓ 14 callersFunctionescapeHTML
Escape user-controlled strings before putting them in HTML.
backend/static/js/history.js:55
↓ 12 callersMethodpredict_disease_probability
Predict disease probability based on selected symptoms.
backend/models/ml_model.py:1192
↓ 10 callersFunctioncreate_app
()
backend/routes/__init__.py:4
↓ 10 callersMethodinfo
Log info message.
backend/middleware/logger.py:123
↓ 10 callersFunctionshowStatus
(msg, kind /* "info" | "error" | "" */)
backend/static/js/history.js:83
↓ 9 callersMethodcalculate_posterior
Calculate posterior probability using Bayes' Theorem.
backend/src/calculator.py:60
↓ 9 callersMethodcheck_rate_limit
(self, identifier, endpoint_type, max_requests, window)
backend/middleware/security.py:55
↓ 9 callersFunctionmake_user
Create a User row and return (user_id, email, password). ⚠️ This fixture's body needs to match your actual User model. The repo's `User` doe
backend/tests/test_patient_history.py:83
↓ 9 callersFunctionvalidate_probability
( value, name="probability", strict_validation=True )
backend/src/calculator.py:3
↓ 8 callersMethodgenerate_patient
Generate single synthetic patient. Args: disease: Disease name (random if None) symptom_intensity: 0
backend/services/synthetic_patient_service.py:16
↓ 8 callersMethodwarning
Log warning message.
backend/middleware/logger.py:127
↓ 7 callersFunctionclean_float
( value: Any, field_name: str, min_value: float, max_value: float, )
backend/preprocessing/cleaning.py:139
↓ 7 callersFunctionfetchPage
()
backend/static/js/history.js:234
↓ 7 callersFunctionresetResultDisplay
()
backend/static/script.js:632
↓ 7 callersFunctionvalidate_startup_config
Validates that necessary environment variables and model files are present. In production mode, raises a ValueError/FileNotFoundError if any
backend/utils/config_validator.py:8
↓ 6 callersMethod__init__
Initialize application error. Args: message: Error message status_code: HTTP status code payload
backend/middleware/error_handler.py:16
↓ 6 callersMethod_get_connection
(self)
backend/middleware/security.py:177
↓ 6 callersFunctioncreate_app
()
backend/__init__.py:69
↓ 6 callersMethodget_available_diseases
(self)
backend/models/ml_model.py:1295
↓ 6 callersMethodinit_app
Initialize request logger for Flask app. Args: app: Flask application instance
backend/middleware/logger.py:436
↓ 6 callersFunctionlogin_session
Mark the flask_login session as authenticated for `user_id`. Bypasses the /login route so this fixture doesn't depend on whatever URL / paylo
backend/tests/test_patient_history.py:112
↓ 6 callersFunctionnormalize_key
Normalize user-facing labels into model-friendly snake_case keys.
backend/preprocessing/cleaning.py:55
↓ 6 callersMethodto_dict
Convert error to dictionary.
backend/middleware/error_handler.py:31
↓ 5 callersMethod_add_context
Add request context to log entry. Args: extra: Additional context data Returns: Dictionary with con
backend/middleware/logger.py:86
↓ 5 callersMethod_get_disease_key
Normalize and fuzzy match disease name to internal key.
backend/models/ml_model.py:1039
↓ 5 callersFunction_require_user_id
()
backend/routes/history_routes.py:58
↓ 5 callersMethodanalyze_vitals
Analyze a single set of vitals, flag clinical anomalies, and compute a vitals health index (0 to 1).
backend/utils/temporal_analysis.py:39
↓ 5 callersFunctionclean_prediction_payload
( payload: Dict[str, Any], valid_symptoms: Optional[Iterable[str]] = None, require_disease: bool =
backend/preprocessing/cleaning.py:164
↓ 5 callersMethodget_all_unique_symptoms
Get all unique symptoms across all diseases
backend/models/ml_model.py:1370
↓ 5 callersFunctionload_data
Load and process data from CSV
backend/src/calculator.py:193
↓ 5 callersFunctionshowResult
(message)
backend/static/script.js:131
↓ 5 callersMethodstop
(self)
backend/middleware/security.py:268
↓ 4 callersFunction_array_to_base64_png
Encode a uint8 RGB numpy array as a base64 PNG data URI.
backend/utils/gradcam.py:228
↓ 4 callersFunction_get_csrf_token
Load the login page and parse the CSRF token from the rendered HTML.
backend/tests/test_csrf.py:28
↓ 4 callersFunction_sanitize_name
Strip non-printable characters and enforce length limit.
backend/routes/disease_routes.py:35
↓ 4 callersMethod_wants_json
Helper to determine if the client expects a JSON response.
backend/middleware/error_handler.py:302
↓ 4 callersMethodcheck_rate_limit
(self, identifier, endpoint_type, max_requests, window)
backend/middleware/security.py:211
↓ 4 callersFunctionget_logger
Get or create global logger instance. Args: name: Logger name Returns: StructuredLogger instance
backend/middleware/logger.py:277
↓ 4 callersMethodget_symptoms_list
(self)
backend/models/prediction.py:133
↓ 4 callersFunctionhideUpdatingState
()
backend/static/script.js:627
↓ 4 callersFunctionload_history
()
backend/utils/history_manager.py:23
↓ 3 callersFunction_assert_prob
(name: str, value: float)
app.py:1
↓ 3 callersMethod_compute_posterior_value
Compute the raw posterior value without rounding.
backend/utils/calculator.py:79
↓ 3 callersMethod_get_json_formatter
Get JSON formatter for structured logging.
backend/middleware/logger.py:82
↓ 3 callersFunction_load_module_from_path
(name, path)
backend/tests/test_calculator.py:13
↓ 3 callersMethod_log_error
Log error details. Args: error: Error instance status_code: HTTP status code include_traceback:
backend/middleware/error_handler.py:308
↓ 3 callersFunction_oldest_allowed_dob
(today)
backend/routes/auth_routes.py:138
↓ 3 callersFunction_preprocess_image
Load, resize, and preprocess an image using ResNet50's preprocess_input (ImageNet mean subtraction) — identical to what predict_disease_type_
backend/utils/gradcam.py:110
↓ 3 callersFunction_validate_pattern
(value, pattern, label, errors, message)
backend/routes/auth_routes.py:54
↓ 3 callersMethodcalculate_dynamic_survival
Calculate dynamic survival/recovery probability. Args: disease_posterior: The posterior probability of having the diseas
backend/utils/temporal_analysis.py:236
↓ 3 callersMethodcalculate_with_test_result
Calculate posterior probability based on test result.
backend/src/calculator.py:93
↓ 3 callersMethodcompute_shap_values
Compute SHAP-style symptom contribution scores for explainability. Uses a linear approximation: - Baseline = expected valu
backend/models/ml_model.py:1058
↓ 3 callersMethoddebug
Log debug message.
backend/middleware/logger.py:119
↓ 3 callersFunctiondisplay_results
Display results in console
backend/src/calculator.py:209
↓ 3 callersMethodget_disease_symptoms
(self, disease: str)
backend/models/ml_model.py:1298
↓ 3 callersFunctionrenderProbabilityChart
(prior, posterior)
backend/static/script.js:140
↓ 3 callersFunctionsetFieldError
(field, message)
backend/static/profile.js:68
↓ 3 callersFunctionshowRecommendationsContainer
()
backend/static/script.js:457
↓ 3 callersMethodstop
(self)
backend/middleware/security.py:90
↓ 3 callersMethodto_dict
(self)
backend/services/model_version_manager.py:22
↓ 3 callersFunctionvalidateInput
(inputEl)
backend/static/script.js:93
↓ 2 callersFunction_blend_overlay
Alpha-blend the heatmap over the original image. overlay = alpha * heatmap + (1 - alpha) * original
backend/utils/gradcam.py:212
↓ 2 callersFunction_classify_risk
Map a probability to a coarse risk band (low / medium / high).
backend/services/history_service.py:34
↓ 2 callersFunction_get_or_404
(entry_id: int)
backend/routes/history_routes.py:64
↓ 2 callersFunction_heatmap_to_colormap
Resize the raw heatmap to target (H, W) and apply the COLORMAP_JET colour palette, returning a uint8 RGB array of shape (H, W, 3).
backend/utils/gradcam.py:195
↓ 2 callersMethod_init
(self)
backend/services/encryption_service.py:11
↓ 2 callersFunction_sanitize_csv_field
Neutralize CSV/Formula Injection (CWE-1236). User-controlled free-text fields (e.g. disease, notes) are written into exported CSVs as-is
backend/routes/history_routes.py:71
↓ 2 callersFunction_tflite_infer
Run a single forward pass and return the output tensor as a float32 array. img_array must be shape (1, H, W, 3), dtype float32. allocate
backend/utils/gradcam.py:326
↓ 2 callersFunction_to_json
Best-effort JSON serialisation. Returns None on failure.
backend/services/history_service.py:23
↓ 2 callersFunction_validate_float
(value, label, minimum, maximum, errors)
backend/routes/auth_routes.py:99
↓ 2 callersFunction_validate_medical_text
(value, label, max_length, errors)
backend/routes/auth_routes.py:115
↓ 2 callersFunction_validate_phone
(value, label, errors)
backend/routes/auth_routes.py:42
↓ 2 callersMethodanalyze_missing_symptoms
Identify high-importance symptoms missing from present symptoms.
backend/models/ml_model.py:1338
↓ 2 callersMethodcalculate_ml_score
Calculate ML probability score for synthetic patient. Args: disease: Disease name symptoms: List of
backend/services/synthetic_patient_service.py:123
↓ 2 callersMethodcalibrated_sigmoid
Temperature-scaled sigmoid for probability calibration.
backend/models/ml_model.py:1014
↓ 2 callersFunctioncloseModal
()
backend/static/js/history.js:219
↓ 2 callersFunctionconfigure_gemini
Configure Gemini API with the API key from environment variables.
backend/utils/gemini_helper.py:14
↓ 2 callersFunctionformatDate
"2026-05-20T11:30:00Z" → "May 20, 2026, 11:30 AM" (user locale).
backend/static/js/history.js:66
↓ 2 callersMethodgenerate_edge_cases
Generate edge cases for stress testing.
backend/services/synthetic_patient_service.py:114
↓ 2 callersFunctiongenerate_gradcam_overlay
Generate a Grad-CAM explanation for a single prediction. Parameters ---------- model : Loaded Keras model (eye diseas
backend/utils/gradcam.py:505
↓ 2 callersMethodgenerate_population
Generate population of synthetic patients.
backend/services/synthetic_patient_service.py:86
↓ 2 callersMethodgenerate_rare_combinations
Generate rare symptom combinations across diseases.
backend/services/synthetic_patient_service.py:90
↓ 2 callersFunctiongenerate_tflite_scorecam_overlay
Generate a Score-CAM explanation for a TFLite model prediction. Parameters ---------- tflite_path : Filesystem path to the
backend/utils/gradcam.py:444
↓ 2 callersMethodget_config
Return active thresholds (exposed via /api/ml/config).
backend/utils/uncertainty_handler.py:133
↓ 2 callersFunctionget_project_root
()
backend/routes/disease_routes.py:43
↓ 2 callersFunctionget_risk_level
Determine risk level based on probability percentage. Args: probability: Probability percentage (0-100) Returns: Dictio
backend/routes/ml_routes.py:715
↓ 2 callersMethodget_symptom_importance
(self, disease: str)
backend/models/ml_model.py:1328
↓ 2 callersFunctionhighlight_text
(text: str, query: str)
dashboard.py:10
↓ 2 callersFunctionload_keras_model
(model_type)
backend/routes/predict_disease_type_routes.py:79
↓ 2 callersMethodlog_api_request
Log API request with details. Args: endpoint: API endpoint method: HTTP method status_code: Resp
backend/middleware/logger.py:139
↓ 2 callersMethodmetadata
(self)
backend/preprocessing/cleaning.py:44
↓ 2 callersMethodprune_stale_entries
(self)
backend/middleware/security.py:42
next →1–100 of 597, ranked by callers