Extracted json generation logic into the model
Added csv format for charts
Fully added download CSV functionality
Merge commit