using d3.js, flask to create complex interactions