Skip to content

Instantly share code, notes, and snippets.

Avatar

Rik Van Bruggen rvanbruggen

View GitHub Profile
@rvanbruggen
rvanbruggen / linkedin-query.py
Last active Nov 11, 2020 — forked from ThomasCabrol/linkedin-2-query.py
Python script to query your LinkedIn network and get all your network's connections and their interconnections.
View linkedin-query.py
#!/usr/bin/env python
# encoding: utf-8
"""
linkedin-query.py
Created by Thomas Cabrol on 2012-12-03.
Customised by Rik Van Bruggen
Copyright (c) 2012 dataiku. All rights reserved.
Building the LinkedIn Graph
@rvanbruggen
rvanbruggen / 1-calendargraph.adoc
Last active Nov 4, 2020
Analysing a google calendar in Neo4j
View 1-calendargraph.adoc
View 1 - neo4jknowledgegraph.adoc

The Neo4j Knowledge Graph

Our friends of Neueda have been doing more and more work with Neo4j. One of the artefacts of that work (see their github repo for more info) has been an unbelievably wonderful page called Awesome Neo4j. This is a webpage with links and other resources that can be useful for people doing Neo4j projects - whether you are looking for tips and tricks, developer resources, language bindings, frameworks, visualization solutions, graph algorithm components, etc…​ all kinds of links are on this page…​ Truly great work of all the Contributors. And inspiring at that.

A Google Sheet as the main repository

Based on that work, I have tried to add some additional links that I use/know about on

@rvanbruggen
rvanbruggen / 1-contacttracing-import.cql
Last active Oct 23, 2020
Contact tracing example #cypher #neo4j
View 1-contacttracing-import.cql
//environment: Neo4j Desktop 1.2.7, Neo4j Enteprise 3.5.17, apoc 3.5.0.9, gds 1.1.0
//or: Neo4j Enterprise 4.0.3, apoc 4.0.0.6 (NOT later! a bug in apoc.coll.max/apoc.coll.min needs to be resolved)
//contact tracing data import
//full spreadsheet with synthetic data
//https://docs.google.com/spreadsheets/d/1R-XVuynPsOWcXSderLpq3DacZdk10PZ8v6FiYGTncIE/edit#gid=0
// person sheet˝
// https://docs.google.com/spreadsheets/u/0/d/1R-XVuynPsOWcXSderLpq3DacZdk10PZ8v6FiYGTncIE/export?format=csv&id=1R-XVuynPsOWcXSderLpq3DacZdk10PZ8v6FiYGTncIE&gid=0
View 1-playlist-importer-and-analyser.py
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 Notebook.md

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

@rvanbruggen
rvanbruggen / loadgtfs.cql
Last active Oct 7, 2020
Loading and Querying GTFS data
View loadgtfs.cql
//LOAD CSV script for GFTS data
create constraint on (a:Agency) assert a.id is unique;
create constraint on (r:Route) assert r.id is unique;
create constraint on (t:Trip) assert t.id is unique;
create index on :Trip(service_id);
create constraint on (s:Stop) assert s.id is unique;
create index on :Stoptime(stop_sequence);
create index on :Stop(name);
schema await
@rvanbruggen
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

View fincen_browser_guide.mdx
@rvanbruggen
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)
You can’t perform that action at this time.