Metadata-Version: 2.4
Name: data_advisor
Version: 0.3.0
Summary: Autonomous Dataset Auditor, Diagnostic Engine & IoT Exam Code Bank for timed data analysis and IoT practical examinations.
Author: Principal Data Science Architect
License-Expression: MIT
Keywords: data-analysis,eda,data-science,hypothesis-testing,code-generation,machine-learning,automated-eda,pandas,scipy,scikit-learn
Classifier: Development Status :: 4 - Beta
Classifier: Intended Audience :: Developers
Classifier: Intended Audience :: Education
Classifier: Intended Audience :: Science/Research
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Topic :: Scientific/Engineering :: Information Analysis
Classifier: Topic :: Software Development :: Code Generators
Requires-Python: >=3.9
Description-Content-Type: text/markdown
Requires-Dist: pandas>=2.0.0
Requires-Dist: numpy>=1.24.0
Requires-Dist: scipy>=1.10.0
Requires-Dist: scikit-learn>=1.2.0
Requires-Dist: matplotlib>=3.7.0
Requires-Dist: seaborn>=0.12.0
Provides-Extra: dev
Requires-Dist: pytest>=7.0.0; extra == "dev"
Requires-Dist: pytest-cov>=4.0.0; extra == "dev"

# DataAdvisor (`data-advisor`)

> **Autonomous Dataset Auditor, Diagnostic Engine & IoT Exam Code Bank**  
> Engineered for students, practitioners, and engineers during timed practical examinations and data analysis tasks.  
> **100% Offline**: Requires **zero internet connection** to inspect datasets, search code, or retrieve solutions.

---

## ⚡ Quickstart

### 1. Search Any Keyword Across the Code Bank
Search instantly across all IoT questions, Arduino sketches, and Python scripts:
```bash
# Terminal CLI
data-advisor --search "dht22"
data-advisor --search "coap"
data-advisor --search "mqtt"
data-advisor --search "random forest"
```

Or inside a Python script / Jupyter Notebook:
```python
from data_advisor import search

# List all available questions and experiments:
search()

# Search for any topic or keyword:
search("dht22")
search("coap")
search(["esp32", "mqtt"])
```

---

### 2. View / Retrieve Complete Question & Code Files (`get_file`)
Retrieve the full question statement, README setup instructions, and all source codes:
```bash
# Terminal CLI
data-advisor --get Q1
data-advisor --get Q3
data-advisor --get 08
data-advisor --get 15 --line-numbers
```

Or inside Python:
```python
from data_advisor import get_file, read_file

# Print the complete question, instructions, and code:
get_file("Q1")
get_file("Q3", line_numbers=True)

# Or return the content as a string:
content = read_file("08")
```

---

### 3. Audit Any Exam Dataset & Generate Python Code (`data_advisor`)
When given an unknown dataset (CSV, TSV, Excel, Parquet):
```bash
# Terminal CLI: Print diagnostic report + executable Python solution:
data-advisor exam_dataset.csv --code

# Specify target column and save generated Python script to a file:
data-advisor exam_dataset.csv --target churn --output solution.py
```

Or inside Python:
```python
from data_advisor import data_advisor

# 1-Line: Outputs diagnostic report AND prints full executable Python code:
data_advisor("exam_dataset.csv")

# With target variable and script export:
data_advisor("exam_dataset.csv", target="churn", output_script="solution.py")
```

---

## 📦 IoT Code Bank Architecture (21 Questions)

The `code_bank/` directory contains **21 comprehensive IoT questions** stored as structured `.txt` files:

### Structure of Each Question File:
- **Title Banner**: Question / Experiment header.
- **`FULL QUESTION`**: Complete official question text with marks and evaluation rubrics.
- **`SHORT QUESTION`**: Concise 1–2 sentence summary / objective.
- **`README & SETUP INSTRUCTIONS`**: Hardware wiring, pinout diagrams, dependencies, execution commands, and expected outputs.
- **`SOURCE CODE FILES`**: Complete executable code files clearly numbered (e.g., `1. server.py`, `2. client.py`, `3. app.py` or `1. sketch.ino`).

### Complete List of 21 Questions:

