Aquaponics Knowledge Base System - Markdown Ingestion Pipeline
This package contains everything you need to turn your Claude-processed textbook markdown files into a queryable, persistent knowledge base.
-
akbs_ingest_markdown.py- Main ingestion pipeline- Reads your markdown files
- Chunks content intelligently
- Extracts metadata and XML tags
- Stores in ChromaDB with embeddings
- Provides query interface
-
akbs_query.py- Interactive query tool- Command-line interface to your knowledge base
- Ask questions in natural language
- Get relevant answers from your textbooks
-
requirements.txt- Python dependencies- ChromaDB for vector storage
- sentence-transformers for embeddings
-
AKBS_Project_Spec.md- Full project specification- Architecture overview
- Integration points
- Roadmap for full AKBS system
-
AKBS_SETUP_GUIDE.md- Detailed setup instructions- Step-by-step installation
- Usage examples
- Integration patterns
pip install -r requirements.txtmkdir -p data/knowledge_db
mkdir -p processed-chaptersPut your Claude-processed markdown files in processed-chapters/
Find the main() function and update paths:
def main():
ingester = AKBSIngester(db_path="./data/knowledge_db")
# Update this path to your markdown files
ingester.ingest_directory(
Path("./processed-chapters"),
source_name="Your Textbook Name"
)python akbs_ingest_markdown.pypython akbs_query.pyType questions like:
- "What is the optimal pH for lettuce?"
- "How do I manage dissolved oxygen?"
- "What temperature do tilapia need?"
Your Workflow AKBS System Future Integration
─────────────────────────────────────────────────────────────────────────
Claude processes textbooks → This ingestion code → Sensor system
↓ ↓ ↓
Markdown + XML files → ChromaDB storage → Real-time queries
↓ ↓ ↓
Topic guides → Query interface → Decision making
┌─────────────────────────────────────────────┐
│ Teaching Interface │ ← Future
│ (Guide learners through process) │
├─────────────────────────────────────────────┤
│ Simulation Layer │ ← Future
│ (Digital twin testing) │
├─────────────────────────────────────────────┤
│ Knowledge Base (AKBS) ← YOU ARE HERE │ ✓ NOW
│ (Query textbook knowledge) │
├─────────────────────────────────────────────┤
│ Sensor System (Raspberry Pi) │ ← In Progress
│ (Monitor & collect data) │
├─────────────────────────────────────────────┤
│ Physical System │ ✓ EXISTS
│ (NFT hydroponics → aquaponics) │
└─────────────────────────────────────────────┘
- ✅ You process textbooks with Claude
- ✅ You get markdown files (readable + AI-tagged)
- ✅ NOW: This code makes them queryable
- Connect to your Raspberry Pi sensor system
- When sensor reads pH = 6.2, query: "What does pH 6.2 mean for lettuce?"
- Get guidance from your knowledge base
- Make informed decisions automatically
your-akbs-project/
├── akbs_ingest_markdown.py # Main ingestion code
├── akbs_query.py # Query interface
├── requirements.txt # Dependencies
├── AKBS_SETUP_GUIDE.md # Detailed guide
├── AKBS_Project_Spec.md # Full specification
├── data/
│ └── knowledge_db/ # ChromaDB storage (created on first run)
└── processed-chapters/ # Your markdown files go here
├── Chapter-01-*.md
├── Chapter-02-*.md
└── ...
✅ Local & Persistent - Runs on your machine, survives restarts ✅ Portable - Copy the database to other machines ✅ Fast - Sub-second queries after initial load ✅ Smart - Uses embeddings for semantic search ✅ Metadata-Rich - Tracks chapters, sources, types ✅ XML-Aware - Extracts tags from AI-tagged files ✅ Modular - Easy to integrate with other projects
from pathlib import Path
from akbs_ingest_markdown import AKBSIngester
# Initialize
kb = AKBSIngester(db_path="./data/knowledge_db")
# Ingest a directory
kb.ingest_directory(
Path("./processed-chapters"),
source_name="RAS Textbook"
)# Ask a question
results = kb.query("optimal pH for lettuce")
# Pretty print results
kb.pretty_print_results(results)# In your sensor monitoring code
current_ph = sensor.read_ph()
guidance = kb.query(f"pH is {current_ph}, what should I do?")This isn't just a document database. It's:
- Context-aware - Understands relationships between concepts
- Source-tracked - Knows where information came from
- Semantic - Finds relevant content even with different wording
- Growing - Add new documents anytime
- Integrated - Designed to work with your other projects
-
Add More Documents
- Process more textbooks with Claude
- Ingest research papers
- Add your own operational learnings
-
Build API Wrapper (Optional)
- REST API for other projects
- FastAPI makes this easy
-
Connect to Sensors
- Raspberry Pi queries knowledge base
- Real-time decision support
-
Expand to Simulation
- Use knowledge base for parameter validation
- Inform simulation models
-
Create Teaching Interface
- Query for learning content
- Generate curriculum from knowledge base
Import Error: No module named 'chromadb'
pip install chromadb sentence-transformersDatabase Won't Persist
- Check that
./data/knowledge_dbis writable - Make sure you're using
PersistentClient, notClient
No Results Found
- Make sure you've ingested files first
- Try broader queries
- Check file paths in ingestion code
Queries Are Slow
- First query loads models (10-30 seconds)
- Subsequent queries are fast (<1 second)
As you use this system:
- Note what works well
- Track what needs improvement
- Add features you need
- Share learnings
This is the foundation. Everything else builds on this.
Today: You have textbook PDFs → Claude processes them → This makes them queryable
Soon: Sensors read data → Query knowledge base → Make informed decisions
Future: Complete autonomous aquaponics system with AI brain powered by your knowledge base
Read the full guides:
- AKBS_SETUP_GUIDE.md - Detailed usage instructions
- AKBS_Project_Spec.md - Complete system architecture
You're building the brain. The sensors are the senses. Together, they think. 🧠🌱
Open source - build on it, share it, improve it.
Start ingesting. Start querying. Start building. 🚀