SiRumCz / CSC501

CSC501 assignments
0 stars 1 forks source link

Provide API for basic node link diagram #26

Closed superliuxz closed 5 years ago

superliuxz commented 5 years ago
  1. Showing movies genres with node link diagram. (Genres would be big nodes and movies would be little nodes attached to these big nodes) => list of movies containing their Genres. Data sample:
 [
{title: Toy Story, Genres:[Adventure, Animation, Children, Comedy, Fantasy]},
{title: Jumanji, Genres:[Adventure, Children, Fantasy]},
…
]

@soroushysfi @SiRumCz I know we haven't had this one done but I think it's a very good example of a more advanced query (as it requires joining two tables), I am willing to work on it now.

@soroushysfi @SiRumCz I am not familiar with node link diagram but I am thinking about something like this:

  • An API provides the following data:
[
  {
    "genres": "Children",
    "numMovies": 123456,
    "data":
      [
        {"movie": "Toy Story", "numRatings": 5678},
        {"movie": "Another Children Movie", "numRatings": 1234},
        {...},
        ...
      ]
  },
  {
    "genres": "Adventure",
    "numMovies": 654321,
    "data":
      [
        {"movie": "Some Adventure Movie", "numRatings": 7891},
        {"movie": "Another Adventure Movie", "numRatings": 1234},
        {...},
        ...
      ]
  },
 ...
]

So in plain english, an API that list the top 5 most rated movies under each genres, then we can have the node link diagram with genres being the master nodes and the movies being the slave nodes (like what @soroushysfi proposed), and the size of the nodes can be rescaled according to the "numMovies" and "numRatings" key (I can even provide a rescaling factor in the API if you want).

Is it doable?

Like to hear your thoughts.

Yeah this is possible. Response is ok, even we can show 10 most rated movies in each genres. The scaling factor might be useful! I can also scale them in my code.

Originally posted by @soroushysfi in https://github.com/superliuxz/CSC501/issues/14#issuecomment-533916081

SiRumCz commented 5 years ago

For the node link I am thinking to have Genres connected according to movies where two genres appear in the same time. The scale of Genre nodes could be how many times they have appeared. data could look something like this:

  {
     "nodes": [
                   {"id":"0", "name":"Action","value":"xxx", "group":1},
                   {"id":"1", "name":"Adventure","value":"xxx", "group":2},
                   ...
                   ],
     "links":[
                 {"source":14, "target":0},
                 {"source":4, "target":4},
                 ...
                ]
  }

one of the example: https://bl.ocks.org/BTKY/6c282b65246f8f46bb55aadc322db709

superliuxz commented 5 years ago

For the node link I am thinking to have Genres connected according to movies where two genres appear in the same time. The scale of Genre nodes could be how many times they have appeared. data could look something like this:

  {
     "nodes": [
                   {"id":"0", "name":"Action","value":"xxx", "group":1},
                   {"id":"1", "name":"Adventure","value":"xxx", "group":2},
                   ...
                   ],
     "links":[
                 {"source":14, "target":0},
                 {"source":4, "target":4},
                 ...
                ]
  }

Good thought, I really like it.

We can do that, but as a more advanced node link diagram though.

I have change the issue title to "basic node link diagram". Feel free to start working on the more advanced one if you want.

And do you want to hoop @soroushysfi into the discussion?

@soroushysfi what do you think about the advanced node link diagram @SiRumCz proposed? How much work is it on the front end?

soroushysfi commented 5 years ago

For the node link I am thinking to have Genres connected according to movies where two genres appear in the same time. The scale of Genre nodes could be how many times they have appeared. data could look something like this:

  {
     "nodes": [
                   {"id":"0", "name":"Action","value":"xxx", "group":1},
                   {"id":"1", "name":"Adventure","value":"xxx", "group":2},
                   ...
                   ],
     "links":[
                 {"source":14, "target":0},
                 {"source":4, "target":4},
                 ...
                ]
  }

one of the example: https://bl.ocks.org/BTKY/6c282b65246f8f46bb55aadc322db709

This would be perfect! in this case I don't need any data manipulation myself.

SiRumCz commented 5 years ago

I will work on API part.

superliuxz commented 5 years ago

Reassigned, as @SiRumCz is working on it. And the API specification should be based on his implementation.