The book is broken into three parts. In Part I, “ActiveRecord and D3,” we use ActiveRecord to retrieve
the data we need to implement several different types of charts. This part includes the following chapters:
• Chapter 1: D3 and Rails—This first chapter introduces you to the technology stack, takes you
through the thought process and steps involved in importing data, and shows you how to build a pie
chart using D3.
• Chapter 2: Transforming Data with ActiveRecord and D3—This chapter revisits the pie chart to

make it interactive, and then walks you through how to build a bar chart, scatter plot, and box plot.
• Chapter 3: Working with Time Series Data—This chapter looks at historic weather readings and
shows you how to build an interactive multi-line chart that displays the maximum and minimum
temperatures from a weather station for a year.
• Chapter 4: Working with Large Datasets—This chapter discusses working with large data files,
how to benchmark Ruby and SQL, and tweaks we can make to gain performance.
Part II, “Using SQLin Rails,” gets a little more SQL-centric. We will use window functions,
subqueries, and Common Table Expression to retrieve data: • Chapter 5: Window Functions, Subqueries,
and Common Table Expression—This chapter begins the discussion of how and when to use raw SQLin
your Rails app.
• Chapter 6: The Chord Diagram—In this chapter we create a new app for flight departures and
build a chord diagram to look at the origin-destination city-pairs for AA flights in 1999.
• Chapter 7: Time-Series Aggregates in Postgres—In this chapter we take the flight departure data
and convert it from transactional to time-series data to build a timeline diagram.
• Chapter 8: Using a Separate Reporting Database—This chapter discusses how to use a separate
database or database schema for a reporting database.
In Part III, “Geospatial Rails,” we will take a look at the geospatial aspects of the data with PostGIS.
We will draw maps with markers, import shapefiles, and query geo data.
• Chapter 9: Working with Geospatial Data in Rails—In this chapter you learn geospatial concepts
and begin looking at geographic data through the lens of geospatial SQLqueries.
• Chapter 10: Making Maps with Leaflet and Rails—In this chapter we add maps to all three
applications using Leaflet.
• Chapter 11: Querying Geospatial Data—In this chapter we talk more about geospatial SQL
queries, and I discuss both the “Rails way” and the raw SQLway, to present both options to you so
you can choose the one that works best for you.
Appendixes include the following:
• Appendix A: Ruby and Rails Setup
• Appendix B: Brief Postgres Overview
• Appendix C: SQLJoins