1 from flask
import Flask
, jsonify
, make_response
2 from mlpccg
.TournamentRecords
import TournamentRecords
3 from mlpccg
.Clustering
import Clustering
9 return make_response(jsonify({'error': 'Not found'}), 404)
11 @app.route('/1.0/records', methods
=['GET'])
13 records
= TournamentRecords()
14 return jsonify({'records': records
.all()})
19 deck url -> similiar decks with placement
20 cluster -> decks in cluster with placement
21 -> list clusters, decks with placement
22 placement, deck url -> update clusters
26 if __name__
== '__main__':
27 app
.run(host
='0.0.0.0', port
=8000, debug
=True)
29 # clustering = Clustering(tournament_records)
31 # for placement_avg, cluster_label in clustering.ranking():
32 # print '%.1f - %s' % (placement_avg, '; '.join(list(set(map(lambda x: x.name, clustering.clusters[cluster_label])))))