Documentation Index
Fetch the complete documentation index at: https://mintlify.com/jonatan-leal/ia-proyecto-sustituto/llms.txt
Use this file to discover all available pages before exploring further.
Introduction
The Diabetes Prediction API is a FastAPI-based REST API that provides endpoints for training machine learning models and making diabetes predictions based on patient data.Base URL
Interactive Documentation
FastAPI provides automatic interactive API documentation:- Swagger UI: http://localhost/docs
- ReDoc: http://localhost/redoc
Available Endpoints
| Method | Endpoint | Description |
|---|---|---|
| POST | /train | Train the diabetes prediction model |
| POST | /predict | Make a diabetes prediction for a patient |
Request Format
All API requests should include the appropriateContent-Type header:
Response Format
All API responses are returned in JSON format:Authentication
The current version of the API does not require authentication. All endpoints are publicly accessible.Error Handling
The API uses standard HTTP status codes and returns error messages in JSON format:Success Response (200 OK)
Error Response
Validation Error (422 Unprocessable Entity)
When the request body contains invalid data, FastAPI returns a detailed validation error:Machine Learning Model
The API uses a Random Forest Classifier with the following preprocessing steps:- Encoding: Categorical variables (gender, smoking_history) are encoded to numerical values
- Scaling: Features are standardized using StandardScaler
- Resampling: SMOTEENN is applied during training to handle class imbalance
Model Artifacts
- Model File:
model.pkl(saved using pickle) - Training Data:
train.csv(required for training)
Quick Start Example
Rate Limiting
The current version does not implement rate limiting. Consider implementing rate limiting in production environments to prevent abuse.Next Steps
Train Endpoint
Learn how to train the diabetes prediction model
Predict Endpoint
Make predictions for patient data
Patient Model
Understand the Patient data schema