How cyberbount/ai-lems works
AI-LEMS is a laboratory equipment management system with a React interface and FastAPI backend. The principal workflow is role-based sign-in, browsing equipment, creating and processing borrow/return requests, and recording maintenance; statistics and usage history support oversight. A separate local-AI workflow retrieves document or operational context and queries Ollama. The README documents the API capabilities, but sampled router and frontend excerpts are incomplete, so feature-level UI-to-route wiring is not inferred.
Main entry points: main.py FastAPI app · models.py Domain models · auth.py Authentication · ai_service.py Context and retrieval
Components 21
Web interface
- React application
frontend/src/App.jsx - API client
frontend/src/lib/api.js
API and access
- FastAPI app
backend/app/main.py - Authentication
backend/app/routers/auth.py - JWT and roles
backend/app/deps.py - Domain models
backend/app/models.py - SQL database
backend/app/db.py
Lab operations
- User management
backend/app/routers/users.py - Equipment catalog
backend/app/routers/catalog.py - Equipment management
backend/app/routers/devices.py - Borrow and return
backend/app/routers/requests.py - Maintenance
backend/app/routers/maintenance.py - Usage statistics
backend/app/routers/stats.py - Audit history
backend/app/routers/audit.py - Audit recording
backend/app/services/audit_service.py
Local AI
- AI chat route
backend/app/routers/ai.py - Context and retrieval
backend/app/services/ai_service.py - SOP document chunks
scripts/seed_sop_documents.py - Ollama local service
backend/app/services/ollama_provider.py
Other components
- Lab users
- Ollama HTTP API
Connections 29
- Lab users → React application: use
- React application → API client: request
- API client → FastAPI app: HTTP calls
- FastAPI app → Authentication: dispatch
- FastAPI app → User management: dispatch
- FastAPI app → Equipment catalog: dispatch
- FastAPI app → Equipment management: dispatch
- FastAPI app → Borrow and return: dispatch
- FastAPI app → Maintenance: dispatch
- FastAPI app → Usage statistics: dispatch
- FastAPI app → Audit history: dispatch
- FastAPI app → AI chat route: dispatch
- Authentication → JWT and roles: verify identity
- Authentication → Domain models: read and write
- Authentication → Audit recording: record events
- User management → Domain models: read and write
- Equipment catalog → Domain models: read and write
- Equipment management → Domain models: read and write
- Borrow and return → Domain models: read and write
- Maintenance → Domain models: read and write
- Usage statistics → Domain models: query
- Audit history → Domain models: query
- Audit recording → Domain models: create log
- Domain models → SQL database: persist
- AI chat route → Context and retrieval: invoke
- Context and retrieval → Domain models: query context
- Context and retrieval → Ollama local service: send prompt
- Ollama local service → Ollama HTTP API: HTTP inference
- SOP document chunks → SQL database: seed chunks