TheDocumentation Index
Fetch the complete documentation index at: https://mintlify.com/davidmpizarro/QuipuEco-Hackaton/llms.txt
Use this file to discover all available pages before exploring further.
VistaMapaPuntos component is a full-screen, dark-themed Mapbox GL JS map that shows Lima residents exactly where to drop off their recyclables based on the material type identified by the AI classifier. Rather than showing every collection point at once, the map filters to the network most relevant to the classified waste — Tambo convenience stores for plastic, paper, and metal; Centro Verde municipal facilities for organic, glass, electronic, peligroso, and general waste. Once the user’s location is known via the browser GeolocateControl, all points are sorted by Haversine distance and a scrollable card tray appears at the bottom. Tapping any card calls the Mapbox Directions API to draw a walking route and display a toast with walking time, driving time, and distance in kilometres.
Map Configuration
VistaMapaPuntos initialises a mapboxgl.Map instance using a CARTO dark raster tile layer instead of a Mapbox style URL. This gives the map its distinctive dark aesthetic while keeping the Mapbox token usage minimal (no vector tile consumption for the base layer).
mapboxgl.GeolocateControl— triggers automatically on load (geolocate.trigger()), tracks the user’s heading, uses high-accuracy positioningmapboxgl.NavigationControl— zoom in/out and compass
The map requires a valid Mapbox public token in the
VITE_MAPBOX_TOKEN environment variable. Without it, the map canvas will fail to load and the component will render blank. See the Mapbox configuration guide for setup instructions.Recycling Networks
QuipuEco maintains two distinct collection networks. The split is intentional and operationally accurate: Tambo stores accept only clean, dry materials that can be handled at a retail counter, while Centro Verde facilities have the infrastructure for composting, RAEE processing, and certified hazardous-waste management.🏪 Tambo
Tambo convenience store chain. Accepts plástico, papel, and metal directly at the counter. 6 locations across Lima Este — no appointment required.
♻️ Centro Verde Municipal
Lima municipal recycling centres. Accepts orgánico, vidrio, electrónico, peligroso, and general waste. 5 locations per category across Lima Este.
Tambo Lima Este Locations
All six Tambo locations currently configured inVistaMapaPuntos.jsx via TAMBO_REAL_LIMA_ESTE:
| Name | District | Address | Coordinates |
|---|---|---|---|
| Tambo Corregidor - La Molina | La Molina | Alameda del Corregidor 1684 | -12.0815, -76.9398 |
| Tambo Alondras - Santa Anita | Santa Anita | Av. Las Alondras 297 | -12.0445, -76.9678 |
| Tambo Paracas - Ate | Ate | Paracas 892 | -12.0398, -76.9156 |
| Tambo Ayllón - Chaclacayo | Chaclacayo | Av. Nicolás Ayllón 421 | -11.9821, -76.7701 |
| Tambo Riva Agüero - El Agustino | El Agustino | Av. Riva Agüero 684 | -12.0478, -76.9967 |
| Tambo 28 de Julio - Chosica | Chosica | Prolongación 28 de Julio 384 | -11.9356, -76.6945 |
Centro Verde Category Coverage
| Category | Network | Example location |
|---|---|---|
organico | Centro Verde | Centro Verde Eucaliptos — Santa Anita |
vidrio | Centro Verde | Centro Verde Separadora Industrial — Ate |
electronico | Centro Verde | Centro Verde Javier Prado — La Molina |
peligroso | Centro Verde | Centro Verde Separadora Industrial — Ate |
general | Centro Verde | Centro Verde Vitarte — Ate |
Category Detection
ThedetectarCategoria() function determines which set of collection points to display. It follows a strict priority order so that the most reliable signal always wins:
filtroForzado (highest priority)
Set when the chat agent returns
accion: "mapa" with an accion_data string (e.g. "electronico"). This value is computed by the Python backend from contexto_residuo.tipo, not inferred by the LLM from free text — making it the most accurate signal.resultado.tipo
The
tipo field from the /clasificar JSON response. Used when the map is opened directly from ClassificationResult via the “Puntos de acopio en Lima” button.Map Markers
Marker appearance differs by network to make Tambo stores instantly recognisable:Tambo Markers
White rounded-square (
border-radius: 10px) with the Tambo logo image (/images/tambo2.png) fitted inside. Border colour matches the category accent colour. No rotation applied.Centro Verde Markers
Teardrop shape (
border-radius: 50% 50% 50% 0) rotated −45°, filled with the category accent colour, with a centred emoji rotated back to upright (+45°). A coloured box-shadow glow reinforces the category colour.mapboxgl.Popup that shows the location name, address, district badge, and network badge on click.
Points Card Tray
OnceGeolocateControl fires its geolocate event, the component:
- Computes Haversine distances from the user’s position to every point in the active category
- Sorts the array ascending by distance
- Updates
puntosOrdenadosstate, triggering a re-render of the bottom card tray
w-48 h-32 cards. Each card shows:
- Rank number badge (coloured with the category accent)
- Location name and address
- Distance badge (e.g.
1.2 kmor850 m) - District and network labels
- A “Ruta” button that calls
trazarRuta(punto)
Route Calculation
Tapping any card callstrazarRuta(), which queries the Mapbox Directions API for a walking route:
line layer styled with the category accent colour at line-width: 4 and line-opacity: 0.9. The map viewport is fitted to the route bounds with 80 px padding.
A toast card appears at the bottom-right of the screen showing:
- Walking time —
Math.round(route.duration / 60)minutes - Driving time —
Math.max(1, Math.round(walkingMinutes / 5))minutes - Distance —
(route.distance / 1000).toFixed(1)km
Triggering the Map from the Voice Agent
When the voice agent returnsaccion: "mapa", App.jsx calls handleVerMapa() with two possible puntoDestino forms:
VistaMapaPuntos component reads puntoDestino from props:
destinoEspecifico is set, a useEffect watches for userPos and puntosOrdenados to be populated, then calls trazarRuta() automatically on the best-matching point name.