GithubHelp home page GithubHelp logo

kuczmama / crypto-ranker Goto Github PK

View Code? Open in Web Editor NEW
3.0 3.0 2.0 4.59 MB

Rank Github projects by a set of criteria

Ruby 68.97% JavaScript 2.46% TypeScript 20.08% HTML 7.57% SCSS 0.77% Procfile 0.16%

crypto-ranker's Introduction

Crytpto Github Ranker

Website: https://kuczmama.github.io/crypto-ranker/#/home

This project will attempt to rate github projects by an unbiased set of criteria. The criteria include:

Table of contents generated with markdown-toc

How the score is calculated

Each criteria is ranked in terms of a percentile, where the top 20% is ranked a 5, 80th percentile is 4, and bottom 20% is ranked a 1. Each is rated by its recency.

  • Number of commits - more is better
  • Number of contributors - more is better
  • Recency of last commit - more recent is better
  • Frequency of commits - More frequent is better, but the most recent commits are ranked higher than the older commits.
  • Number of issues - More is better, because that means there is active development
  • Number of github stars
  • Number of forks
  • NUmber of github watcher - more is better
  • Ratio of open issues to closed issues - The ratio should be smaller
  • Language used, bonus points for esoteric languages, minus points for smart contract languages like solidity.

MVP Requirements

  • Load a github url through the API
  • Load all of the criteria and put the raw data into a data store
  • Rank the data based on above criteria
  • Update the data at least once per day
  • Display the data on a frontend# crypto-ranker

Nice to have features

  • Update the database so it's on the paid plan of heroku
  • Make it so there is only 1 github url per project
  • Store runner service in database
  • Add tool tips to explain ranking columns
  • Show image for each cryptocurrency
  • Calculate rank and rank score over time
  • Graph rank score over time
  • Rank commits based off of frequency

Architecture

This diagram shows what the MVP's architecture will look like once it is all completed

Server Architecture

Components

  • Third Party data loading service - Service to load raw data from third party websites
  • Data Source DB - Database to have metadata about where to load the third party data from, and logs around loading
  • Data Processing Service - Process the loaded data from all of the third party data sources, this will rank each project, and bundle the meaningful information together and store the data in the database.
  • Ranking Data DB - This has all of the ranked crypto data, as well as the raw data that can be used to rank more projects
  • Web API - A web API will allow users to query data from the database, and run custom queries
  • Data Bundling Service - This will query the ranking data DB, and it will bundle it into meaningful data to the user, and store that data in a CDN for quick retrieval
  • Web Client - The frontend of the website, this will be what the user sees, it will contain all of the ranking information

API

The API is hosted at https://cryptoranker.herokuapp.com/

To access the coins you can use the endpoint https://cryptoranker.herokuapp.com/api/v1/coins

The API allows for certain params

limit - integer - max 100

sort - filter by a column name eg: rank. To order prefix '+' or '-' to the sort param + sort ascending - sort descending

page - integer - starts at 0

Example

GET /api/v1/coins?sort=+rank&limit=10&page=2

This query returns all coins, sorted by rank ascending, limit 10, on the second page of coins. Meaning that of the 1000's of coins ranked this returns coins of rank 20-29, because we are on the 3rd page since pages are 0 index.

Return all coins and their rankings

GET /api/v1/coins

GET /api/v1/coins

[{
    [{
        "id":"35ed5260-60cb-4461-bf24-18b80760009a",
        "coin_marketcap_id":6636,
        "name":"Polkadot",
        "symbol":"DOT",
        "slug":"polkadot-new",
        "rank":0,
        "coin_marketcap_source_code_url":"https://github.com/paritytech/polkadot",
        "github_url":"https://github.com/paritytech/polkadot",
        "created_at":"2022-01-22T21:18:24.980Z",
        "updated_at":"2022-01-23T03:02:24.862Z",
        "rank_score":30
    },
    {}...
}]

Return an individual coin

GET /api/v1/coins/:id

Return a singular coin

GET /api/v1/coins/35ed5260-60cb-4461-bf24-18b80760009a

{
        "id":"35ed5260-60cb-4461-bf24-18b80760009a",
        "coin_marketcap_id":6636,
        "name":"Polkadot",
        "symbol":"DOT",
        "slug":"polkadot-new",
        "rank":0,
        "coin_marketcap_source_code_url":"https://github.com/paritytech/polkadot",
        "github_url":"https://github.com/paritytech/polkadot",
        "created_at":"2022-01-22T21:18:24.980Z",
        "updated_at":"2022-01-23T03:02:24.862Z",
        "rank_score":30
    }

Return github metadata for a given coin

GET /api/v1/coins/:id/github-metadata

Return the github metadata for a given coin

GET /api/v1/coins/35ed5260-60cb-4461-bf24-18b80760009a/github-metadata

{"id":"d2f40ccb-d131-40b9-be96-9a9813115b4f","language":"C++","watchers_count":61343,"open_issues_count":1000,"commit_count":32319,"contributors_count":362,"stars_count":61343,"forks_count":31338,"size":194761,"days_since_last_commit":2,"source_code_url":"https://github.com/bitcoin/bitcoin","owner":"bitcoin","repo":"bitcoin","created_at":"2022-01-23T01:20:29.798Z","updated_at":"2022-01-23T01:20:29.798Z","coin_id":"0c919e1d-987f-4f6e-b4b9-fad3cb48e39b"}

Install

If you want to run this locally, you'll need to do the following:

Set Environment Variables

Set Coin marketCap Pro API

The environment variable CMC_PRO_API_KEY, needs to be set in the environment. This can be gotten via coinmarketcap: https://pro.coinmarketcap.com/

M1 or M2 Mac Prerequisites

# Install ruby
brew install rbenv ruby-build

# On m1/m2 macs install rosetta
brew tap heroku/brew && brew install heroku

# Install heroku cli -- https://devcenter.heroku.com/articles/heroku-cli
brew tap heroku/brew && brew install heroku

# Install libpq
brew install libpq

# Install postgres
brew install postgres

# Start postgresql
brew services restart postgresql

Setup CryptoRanker

# Clone repo
git clone [email protected]:kuczmama/crypto-ranker.git
cd crypto-ranker

bundle install

# Setup database
rake db:create
rake db:migrate
rake db:seed

# Run server
ruby app/server.rb

Heroku Administration

Update all cryptocurrencies

heroku run rake cron:load_all_data -a cryptoranker

Query Database

heroku run irb -a cryptoranker
require_relative 'app/db.rb'

# Get last update time for a coin

Db::coins.order(updated_at: :desc).first

# Get total number of coins
Db::coins.count

# View runner logs
Db::runner_logs.all

Deploy to heroku

# Add heroku remote
git remote add heroku https://git.heroku.com/cryptoranker.git

# Deploy
git push heroku main

crypto-ranker's People

Contributors

kuczmama avatar shashu10 avatar

Stargazers

 avatar  avatar

Watchers

 avatar  avatar  avatar

Forkers

shashu10

crypto-ranker's Issues

Some coins have the wrong github info

Coins like ACE actually uses the github information for EOS: https://github.com/EOSIO/eos.

This is because ACE uses the following github url:

EOS: https://github.com/eosio
ACE: https://github.com/EOSIO/eos

One potential way to solve this is when there is a conflict to default to the higher marketcap coin, or the lower coin marketcap ID.

While we don't know for sure, it's a valid heuristic to assume the coin with the higher marketcap or lower coin marketcap ID came first, and the other coin is likely copying the other coin.

For now, we can make coins which share a github as unranked.

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.