Skip to content

Instantly share code, notes, and snippets.


Rik Van Bruggen rvanbruggen

View GitHub Profile
rvanbruggen /
Last active Nov 25, 2020
Spotify Playlist importer, queries, and dashboard
import spotipy
from neo4j import GraphDatabase
from spotipy.oauth2 import SpotifyClientCredentials, SpotifyOAuth
# ------------------------------------ Configuration parameters ------------------------------------ #
user_id = "<<YOUR SPOTIFY USER ID>>" # Spotify user ID.
client = "<<YOUR SPOTIFY CLIENT ID>>" # Spotify client ID.
secret = "<<YOUR SPOTIFY CLIENT SECRET>>" # Spotify client secret.
playlist_uri = "spotify:playlist:1eCqsRrwBAFc2lf5ZLGa5m" # public playlist with songs to be sorted.
neo4j_url = "neo4j://localhost:7687" # bolt url of the neo4j database.
rvanbruggen / 1-calendargraph.adoc
Last active Nov 4, 2020
Analysing a google calendar in Neo4j
View 1-calendargraph.adoc
import spotipy
from neo4j import GraphDatabase
from spotipy.oauth2 import SpotifyClientCredentials, SpotifyOAuth
# ------------------------------------ Configuration parameters ------------------------------------ #
user_id = "YOUR USER_ID" # Spotify user ID.
client = "YOUR CLIENT" # Spotify client ID.
secret = "YOUR SECRET" # Spotify client secret.
# playlist_uri = "spotify:playlist:1eCqsRrwBAFc2lf5ZLGa5m" # LONG original public playlist with songs to be sorted.
playlist_uri = "spotify:playlist:1BTunw40NV9HgFpLXQ7hpm" # SHORT original public playlist with songs to be sorted.
View 1 - FinCEN files in Zeppelin

Using Zeppelin with Neo4j to analyse the FinCEN Files

Last week, we got another great and widely publicised case of Graph Databases' usefullness throw our way. The ICIJ published their FinCEN Files research, and on top of allowing you to explore the data on their website they also published an anonymised subset of the data as a series of CSV/JSON files. My friends and colleagues Michael Hunger, Will Lyon and the rest of the team, helped with the process of making this subset available as a Neo4j database (see this github repo), and there's even a super easy FinCEN Files Neo4j Sandbox that you can spin up in no time for some investigation fun.

So of course I had to take this data for a spin myself - it seems real

View fincen_browser_guide.mdx
rvanbruggen / exponential_growth.adoc
Last active Sep 24, 2020
Exponential growth in Neo4j
View exponential_growth.adoc

Exponential growth in Neo4j

With the current surges of the Covid-19 Pandemic globally, there is a huge amount of debate raging in our societies - everywhere. It’s almost as if the duality between left and right that has been dividing many political spectra in the past few years, is now also translating itself into a duality that is all about more freedom for the individual (and potentially - a higher spread of the SARS-CoV-2 virus), versus more restrictions for the individual. It’s such a difficult debate - with no clear definitive outcome that I know of. There’s just too many uncertainties and variations in the pandemic - I personally don’t see how you can make generic statements about it very easily.

One thing I do know though, is that very smart and loveable people, in my own social and professional circle and beyond, seem to be confused by some of the data. Very often, they make seemingly rational arguments about the numbers that are seeing - but ig

rvanbruggen / opentrialsqueries.cql
Last active Sep 18, 2020
Queries to run against the OpenTrials database, once imported into Neo4j
View opentrialsqueries.cql
//Look at schema
call db.schema.visualization
//what is connected and how
match (n)-[r]->(m)
return distinct labels(n), type(r), labels(m)
//how many nodes of each label
match (n)
return labels(n), count(n)
View 0-detijd-bestuurders-intro.adoc

Bestuurders Beursgenoteerde bedrijven in Neo4j - Intro

Origineel onderzoek - vorige edities

Uit 2018

Conversie naar Google Sheet

Om makkelijk online beschikbaar te zijn: import in Google sheets. Automatisch conversie terug naar .csv daardoor. Volledige google sheet staat hier.

Twee sheets:

View 1-contacttracing and recommender systems.adoc

How to convert a contact tracing graph into a recommendation graph

Creating the contact tracing graph with faker

Using the Neo4j plugin that allows for creating fake data with the "faker library": plugin over here

Persons using faker

foreach (i in range(1,5000) |
View 0-background
//find at
//release at
//unzip: place the contents of the "dist" directory in the "plugins" directory of your neo4j server
// add property:*,gds.*,fkr.* to neo4j.conf in the conf directory