Step 2 on developing UA: Calculating UA scores from a MongoDB subset

image.png

Following the previous article First step to building a PoC for UA, @scipio and I have continued working on the project development. In the first article, I discussed how we constructed a subset of the entire Steem blockchain data, just to follower data, which we read (as an intermediary step) using the MongoDB interface of Steemdata.com. In the second development step, we are calculating UAs via multi-iterations, and we are testing the results using the example follower matrix dataset @scipio presented in his first article.

Technical approach

We started with a JSON file, holding the follower matrix of the example follower graph. The file describes the user names (the nodes in the graph) and the user IDs. In step 3, writing to and reading UA data in a unidimensional binary index file, it's important to store accounts / users via their ID in chronological order of entering Steem. We calculate all account UA results via intermediate MongoDB collections (UA and UA1) via a multi-iterative approach.

Installation of UA-JS

Do you want to test how the current algorithm works and verify its output? Then install the code via the following steps!

Step 1 : Install node


  • Clone the Github repository somewhere on your device.
  • Install node (there is plenty of resources online to find how to do that).
  • Open a node console, navigate to the uaJS folder.
  • Run npm install

Step 2: Create the testDb collection


  • Install mongodb and launch mongod (plenty of tutorials on the internet)
  • Use mongoimport from the mongodb folder to import the test collection : mongoimport --db uaJS --collection testDB --file testDB.json. replace testDB.json by the full path to the file.

Step 3: Run computeUA.js


  • Run node test/computeUA to run the test.

The first time, you won't need these two lines, so comment them out:

/*     await db.collection('uaDB').drop();
      await db.collection('uaDB_1').drop();*/

image.png

This result is coherent with the result from @scipio 's post. You can create your own collection as testDB and test the algorithm.

This is a two-men-effort, so we decided to equally share the payout of this post between @scipio and @stoodkev.

@stoodkev && @scipio



Posted on Utopian.io - Rewarding Open Source Contributors

H2
H3
H4
3 columns
2 columns
1 column
11 Comments