Skip to content

Backend API Implementation - Nagara AI

Shivanarayana Lovdi requested to merge backend-api into main

Backend API Implementation

Implemented the FastAPI backend for the Nagara AI Smart City Platform.

This backend provides modular API endpoints for tourism, traffic, civic complaints, emergency services, city health score, and analytics dashboard features. It is designed to connect with the Streamlit frontend in the next step.

Key Features

  • FastAPI application configured with title, version, Swagger docs, and CORS
  • SQLite database integration using SQLAlchemy ORM
  • Auto table creation on application startup
  • Modular route structure for clean backend organization
  • Service layer added for business logic and mock data
  • Pydantic schemas added for request and response validation
  • Complaint reporting and status update APIs
  • Mock APIs for tourism, traffic, emergency services, health score, and analytics

Endpoints Added

  • POST /api/tourism/generate-itinerary
  • GET /api/tourism/places
  • GET /api/traffic/live
  • GET /api/traffic/all
  • POST /api/complaints/report
  • GET /api/complaints
  • GET /api/complaints/{complaint_id}
  • PUT /api/complaints/{complaint_id}
  • GET /api/emergency/services
  • GET /api/health-score
  • GET /api/analytics/dashboard

Testing

The backend was tested locally using:

uvicorn backend.main:app --reload

Merge request reports

Loading