return stats as JSON, use transactions in repo ingestion instead of passing a session around