TheDocumentation 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.
POST /api/productos/predict endpoint accepts a product data payload and acts as a transparent proxy to the Python FastAPI AI service running at http://127.0.0.1:8001/predict/smart-stock. The Spring Boot service receives the PredictDto request body, forwards it verbatim via RestTemplate, and returns the raw JSON prediction string back to the caller. The response content — including demand classification, confidence score, ranked scenarios, and restock recommendations — is generated entirely by the underlying Python machine-learning model.
Endpoint
| Property | Value |
|---|---|
| Method | POST |
| Path | /api/productos/predict |
| Base URL | http://localhost:8080 |
| Full URL | http://localhost:8080/api/productos/predict |
| Content-Type | application/json |
| CORS | All origins (*) |
| Auth | None |
| Proxies to | http://127.0.0.1:8001/predict/smart-stock |
Request Body
All fields map directly to thePredictDto class and are required. The Spring Boot layer performs no validation or transformation — the object is serialized and forwarded as-is to the Python AI service via RestTemplate.postForObject.
Product unit price in local currency.Example:
149.90Current number of units in inventory at the time of the prediction request.Example:
42Total units sold over the past 7 days. Used as the primary short-term velocity feature.Example:
17Current active discount expressed as a percentage. A value of
0 indicates no active promotion.Example: 10.0Encoded season / demand-period code. The AI model uses this to weight seasonal demand patterns.
Example:
| Value | Meaning |
|---|---|
0 | Normal / off-peak |
1 | Campaña (promotional period) |
2 | Feriado / alta demanda |
1Number of calendar days elapsed since the last restock event.Example:
5Average customer rating for the product on a scale of
1.0 to 5.0.Example: 4.7Response
Returns HTTP200 OK. The Spring Boot controller is declared with produces = "application/json" and returns a raw String — the verbatim JSON body forwarded from the Python AI service with no additional transformation.
A short label for the predicted demand scenario, such as
"ALTA DEMANDA", "DEMANDA NORMAL", or "BAJA DEMANDA".Human-readable summary sentence describing the overall prediction outcome (e.g.,
"Se recomienda reabastecer antes de 3 días").Model confidence score for the top prediction, expressed as a decimal between
0.0 and 1.0. Values above 0.80 indicate high model certainty.Ordered list of the top predicted demand scenarios with their individual probabilities.
List of plain-language action items generated by the AI model based on the prediction (e.g.,
"Aumentar stock en al menos 50 unidades", "Mantener descuento actual para sostener la demanda").Echo of the input payload that was sent to the AI model, useful for debugging and audit logging.