An ERP platform integrating DeepSeek V4 to generate automatic executive summaries and a conversational (RAG) assistant that answers questions about each building's history. From 30 minutes of manual work to 10 seconds with a single click.
The system goes far beyond a simple chatbot. AI is integrated into the ERP's operational core.
DeepSeek analyzes all technical notes and work reports from the last 6 months and generates a structured report: general overview, detected issues, completed work, and recommendations.
A per-building chat that answers natural-language questions ("was anything done about the padlocks?") by citing the building's actual records. It blends vector search over ChromaDB with DeepSeek-powered generation.
The lightweight embedder alone failed on literal matches. Retrieval blends semantic similarity with IDF-weighted keyword matching, generically: any literally-mentioned term climbs the ranking — not a fixed word list.
Every time a technician creates a note or report, a Django signal automatically schedules summary regeneration via Celery. The system is always up to date without human intervention.
A database-level debounce mechanism prevents redundant API calls when multiple notes are generated during a single inspection. 5 stickers in 30 seconds = 1 single API call.
Flash model for fast and cost-effective summaries (90% of buildings). Pro model with deep reasoning for analyses requiring pattern and recurring issue identification.
The AI summary is exposed through three channels: API endpoint for integrations, embedded widget on the building profile, and a dedicated page with real-time Markdown rendering.
Staff-exclusive panel showing DeepSeek available balance in real time, service availability, and operational AI cost monitoring.
The impact of integrating AI into the building maintenance workflow.
| Indicator | Before | After | Impact |
|---|---|---|---|
| Time per executive report | 30 minutes (manual writing) | 10 seconds | −99.4% |
| Building report coverage | Priority buildings only (~15%) | 91% of subscribed buildings | +506% |
| Report availability | Only when a supervisor prepared them | 24/7, automatically updated | Always available |
| Format consistency | Varies by report author | 100% standardized | Guaranteed |
| Monthly AI operational cost | — | ~USD 15 (~400 regenerations) | ROI 5:1 |
| API calls avoided (debounce) | — | ~80% reduction | Optimized |
Quantitative indicators of the platform's operational and economic impact.
| KPI | Value | Context |
|---|---|---|
| AI summary coverage | 91% | 273 out of 300 subscribed buildings with generated summaries |
| Estimated ROI | 5:1 | Every USD 1 invested in API saves USD 5 in supervisor hours |
| Buildings managed | 300+ | Including subscribed and non-subscribed |
| Tickets processed / year | 1,000+ | Service tickets with real-time tracking |
| Work reports / year | 2,500+ | With integrated billing and photos |
| AI service availability | 99.7% | Measured over 30-day windows |
| Documents indexed in ChromaDB | 365,000+ | Technical notes (with comments) + work reports |
| Hybrid vs. semantic-only retrieval | Rank 49–86 → top 8 | Records with literal matches that previously fell outside the context |
The core of the AI integration: Django signals, debounce mechanism, direct DeepSeek API calls, and hybrid retrieval for the RAG chat.
# ri/stickers/signals.py — Signal that triggers automatic regeneration from django.db.models.signals import post_save from django.dispatch import receiver from .models import Stickers from ri.buildings.models import AISummaryDebounce from ri.buildings.tasks import generate_ai_summary_for_building DEBOUNCE_WINDOW = 30 # seconds @receiver(post_save, sender=Stickers) def schedule_ai_summary_on_sticker_change(sender, instance, **kwargs): # Only if the sticker has a building and is not removed if not instance.building_id or instance.removed: return # Debounce: prevents multiple API calls in a burst if AISummaryDebounce.should_schedule( instance.building_id, DEBOUNCE_WINDOW ): generate_ai_summary_for_building.apply_async( args=[instance.building_id], countdown=DEBOUNCE_WINDOW, )
# ri/core/ai.py — Direct DeepSeek API call without external SDK def call_deepseek_api(prompt, model='deepseek-v4-flash', max_words=200): config = Configuration.get_solo() body = { "model": model, "messages": [ {"role": "system", "content": "You are an expert assistant in building maintenance."}, {"role": "user", "content": prompt}, ], "max_tokens": min(int(max_words * 3) + 500, 384000), "temperature": 0.3, } if 'pro' in model: body["reasoning_effort"] = "high" response = requests.post( f"{config.deepseek_base_url}/chat/completions", headers={"Authorization": f"Bearer {config.deepseek_api_key}"}, json=body, timeout=60, ) response.raise_for_status() return _clean_output(response.json()["choices"][0]["message"]["content"])
# ri/core/chroma_client.py — Hybrid retrieval (semantic + lexical) def query_edificio(building_id, embedding, n=8, pregunta=None, lexical_weight=0.5): # Fetch ALL of the building's docs (exact recall, no HNSW) query_terms = content_terms(pregunta) # no accents/stopwords, singular for i, doc in enumerate(docs): sim = cosine(embedding, embs[i]) # semantic similarity matched = query_terms & doc_terms[i] # literal matches # rare terms (high IDF) weigh more lexical = sum(idf(t) for t in matched) / idf_total if matched else 0.0 combined = sim + lexical_weight * lexical # hybrid ranking # A doc literally mentioning what was asked climbs the ranking # even when the embedder misses it. Generic: works for any term. return top_n(scored, n)
Each piece was chosen with a specific purpose of scalability, cost, and maintainability.
Diagrams and infographics illustrating the architecture and workflow of the solution.
Complete flow: Django signal → debounce → Celery → DeepSeek API → PostgreSQL → REST API + HTML.
Control panel with key metrics: managed buildings, active tickets, AI summaries generated.
Comparison infographic: 30 minutes of manual work → 10 seconds with one click.
This system is in production managing the maintenance of over 300 buildings. The AI integration is just one of its capabilities.
Request more information