Skip to content

Conversation

@matiasmartos
Copy link

Summary

Implementation of a REST API for analyzing coaching transcripts using OpenAI's structured outputs. Built following hexagonal architecture principles.

Requirements Completed

Point 1 (Mandatory) ✅

  • POST /transcripts/analyze - Analyze a single transcript
  • GET /transcripts/{id} - Retrieve analysis by ID
  • Input validation (empty transcript handling)
  • In-memory storage
  • Unique ID generation per analysis

Point 2 (Optional) ✅

  • POST /transcripts/analyze/batch - Concurrent analysis of multiple transcripts
  • Async processing with asyncio.gather()

Architecture

app/
├── adapters/       # OpenAI adapter, InMemoryRepository
├── api/            # FastAPI routes, schemas, dependencies
├── application/    # Services, DTOs
├── domain/         # Domain models
└── ports/          # Abstract interfaces (LLM, Repository)

How to Run

# Install dependencies
poetry install

# Configure environment
cp .env.example .env
# Add your OPENAI_API_KEY

# Start server
uvicorn app.main:app --reload

# Run tests
pytest

API Documentation

Available at http://localhost:8000/docs (Swagger UI)

Tests

  • Unit tests with mocked LLM adapter
  • All endpoints covered
  • pytest -v → 10 tests passing

- POST /transcripts/analyze endpoint
- GET /transcripts/{id} endpoint
- POST /transcripts/analyze/batch (concurrent processing)
- Hexagonal architecture with ports/adapters
- In-memory repository
- Input validation
- Unit tests with mocks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant