# SafeVixAI — Data Acquisition Scripts 🔬 These scripts are the **raw data pipeline** that built the 3.6GB SafeVixAI dataset. All scripts here are **pure Python** — they require no database, no Redis, no PostGIS. > Scripts are mirrored from the [SafeVixAI main repo](https://github.com/SafeVixAI/SafeVixAI) and organized by their origin folder. --- ## 📁 Structure ``` scripts/ ├── scripts/data/ ← from SafeVixAI/scripts/data/ │ ├── fetch_*.py ← Overpass GIS fetchers (basic version) │ ├── _overpass_utils.py ← Core GIS utility │ ├── download_legal_pdfs.py │ ├── extract_morth2022_tables.py │ ├── seed_blackspots.py │ ├── bootstrap_local_data.py │ ├── verify_data.py │ ├── inspect_zips.py │ ├── audit_env.py │ ├── check_all_scripts.py │ └── setup_kaggle.ps1 │ ├── backend/data/ ← from SafeVixAI/backend/scripts/data/ │ ├── seed_violations.py ← MVA 2019 traffic fine normalizer │ ├── prepare_road_sources.py │ ├── sample_pmgsy.py │ └── road_sources.example.json │ └── chatbot_service/data/ ← from SafeVixAI/chatbot_service/scripts/data/ ├── _overpass_utils.py ← ⭐ Pro version (retries + backoff) └── fetch_*.py ← ⭐ Pro fetchers (use these over scripts/data/) ``` --- ## 🚀 Recommended Run Order ```bash # Install dependencies first pip install requests pdfplumber # 1. Setup Kaggle API (one-time) pwsh scripts/scripts/data/setup_kaggle.ps1 # 2. Fetch all emergency services (use Pro versions) python scripts/chatbot_service/data/fetch_hospitals.py python scripts/chatbot_service/data/fetch_police.py python scripts/chatbot_service/data/fetch_ambulance.py python scripts/chatbot_service/data/fetch_blood_banks.py python scripts/chatbot_service/data/fetch_fire.py # 3. Download legal documents python scripts/scripts/data/download_legal_pdfs.py # 4. Extract MoRTH accident tables from PDFs python scripts/scripts/data/extract_morth2022_tables.py # 5. Normalize accident blackspot data python scripts/scripts/data/seed_blackspots.py # 6. Normalize traffic violations (MVA 2019) python scripts/backend/data/seed_violations.py # 7. Verify everything is correct python scripts/scripts/data/verify_data.py ``` --- ## ⭐ Pro vs Basic Fetchers | Feature | `scripts/scripts/data/fetch_*.py` | `scripts/chatbot_service/data/fetch_*.py` | |---|---|---| | Retry logic | ❌ | ✅ | | Exponential backoff | ❌ | ✅ | | Indian GIS precision | Basic | Enhanced | | Extra fields (email, postcode) | ❌ | ✅ | **Always prefer `chatbot_service/data/` versions** for data acquisition. --- ## 📦 Dependencies ``` pip install -r requirements.txt ``` See `requirements.txt` in the Hub root.