Project: the Tindahan monthly report
Last updated
The owners want the same report on the first Monday of every month, and the store managers want to check their own numbers any day. In this project you'll build both from one project folder: a parameterised report that Quarto renders for any month, a Streamlit dashboard with two filters, and the README and requirements that let someone else rerun it all on a fresh computer.
By the end of this lesson you can
- Build a report that reruns for any month from one parameter
- Build a small dashboard on the same clean data
- Make the project rerun the same on a fresh computer
Plan it
Two readers, two products, one set of data:
| the owners | the store managers | |
|---|---|---|
| Wants | A summary of last month, on the first Monday | Their own store's numbers, any day |
| Product | A report, rendered from report.ipynb | A dashboard, dashboard.py |
| Shows | All four stores, the month against the same month last year, what to watch | One or more stores, one year against the last |
Both read data/clean/books.csv, made by clean.py from the owners' raw export (5.10). The project folder:
tindahan/ ├── README.md ├── requirements.txt ├── .gitignore ├── clean.py data/raw/ → data/clean/ ├── report.ipynb the monthly report (parameter: month) ├── dashboard.py the managers' dashboard ├── data/ │ ├── raw/ from the owners, never edited │ └── clean/ made by clean.py └── reports/ made by quarto render
The report
Start report.ipynb with a parameters cell, then compute everything from it. Try it here: change month to "2024-10" and run all. The text and the chart's title should change with it.
For December 2024: ₱357,952, +6.9% on December 2023. Per day open, Tanauan was up 16.3%, Lipa 7.9%, Batangas 3.9%, and Rosario −1.1%, the only store below. The chart's title is built from the data too, so it names whichever stores were below that month, or "no store".
On your computer, add Markdown cells for the story (10.1): what to watch this month, and a caveats line. Put the document's options in a raw cell at the very top:
---
title: "The Tindahan: monthly report"
format:
html:
embed-resources: true
execute:
echo: false
---embed-resources: true puts the charts inside the one HTML file, so it can be emailed. Then render it for each month:
(.venv) $ python clean.py (.venv) $ quarto render report.ipynb --execute -P month:2024-12 --output-file 2024-12.html --output-dir reports (.venv) $ quarto render report.ipynb --execute -P month:2024-11 --output-file 2024-11.html --output-dir reports
The dashboard
Write dashboard.py as in 10.3: the store and year filters, takings and the change on the year before, and the monthly line. Load the data with @st.cache_data. Run it:
(.venv) $ streamlit run dashboard.py
Then ask a store manager (or anyone) to use it without help: "How did Lipa do in 2024 against 2023?" If they need to ask you how, fix the dashboard.
It shows store totals only, so it's safe to share with the managers. Don't add card holder data to it (10.6).
README and requirements
Write README.md (10.4): what the project is, how to set it up, how to make a month's report, how to start the dashboard, and where the raw data comes from. Save the packages:
python -m pip freeze > requirements.txt
Write .gitignore before the first commit (10.5): .venv/, .env, data/, reports/ and .ipynb_checkpoints/. Clear the notebook's outputs, then commit.
A fresh-computer rerun
The test that counts: do what the README says, in a new folder, with a new environment. The commands below are for Windows; fc compares two files.
git clone <the project's repository> tindahan-test cd tindahan-test py -m venv .venv .venv\Scripts\activate (.venv) $ python -m pip install -r requirements.txt (.venv) $ copy ..\tindahan\data\raw\books.csv data\raw\ (.venv) $ python clean.py (.venv) $ quarto render report.ipynb --execute -P month:2024-12 --output-file 2024-12.html --output-dir reports (.venv) $ fc reports\2024-12.html ..\tindahan\reports\2024-12.html
fc may report differences in the HTML even when every number matches, because some tools write the date or a random id into the file. Open both reports and compare what they say. Every number should be identical. If one isn't, find out why before you call the project finished.
Finished
Tick each one off when it's true of your project:
When all eight are ticked, the project can be handed to someone else.
Look at what you used:
- The story order (10.1): the month's answer first, then what to watch.
- A parameterised report (10.2), rendered without code, and rerun from the top every time.
- A dashboard (10.3) for the questions people ask again and again.
- Reproducibility (10.4): pinned packages, paths inside the project, raw data untouched, a README.
- Git (10.5) with data, keys and outputs kept out.
- Privacy (10.6): only store totals leave the project.
- Honest charts (10.7): bars from zero, the comparison in the title.
The capstone puts the whole course together, with real Philippine open data instead of the Tindahan.
Sources
Every example on this page was run with Python 3.14, and its output and error messages are copied from it. These pages cover the same ground in more depth.
- Quarto: Parameters: the parameters tag and -P
- Streamlit: st.cache_data: caching the data load
- Git: gitignore documentation: keeping data, keys and outputs out of the repository