A REST API for managing anonymous school reports. Students can submit complaints about bullying, violence, and other issues — automatically classified by AI and notified to school coordination via email.
1. Clone the repository:
git clone https://github.com/broislerdev/school-reports-api.git
cd school-reports-api
2. Create a virtual environment and install dependencies:
python -m venv .venv
.venv\Scripts\activate
pip install -r requirements.txt
3. Set up your .env file based on .env.example:
DATABASE_URL=your_supabase_connection_string
SUPABASE_KEY=your_supabase_key
SECRET_KEY=your_secret_key
GROQ_API_KEY=your_groq_api_key
SENDGRID_API_KEY=your_sendgrid_api_key
SENDGRID_FROM_EMAIL=your_verified_sender_email
COORDINATION_EMAIL=coordination_email4. Run the server:
uvicorn main:app --reload
5. Access the interactive docs:
http://localhost:8000/docs
| Method | Endpoint | Description |
|---|---|---|
| GET | /reports/ |
List all reports |
| GET | /reports/{id} |
Get report by ID |
| POST | /reports/ |
Submit a new report |
| PATCH | /reports/{id}/status |
Update report status |
- Student submits a report via
POST /reports/ - Groq AI automatically classifies the complaint
- Report is saved to Supabase (PostgreSQL)
- SendGrid sends an email notification to the coordinator
- Coordinator can view all reports and update their status
- 🕵️ Anonymous reports — student name is optional
- 🤖 AI classification — automatically categorizes complaints using Groq (Llama 3.1)
- 📧 Email notifications — coordinator is notified via SendGrid on every new report
- 📋 Status tracking — reports can be tracked through
novo → em_analise → encaminhado → resolvido - 🛡️ Input validation — Pydantic schemas for all endpoints
school-reports-api/
├── database/
│ └── connection.py # SQLAlchemy engine and session
├── db_models/
│ └── report_model.py # Report ORM model
├── routers/
│ ├── auth_router.py # Auth routes
│ └── report_router.py # Report CRUD routes
├── schemas/
│ └── report_schema.py # Pydantic validation schemas
├── services/
│ ├── groq_service.py # AI classification service
│ └── email_service.py # Email notification service
├── main.py
├── .env.example
└── requirements.txt
- REST API with FastAPI
- ORM with SQLAlchemy
- Data validation with Pydantic
- AI integration with Groq (Llama 3.1)
- Email notifications with SendGrid
- PostgreSQL on Supabase
- Environment variables with python-dotenv
- Separation of concerns (routers / services / models / schemas)