An integrated solution for collecting, normalizing, and analyzing KAMCO (Korea Asset Management Corporation) public auction data using RAG (Retrieval-Augmented Generation).
์บ ์ฝ(KAMCO) ๊ณต๋งค ๋ฌผ๊ฑด ๋ฐ์ดํฐ๋ฅผ ์์งยท์ ๊ทํยท๋ฒกํฐํํ์ฌ RAG(๊ฒ์ ์ฆ๊ฐ ์์ฑ) ๊ธฐ๋ฐ AI ์ฑ๋ด์ผ๋ก ์์ฐ์ด ๊ฒ์๊ณผ ์ง์์๋ต์ ์ ๊ณตํ๋ ํตํฉ ๋ฐ์ดํฐ ํ์ดํ๋ผ์ธ์
๋๋ค. ๊ณต๊ณต๋ฐ์ดํฐํฌํธ์ ์บ ์ฝ ๊ณต๋งค OpenAPI์์ ์์ ๋ฐ์ดํฐ๋ฅผ ์์งํด MongoDB์ ์ ์ฅํ๊ณ , Qdrant ๋ฒกํฐ DB์ ์๋ฒ ๋ฉํ ๋ค FastAPI + Ollama(๋ก์ปฌ LLM)๋ก "์์ธ ๊ฐ๋จ ์ํํธ 5์ต ์ดํ" ๊ฐ์ ์ง๋ฌธ์ ์ถ์ฒ๊น์ง ํฌํจํ ๋ต๋ณ์ ์์ฑํฉ๋๋ค. ๋ฒกํฐ DB๊ฐ ์์ด๋ MongoDB ํค์๋ ๊ฒ์์ผ๋ก ์๋ ํด๋ฐฑ(fallback)๋๋ ํ์ด๋ธ๋ฆฌ๋ ๊ฒ์ ๊ตฌ์กฐ๋ฅผ ๊ฐ์ต๋๋ค.
| ๋ถ๋ฅ | ๊ธฐ์ | ์ฉ๋ |
|---|---|---|
| ์ธ์ด | Python 3.9+ | ์ ์ฒด ๋ฐฑ์๋ |
| API ์๋ฒ | FastAPI 0.115+ | RAG ์ง์์๋ต REST API (/ask, /api/chat) |
| ์น UI | Flask 3.0+ | ๊ด๋ฆฌ ๋์๋ณด๋ ยท ๋ฐ์ดํฐ ์กฐํ ยท AI ์ฑ๋ด ์น ์ธํฐํ์ด์ค |
| ๋ฌธ์ DB | MongoDB 7.0+ | ์์/์ ๊ทํ/์ฒญํฌ ๋ฐ์ดํฐ ์ ์ฅ + ํค์๋ ํด๋ฐฑ ๊ฒ์ |
| ๋ฒกํฐ DB | Qdrant 1.9+ | ์๋ฒ ๋ฉ ์ ์ฌ๋ ๊ฒ์ (Top-k) |
| LLM | Ollama (deepseek-r1 ์์ฑ ยท nomic-embed-text ์๋ฒ ๋ฉ) |
๋ก์ปฌ LLM ์ถ๋ก |
| ์์ด์ ํธ ์ฐ๋ | MCP Server | ChatGPT ๋ฐ์คํฌํฑ์์ ์ง์ ๊ฒ์/์์ง/์ง์ |
| ๋ฐฐํฌ | Docker / Docker Compose | ๋ฉํฐ ์ปจํ ์ด๋ ์ค์ผ์คํธ๋ ์ด์ |
| ํฐ๋ (์ ํ) | Cloudflare Tunnel / Workers | ์ธ๋ถ ์ ๊ทผ ๋ ธ์ถ |
Main dashboard showing data statistics and quick actions
KAMCO API data collection interface with real-time progress
Browse and search collected auction data
Detailed property information with all auction details
RAG-based AI chatbot for intelligent property search and Q&A
- ๐ Automated data collection from KAMCO OpenAPI
- ๐ Data normalization and structuring
- ๐ค RAG-based AI Chatbot with intelligent search and Q&A
- ๐ Hybrid search: Vector (Qdrant) + Keyword (MongoDB) fallback
- ๐ FastAPI RESTful endpoints
- ๐พ MongoDB + Qdrant vector database
- ๐ง Ollama local LLM integration (deepseek-r1, nomic-embed-text)
- ๐ฅ๏ธ Web-based management interface with real-time stats
- ๐ MCP (Model Context Protocol) server for ChatGPT integration
- ๐ณ Docker deployment ready
[ChatGPT Desktop]
โ (MCP Protocol)
[MCP Server] โโ [FastAPI Server]
โ โ
[MongoDB] โโ [Qdrant] โโ [Ollama]
โ
[KAMCO OpenAPI]
Optional:
[Cloudflare Front]
โ
[Cloudflare Workers]
โ (Tunnel)
[Mac mini / Server]
brew tap mongodb/brew
brew install mongodb-community@7.0
brew services start mongodb-communitybrew install ollama
# Pull required models for RAG chatbot
ollama pull nomic-embed-text:latest # Embedding model
ollama pull deepseek-r1:latest # LLM for generationdocker run -d \
--name qdrant \
-p 6333:6333 \
-v ~/qdrant:/qdrant/storage \
qdrant/qdrantkamco
โโ raw_items # Raw API responses
โโ normalized_items # Normalized text data
โโ chunks # Chunked data for RAG (matches Qdrant payload)
# Clone repository
git clone https://github.com/lhg96/kamco-data-collector.git
cd kamco-data-collector
# Configure environment
cp .env.example .env
nano .env # Edit with your KAMCO API key
# Start all services
docker-compose up -d
# Pull Ollama model
docker exec -it kamco-ollama ollama pull qwen2.5:latest
# Collect and process data
docker exec -it kamco-mcp-server python -m rag.managergit clone https://github.com/lhg96/kamco-data-collector.git
cd kamco-data-collector
python -m venv .venv
source .venv/bin/activate # On Windows: .venv\Scripts\activate
pip install -r requirements.txtCreate a .env file in the project root:
# KAMCO API Key (get from https://www.data.go.kr/)
KAMCO_API_KEY=your_api_key_here
# MongoDB Configuration
MONGO_URI=mongodb://localhost:27017
MONGO_DB_NAME=kamco
MONGO_COLLECTION_NAME=collected_items
# Qdrant Configuration
QDRANT_HOST=localhost
QDRANT_PORT=6333
QDRANT_COLLECTION=kamco
# Ollama Models
EMBED_MODEL=nomic-embed-text:latest # For embeddings
LLM_MODEL=deepseek-r1:latest # For generation
# Flask Configuration
FLASK_SECRET_KEY=your_random_secret_key_here
FLASK_PORT=5001 # Default: 5000 (avoid conflicts with macOS Control Center)The MCP server allows ChatGPT to directly interact with KAMCO data.
docker-compose up -d# Using RAG Manager (all-in-one)
docker exec -it kamco-mcp-server python -m rag.manager
# Or step by step:
docker exec -it kamco-mcp-server python -m services.kamco_collector_service
docker exec -it kamco-mcp-server python -m normalize.kamco_normalizer
docker exec -it kamco-mcp-server python -m rag.embedSee MCP_SETUP_GUIDE.md for detailed instructions.
Available MCP Tools:
search_kamco- Search auctions by natural languageget_kamco_by_id- Get detailed item informationget_recent_kamco- Get recent listingsask_kamco- Ask questions with RAG answerscollect_kamco_data- Trigger data collectionembed_kamco_data- Process and embed data
Fetch raw data from KAMCO OpenAPI and store in MongoDB:
python collector/kamco_fetcher.py
# Or use the service:
python -m services.kamco_collector_serviceConvert raw data to human-readable text format:
python normalize/kamco_normalizer.pyGenerate embeddings and store in Qdrant vector database:
python rag/embed.pysetup_collection() recreates the collection, deleting existing data.
uvicorn api.main:app --host 0.0.0.0 --port 8000
# Or with Docker:
docker-compose up -d apiAvailable endpoints:
GET /ask?q=your_question- RAG-based question answering (Top-5 vector search)GET /health- Health check
Start the Flask web application:
python web/app.pyAccess at http://localhost:5001
Features:
- ๐ Real-time data collection monitoring
- ๐ Advanced search with filters
- ๐ Detailed property information view
- ๐ค AI Chatbot - RAG-based intelligent Q&A system
- ๐ Dashboard with statistics
The web interface includes an AI chatbot powered by RAG (Retrieval-Augmented Generation) technology:
- ๐ง Natural Language Search: Ask questions in natural Korean
- ๐ Intelligent Query Processing: Automatically detects search intent (region, price, property type)
- ๐ Hybrid Search Mode:
- Primary: Vector-based semantic search with Qdrant + Ollama
- Fallback: MongoDB keyword/regex search when vector DB is unavailable
- ๐ฏ Context-Aware Responses: Recent data queries automatically pull latest collections
- ๐ Source Citations: All answers include source documents with relevance scores
- ๐ Direct Links: Includes original KAMCO auction URLs in responses
"์ต๊ทผ ์์ง๋ ๋ฐ์ดํฐ ๋ณด์ฌ์ค"
โ Shows 5 most recent items with details
"์์ธ ๊ฐ๋จ ์ํํธ 5์ต ์ดํ"
โ Searches for apartments in Gangnam, Seoul under 500M won
"์ด ๋ฌผ๊ฑด์ ๊ฐ์ ๊ฐ๋ ์ผ๋ง์ธ๊ฐ์?"
โ RAG-based answer with specific property details
1. RAG Mode (When Qdrant + Ollama Available):
- Embeds user question using
nomic-embed-textmodel - Performs vector similarity search in Qdrant (top-3)
- Generates natural language answer using
deepseek-r1LLM - Returns answer with source documents and confidence scores
2. Fallback Mode (MongoDB Only):
- Uses Ollama to analyze query intent (JSON extraction)
- Constructs MongoDB query from extracted parameters:
- Region:
basic_info.lctnAddrregex match - Property type:
basic_info.pblancObjSeregex match - Price range: Numerical comparison
- Keywords: Multi-field OR search
- Region:
- Returns structured results with formatted descriptions
3. Recent Data Optimization:
- Detects keywords: '์ต๊ทผ', '์ต์ ', '์์ง', '๋ชฉ๋ก'
- Bypasses RAG for direct MongoDB lookup
- Sorts by
collected_attimestamp (descending) - Faster response time for common queries
POST /api/chat
Content-Type: application/json
{
"question": "์์ธ ๊ฐ๋จ๊ตฌ ์ํํธ ๋งค๋ฌผ ๋ณด์ฌ์ค"
}
Response:
{
"success": true,
"answer": "์์ธ ๊ฐ๋จ๊ตฌ ์ํํธ ๊ฒ์ ๊ฒฐ๊ณผ์
๋๋ค:\n\n1. ...",
"sources": [
{
"text": "๊ณต๊ณ ๋ช
: ...\n์๋ฌธ URL: https://...",
"score": 0.95
}
],
"fallback": false // true if using MongoDB fallback
}- Qdrant: Vector database for embeddings (optimal)
- Ollama: Local LLM for embeddings + generation (optimal)
- MongoDB: Document store + fallback search (required)
๐ก Tip: For best results, ensure Qdrant and Ollama are running. The system gracefully falls back to MongoDB-only mode if vector services are unavailable.
# ์๋ฒ ๊ธฐ๋
uvicorn api.main:app --host 0.0.0.0 --port 8000
# ์์ฐ์ด ์ง๋ฌธ โ Top-5 ๋ฒกํฐ ๊ฒ์ ๊ธฐ๋ฐ ๋ต๋ณ
curl "http://localhost:8000/ask?q=์์ธ%20๊ฐ๋จ๊ตฌ%20์ํํธ%20๋งค๋ฌผ"
# ํฌ์ค ์ฒดํฌ
curl "http://localhost:8000/health"
# โ {"status": "ok"}# Flask ์น ์๋ฒ ๊ธฐ๋ (http://localhost:5001)
python web/app.py
# ์ฑ๋ด ์ง๋ฌธ
curl -X POST http://localhost:5001/api/chat \
-H "Content-Type: application/json" \
-d '{"question": "์ต๊ทผ ์์ง๋ ๊ณต๋งค ๋ฌผ๊ฑด ๋ณด์ฌ์ค"}'{
"success": true,
"answer": "์ต๊ทผ ์์ง๋ ๊ณต๋งค ๋ฌผ๊ฑด 5๊ฑด์
๋๋ค:\n1. ...",
"sources": [
{
"text": "๊ณต๊ณ ๋ช
: ...\n์๋ฌธ URL: https://...",
"score": 0.95
}
],
"fallback": false
}# 1) KAMCO OpenAPI์์ ์์ ๋ฐ์ดํฐ ์์ง (MongoDB ์ ์ฅ)
python -m services.kamco_collector_service
# 2) ์ฌ๋์ด ์ฝ์ ์ ์๋ ํ
์คํธ๋ก ์ ๊ทํ
python -m normalize.kamco_normalizer
# 3) ์ฒญํฌ ์๋ฒ ๋ฉ ์์ฑ โ Qdrant ๋ฒกํฐ DB ์ ์ฅ
python -m rag.embeddocker-compose up -d
docker exec -it kamco-mcp-server python -m rag.managerChatGPT ๋ฐ์คํฌํฑ์์ search_kamco, ask_kamco, collect_kamco_data ๋ฑ MCP ๋๊ตฌ๋ฅผ ์ง์ ํธ์ถํ ์ ์์ต๋๋ค. ์์ธํ ์ค์ ์ MCP_SETUP_GUIDE.md๋ฅผ ์ฐธ๊ณ ํ์ธ์.
For external access via Cloudflare Workers:
cloudflared tunnel create kamco-rag
cloudflared tunnel run kamco-ragConfigure Workers to proxy /ask endpoint to your local FastAPI server.
python test_api.pypytestpytest --cov=. --cov-report=htmlkamco-data-collector/
โโโ api/
โ โโโ main.py # FastAPI RAG endpoints
โโโ collector/
โ โโโ kamco_fetcher.py # KAMCO OpenAPI data collector
โโโ mcp_server/
โ โโโ __init__.py
โ โโโ server.py # MCP server for ChatGPT integration
โโโ normalize/
โ โโโ kamco_normalizer.py # Data normalization
โโโ rag/
โ โโโ embed.py # Embedding & Qdrant operations
โ โโโ manager.py # RAG pipeline orchestration
โโโ services/
โ โโโ kamco_collector_service.py # Service layer
โโโ web/
โ โโโ app.py # Flask web interface
โ โโโ templates/ # HTML templates
โ โโโ static/ # Static assets
โโโ tests/ # Test files
โโโ screenshots/ # Application screenshots
โโโ Dockerfile # Docker image definition
โโโ docker-compose.yml # Multi-container orchestration
โโโ .dockerignore # Docker build exclusions
โโโ requirements.txt # Python dependencies
โโโ .env.example # Example environment variables
โโโ mcp_config.json # MCP server configuration
โโโ MCP_SETUP_GUIDE.md # MCP setup instructions
โโโ .gitignore
โโโ README.md
Get your API key from ๊ณต๊ณต๋ฐ์ดํฐํฌํธ (data.go.kr)
- Search for "ํ๊ตญ์์ฐ๊ด๋ฆฌ๊ณต์ฌ_๊ณต๋งค"
- Register and obtain your service key
- Use the URL-encoded version of the key
During development, we evaluated the PublicDataReader library, which provides a convenient wrapper around various Korean public data APIs, including KAMCO.
โ
Returns data as pandas DataFrame for easy analysis
โ
Automatic Korean column name conversion
โ
Simple installation via pip
โ
Unified interface for multiple public APIs
โ Difficult to access raw data structure
โ Additional external dependencies
โ Less control over data processing pipeline
โ Not suitable for MongoDB storage workflow
โ Limited customization for RAG pipeline
โ
Direct XML/Dict data processing
โ
Built-in MongoDB storage
โ
Integrated Flask web UI
โ
Duplicate removal logic
โ
Minimal external dependencies
โ
Optimized for RAG pipeline
We maintain PublicDataReader compatibility for users who prefer DataFrame-based analysis:
# Optional: Use PublicDataReader for analysis
import PublicDataReader as pdr
api = pdr.Kamco(service_key)
df = api.get_data(service="์บ ์ฝ๊ณต๋งค๋ฌผ๊ฑด", function="๋ฌผ๊ฑด๋ชฉ๋ก")- Data Collection & Storage: Use our KamcoCollectorService
- Data Analysis: Consider PublicDataReader for exploratory analysis
- Web Interface: Use our Flask application
- RAG Pipeline: Use our custom implementation
For detailed PublicDataReader test results and comparisons, see tests/README_PUBLICDATAREADER.md.
- Implement incremental updates (delta sync)
- Add support for additional KAMCO API endpoints
- Implement retry logic with exponential backoff
- Add data validation and quality checks
- AI Chatbot with natural language search โ
- Hybrid search (vector + keyword fallback) โ
- Recent data query optimization โ
- Multi-language support (English/Korean)
- Enhanced vector search with re-ranking
- Implement query expansion techniques
- Conversation history and context memory
- Containerization with Docker Compose โ
- MCP server for ChatGPT integration โ
- Add monitoring and logging (Prometheus/Grafana)
- Implement API rate limiting
- Add authentication and authorization
- Performance optimization and caching
- Real-time data streaming
- Machine learning-based recommendations
- Advanced analytics dashboard
- Mobile application support
- Integration with external platforms
# Clone the repository
git clone https://github.com/lhg96/kamco-data-collector.git
cd kamco-data-collector
# Create virtual environment
python -m venv .venv
source .venv/bin/activate
# Install dependencies
pip install -r requirements.txt
# Run tests
pytestCustom License - Free for Personal Use, Commercial License Required
This software is free to use for personal, educational, and non-commercial purposes. Commercial use requires a separate license agreement.
- โ Free: Personal use, education, research
- โ Requires License: Commercial use, production deployment, integration into commercial products
For commercial licensing inquiries, please contact: hyun.lim@okkorea.net
Exchange rate data collected from Investing.com and other public financial data sources. KAMCO auction data provided by Korea Asset Management Corporation through public data portal. Accurate as of December 2024.
We provide professional consulting and development services for IoT, AI, and embedded systems projects.
- Email: hyun.lim@okkorea.net
- Homepage: https://www.okkorea.net
- LinkedIn: https://www.linkedin.com/in/aionlabs/
- IoT System Design and Development / IoT ์์คํ ์ค๊ณ ๋ฐ ๊ฐ๋ฐ
- Embedded Software Development / ์๋ฒ ๋๋ ์ํํธ์จ์ด ๊ฐ๋ฐ (Arduino, ESP32)
- AI Service Development / AI ์๋น์ค ๊ฐ๋ฐ (LLM, MCP Agent)
- Cloud Service Architecture / ํด๋ผ์ฐ๋ ์๋น์ค ๊ตฌ์ถ (Google Cloud Platform)
- Hardware Prototyping / ํ๋์จ์ด ํ๋กํ ํ์ดํ
- IoT project planning and design consultation / IoT ํ๋ก์ ํธ ๊ธฐํ ๋ฐ ์ค๊ณ ์๋ฌธ
- System architecture design / ์์คํ ์ํคํ ์ฒ ์ค๊ณ
- Technology stack selection / ๊ธฐ์ ์คํ ์ ์
- Full-stack development from firmware to cloud / ํ์จ์ด๋ถํฐ ํด๋ผ์ฐ๋๊น์ง Full-stack ๊ฐ๋ฐ
- Proof of Concept (PoC) development / ๊ฐ๋ ๊ฒ์ฆ ๊ฐ๋ฐ
- Production-ready system development / ์์ฉ ์์คํ ๊ฐ๋ฐ
- KAMCO (Korea Asset Management Corporation) for providing public auction data
- ๊ณต๊ณต๋ฐ์ดํฐํฌํธ for API access
- PublicDataReader by WooilJeong for Python library inspiration
- All contributors and users of this project
Made with โค๏ธ by OK Korea