Flask patterns -- application factory, blueprints, error handlers, extensions, request lifecycle, configuration, logging, CLI commands
98
98%
Does it follow best practices?
Impact
98%
1.28xAverage score across 5 eval scenarios
Passed
No known issues
A SaaS company needs a Flask API for their internal support ticket system. Support agents create tickets on behalf of customers, update ticket status, and add comments.
Data model:
Endpoints:
POST /api/tickets -- create a ticket (title, description, customer_email, priority required)GET /api/tickets -- list tickets with optional ?status=open&priority=urgent filtersGET /api/tickets/<id> -- get ticket with its commentsPATCH /api/tickets/<id> -- update status and/or priorityPOST /api/tickets/<id>/comments -- add a comment to a ticketGET /api/health -- health check endpoint returning {"status": "healthy"}Requirements:
Produce Python source files in a ticket-system/ directory:
app/__init__.py -- application factoryapp/extensions.py -- extension instancesapp/errors.py -- custom exceptions and error handlersapp/db.py -- data storeapp/routes/tickets.py -- tickets blueprintapp/routes/comments.py -- comments blueprintapp/routes/health.py -- health blueprintconfig.py -- configuration classes (Development, Testing, Production)tests/conftest.py -- test fixturesrun.py -- entry pointrequirements.txtDo not run pip install or start the server.