Django Admin
Jarbas ships the standard Django Admin interface at/admin/. It gives you an alternative view of the database that is separate from the public dashboard — useful for inspecting raw records, debugging data quality, and managing users.
Creating a superuser
Available models in the admin
Reimbursement
Every expense claim loaded into Jarbas. Fields include
document_id, congressperson_name, supplier, cnpj_cpf, total_net_value, issue_date, suspicions (JSON), and probability. Ordered by year and issue date descending.ReimbursementSummary
A proxy model over
Reimbursement that provides a summary-oriented admin view. Contains the same data but is registered separately for focused browsing.Tweet
Links between
@RosieDaSerenata tweets and specific reimbursements. Each record stores the Twitter status ID and a foreign key to the related Reimbursement.SocialMedia
Social media profiles for congresspeople, including
twitter_profile, secondary_twitter_profile, and facebook_page fields keyed by congressperson_id.Admin vs public dashboard
| Capability | Public dashboard | Django Admin |
|---|---|---|
| Browse reimbursements | Yes | Yes |
| Filter by suspicion flag | Yes | Yes |
| Full-text search | Yes (requires searchvector) | No |
| Edit or delete records | No | Yes |
| View raw JSON suspicion data | No | Yes |
| Manage users and permissions | No | Yes |
| Browse tweet links | No | Yes |
| Browse social media profiles | No | Yes |
Healthcheck endpoint
Jarbas exposes a lightweight healthcheck at/healthcheck/. It returns an HTTP 200 response when the application is running correctly. Use it for load balancer health probes or uptime monitoring.
Debug toolbar
WhenLOG_LEVEL=debug is set in .env, the Django Debug Toolbar is mounted at /__debug__/ and injected into HTML responses. It shows SQL queries, cache hits, template rendering times, and request headers.
The debug toolbar is only active in development (
ENVIRONMENT != production). It is never loaded in production builds..env:
Useful maintenance commands
searchvector — rebuild the search index
searchvector — rebuild the search index
Run after importing new data to make the dashboard search bar reflect the latest records.Pass
--all to rebuild every record rather than only new ones:tweets — sync @RosieDaSerenata tweet links
tweets — sync @RosieDaSerenata tweet links
Re-fetches tweets from the Requires Twitter API credentials in
@RosieDaSerenata timeline and links any new ones to their reimbursements. Safe to run repeatedly..env.update — full database refresh
update — full database refresh
Drops and reloads all reimbursement data from a directory of CSV and LZMA files, then rebuilds suspicions, receipt texts, the search vector, and tweet links.See Data loading — update command for the full step-by-step breakdown.
check — validate configuration
check — validate configuration
Runs Django’s system checks to confirm the configuration is valid before starting the server.
test — run the test suite
test — run the test suite
Runs the full test suite. Tests run without migrations thanks to
django-test-without-migrations.Production services
In production,docker-compose.yml runs three Django-based processes:
| Container | Command | Role |
|---|---|---|
django | gunicorn jarbas.wsgi:application | Serves HTTP requests |
tasks | celery worker --app jarbas | Processes asynchronous tasks |
beat | celery beat --app jarbas | Triggers scheduled tasks (e.g. searchvector) |
serenata/django image and read configuration from the .env file. New Relic monitoring is enabled by the newrelic-admin run-program wrapper when NEW_RELIC_LICENSE_KEY is set.