Code
Hub
Workspaces
Following
Trending
Connect
MCP
copy
Create free account
hub
/
github.com/aliviahossain/Disease-prediction
/ functions
Functions
597 in github.com/aliviahossain/Disease-prediction
⨍
Functions
597
◇
Types & classes
52
↳
Endpoints
60
↓ 28 callers
Function
bayesian_survival
Calculate posterior probability using Bayes' Theorem. Args: prior: Prior probability sensitivity: Test sensitivity s
backend/src/calculator.py:18
↓ 24 callers
Function
_form_has_field
True when the field was included in the POST (disabled inputs are omitted).
backend/routes/auth_routes.py:37
↓ 22 callers
Function
bayes_theorem
Calculate the posterior probability of disease given a test result, using Bayes' theorem, with input validation.
app.py:6
↓ 19 callers
Function
save_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 callers
Method
evaluate
Decide if the prediction is reliable. Parameters ---------- confidence_score : float Top prediction's confide
backend/utils/uncertainty_handler.py:68
↓ 16 callers
Method
error
Log error message.
backend/middleware/logger.py:131
↓ 15 callers
Function
updateSliderValue
(elementId, value)
backend/static/script.js:791
↓ 14 callers
Function
_clean_form_value
(name)
backend/routes/auth_routes.py:33
↓ 14 callers
Function
escapeHTML
Escape user-controlled strings before putting them in HTML.
backend/static/js/history.js:55
↓ 12 callers
Method
predict_disease_probability
Predict disease probability based on selected symptoms.
backend/models/ml_model.py:1192
↓ 10 callers
Function
create_app
()
backend/routes/__init__.py:4
↓ 10 callers
Method
info
Log info message.
backend/middleware/logger.py:123
↓ 10 callers
Function
showStatus
(msg, kind /* "info" | "error" | "" */)
backend/static/js/history.js:83
↓ 9 callers
Method
calculate_posterior
Calculate posterior probability using Bayes' Theorem.
backend/src/calculator.py:60
↓ 9 callers
Method
check_rate_limit
(self, identifier, endpoint_type, max_requests, window)
backend/middleware/security.py:55
↓ 9 callers
Function
make_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 callers
Function
validate_probability
( value, name="probability", strict_validation=True )
backend/src/calculator.py:3
↓ 8 callers
Method
generate_patient
Generate single synthetic patient. Args: disease: Disease name (random if None) symptom_intensity: 0
backend/services/synthetic_patient_service.py:16
↓ 8 callers
Method
warning
Log warning message.
backend/middleware/logger.py:127
↓ 7 callers
Function
clean_float
( value: Any, field_name: str, min_value: float, max_value: float, )
backend/preprocessing/cleaning.py:139
↓ 7 callers
Function
fetchPage
()
backend/static/js/history.js:234
↓ 7 callers
Function
resetResultDisplay
()
backend/static/script.js:632
↓ 7 callers
Function
validate_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 callers
Method
__init__
Initialize application error. Args: message: Error message status_code: HTTP status code payload
backend/middleware/error_handler.py:16
↓ 6 callers
Method
_get_connection
(self)
backend/middleware/security.py:177
↓ 6 callers
Function
create_app
()
backend/__init__.py:69
↓ 6 callers
Method
get_available_diseases
(self)
backend/models/ml_model.py:1295
↓ 6 callers
Method
init_app
Initialize request logger for Flask app. Args: app: Flask application instance
backend/middleware/logger.py:436
↓ 6 callers
Function
login_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 callers
Function
normalize_key
Normalize user-facing labels into model-friendly snake_case keys.
backend/preprocessing/cleaning.py:55
↓ 6 callers
Method
to_dict
Convert error to dictionary.
backend/middleware/error_handler.py:31
↓ 5 callers
Method
_add_context
Add request context to log entry. Args: extra: Additional context data Returns: Dictionary with con
backend/middleware/logger.py:86
↓ 5 callers
Method
_get_disease_key
Normalize and fuzzy match disease name to internal key.
backend/models/ml_model.py:1039
↓ 5 callers
Function
_require_user_id
()
backend/routes/history_routes.py:58
↓ 5 callers
Method
analyze_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 callers
Function
clean_prediction_payload
( payload: Dict[str, Any], valid_symptoms: Optional[Iterable[str]] = None, require_disease: bool =
backend/preprocessing/cleaning.py:164
↓ 5 callers
Method
get_all_unique_symptoms
Get all unique symptoms across all diseases
backend/models/ml_model.py:1370
↓ 5 callers
Function
load_data
Load and process data from CSV
backend/src/calculator.py:193
↓ 5 callers
Function
showResult
(message)
backend/static/script.js:131
↓ 5 callers
Method
stop
(self)
backend/middleware/security.py:268
↓ 4 callers
Function
_array_to_base64_png
Encode a uint8 RGB numpy array as a base64 PNG data URI.
backend/utils/gradcam.py:228
↓ 4 callers
Function
_get_csrf_token
Load the login page and parse the CSRF token from the rendered HTML.
backend/tests/test_csrf.py:28
↓ 4 callers
Function
_sanitize_name
Strip non-printable characters and enforce length limit.
backend/routes/disease_routes.py:35
↓ 4 callers
Method
_wants_json
Helper to determine if the client expects a JSON response.
backend/middleware/error_handler.py:302
↓ 4 callers
Method
check_rate_limit
(self, identifier, endpoint_type, max_requests, window)
backend/middleware/security.py:211
↓ 4 callers
Function
get_logger
Get or create global logger instance. Args: name: Logger name Returns: StructuredLogger instance
backend/middleware/logger.py:277
↓ 4 callers
Method
get_symptoms_list
(self)
backend/models/prediction.py:133
↓ 4 callers
Function
hideUpdatingState
()
backend/static/script.js:627
↓ 4 callers
Function
load_history
()
backend/utils/history_manager.py:23
↓ 3 callers
Function
_assert_prob
(name: str, value: float)
app.py:1
↓ 3 callers
Method
_compute_posterior_value
Compute the raw posterior value without rounding.
backend/utils/calculator.py:79
↓ 3 callers
Method
_get_json_formatter
Get JSON formatter for structured logging.
backend/middleware/logger.py:82
↓ 3 callers
Function
_load_module_from_path
(name, path)
backend/tests/test_calculator.py:13
↓ 3 callers
Method
_log_error
Log error details. Args: error: Error instance status_code: HTTP status code include_traceback:
backend/middleware/error_handler.py:308
↓ 3 callers
Function
_oldest_allowed_dob
(today)
backend/routes/auth_routes.py:138
↓ 3 callers
Function
_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 callers
Function
_validate_pattern
(value, pattern, label, errors, message)
backend/routes/auth_routes.py:54
↓ 3 callers
Method
calculate_dynamic_survival
Calculate dynamic survival/recovery probability. Args: disease_posterior: The posterior probability of having the diseas
backend/utils/temporal_analysis.py:236
↓ 3 callers
Method
calculate_with_test_result
Calculate posterior probability based on test result.
backend/src/calculator.py:93
↓ 3 callers
Method
compute_shap_values
Compute SHAP-style symptom contribution scores for explainability. Uses a linear approximation: - Baseline = expected valu
backend/models/ml_model.py:1058
↓ 3 callers
Method
debug
Log debug message.
backend/middleware/logger.py:119
↓ 3 callers
Function
display_results
Display results in console
backend/src/calculator.py:209
↓ 3 callers
Method
get_disease_symptoms
(self, disease: str)
backend/models/ml_model.py:1298
↓ 3 callers
Function
renderProbabilityChart
(prior, posterior)
backend/static/script.js:140
↓ 3 callers
Function
setFieldError
(field, message)
backend/static/profile.js:68
↓ 3 callers
Function
showRecommendationsContainer
()
backend/static/script.js:457
↓ 3 callers
Method
stop
(self)
backend/middleware/security.py:90
↓ 3 callers
Method
to_dict
(self)
backend/services/model_version_manager.py:22
↓ 3 callers
Function
validateInput
(inputEl)
backend/static/script.js:93
↓ 2 callers
Function
_blend_overlay
Alpha-blend the heatmap over the original image. overlay = alpha * heatmap + (1 - alpha) * original
backend/utils/gradcam.py:212
↓ 2 callers
Function
_classify_risk
Map a probability to a coarse risk band (low / medium / high).
backend/services/history_service.py:34
↓ 2 callers
Function
_get_or_404
(entry_id: int)
backend/routes/history_routes.py:64
↓ 2 callers
Function
_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 callers
Method
_init
(self)
backend/services/encryption_service.py:11
↓ 2 callers
Function
_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 callers
Function
_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 callers
Function
_to_json
Best-effort JSON serialisation. Returns None on failure.
backend/services/history_service.py:23
↓ 2 callers
Function
_validate_float
(value, label, minimum, maximum, errors)
backend/routes/auth_routes.py:99
↓ 2 callers
Function
_validate_medical_text
(value, label, max_length, errors)
backend/routes/auth_routes.py:115
↓ 2 callers
Function
_validate_phone
(value, label, errors)
backend/routes/auth_routes.py:42
↓ 2 callers
Method
analyze_missing_symptoms
Identify high-importance symptoms missing from present symptoms.
backend/models/ml_model.py:1338
↓ 2 callers
Method
calculate_ml_score
Calculate ML probability score for synthetic patient. Args: disease: Disease name symptoms: List of
backend/services/synthetic_patient_service.py:123
↓ 2 callers
Method
calibrated_sigmoid
Temperature-scaled sigmoid for probability calibration.
backend/models/ml_model.py:1014
↓ 2 callers
Function
closeModal
()
backend/static/js/history.js:219
↓ 2 callers
Function
configure_gemini
Configure Gemini API with the API key from environment variables.
backend/utils/gemini_helper.py:14
↓ 2 callers
Function
formatDate
"2026-05-20T11:30:00Z" → "May 20, 2026, 11:30 AM" (user locale).
backend/static/js/history.js:66
↓ 2 callers
Method
generate_edge_cases
Generate edge cases for stress testing.
backend/services/synthetic_patient_service.py:114
↓ 2 callers
Function
generate_gradcam_overlay
Generate a Grad-CAM explanation for a single prediction. Parameters ---------- model : Loaded Keras model (eye diseas
backend/utils/gradcam.py:505
↓ 2 callers
Method
generate_population
Generate population of synthetic patients.
backend/services/synthetic_patient_service.py:86
↓ 2 callers
Method
generate_rare_combinations
Generate rare symptom combinations across diseases.
backend/services/synthetic_patient_service.py:90
↓ 2 callers
Function
generate_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 callers
Method
get_config
Return active thresholds (exposed via /api/ml/config).
backend/utils/uncertainty_handler.py:133
↓ 2 callers
Function
get_project_root
()
backend/routes/disease_routes.py:43
↓ 2 callers
Function
get_risk_level
Determine risk level based on probability percentage. Args: probability: Probability percentage (0-100) Returns: Dictio
backend/routes/ml_routes.py:715
↓ 2 callers
Method
get_symptom_importance
(self, disease: str)
backend/models/ml_model.py:1328
↓ 2 callers
Function
highlight_text
(text: str, query: str)
dashboard.py:10
↓ 2 callers
Function
load_keras_model
(model_type)
backend/routes/predict_disease_type_routes.py:79
↓ 2 callers
Method
log_api_request
Log API request with details. Args: endpoint: API endpoint method: HTTP method status_code: Resp
backend/middleware/logger.py:139
↓ 2 callers
Method
metadata
(self)
backend/preprocessing/cleaning.py:44
↓ 2 callers
Method
prune_stale_entries
(self)
backend/middleware/security.py:42
next →
1–100 of 597, ranked by callers