This is a small, self-hosted web app for recording R&D parameters for:
- Presses (with hero photo + full video + microscope media)
- Sift batches (with microscope slide media + batch metadata)
It’s built to run on your LAN and be embedded inside Home Assistant via an iframe/webpage card.
- Web-based forms (press + sift)
- Upload hero photo + video (and extra photos/microscope media)
- Press detail view: video player + parameters displayed alongside
- Compare view: choose up to 3 presses and play videos simultaneously, with parameters next to each one
- SQLite database + on-disk media storage (simple to backup)
cd rosinlab
python3 -m venv .venv
source .venv/bin/activate
pip install -r requirements.txtpython app.pyDefault: http://0.0.0.0:8099
Database file is created at ./rosinlab.db and media goes in ./uploads/.
- Run this on a small box (NUC, Pi, server, etc)
- Then add it to Home Assistant as a Panel iFrame or use a Webpage Card pointing to:
http://<that-host>:8099
You can containerise this easily. Example docker run:
docker run -it --rm \
-p 8099:8099 \
-v "$(pwd)/data:/data" \
-e ROSINLAB_DB=/data/rosinlab.db \
-e ROSINLAB_UPLOADS=/data/uploads \
ghcr.io/<your-org>/<your-image>:latest(You’ll need to build/publish an image, or you can just run it with Python.)
If you set an API key, creating/editing records and uploading media requires the browser to send X-Api-Key.
export ROSINLAB_API_KEY="your-secret"
python app.pyIn the UI, go to Process and paste the key (stored in that browser only).
This lets the press form auto-fill room temp/RH from HA sensors.
Create config.json next to app.py:
{
"ha_base_url": "http://homeassistant.local:8123",
"ha_token": "LONG_LIVED_ACCESS_TOKEN_HERE",
"ha_temp_entity": "sensor.press_room_temperature",
"ha_rh_entity": "sensor.press_room_humidity",
"db_path": "./rosinlab.db",
"upload_dir": "./uploads",
"max_upload_mb": 10240
}Then press “Auto-fill from Home Assistant sensors” in the press form.
To back up everything:
- Copy
rosinlab.db - Copy the entire
uploads/directory
That’s your whole dataset.
Browser uploads work best when videos are:
- 720p (or 1080p if you must)
- H.264 MP4
- Reasonable bitrate
If you upload 5GB monsters, it’ll work… but your patience won’t.
This app stores microscope media and has DB fields to save AI outputs later (ai_version, ai_metrics_json).
Recommended architecture:
- Keep this app as the “truth database + UI”
- Add a separate analysis service later that:
- downloads microscope images from
/api/media/<id> - runs counting/detection
- writes results back to
/api/sifts/<id>or/api/presses/<id>via the API
- downloads microscope images from
Modular > monolith.