This project analyzes online discussion about exotic pets, combining data collection, text processing, sentiment and risk analysis, and an interactive Streamlit dashboard for exploration.
Purpose: Store all project data
raw/: Original, immutable source data. Never modify files here.processed/: Cleaned and transformed data ready for analysis.external/: Third-party or reference datasets.
Purpose: Jupyter notebooks for exploration, analysis, and reporting
- Use numbered prefixes where helpful:
01_exploration.ipynb,motivation.ipynb - Keep one clear purpose per notebook
- Include markdown cells with objectives and findings
- Clean output before committing
Purpose: Reusable Python modules and utilities
data.py: Data loading and preprocessing helpersutils.py: Shared utility functionswildlife_nlp.py: NLP and conservation risk functions- Keep functions well-documented with docstrings
Purpose: Output and analysis results
figures/: Generated plots, graphs, and visualizationsreports/: Final analysis reports, summaries, and presentations
Purpose: Unit and integration tests
- Mirror the structure of
/srcwhere practical - Name files as
test_*.py - Run with
pytest
Purpose: Project documentation
STRUCTURE.md: Detailed structure guideDASHBOARD_RESTRUCTURE_SUMMARY.md: Dashboard restructuring notes
Purpose: Configuration files for reproducibility
default.yaml: Default parameters- Use YAML format for human readability
Purpose: Standalone Python scripts for automation
- Data collection workflows
- Data processing and cleanup scripts
- Scrapers for Quora, Reddit, and SerpApi workflows
Purpose: Main dashboard entry point
streamlit_exotic_pet_dashboard.py: Interactive Streamlit dashboard for analysis and exploration
Purpose: Project metadata and support files
README.md: Project overview and setup instructionsrequirements.txt: Python dependenciesLICENSE: License text.gitignore: Git ignore rules
# Create virtual environment
python -m venv venv
source venv/bin/activate
# Install dependencies
pip install -r requirements.txt# Run notebooks
jupyter notebook notebooks/
# Run scripts
python scripts/data_processing.pySERPAPI_KEY— Set this environment variable to your SerpApi API key before running crawlers or the notebook. Example:
export SERPAPI_KEY=your_real_key_hereDo not commit API keys to source control; the notebook and scripts read the key from SERPAPI_KEY.
- Copy the example env file and set your SerpApi key:
cp .env.example .env
# then edit .env and set SERPAPI_KEY- Verify the key loads (uses
python-dotenv):
python scripts/load_env.py- Run the SerpApi crawl (will use
SERPAPI_KEYand consume credits):
python scripts/run_serpapi_crawl.py- Open notebooks for exploration:
jupyter notebook notebooks/If the requests-based Quora scraper misses content (Quora is JS-heavy), use the Selenium fallback script which runs a headless Chrome browser to render pages before scraping.
- Ensure Chrome/Chromium is installed for your platform (macOS example):
# Install Chrome on macOS (Intel or Apple Silicon) via Homebrew
brew install --cask google-chrome- Install Python dependencies (includes
seleniumandwebdriver-manager):
python3 -m pip install -r requirements.txt- If you previously ran the Selenium script and hit a chromedriver/architecture mismatch (Exec format errors), remove webdriver-manager's cached drivers so it will redownload the correct binary:
rm -rf ~/.wdm/drivers/chromedriver- Run the Selenium fallback (non-headless mode is useful for debugging — edit
scripts/scrape_quora_selenium.pyand setheadless=Falseinget_driver()):
python3 scripts/scrape_quora_selenium.pyTroubleshooting:
- If you see
Exec format error, it usually means the downloaded chromedriver binary doesn't match your CPU architecture (Intel vs Apple Silicon). Deleting~/.wdm/drivers/chromedriverand reinstalling Chrome then re-running will usually fix it. - For debugging, run with
headless=Falseand watch the browser to confirm pages load. - If Chrome is not installed or not on PATH,
webdriver-managermay download drivers that won't run — ensure a matching Chrome browser is installed.
A simple CLI wrapper is provided to run the combined Quora scraper with custom keywords or a file of keywords. The wrapper calls scripts/scrape_quora_combined.py and writes WWF_Quora_Crawl_Combined.csv by default.
Usage examples:
# Run built-in small keyword set
python3 scripts/run_quora_scraper.py
# Pass comma-separated keywords
python3 scripts/run_quora_scraper.py --keywords "pet monkey,pet tiger"
# Read keywords from a file (one per line)
python3 scripts/run_quora_scraper.py --file keywords.txt
# Specify custom output file
python3 scripts/run_quora_scraper.py --keywords "pet monkey" --output my_results.csvNotes:
- The scraper first tries a lightweight
requestsparse and falls back to Selenium if pages require rendering. - Ensure dependencies are installed (
pip install -r requirements.txt) and Chrome is available for Selenium fallback.
Notes:
- Keep your
.envprivate — it's already listed in.gitignore. - If you prefer not to use
.env, exportSERPAPI_KEYdirectly in your shell.
See requirements.txt for Python dependencies.
- Olabode Ajayi : Email.........
- vaishnavi.pachva@gwmail.gwu.edu
- Henry.lin@gwmail.gwu.edu
- c.buss@gwmail.gwu.edu
- kittyyangjunbi@gwmail.gwu.edu
- david.king@gwmail.gwu.edu
See LICENSE file for details.
- Create a feature branch
- Make changes and commit
- Push to remote and create a pull request
- Keep raw data immutable
- Version control notebooks carefully
- Document assumptions and decisions
- Use config files for parameters