FastAPI backend for the MyLab weekend demo. It serves realistic lab-result JSON for a patient-facing Flutter app.
GET /adminGET /admin/patients/{id}/qr.pngGET /demo-accountsPOST /loginPOST /access/exchangeGET /meGET /resultsGET /results/{id}POST /results/{id}/readGET /health
python3 -m venv .venv
source .venv/bin/activate
pip install -e ".[dev]"
uvicorn app.main:app --reloadThe API will start on http://127.0.0.1:8000.
Admin console:
open http://127.0.0.1:8000/adminThe admin console provides a polished web interface for uploading patient/result JSON, reviewing the live dataset immediately after upload, and generating a patient-specific QR code that opens the mobile app access flow.
Patient JSON must include:
idfirst_namelast_nameemailbirth_dateinYYYY-MM-DDpasswordtokenresult_ids
The backend generates an access_code automatically if the uploaded patient JSON does not contain one already.
Build the image:
docker build -t mylab-backend .Run it on a server:
docker run -d \
--name mylab-backend \
-p 8000:8000 \
mylab-backendThe container serves the API on 0.0.0.0:8000 by default.
Useful environment variables:
MYLAB_HOSTMYLAB_PORTMYLAB_DATA_DIRMYLAB_MOBILE_SCHEMEMYLAB_QR_SECRET
If you want to run the published image from GitHub Container Registry instead of building locally:
docker run -d \
--name mylab-backend \
-p 8000:8000 \
ghcr.io/tgrytnes/mylab-backend:backend-v0.1.0python3 -m pytest
python3 -m ruff check .- Emma Lawson:
emma.lawson@mylab.demo/demo-emma - Liam Carter:
liam.carter@mylab.demo/demo-liam - Sophia Nguyen:
sophia.nguyen@mylab.demo/demo-sophia - Noah Fischer:
noah.fischer@mylab.demo/demo-noah - Ava Martinez:
ava.martinez@mylab.demo/demo-ava - Ben Weber:
ben.weber@mylab.demo/demo-ben
The demo data is stored in data/patients.json and data/results/*.json.
- Select a patient in
/admin - Open or download the generated QR image
- The QR points to
mylab://access?code=... - The Flutter app opens, asks for birth date, exchanges the QR access code through
POST /access/exchange, and then loads all results linked to that patient profile
ci.ymlruns Ruff and pytest on pushes and pull requests.publish-image.ymlbuilds a Docker image and publishes it to GHCR on version tags.