Skip to content

Instantly share code, notes, and snippets.

Avatar

Rik Van Bruggen rvanbruggen

View GitHub Profile
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

View fincen_browser_guide.mdx
@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

@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)
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 https://github.com/neo4j-contrib/neo4j-faker
//release at https://github.com/neo4j-contrib/neo4j-faker/releases
//unzip: place the contents of the "dist" directory in the "plugins" directory of your neo4j server
// add property: dbms.security.procedures.unrestricted=apoc.*,gds.*,fkr.* to neo4j.conf in the conf directory
@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
@rvanbruggen
rvanbruggen / 1-scm-background.txt
Last active Jun 12, 2020
Supply Chain Management Example in Neo4j
View 1-scm-background.txt
// Found article on https://or.stackexchange.com/questions/529/supply-chain-public-data-repository
// https://pubsonline.informs.org/doi/suppl/10.1287/msom.1070.0176
// https://pubsonline.informs.org/doi/suppl/10.1287/msom.1070.0176/suppl_file/msom.1070.0176-sm-datainexcel.zip
//Article by Sean P. Willems: https://pdfs.semanticscholar.org/232c/451fcf58dbcc1527de6d02cd6e76aea9e871.pdf?_ga=2.33151675.429569592.1581427039-1552162479.1581427039
Table 2 Classifications Used to Label Every Stage in the Chains
Classifications label Activity
Dist_ A stage that distributes an item
Manuf_ A stage that manufactures or assembles an item
Part_ A stage that procures an item
You can’t perform that action at this time.