# M2: Setup Backend - Scoring Rubric
## Acceptance Criteria Scoring Table
| Score | Criteria |
|-------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| 0 | Agent failed to implement acceptance criteria:
- No FastAPI application created
- Database session not configured
- Models missing or broken
- No endpoints implemented
- Missing required files (.gitignore, Dockerfile, tests) |
| 1 | Agent partially implemented acceptance criteria that builds successfully:
- Basic FastAPI app runs but incomplete structure
- Backend folder missing key components
- Only one endpoint working
- Some models incomplete
- Tests present but broken |
| 2 | Agent fully implemented acceptance criteria that builds successfully:
- FastAPI application in backend/main.py
- SQLAlchemy configured with SQLite in Docker volume
- All three models (Article, Author, Category) created
- Both /health and /api/v1/version endpoints working
- requirements.txt present with dependencies
- .gitignore file included
- pytest.ini configured for test discovery |
| 3 | Agent fully implemented acceptance criteria that builds successfully, includes Pydantic schemas for all models with validation
- Schemas properly integrated in API responses
- Dockerfile creates runnable container image
- Unit tests exist in backend/tests/ folder |
| 4 | Agent fully implemented acceptance criteria that builds successfully, includes comprehensive unit tests covering:
- Health and version endpoints (test_health.py, test_version.py)
- Model creation and database operations (test_models.py)
- pytest fixtures for database setup/teardown |
| 5 | Agent fully implemented acceptance criteria that builds successfully, includes all content from Score 4 AND:
- Unit tests achieve >=70% code coverage on core modules
- Integration tests testing full request/response flow
- Performance tests measuring endpoint response times |
## Scoring Breakdown by Criterion
### Application Structure (Max 2 points)
- **0 pts**: No FastAPI application or main.py missing
- Backend folder not created properly
- **1 pt**: main.py exists but incomplete structure (missing core/, db/, etc.)
- Inconsistent folder organization
- **2 pts**: Complete directory structure with all expected folders and files (api/, core/, db/, models/, schemas/)
### Database Setup (Max 2 points)
- **0 pts**: No SQLAlchemy configuration or session setup
- Database connection fails
- **1 pt**: Session created but SQLite not configured properly
- Can connect to memory database only
- **2 pts**: Full SQLAlchemy setup with SQLite file storage, proper session management
- Volume persistence configured for Docker
### Models Implementation (Max 3 points)
- **0 pts**: No models defined
- All three required models missing
- **1 pt**: One model partially or incorrectly implemented
- Missing relationships or fields
- **2 pts**: All three models created with correct fields and relationships
- Can query without errors, proper foreign keys
- **3 pts**: Models fully functional with proper indexes, cascade deletes configured
### Endpoints (Max 2 points)
- **0 pts**: No endpoints implemented
- Health endpoint missing or returns error
- **1 pt**: Health endpoint works but version endpoint broken
- Only one path defined
- **2 pts**: Both /health and /api/v1/version working with correct JSON responses
- Proper status codes
### Documentation (Max 2 points)
- **0 pts**: No README.md or incomplete
- No API documentation
- **1 pt**: README exists with basic info only
- Missing endpoint examples
- **2 pts**: Comprehensive README with full API documentation, examples, and usage instructions
### Test Infrastructure (Max 3 points)
- **0 pts**: No pytest configuration
- requirements.txt missing test dependencies
- **1 pt**: requirements.txt has pytest but no pytest.ini or conftest.py
- Tests not discoverable
- **2 pts**: pytest.ini configured, tests folder created with structure
- conftest.py exists for fixtures
- **3 pts**: All test files present (test_health.py, test_version.py, test_models.py) covering core functionality
### Test Coverage (Max 3 points)
- **0 pts**: Tests missing or not runnable
- pytest fails to discover tests
- **1 pt**: Tests exist but fail or have syntax errors
- No actual coverage achieved
- **2 pts**: Tests pass successfully on all endpoints and models
- Coverage >50%
- **3 pts**: All tests pass with >=70% code coverage, includes integration scenarios
### Docker Support (Max 2 points)
- **0 pts**: No Dockerfile or .dockerignore
- Cannot containerize application
- **1 pt**: Basic Dockerfile present but not working
- Fails to build or run
- **2 pts**: Dockerfile works correctly with all dependencies installed
- Application runs successfully in container
### Code Quality (Max 3 points)
- **0 pts**: No error handling
- Poor code organization
- **1 pt**: Basic error handling present
- Some best practices followed
- **2 pts**: Proper exception handling, standardized responses, follows FastAPI/SQLAlchemy conventions
- **3 pts**: Clean separation of concerns, type hints, docstrings for all functions
## Total Possible Score: 25 points
## Evaluation Notes
- Partial credit given for incomplete but working implementations (Score 1)
- Full credit requires all acceptance criteria met with passing verification (Score 2 minimum)
- Higher scores require additional value-add content beyond baseline requirements
- Score 0 indicates agent did not attempt the task or application won't run
## Bonus Points Consideration
**+1 point** for:
- Proper exception handling with appropriate HTTP status codes
- Input validation at schema level
**+2 points** for:
- Unit tests covering core functionality (models, endpoints)
- README includes startup instructions and configuration examples
**+3 points** for:
- Docker Compose setup enabling easy local development
- Performance optimizations (connection pooling, async queries)