Giter Club home page Giter Club logo

flat-graph's Introduction

Flat Graph GitHub Action

Flat Graph is a GitHub action designed to be a companion to the Flat Data GitHub action for regularly scraping data from a URL and enables import into a Neo4j graph database using on Cypher.

Why would I want to use this?

To periodically import data into Neo4j from a JSON file.

Examples

Coming soon

Usage

Create a GitHub Actions workflow yml file, .github/workflows/flat.yml. This example will use the Flat Data GitHub action to fetch the latest submissions to the Lobste.rs site every 60 minutes, then using the Flat Graph GitHub action import this data into Neo4j. Be sure to use GitHub secrets to avoid exposing credentials.

name: Flat Graph for Neo4j

on:
  push:
    paths:
      - .github/workflows/flat.yml
  workflow_dispatch:
  schedule:
    - cron: '*/60 * * * *'

jobs:
  scheduled:
    runs-on: ubuntu-latest
    steps:
      - name: Check out repo
        uses: actions/checkout@v2
      - name: Setup deno
        uses: denoland/setup-deno@main
        with:
          deno-version: v1.x
      - name: Fetch newest 
        uses: githubocto/flat@v2
        with:
          http_url: https://lobste.rs/newest.json
          downloaded_filename: newest.json
      - name: Neo4j import
        uses: johnymontana/[email protected]
        with:
          neo4j-user: ${{secrets.NEO4J_USER}}
          neo4j-password: ${{secrets.NEO4J_PASSWORD}}
          neo4j-uri: ${{secrets.NEO4J_URI}}
          filename: 'newest.json'
          cypher-query: >
              UNWIND $value AS article
              MERGE (u:User {username: article.submitter_user.username})
              MERGE (a:Article {id: article.short_id})
              SET a.url           = article.url,
                  a.id_url        = article.short_id_url,
                  a.created_at    = article.created_at,
                  a.title         = article.title,
                  a.score         = article.score,
                  a.flags         = article.flags,
                  a.comment_count = article.comment_count,
                  a.description   = article.description,
                  a.comments_url  = article.comments_url
              MERGE (u)-[:SUBMITTED]->(a)
              WITH article, a
              UNWIND article.tags AS tag
              MERGE (t:Tag {name: tag})
              MERGE (a)-[:HAS_TAG]->(t)        

Inputs

neo4j-user

The username for your Neo4j instance

neo4j-password

The password for your Neo4j user

neo4j-uri

The connection string for your Neo4j instance

filename

The name of the file to be loaded. Currently only JSON is supported. This file will be passed as a parameter to the specified Cypher query.

cypher-query

The Cypher query to run. Your JSON file will be passed in a variable $value

flat-graph's People

Contributors

johnymontana avatar

Stargazers

 avatar  avatar Almir Polverini avatar Sai Sarath avatar Zhibo avatar Quinn McHugh avatar M1k4el4 avatar Matt Young avatar Harley avatar Alexandre Nicastro avatar Henry S avatar Jonathan Morales Vélez avatar Tomiyuki Terasshima avatar  avatar Chris Zubak-Skees avatar Max Harlow avatar  avatar Francisco Navarro avatar Chetachi Ezikeuzor avatar  avatar Michael O'Boyle avatar  avatar

Watchers

James Cloos avatar  avatar Ronaldo V. avatar  avatar

flat-graph's Issues

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.