Giter Club home page Giter Club logo

compatibility's Introduction

Compatibility Predictor

Steps to Run

Assumptions

  • Higher the score the better
  • Team members want/are compatible with applicants who value the same attributes they do
  • Regardless of team chemistry, applicants who score 10 in everything get assigned the highest score: 1.
  • Regardless of team chemistry, applicants who score 0 in everything get assigned the lowest score: 0.

Features

  • Two custom exceptions
  • Input validation
  • Scores in range [0, 1]
  • Two integration tests (one valid and one that throws a custom exception)
  • Non-hard coded integers

Logic Behind It

  • Spring Boot rejects JSON payloads with invalid parameters (missing or bad data types) by throwing custom InvalidParameters exception
  • CompatibilityController takes in user's JSON file
  • CompatibilityController parses JSON payload and calls CandidateService method "evaluateCandidates" passing in TeamMemberApplicantDTO
  • evaluateCandidates throws custom InvalidScore Exception if scores are incorrect (less than 0 or greater than 10) or null
  • evaluateCandidates adds total attribute scores from all team members
  • evaluateCandidates uses a HashMap and Priority Queue to assign top two attribute scores with a positive percentage multiplier and the bottom two attribute scores with a negative one
  • In case of ties, prioritize attributes that were first added to HashMap (Intelligence, Endurance, Strength, SpicyFoodTolerance)
  • evaluateCandidates pulls info (name, attributes) from each applicant in the list
  • evaluateCandidates throws InvalidScore exception if scores are incorrect (less than 0 or greater than 10) or null
  • evaluateCandidates multiplies each applicant's attributes with its percentage multiplier, stored in priorityWeight.properties, and creates a weighted overall score
  • evaluateCandidates adds each applicant and their weighted score to a temporary list and sets it in the response DTO (scoredApplicantListDTO)
  • CompatibilityController stringifies response DTO and returns JSON payload to user

image

Ways to Improve

  • Set up an H2 in-memory DB for storing applicants
  • If DB exists, create APIs to update and delete (assuming applicants can reapply and that their attributes have improved/degraded since)
  • Remove hard coded Strings using a Constants or properties file

compatibility's People

Contributors

joshuasingerew avatar jsinger808 avatar

Watchers

 avatar

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.