Bappadala Rohith Kumar Naidu
docs: update repository and scripts readmes to reflect 4.2GB master sync layouts
3c7d01d
|
Raw
History Blame Contribute Delete
2.55 kB

SafeVixAI β€” Data Acquisition Scripts πŸ”¬

These scripts are the raw data pipeline that built the 4.2 GB SafeVixAI dataset. All scripts here are pure Python β€” they require no database, no Redis, no PostGIS.

Scripts are mirrored from the SafeVixAI main repo and organized by their origin folder.


πŸ“ Structure

scripts/
β”œβ”€β”€ backend/                  ← from SafeVixAI/backend/scripts/
β”‚   β”œβ”€β”€ app/                  ← Web app database setup & SQL migrations
β”‚   └── data/                 ← Civic intel ETL pipelines & seeders
β”‚
β”œβ”€β”€ chatbot_service/          ← from SafeVixAI/chatbot_service/scripts/
β”‚   β”œβ”€β”€ app/                  ← Chatbot seeders
β”‚   β”œβ”€β”€ data/                 ← Overpass GIS fetchers (Pro version)
β”‚   └── verify_rag.py         ← Vectorstore validation
β”‚
└── scripts/                  ← from SafeVixAI/scripts/
    β”œβ”€β”€ app/                  ← Asset generators
    └── data/                 ← Scrapers, downloaders, and legacy seeders

πŸš€ Recommended Run Order

# 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.