Because your soil deserves a brain π§ + π€
Quick Start β’ Architecture β’ Roadmap β’ Contributing β’ License
AFTEC is a modular, openβsource AI platform for precision farming.
It starts simple: monitor soil temperature and pH from sensors, detect anomalies, and later predict trends β all while staying clean and expandable.
Think of it as POKAD but for agriculture. π‘βπΎ
- For developers β clean interfaces (
BaseIngester,BaseStorage,BaseDetector), easy to extend with MQTT, LoRa, or new ML models. - For farmers β catches weird readings before crops suffer, sends alerts, and visualizes data.
- For your resume β shows you can build productionβready, testable, containerized AI systems.
- For business β you can later offer a SaaS version or custom hardware integration.
π‘ Still early? Yes β and that's good. We build stepβbyβstep, no spaghetti.
AFTEC/
βββ src/aftec/
β βββ core/ # data models & abstract base classes
β βββ ingesters/ # read from serial, mock, MQTT, etc.
β βββ storage/ # SQLite (now), PostgreSQL/InfluxDB (later)
β βββ detectors/ # anomaly detection (IQR β IsolationForest β LSTM)
β βββ monitoring/ # dashboard (Streamlit) + notifiers (Telegram)
βββ scripts/ # run mock sensor, run ingester
βββ tests/ # pytest unit tests
βββ docs/ # detailed docs (mkdocs later)
Current scope (MVP):
- Mock sensor (generates realistic temp/pH with occasional anomalies)
- SQLite storage
- IQRβbased anomaly detector
- Simple CLI dashboard (or Streamlit)
- Full test suite
Later:
- Real sensor support (USB serial / Modbus)
- Predictive model (ARIMA or tiny LSTM)
- Telegram alerts
- Docker & cloud deploy
git clone https://github.com/combat47/AFTEC.git
cd AFTEC
make install
make run-simIn another terminal:
make run-ingesterπ You'll see mocked sensor data being ingested and saved to aftec.db. Anomalies (e.g., pH 3.0 or temp 55Β°C) will be flagged.
π οΈ Makefile commands (save your brain)
| Command | What it does |
|---|---|
| make install | install deps + package in editable mode |
| make run-sim | run mock sensor (prints fake data) |
| make run-ingester | main loop: read from mock sensor β store β detect anomalies |
| make test | run all tests with pytest |
| make clean | remove cache files |
[2025-05-12 14:32:01] sensor=mock_01 | temp=22.3Β°C | pH=6.8 | anomaly=False
[2025-05-12 14:32:03] sensor=mock_01 | temp=23.1Β°C | pH=7.0 | anomaly=False
[2025-05-12 14:32:05] sensor=mock_01 | temp=55.0Β°C | pH=3.2 | anomaly=True β οΈ
Anomaly detection currently uses IQR on a sliding window of last 100 readings. Simple, explainable, and easy to replace later.
Phase 0 β Project structure, mock sensor, base classes
Phase 1 β SQLite storage + IQR anomaly detector + unit tests
Phase 2 β Streamlit dashboard (live plots, anomaly highlights)
Phase 3 β Telegram notifier (get alerts when soil goes crazy)
Phase 4 β Real serial sensor integration (Arduino + pH probe + DS18B20)
Phase 5 β Predictive model (forecast temp/pH for next 6h)
Phase 6 β Docker + dockerβcompose, cloud deployment template
Each phase is a separate milestone with its own branch and release.
You want to help? Awesome.
Fork, create a feature branch, open a PR.
Keep the modular spirit β new ingesters, detectors, or storage backends are welcome.
Write tests (pytest) for anything nonβtrivial.
Use make test before pushing.
We also welcome realβworld sensor configs (e.g., how to connect a specific pH meter). Share your setup in docs/hardware/.
This repo is MIT licensed β free forever. But if you want to make money:
SaaS version β hosted dashboard, multiβfarm, premium alerts.
Consulting β help farms integrate AFTEC with their existing sensors.
Whiteβlabel β sell a branded version to agritech companies.
All using the same core code. I'll keep the core open, you build business on top.
Apache 2.0 Β© [Amirhossein Jahazi] β do whatever you want, but keep the original copyright, disclaimer, and note any changes.
If AFTEC helps you or makes you smile, star this repo π and share it with a farmer or a dev friend.
Made with β, Python, and a dream of smarter fields.