- You are given a JSON file with an array of Objects. Every element can be grouped together using the "type" property.
- Your job is to import the data and arrange them in a way that the elements are evenly distributed.
- You then have to create a server using node.js(micro or express) and serve this distribution upon request.
- Create a frontend using either VanillaJS, React, Angular, Vue or Hyperapp that consumes this distribution and colors all the elements with similar type. For Example, if I click "typeA", it should color all the positions that this type exists at.
- Provide buttons on the UI for each type so we can toggle between types. All unique types in the data should have buttons on the UI.
- Sample pictures are in the "outputExamples" folder.
- You can display the distribution in any similar way possible (get creative). Visualization is upto you (you can use libraries like D3.js).
- Please add references to all the mathematical formulas or theorms used to achieve these results.
- If you come up with your own algorithm please explain in brief how, why and when for the algorithm.
- Create a branch from master and pull request when you're done.
- Reach out to us if you have any questions and inform us when you're done.
- Place the Frontend in the root folder "static".
- Update the README.md file with the instructions on how to test the app.
- If you deploy this app on a cloud(preferably on AWS).
- The output images are just the example visualizations we are expecting to see when we click a type
- Output images do not necessarily represent even distribution
- Clone to local machine:
git clone https://github.com/sufanHuang/codingChallenge.git- Use this command to build/start/test the project:
sh start.sh-
shuffleItems(): used to randomize data on the backend. I created a trueOrFalse() to return a random true/false result. When each item in data is mapped, the result array
pushorunshiftthe item, based on the trueOrFalse() result. Unit test for this module is in/test.js. -
getData(): used in frontend to fetch data from backend using axios.
-
handleClick(): used in frontend to display items of the same type.
-
getTypes() : used to extract all the existed types from data. I use
forEachto loop through data, thenpushthe types that are unique to the result array. -
getTypeCount(): used to count how many items each type has from data. I use
reduceto get the total count of current type, then usemapon top to loop through each type. -
getChartData(): used for visualization using react-chart2. I use Brad Traversy's reactcharts project and react-chartjs-2 documentation as reference.
- Using AWS S3 : http://codingchallengesufan.s3-website-us-east-1.amazonaws.com/
- Using netlify: https://data-visualization-sufan.netlify.com/