Git Product home page Git Product logo

aldini_graph's Introduction

aldini-graph

Neo4j microservice for storing User details and their typing biometrics relationships for aldini. This simple flask microservice takes user information as JSON and inserts it into Neo4j. The project is an effort to demonstrate how we can use a graph db like Neo4j for empowering TypingDNA at scale. The demo of entire aldini will presented at TypingDNA hackathon.

Presently we are using Neo4j and Neo4j Browser User Interface, which supports rich and intuitive relationship visualization.

This repostitory is intended as a microservice only, where aldini-backend can send relevant information over HTTP/1.1.

This code primarily uses py2neo as neo4j driver, flask as backend-http framework, uWSGI for production grade WSGI, nginx as reverse-proxy and load-balancer. All thanks to uwsgi-nginx-flask-docker. It was built using Doom Emacs.

Instructions on getting up and running

→ docker build --rm . -t aldini-graph

→ docker-compose --env-file app/.env up 

Instructions on how to use the endpoints

There are two important endpoints.

Note: replace the IP with your DOCKER IP though. You can find it as inet addr under docker0 in ifconfig. Also the NGINX_PORT has been purposefully set as 8080 (in the .env) so that aldini-backend can run on default port 80.

  1. /api/add_user which is used to create a new User node.

useful cURL requests for the same:

ozen:  ~/.../aldini_graph/app  |main ✓|
→ curl -d '{"uid":"123", "name":"bhavesh"}' -H "Content-Type: application/json" -X POST http://172.19.0.1:8080//api/add_user
{"created":true,"uid":"123"}

ozen:  ~/.../aldini_graph/app  |main ✓|
→ curl -d '{"uid":"456", "name":"yaswant"}' -H "Content-Type: application/json" -X POST http://172.19.0.1:8080/api/add_user
{"created":true,"uid":"456"}
  1. /api/add_match which is used to create similarity relationship between two existing User nodes.

useful cURL requests for the same:

ozen:  ~/.../aldini_graph/app  |main ✓|
→ curl -d '{"from_uid":"456", "to_uid":"123" ,"conf":0.6}' -H "Content-Type: application/json" -X POST http://172.19.0.1:8080/api/add_match
{"conf":0.6,"created":true,"from_uid":"456","to_uid":"123"}

now run to your browser & open http://localhost:7474 to see visualzations using Neo4j Browser User Interface

Visualization Usage

For demo purposes these commands might be useful:

  • show all User nodes and relationships
MATCH (n:User) RETURN n
  • delete all nodes and relationships
MATCH (n:User) DETACH DELETE n
  • show all Users relationships
MATCH (n:User)-[r:SIMILAR]-(:User) RETURN n
  • show all relationships based on property's value
MATCH (n:User)-[r:SIMILAR]-(:User) WHERE r.conf > 0.8 RETURN n

aldini_graph's People

Contributors

greed2411 avatar

Stargazers

 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.