Course 4 — Card-spending analysis with CSV + LLM
Audience: students who finished Course 2 (or already know Python + Ollama) and want a complete real-world project mixing data ingestion, SQL, dashboards and a tool-using LLM agent.
The big picture
Section titled “The big picture”We start from a mundane file — a credit-card CSV export with 734 synthetic transactions — and build a real app that does three things:
- Understands the CSV: columns, date formats, debit/credit.
- Renders useful Plotly dashboards: monthly, by category, top merchants, recurring.
- Answers questions in plain English by letting an LLM write SQL and run it against a local SQLite database.
The same architecture is implemented twice — once with a local LLM (Ollama), once with the cloud (OpenAI) — sharing a Python library you can reuse on any CSV-based project.
flowchart TD CSV["bank CSV<br/>(data1-anonymized.csv, 734 rows)"] Shared["csv-llm-shared<br/>(ingest, normalize, db,<br/>categorize, dashboards)"] Ollama["csv-llm-ollama<br/>port 8504<br/>llama3.1:8b (local)"] OpenAI["csv-llm-openai<br/>port 8505<br/>gpt-4o-mini (cloud)"] CSV --> Shared Shared --> Ollama Shared --> OpenAI
The 3 Parts
Section titled “The 3 Parts”| Part | Focus | Duration | Chapters |
|---|---|---|---|
| Part 1 — Project 1: Ollama (local) | Build the full app with a local LLM. No API key, no cloud. | ~3h | 9 |
| Part 2 — Project 2: OpenAI (cloud) | Swap the LLM backend for the OpenAI API. 5× faster, ~$0.001/question. | ~1.5h | 7 |
| Part 3 — Project 3: csv-llm-shared | Deep-dive into the shared Python library powering Parts 1 and 2. | ~2h | 8 |
How to read this course
Section titled “How to read this course”- Linear (recommended): Part 1 → Part 2 → Part 3. About 6.5 hours.
- Just want a local app: Part 1 only.
- Already know Ollama, prefer the cloud: skip to Part 2.
- Library deep-dive: jump straight to Part 3.
Each Part has its own overview page with prerequisites, chapter list, and “how to read” guidance.
Common prerequisites across all 3 Parts
Section titled “Common prerequisites across all 3 Parts”- Python 3.9+ and
pip. - Comfortable with a terminal and basic Git (
git clone,git pull). - Roughly 6 GB of free disk space (mostly for the Ollama model in Part 1; Parts 2 and 3 are tiny).
- The three GitHub repositories cloned side by side:
https://github.com/inskillflow/csv-llm-shared(mandatory for all Parts)https://github.com/inskillflow/csv-llm-ollama(Part 1)https://github.com/inskillflow/csv-llm-openai(Part 2)
What you’ll have at the end
Section titled “What you’ll have at the end”- Two working Streamlit apps on ports 8504 (Ollama) and 8505 (OpenAI) that load the same demo CSV.
- 4 Plotly dashboards per app (monthly, categories, top merchants, recurring).
- A chat tab where you can ask in natural English: “What is my biggest spending category?” — answered with a generated SQL query against SQLite.
- A reusable shared Python module you can fork to support your own bank’s CSV.