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.
Welcome
This guide will help you make your first diabetes prediction using the easiest deployment method - the REST API (Phase 3). You’ll have a working prediction endpoint in minutes.Time Required: ~10 minutesPrerequisites: Docker installed on your system
Quick Start with REST API
Build Docker Image
Build the FastAPI container:This creates a Docker image with all dependencies installed:
- Python 3.12
- FastAPI 0.111.0
- scikit-learn 1.4.1
- imbalanced-learn 0.12.0
- All other required packages
Run API Container
Start the API server in detached mode:The API is now running and accessible at
http://localhostCopy Training Data
Copy your training dataset into the container:
Make sure you have
train.csv from the Kaggle dataset. See Dataset Documentation for download instructions.Access Swagger UI
Open your browser and navigate to:You’ll see the interactive Swagger API documentation with two endpoints:
POST /train- Train the modelPOST /predict- Make predictions
Train the Model
In Swagger UI:
- Click on the
POST /trainendpoint - Click “Try it out”
- Click “Execute”
- Load
train.csv - Encode categorical features
- Scale features with StandardScaler
- Apply SMOTEENN resampling
- Train RandomForestClassifier
- Save model to
model.pkl
Test with Different Patient Profiles
- High Risk Patient
- Low Risk Patient
- Moderate Risk Patient
Using cURL
You can also interact with the API using command-line tools:Verify Container Status
Check that your container is running properly:Stopping and Cleaning Up
When you’re done:Understanding the API Response
The predict endpoint returns a simple JSON response:The messages are in Spanish:
- “Tiene diabetes” = Has diabetes (prediction: 1)
- “No tiene diabetes” = No diabetes (prediction: 0)
Troubleshooting
Port 80 already in use
Port 80 already in use
If port 80 is occupied, use a different port:Then access at
http://localhost:8080/docsModel file does not exist error
Model file does not exist error
This means the model hasn’t been trained yet. Make sure to:
- Copy
train.csvinto the container - Call the
/trainendpoint before/predict
Something went wrong message
Something went wrong message
Check the container logs for detailed error messages:Common issues:
- Invalid patient data format
- Missing required fields
- Invalid categorical values (e.g., wrong gender or smoking_history)
Cannot download train.csv
Cannot download train.csv
You need Kaggle credentials to download the dataset:See Dataset Documentation for detailed instructions.
- Create a Kaggle account
- Generate API token (kaggle.json)
- Download dataset:
What’s Next?
Phase 1: Notebook
Explore the data and model in an interactive Jupyter notebook
Phase 2: CLI
Use command-line tools for batch predictions
API Deployment
Advanced API deployment and integration guide
Patient Features
Understand what each patient feature means