No description
  • Go 99.2%
  • Dockerfile 0.6%
  • Makefile 0.2%
Find a file
2026-03-01 00:20:13 -05:00
admin generalized sources 2025-12-22 09:08:57 -05:00
database completely rm batching 2026-02-26 05:26:15 -05:00
server open 2026-02-25 23:24:49 -05:00
utils Initial commit; MVP with VT support 2025-12-22 03:24:06 -05:00
vt open 2026-02-25 23:24:49 -05:00
.gitignore docker compose gemini api key config 2025-12-29 05:31:46 +00:00
docker-compose.yml docker compose gemini api key config 2025-12-29 05:31:46 +00:00
Dockerfile fixed to work with sqlite 2025-12-22 13:49:55 +00:00
go.mod gemini proxy 2025-12-29 00:24:37 -05:00
go.sum gemini proxy 2025-12-29 00:24:37 -05:00
main.go open 2026-02-25 23:24:49 -05:00
Makefile make purge 2025-12-23 15:56:13 +00:00
README.md readme 2026-03-01 00:20:13 -05:00

Calora Server

Backend server for the Calora nutrition tracking app. Written in Go, scrapes nutrition data from dining halls and serves it to the mobile app.

Features

  • Data fetching - Automatically scrapes nutrition information from Virginia Tech dining halls (extensible to other sources)
  • REST API - Serves nutrition data with caching and support for querying multiple dates at once
  • Gemini Vision API - Food identification from photos, portion estimation, and nutrition label parsing
  • IMAP support - Import meal data from email receipts
  • Transform DSL - Lisp-based system for applying custom transformations to nutrition data
  • Training data collection - Password-protected endpoint for submitting receipt photos and tagged items
  • Auto cleanup - Removes old meal data and orphaned records from the database

The server checks for updates from configured sources on startup and caches everything locally. The cache invalidates automatically when source data changes.

Running

Configure via environment variables:

  • DATA_DIR - Where to store the database and transform files (default: ./data)
  • GEMINI_API_KEY - Google Gemini API key for vision features
  • TRAINING_PASSWORD - Password for training data submissions
go build -o calora
./calora

The main API runs on port 8080, admin interface on 8081.

API

  • GET /api/{source}?date=YYYY-MM-DD - Get meals for a date (comma-separate multiple dates)
  • POST /api/gemini/vision - Identify food, estimate portions, or parse labels
  • POST /api/imap/fetch - Fetch emails via IMAP
  • GET /api/transform/checksums - Get transform file checksums
  • GET /api/transform/std - Download standard library
  • GET /api/transform - Download transformation rules
  • POST /api/transform/error - Report transformation errors
  • POST /api/training/verify - Verify training password
  • POST /api/training/submit - Submit training data

Uses SQLite with GORM for storage. Supports sources, meals, locations, items, allergens, flags, and training submissions.