Explore the data

The data can be extracted in a multitude of ways using the API endpoints documented below. We’re hoping by providing an array of interesting ways to query the data it will encourage exploration and experimentation. We also show you how to aggregate your own interesting data sets.

If you want queries to return the body of the text you will need to append the ?include_body=true query string. If you want to include comments you need to append ?include_comments=true.

All API endpoints also support JSONP. Just append the extension and the callback function name attribute you wish to use to your requests:

.jsonp?callback=WillowPatterns.success

All chapters

http://www.willowpatterns.net/chapters

The final revision of a specific chapter

http://www.willowpatterns.net/chapters/1

Chapters one through to chapter nine, eg.:

http://www.willowpatterns.net/chapters/9

All the revisions of a specific chapter

http://www.willowpatterns.net/chapters/1/versions

A single specific revision of a chapter

http://www.willowpatterns.net/chapters/1/versions/34

Comments can be queried specifically on a revision, eg.:

http://www.willowpatterns.net/chapters/6/versions/259/comments

Individual comments:

http://www.willowpatterns.net/chapters/6/versions/259/comments/1

The latest revision of a chapter at a specific time

http://www.willowpatterns.net/chapters?at=2012-6-11-16-30-0

The time stamp is of the format yyyy-m-d-h-m-s (year, month, day, hour [24], minute, second).

Search for all revisions of all chapters that contain a specific word

http://www.willowpatterns.net/versions?query=coffee

Search for all revisions of all chapters that were created after a particular point in time

http://www.willowpatterns.net/versions?from=2012-6-12-1-30-0

Search for all revisions of all chapters that were created before a particular point in time

http://www.willowpatterns.net/versions?to=2012-6-12-11-30-0

The to, from and query options can be combined, eg:

http://www.willowpatterns.net/versions?from=2012-6-12-1-30-0&to=2012-6-12-11-30-0&query=coffee

Instances of a word in a chapter

http://www.willowpatterns.net/chapters/1/word_frequency?word=coffee

Instances of all words in a chapter

http://www.willowpatterns.net/chapters/1/word_frequencies

Instances of a word in a revision

http://www.willowpatterns.net/chapters/1/versions/120/word_frequency?word=coffee

Instances of all words in a chapter

http://www.willowpatterns.net/chapters/1/versions/120/word_frequencies

Instances of a word the whole book

http://www.willowpatterns.net/book/word_frequency?word=coffee

Instances of all words in the whole book

http://www.willowpatterns.net/book/word_frequencies

Data Visualisations

Here is a visualisation of how each chapter grew in size over the 24 hours the book was written. With 10 minute samples measuring the number of words in each chapter there are 12960 points of data powering this graph.

To extract a dataset such as this you could run the following code in Safari Web Inspector or the Chrome Developer Tools console open on this page:

After running this function you will end up with a array of data assigned to window.chapters that should look like this:

Further manipulation of the data is required before we pass it to the charting library chart.js: