Work Case study
Web Extraction & RAG Chatbot
One database that keeps itself current, that a person can browse, and that answers a plain question in a sentence instead of a query.
How it fits together
01
The problem
A client needed one structured record of what a few hundred organisations publish on their own websites: each location, the details of it, and what is currently available. Every site is built differently, and much of the detail lives only inside PDF brochures.
02
What needed to change
One database that keeps itself current, that a person can browse, and that answers a plain question in a sentence instead of a query.
03
Architecture
A Python pipeline starts from a list of organisations, discovers the relevant pages on each site through its homepage and sitemaps, and fetches them with escalating effort: static first, then a headless browser, then a proxy for sites that block. Instead of a scraper per site, an LLM extracts each page into a fixed schema, and PDF brochures go through OCR. Records are normalized, linked to known entities, embedded into pgvector, and served through a dashboard and a chatbot that cites the pages it answered from.
04
What I built
- Fetching that escalates from static to rendered to proxied, so one path covers most sites and the hard ones never block the batch
- Schema-constrained LLM extraction that generalizes across hundreds of differently built sites
- OCR of PDF brochures to recover details the pages never show
- Change detection on re-checks, so an unchanged page costs nothing
- Embeddings in Postgres with pgvector, a browsable dashboard, and a retrieval chatbot that names its sources
05
Stack
- Python
- AI / LLM
- OCR
- Embeddings
- PostgreSQL
- pgvector
- Playwright
- Docker
06
Result
A database built from the organisations' own websites rather than a bought list, refreshed on a schedule, with a chatbot the team can ask instead of a query someone would have to write.
07
What I learned
LLM extraction replaced hundreds of scrapers, but it is only as good as what it is shown. Most of the engineering went into fetching the right pages and being honest about which details are published and which are not.