Country-Level Investment Forecasts with SQL + RAG

Quick Summary

Challenge
Users of a financial research platform needed macro insights from structured and unstructured financial data.
Solution
Tatras Data built a hybrid system, and a RAG-powered knowledge base to deliver insights via a chatbot.
Result
Real-time access to macroeconomic data for forecasts and chatbot access.

Tech Stack

AI: Custom LLMs for SQL generation | ML: Combined sentiment analysis | Data & Retrieval: RAG pipeline with structured SQL DB Unstructured document storage | Dev: FastAPI Vector DB integration Query prefetching logic | Viz: Chatbot UI for communicating with forecast data and research papers | Security: Structured access to sensitive macroeconomic data Audit logging Query compliance checks

The Challenge

Forecasting country-specific macroeconomic performance is a high-stakes, data-heavy process. A financial intelligence platform wanted to create an end-to-end engine that could:
  • Forecast economic factors from vast reports
  • Interpret sentiment in those forecasts
  • Let analysts and clients ask natural-language questions about countries and markets
  • Answer in real-time by combining structured databases and unstructured research
The system had to be fast, accurate, and accessible all while scaling across new data sources.

A Day in the Life: Before Our Solution

An analyst wants to evaluate three countries for emerging-market investment. They search through PDFs, spreadsheets, World Bank data, and proprietary forecasts. They manually extract tables, run sentiment scoring in Excel, and summarize findings for a report. It takes hours (if not days) per country. And follow-up questions like, “What was Vietnam’s Q2 GDP sentiment trend compared to Thailand’s?” require starting over

Pain Points:

  • Forecasts were buried in inconsistent, unstructured reports
  • No unified system to compare countries across indicators
  • Analysts spent excessive time on data wrangling
  • Sentiment analysis was manual and subjective
  • Structured databases and unstructured documents lived in silos

Solution

1. Core Innovation

Tatras Data built a hybrid pipeline combining forecasting, RAG-based document intelligence, and a natural language to SQL interface.

  1. Forecast Classifier with Sentiment Detection: Trained models parse financial and economic documents to extract quantitative trends and label forecasts as positive, neutral, or negative.
  2. LLM-Based SQL Generator: A natural language interface lets users ask open-ended financial questions. Behind the scenes, a custom LLM translates the question into SQL for structured lookup.
  3. RAG Knowledge Base: For deeper or non-tabular queries, a retrieval-augmented generation pipeline combines the structured SQL output with unstructured insights for richer answers.
  4. Prefetching Layer for Anticipated Queries: To reduce latency, a predictive module pre-runs related queries, improving the chatbot’s response speed and context handling.

2. Key Features

  • Forecast + Sentiment Engine: Extracts and classifies country-level projections.
  • Natural Language SQL Interface: Converts investor queries into dynamic SQL.
  • RAG-Based Intelligence Layer: Combines structured + unstructured results into unified answers.
  • Query Prefetching: Improves response time for repeated and related questions.
  • Chatbot Interface: Brings data access to business users, not just analysts.

3. Workflow Integration

The system is deployed as part of the research platform’s core offering. Analysts, strategists, and clients can explore macro trends, run comparisons, and extract insights through a simple chatbot.

Outcomes

✅ Massive increase in financial data accessibility and decision-making speed 🔍 Unified insights from structured SQL and unstructured economic reports ⏱️ Time-to-analysis cut from hours to minutes 📊 Supports dynamic investment screening across countries and timeframes 💡 Forecasts are tagged with sentiment and ready for strategic use

Ready to build your AI system?

Let's discuss how our pipeline can accelerate your path to production.

Start a Conversation
×

    You're interacting with a beta version of our chatbot—thanks for helping us improve!