Skip to main content

Documentation Index

Fetch the complete documentation index at: https://mintlify.com/JoseOlivares19/Proyecto-PC3-JavaScript-Avanzado/llms.txt

Use this file to discover all available pages before exploring further.

SmartStock360’s AI service is a FastAPI application that hosts five scikit-learn Random Forest classifiers. All models are trained entirely in memory at startup from synthetic data — no external model files, databases, or checkpoints are required. Once the server is running, every endpoint is immediately ready to accept prediction requests.

Shared Classifier Configuration

Every model uses the same RandomForestClassifier hyperparameters, ensuring consistent behaviour across all five domains:
RandomForestClassifier(
    n_estimators=180,
    max_depth=7,
    random_state=42,
    class_weight="balanced_subsample"
)
balanced_subsample reweights classes at each bootstrap draw, which prevents majority-class dominance in the synthetic training sets. random_state=42 guarantees reproducible predictions on every server restart.

ModelPack Architecture

Each model is wrapped in a ModelPack instance that bundles four things together:
  • features — ordered list of input feature names
  • labels — list of string class names
  • model — the trained RandomForestClassifier
  • encoder — a fitted LabelEncoder mapping integer indices back to label strings
The predict() method accepts a Dict[str, float], builds a numpy row in feature order, runs inference, and returns a dictionary with three keys:
KeyTypeDescription
labelstrWinning class name
confidencefloatProbability of the winning class (0–1, 4 decimal places)
rankinglistAll classes sorted by probability descending

All Five Models at a Glance

Model KeyEndpointOutput Labels
smart-stockPOST /predict/smart-stockDEMANDA_ALTA_REABASTECER, DEMANDA_MEDIA_MONITOREAR, DEMANDA_BAJA_OPTIMIZAR
fraud-shieldPOST /predict/fraud-shieldFRAUDE_PROBABLE, REVISION_MANUAL, TRANSACCION_SEGURA
cyber-sentinelPOST /predict/cyber-sentinelCRITICO, ALTO, MEDIO, BAJO
utp-riskPOST /predict/utp-riskRIESGO_ALTO, RIESGO_MEDIO, RIESGO_BAJO
talent-matchPOST /predict/talent-matchFRONTEND_REACT, BACKEND_SPRING, DATA_ANALYST_JUNIOR, FULLSTACK_JUNIOR

Common Response Shape

Every prediction endpoint returns the same JSON envelope, regardless of which model was called:
{
  "caso": "<model name>",
  "prediccion": "<label>",
  "confianza": 0.87,
  "ranking": [
    { "clase": "LABEL_A", "probabilidad": 0.87 },
    { "clase": "LABEL_B", "probabilidad": 0.13 }
  ],
  "recomendaciones": ["..."],
  "entrada": { }
}
FieldTypeDescription
casostringHuman-readable model name
prediccionstringPredicted class label
confianzafloatConfidence score of the top prediction
rankingarrayAll classes with their individual probabilities
recomendacionesarrayActionable suggestions based on the predicted label
entradaobjectEcho of the exact request payload received

API Endpoints

The service exposes seven endpoints. Two utility endpoints are available immediately on startup; five prediction endpoints accept POST requests.

GET /health

Returns a liveness check confirming that all five models loaded successfully.
curl http://localhost:8001/health
{
  "status": "ok",
  "modelos_cargados": [
    "utp-risk",
    "fraud-shield",
    "cyber-sentinel",
    "smart-stock",
    "talent-match"
  ]
}

GET /metadata

Returns the ordered feature list and label list for every loaded model. Useful for programmatically validating request payloads before sending them.
curl http://localhost:8001/metadata
{
  "utp-risk": {
    "features": ["promedio_actual", "asistencia_pct", "tareas_entregadas_pct", "participacion_pct", "horas_estudio_semana", "nota_pc_anterior"],
    "labels": ["RIESGO_ALTO", "RIESGO_BAJO", "RIESGO_MEDIO"]
  },
  "fraud-shield": {
    "features": ["monto", "hora_24", "intentos_previos", "antiguedad_cliente_meses", "dispositivo_nuevo", "pais_riesgo", "compras_ultima_hora"],
    "labels": ["FRAUDE_PROBABLE", "REVISION_MANUAL", "TRANSACCION_SEGURA"]
  },
  "cyber-sentinel": {
    "features": ["intentos_login_fallidos", "puertos_abiertos", "vulnerabilidades_criticas", "trafico_anomalo_pct", "equipos_afectados", "parcheado_pct"],
    "labels": ["ALTO", "BAJO", "CRITICO", "MEDIO"]
  },
  "smart-stock": {
    "features": ["precio", "stock_actual", "ventas_7d", "descuento_pct", "temporada", "dias_sin_reabastecer", "rating_producto"],
    "labels": ["DEMANDA_ALTA_REABASTECER", "DEMANDA_BAJA_OPTIMIZAR", "DEMANDA_MEDIA_MONITOREAR"]
  },
  "talent-match": {
    "features": ["javascript", "react", "spring_boot", "python_datos", "sql", "experiencia_proyectos", "preferencia"],
    "labels": ["BACKEND_SPRING", "DATA_ANALYST_JUNIOR", "FRONTEND_REACT", "FULLSTACK_JUNIOR"]
  }
}

POST /predict/* (five endpoints)

Each prediction endpoint accepts the model-specific JSON body and returns the common response shape described below. See each model’s page for the full request schema and examples.
EndpointModel
POST /predict/utp-riskUTP Risk AI
POST /predict/fraud-shieldFraud Shield
POST /predict/cyber-sentinelCyber Sentinel
POST /predict/smart-stockSmart Stock 360
POST /predict/talent-matchTalent Match AI

Explore Each Model

Smart Stock 360

Inventory demand forecasting — classifies products into high, medium, or low demand tiers.

Fraud Shield

Real-time transaction risk classification across three risk levels.

Cyber Sentinel

Cybersecurity incident severity scoring from BAJO to CRITICO.

UTP Risk AI

Student academic performance risk prediction across three risk bands.

Talent Match AI

Developer skill profile classification into four tech career paths.

Build docs developers (and LLMs) love