Code to convert API data to what the viz wants