A full-stack system built with Django REST Framework and React for managing field operations, tasks, and visits with Role-Based Access Control (RBAC) and Mock AI insights.
- Backend: Django, Django REST Framework, SimpleJWT (Auth)
- Frontend: React, Vite, Axios, Lucide React
- Database: PostgreSQL
- RBAC (Role Based Access Control): 5 Roles (Admin, Regional Manager, Team Lead, Field Agent, Auditor).
- Scoped Visibility:
- Regional Managers see data only in their region.
- Team Leads see data only for their team.
- Field Agents see only their assigned tasks/visits.
- Task Management: Create, Assign, Update status.
- Visit Tracking: Start/Complete visits with notes.
- Mock AI Service: Automatically generates summaries, recommendations, and risk flags from visit notes.
- Activity Logging: Tracks all major actions.
- Dashboard & Reporting: Scoped metrics and SQL-based reports.
Ensure you have a PostgreSQL server running. You can easily start a PostgreSQL instance using the provided Docker Compose file:
- In the root directory, run:
This will spin up a PostgreSQL instance on port
docker-compose up -d
5432with userfieldops_user, databasefieldops_db, and passwordpassword123.
Note: Environment variables can be configured via a .env file in the backend directory (see backend/.env.example).
- Navigate to the
backenddirectory. - Create and activate a virtual environment:
python -m venv venv source venv/bin/activate # On Windows: venv\Scripts\activate
- Install dependencies:
(Note: Requirements are already installed in the provided environment)
pip install -r requirements.txt
- Run migrations to initialize the PostgreSQL schema:
python manage.py migrate
- Seed initial data (Roles, Regions, Teams, Users, Tasks):
python seed_data.py
- Start the server:
python manage.py runserver
- Navigate to the
frontenddirectory. - Install dependencies:
npm install
- Start the development server:
npm run dev
- Access the app at
http://localhost:3000.
All accounts use the password: password123
admin(Full access)rm_north(Regional Manager - North)tl_alpha(Team Lead - North/Alpha)agent_1(Field Agent - North/Alpha)auditor(Read-only access)
Once the backend is running, visit:
- Swagger UI:
http://localhost:8000/api/docs/ - Redoc:
http://localhost:8000/api/schema/