This document demonstrates how to use composable filters with time series data in Neo4j to analyze a crime data set. Specifically, it shows how to filter the data to find the highest crime area on the lowest crime day by layering filters on location and date/time. First, filters are used to select a thin slice of locations based on longitude. Then a second filter is added on date/time to select a single day. This allows refining the data set to just the crimes committed in that highest crime area on that lowest crime day.
More than Just Lines on a Map: Best Practices for U.S Bike Routes
Composable Filters with Time Series Data
1. Composable Filters with Time Series Data
POLE Crime Data Set courtesy of Joe Depeau for Neo4j
https://medium.com/neo4j/announcing-the-neo4j-crime-investigation-sandbox-c0c3bd9e71b1
2. With Composable Filters, you can quickly drill down on any parameter. This includes, but is not restricted to, date
and time. For this example, we’ll look at the POLE Crime Data Set created by Joe Depeau for Neo4j.
3. Here we have about 2,000 criminal records connected to 1,000 locations. Let’s reduce our graph to the
highest-crime area on the lowest-crime day. We’ll start by opening the filter panel.
4. Clicking the Node Properties dropdown brings up all numeric properties available in our graph.
5. Let’s narrow down the area we’re looking at. Selecting “longitude” creates a filter on Location nodes. The extents
are defined by the minimum and maximum values for this property among nodes present in the graph.
6. Dragging the filter handles allows us to narrow down to a thin slice of the map with a dense concentration of
Locations.
8. Selecting “datetime” creates a second filter, this time on the Crime nodes. We call this ability to layer filters
“Composability.”
9. Notice the Min, Max, and Fixed Range controls for “longitude” have been hidden while we adjust “datetime.”
This is done to save space, but they’re still available whenever we return to adjusting “longitude.”
10. Clicking the text input boxes offers fine-grain control over the Min and Max value. Dates can be selected from a
calendar.
11. Now the range is set to one day. Activating the Fixed Range checkbox enables us to scrub the current range like
a video playhead. This is possible with any property, not just time.
12. Drag either handle to scrub through the available values. We’ll stop on the day with the lowest number of crimes.
13. Now let’s refine our data set. First we’ll select fully visible nodes, then we’ll clear our filters.
14. Next let’s invert our selection to grab all the nodes we don’t want.
15. We’ll get rid of these nodes by clicking the trashcan icon.
16. Next let’s remove the crimes not connected with our area of interest. First we’ll draw a selection box around them
by left click-dragging the mouse with the “shift” or “control” key held down.
17. We can also delete selected nodes by pressing “delete” or “backspace” on the keyboard. What remains are the
crimes committed in the highest-crime area on the lowest-crime day.
18. There are many ways to use Composable filters. Try experimenting on your own!