Skip to content

Instantly share code, notes, and snippets.

@EdMan1022
Created November 27, 2017 18:39
Show Gist options
  • Save EdMan1022/8e497e80fa6df3eafedbd821c0786e95 to your computer and use it in GitHub Desktop.
Save EdMan1022/8e497e80fa6df3eafedbd821c0786e95 to your computer and use it in GitHub Desktop.
from sqlalchemy.orm.exc import NoResultFound, MultipleResultsFound
from voxco_survey_analysis.exceptions import InvalidUsage
from ..models import Analytic
def cluster_analysis_function(request):
"""
Perform a cluster analysis using the analysis group specified in the request
:param request: http request carrying the database id of the analysis group.
:return: JSON containing the cluster analysis data
"""
try:
analytic = Analytic.query.filter_by(id=int(request.args.get('analytic_id'))).one()
except NoResultFound:
raise InvalidUsage(message="No analytic exists with the given id", status_code=404)
except MultipleResultsFound as e:
raise e
print('ajax test')
return 'ajax test'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment