dani-boo / close-customers

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

πŸ“πŸ—ΊοΈπŸ“πŸ—ΊοΈπŸ“πŸ—ΊοΈπŸ“πŸ—ΊοΈπŸ“πŸ—ΊοΈπŸ“

"CLOSE CUSTOMERS" TECH TEST

πŸ—ΊοΈπŸ“πŸ—ΊοΈπŸ“πŸ—ΊοΈπŸ“πŸ—ΊοΈπŸ“πŸ—ΊοΈπŸ“πŸ—ΊοΈ

A barely-there, reusable program written in Node.js that:

  • reads data from a .txt file,
  • converts data to a JSON array,
  • finds customers within a defined radius using the great-circle distance formula, and
  • returns a new simplified output.txt file of "close customers", sorted by user_id.

HOW TO USE?

πŸ“Œ In your teminal, run git clone https://github.com/dani-boo/close-customers.git
πŸ“Œ Go to directory by running cd close-customers
πŸ“Œ Run yarn to install dependencies

🚨NB: You need node to run this project, which you can download from here. If you don't know whether node is installed on your machine you can check with the command node -v, which will print your current node version to the console.

🌑️ TESTING:
Run tests with yarn test. See coverage report by running yarn test --coverage
test coverage

πŸ’» RUN PROGRAM:
Write/overwrite the output.txt file (in repo's public folder) by going to src folder (cd src) and running writeFile function inside index.js:
node index.js
(this also logs the result to the console)

Sample input data:

sample input data

Sample filtered and sorted data (customers who are close enough):

{"id": "4", "name": "Ian Kehoe"}
{"id": "5", "name": "Nora Dempsey"}
{"id": "6", "name": "Theresa Enright"}
{"id": "8", "name": "Eoin Ahearn"}
{"id": "11", "name": "Richard Finnegan"}
{"id": "12", "name": "Christina McArdle"}
{"id": "13", "name": "Olive Ahearn"}
{"id": "15", "name": "Michael Ahearn"}
{"id": "17", "name": "Patricia Cahill"}
{"id": "23", "name": "Eoin Gallagher"}
{"id": "24", "name": "Rose Enright"}
{"id": "26", "name": "Stephen McArdle"}
{"id": "29", "name": "Oliver Ahearn"}
{"id": "30", "name": "Nick Enright"}
{"id": "31", "name": "Alan Behan"}
{"id": "39", "name": "Lisa Ahearn"}

About


Languages

Language:HTML 73.2%Language:JavaScript 21.0%Language:CSS 5.8%