# IT Site Survey AI

A complete single-page web application for conducting IT infrastructure site surveys with AI-powered analysis and recommendations.

## Features

### 1. Surveys List Tab
- View all created surveys with metadata (name, client, site, date)
- Click any survey to view and analyze
- Delete individual surveys with confirmation
- Clear all surveys with confirmation
- Empty state with quick action to create first survey

### 2. Create Survey Tab
- **Metadata Fields**: Survey name, client name, site location, description
- **Model Selector**: Choose from GPT-4o, GPT-4o Mini, Claude 3.5 Sonnet, Claude 3 Opus, Gemini 1.5 Pro
- **35 Survey Questions**: Comprehensive IT infrastructure questions organized by category:
  - General Information
  - Infrastructure
  - Networking
  - Security
  - Cloud
  - Applications
  - Compliance
  - IT Operations
  - Future Planning
- **Load Sample Data**: Button to fill all fields with realistic test data
- **Photo Upload**: Drag-and-drop photo upload with preview
- **Submit**: Creates survey and redirects to surveys list

### 3. AI Analysis Tab
- **Survey Details Panel**: Shows client, site, creation date, description
- **Questions Summary**: Shows answered/total count per category
- **Model Selector**: Choose AI model for analysis
- **Generate Recommendations**: Streaming AI analysis with:
  - Executive Summary
  - Critical Findings
  - Immediate Actions
  - Short-term Initiatives
  - Strategic Roadmap
  - Resource Planning
  - Compliance Considerations
- **Export Options**: Text, JSON (PDF placeholder), Email
- **Chat Interface**: Ask AI questions about the survey

## API Endpoints

| Method | Endpoint | Description |
|--------|----------|-------------|
| GET | `/api/models` | Get available AI models |
| GET | `/api/surveys/template` | Get 35-question survey template |
| GET | `/api/surveys` | List all surveys |
| POST | `/api/surveys` | Create new survey |
| GET | `/api/surveys/{id}` | Get specific survey |
| PUT | `/api/surveys/{id}` | Update survey |
| DELETE | `/api/surveys/{id}` | Delete survey |
| DELETE | `/api/surveys` | Delete all surveys |
| POST | `/api/surveys/{id}/analyze` | Generate AI analysis (streaming) |
| POST | `/api/surveys/{id}/chat` | Chat about survey |
| POST | `/api/surveys/{id}/export` | Export survey report |

## Installation

```bash
# Create virtual environment
python3 -m venv venv

# Activate virtual environment
source venv/bin/activate  # On Windows: venv\Scripts\activate

# Install dependencies
pip install -r requirements.txt
```

## Running the Application

```bash
# Default port (5000)
python app.py

# Custom port
python app.py 8080
```

Then open `http://localhost:5000` (or your custom port) in a web browser.

## Project Structure

```
site-survey-ai-v2/
├── app.py                 # Flask backend API
├── requirements.txt       # Python dependencies
├── README.md             # This file
├── static/
│   ├── style.css         # Dark theme styling
│   └── app.js            # Frontend application
└── templates/
    └── index.html        # Single-page app template
```

## Technologies Used

- **Backend**: Python Flask
- **Frontend**: Vanilla JavaScript (no frameworks)
- **Styling**: CSS3 with CSS variables for theming
- **API**: RESTful JSON API with streaming support

## Browser Compatibility

- Chrome 90+
- Firefox 88+
- Safari 14+
- Edge 90+

## License

MIT License