| # | Question File | Category / Topic | Included Code Files |
|---|:---|:---|:---|
| **1** | `01_dht22_serial.txt` | ESP32 DHT22 Temperature & Humidity (Serial) | `1. sketch.ino`, `2. diagram.json`, `3. libraries.txt` |
| **2** | `02_ldr_serial.txt` | ESP32 LDR Light Intensity Monitoring | `1. sketch.ino`, `2. diagram.json` |
| **3** | `03_pir_serial.txt` | ESP32 PIR Motion Detection | `1. sketch.ino`, `2. diagram.json` |
| **4** | `04_mqtt_esp32_python.txt` | ESP32 MQTT Publisher & Python Subscriber | `1. sketch.ino`, `2. subscriber.py`, `3. diagram.json`, `4. libraries.txt` |
| **5** | `05_http_rest_supabase.txt` | HTTP REST API Cloud Storage & Web Dashboard | `1. send_http_data.py`, `2. app_http.py` |
| **6** | `06_mqtt_cloud_dashboard.txt` | MQTT Cloud Bridge & Streamlit Dashboard | `1. publisher.py`, `2. mqtt_bridge.py`, `3. app.py` |
| **7** | `07_thingsboard_simulation.txt` | ThingsBoard MQTT Telemetry Simulation | `1. simulate_thingsboard.py`, `2. environmental_dashboard.json` |
| **8** | `08_coap_server_client_dashboard.txt` | CoAP Server & Client Dashboard | `1. server.py`, `2. client.py` |
| **9** | `09_mqtt_hivemq_mosquitto_dual.txt` | Dual MQTT (HiveMQ Public & Mosquitto Local) | `1. dual_broker.py` |
| **10** | `10_coap_openmeteo_cloud.txt` | CoAP Environmental Monitoring & Cloud DB | `1. server.py`, `2. app.py` |
| **11** | `11_iss_tracker.txt` | Real-Time ISS Location Tracker & Plotter | `1. iss_tracker.py` |
| **12** | `12_earthquake_dashboard.txt` | USGS Earthquake Analysis Dashboard | `1. app.py` |
| **13** | `13_weather_analysis.txt` | Open-Meteo Weather Trend Visualizations | `1. weather_analysis.py` |
| **14** | `14_air_quality_kochi.txt` | Kochi Air Quality Dashboard (PM2.5, PM10, AQI) | `1. app.py` |
| **15** | `15_decision_tree_occupancy.txt` | Decision Tree Room Occupancy Classifier | `1. occupancy_cli.py`, `2. occupancy_app.py` |
| **16** | `16_linear_regression_beijing.txt` | Linear Regression Temperature Prediction | `1. temperature_cli.py`, `2. temperature_app.py` |
| **17** | `17_random_forest_air_quality.txt` | Random Forest 6-Class Air Quality Classifier | `1. air_quality_cli.py`, `2. air_quality_app.py` |
| **18** | `Q1_dht22_temperature_humidity.txt` | **CAE 2 Exam Section A**: Q1 DHT22 Monitoring [30M] | `1. sketch.ino`, `2. diagram.json`, `3. libraries.txt` |
| **19** | `Q2_ldr_light_intensity.txt` | **CAE 2 Exam Section A**: Q2 LDR Intensity [30M] | `1. sketch.ino`, `2. diagram.json` |
| **20** | `Q3_coap_air_quality_random_forest.txt` | **CAE 2 Exam Section B**: Q3 CoAP Air Quality & RF [30M] | `1. server.py`, `2. client.py`, `3. app.py` |
| **21** | `Q4_coap_weather_decision_tree.txt` | **CAE 2 Exam Section B**: Q4 CoAP Weather & DT [30M] | `1. server.py`, `2. client.py`, `3. app.py` |

> **Adding More Questions**: You can add your own `.txt` files to `code_bank/` at any time. The search and retrieval functions automatically detect new files dynamically.

---

## 🔒 100% Offline Capability

- **Zero Network Required**: Does not connect to the internet to run searches, load code files, or inspect datasets.
- **Local Fallback Datasets**: The machine learning scripts support offline CSV datasets (`city_day.csv`, `historical_weather_kochi.csv`, `datatraining.txt`).
- **Local Protocol Testing**: CoAP server/client examples bind to `127.0.0.1:5683` (localhost UDP) and local MQTT uses `localhost:1883`.

---

## 🚀 Building & Publishing to PyPI

### 1. Build the Package
```powershell
python -m build
```
*(Builds the universal wheel and source distribution bundling the complete library and code bank).*

### 2. Upload to PyPI
```powershell
python -m twine upload dist/*
```
- **Username**: `__token__`
- **Password**: `<paste your PyPI API token starting with pypi-...>`

---

## 💻 Installation on Other Machines

On any lab system, exam machine, or virtual environment:
```bash
# Install directly from PyPI
pip install data-advisor

# Or install locally in editable mode
pip install -e .
```

### CLI Command Summary:
| Command | Action |
|:---|:---|
| `data-advisor --search list` | List all 21 questions & files in the code bank |
| `data-advisor --search "<keyword>"` | Search questions matching any keyword or phrase |
| `data-advisor --get <Q1/Q3/08>` | Print complete question statement, setup instructions & code |
| `data-advisor <dataset.csv> --code` | Audit dataset and output complete copy-pasteable Python code |
| `data-advisor <dataset.csv> -o run.py` | Save generated Python data science pipeline to `run.py` |
