case-study/citycare
CityCare: coordinating volunteer teams across a city's green spaces
Live city map — volunteer actions logged against real locations
Context
Volunteer teams look after a city's green spaces. CityCare lets them record care, cleaning and watering work against named, geolocated places, and shows who did what, where and when. New volunteers apply through a public form, and an admin panel manages action types, places, teams and people. The interface is in Greek and English.
Design
- A map that shows what needs attention. Each action page plots every location on a Leaflet map with OpenStreetMap tiles. Pin colour shows how recently the work was done: green within 14 days, yellow within 28, red after that. Clicking a pin opens that location's form, and admins place new locations by clicking on a map. Leaflet, Chart.js and Bootstrap are self-hosted, with no CDN dependencies.
- Volunteer intake with an audit trail. Each application is stored as pending, accepted or declined, with who decided and when. Accepting one emails a single-use invite link that expires; signing up creates the user and their personal team in a single transaction, so a half-finished sign-up can't leave orphaned records.
- Roles in one place. Each person has a role per team (member, team lead or moderator),
plus site admins. Every view checks access through a single
permissions.pymodule. - One query for the statistics. A single aggregate (
TruncDay+values()+annotate(Count)) groups actions by day and team, then gets reshaped into per-team series for Chart.js, with pinch-zoom on touch screens. - Safe sorting. List views take sort order from query parameters, but only fields on an
allowlist reach
order_by.
How it evolved
- From hardcoded choices to data. The first version had three fixed action types. They're
now database rows, each with a Greek and English name, description, card image, icon, marker colour, order
and active flag, and they drive the landing cards and the
/action/<slug>/pages. A data migration moved the existing records across, and the old/caring/,/cleaning/and/watering/URLs redirect permanently, so no links broke. - From SQLite to PostgreSQL. The project now targets PostgreSQL 17, and CI runs the test suite against both SQLite and PostgreSQL.
Quality
258 tests run in GitHub Actions on both databases. The project is deployment-ready; the next step is a first rollout with real volunteer teams.