How muhammad-hassaan11/etl---coding-night- works
1. This repository is a small end-to-end analytics pipeline, not a multi-service application. The core flow is: scrape RC product data from Banggood, persist it as flat files, analyze it in SQL, and present it in a Streamlit dashboard.
2. The data acquisition boundary lives in CODING NIGHT HACKATHON.ipynb. That notebook uses Selenium for browser automation and BeautifulSoup for HTML parsing to extract product records from Banggood’s product pages. This is the only place where live web interaction happens.
3. The scraper outputs structured snapshots into rc_products.csv and rc_products.json. These files are the handoff point between acquisition and downstream analysis; they contain the shared product schema: category, name, prices in multiple currencies, rating, URL, and image link.
4. app.py is the presentation layer. It is a Streamlit app that loads the scraped CSV, performs in-memory cleaning and aggregation with pandas/NumPy/regex, and renders interactive charts with Matplotlib.
5. The dashboard is built around a few analytical views rather than transactional UI: summary metrics, category price distributions, price-vs-rating scatter analysis, top-rated products, category counts, and a raw-data/diagnostics section. Its role is consumption and exploration of the dataset, not data collection.
6. code night sql code.sql is a separate analytics layer. It contains SQL queries for category-level aggregation, rating analysis, price banding, ranking, and value scoring. This suggests a relational database is used for deeper analysis, but that database is external to the files in the repo.
7. The main data contract across the system is the product table. Every downstream component assumes consistent column names and types from the scraper output; the Streamlit app and SQL queries both depend on that schema.
8. The key architectural boundary is between raw scraped data and analytical consumers. The notebook is responsible for noisy, web-specific extraction; the dashboard and SQL script assume cleaned, tabular data and do not deal with browser automation.
9. There is no backend API, message queue, scheduler, or server-side application logic in this repo. The runtime is mostly local and manual: Jupyter for scraping, file-based storage for interchange, and Streamlit for interactive visualization.
10. Relevant technologies that materially shape the architecture are Python, Selenium/ChromeDriver, BeautifulSoup, pandas, Streamlit, Matplotlib, and SQL. The architecture is lightweight and file-driven, with CSV/JSON acting as the integration layer between scraping, analysis, and visualization.
Main entry points: code night sql code.sql SQL analysis · rc_products.csv CSV snapshot · CODING NIGHT HACKATHON.ipynb Scrape notebook · app.py Dashboard app
Components 15
Acquisition
Live scraping and file output
- Scrape notebook · Orchestrates the Banggood scraping workflow
CODING NIGHT HACKATHON.ipynb - Browser automation · Drives live page navigation and interaction
- HTML parsing · Extracts product fields from rendered pages
Analytics
SQL and dashboard consumers
- Dashboard app · Interactive analytics and presentation layer
app.py - Data prep · Cleans, filters, and aggregates scraped rows in memory
- Metrics views · Builds overview KPIs and category counts
- Distribution plots · Renders price distributions and scatter analysis
- Top products · Highlights top-rated products and value candidates
- Diagnostics view · Shows raw rows and inspection output
- SQL analysis · Standalone relational analysis queries
code night sql code.sql - Category aggregates · Category-level counts and summaries
- Ranking & scoring · Rating analysis, price bands, and value scoring
Data files
Shared flat-file contract
- Product schema · Shared product fields: category, name, prices, rating, URL, image
- CSV snapshot · Primary tabular handoff for downstream analysis
rc_products.csv - JSON snapshot · Alternate structured handoff for the same scraped records
rc_products.json
Connections 15
- Scrape notebook → Browser automation: drives · The notebook uses Selenium for live browsing
- Scrape notebook → HTML parsing: parses · Rendered HTML is parsed with BeautifulSoup
- Browser automation → HTML parsing: feeds · Browser output is passed to the parser
- HTML parsing → Product schema: extracts · Parsed fields are normalized into the shared product schema
- Product schema → CSV snapshot: writes · Structured records are persisted as CSV snapshots
- Product schema → JSON snapshot: writes · Structured records are also persisted as JSON snapshots
- CSV snapshot → Dashboard app: loads · The dashboard reads the scraped CSV
- Dashboard app → Data prep: prepares · The app cleans and reshapes data before display
- Data prep → Metrics views: supports · Prepared data feeds summary metrics and category counts
- Data prep → Distribution plots: supports · Prepared data feeds distribution and scatter plots
- Data prep → Top products: supports · Prepared data feeds top-rated and value-focused views
- Data prep → Diagnostics view: supports · Prepared data feeds raw-data and diagnostics panels
- CSV snapshot → SQL analysis: analyzed by · The SQL layer operates on the same tabular product data
- SQL analysis → Category aggregates: queries · SQL includes category-level aggregation logic
- SQL analysis → Ranking & scoring: queries · SQL includes ranking, rating, price banding, and value scoring