Skip to content
/ koi Public

Koi utilizes Bellman-Ford Algorithm to maximize ratio for connecting reward programs and determine transfer strategy for users. User can edit program balances within profile on the webapp, simulate transfers, and view transaction history.

Notifications You must be signed in to change notification settings

linvivian7/koi

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

81 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Koi is a webapp that helps its users optimize transfers among their credit card, hotel, and airline reward points.

Note:

  • User password is hashed upon login via flask.bcrypt.
  • The webapp is by no means a commercial product and does not aim to function as one.

Koi Homepage About Koi Contact Us

enter image description here

enter image description here

Navigate

Welcome to Koi

Navigate

Dashboard

Transaction History

Koi History

Dashboard

Let's explore all the functionalities the dashboard provides for users.

Main

Main Dashboard

#####$ Update Balance (not shown)

  • Add/update program balances
  • Editable-select1 drop-down

#####$ Transfer Points

  • Transferred From: List of programs within user portfolio with point conversion
  • To: Dynamic list rendered post-AJAX call to database based on Transferred From selection
  • Ratio: Ratio between the selected outgoing and receiving programs

Transfer Constraints:

  • No balances, beginning or ending, can be negative
  • Transfer amounts are full-points

#####$ Point Distribution

def generate_random_color(ntimes, base=(255, 255, 255)):
    """ Generate random pastel blue-green and red-orange colors for charts """

    colors = set()

    i = 1

    while len(colors) < ntimes + 1:

            if i % 2 == 0:
                red = random.randint(0, 50)
                green = random.randint(150, 170)
                blue = random.randint(155, 219)

            if i % 2 != 0:
                red = random.randint(240, 250)
                green = random.randint(104, 168)
                blue = random.randint(0, 114)

            if base:
                red = (red + base[0]) / 2
                green = (green + base[1]) / 2
                blue = (blue + base[2]) / 2

            color = (red, green, blue)
            colors.add(color)
            i += 1

    return colors

#####$ Program Balances

  • All tables are jQuery datatables3
  • Searchable, sortable, enables column re-order and pagination, and have fixed headers
  • Click x to delete a program balance

Optimization

Optimization Page

#####$ User Actions

  • User selects a goal program whose value he/she would like to maximize
  • User inputs a goal balance for the goal program
  • Press Run Optimization
  • Press Yes to commit transfers within Koi profile

#####$ Visualization of how programs map to each other4

  • function renderD3 makes AJAX call to server
  • Server returns jsonified mapping for the user's portfolio
  • Full D3 of all programs on Koi can be found in the Visualize section of the Homepage.

D3 actions

Optimization Process

Optimization Process

Brief overview of the calculation process. For more information, please see helper.py.

#####$ function optimize (start)

def optimize(user_id, source, goal_amount, commit=False):
    """ Optimizes points transfer """
*  source = goal_program

#####$ function bellman_ford 5 returns:

def bellman_ford(graph, source):
# example_min_cost: [(16, 0), (212, 0.0), (164, 1.0986122886681098), (6, inf), (170, inf), (187, inf)]
# example predecessor: {164: 212, 6: None, 170: None, 16: None, 212: 16, 187: None}
  • Array of node-to-cost tuples
  • Hashmap of nodes and predecessors as key, value pairs

#####$ function make_path constructs possibly paths with doubly-linked lists

def make_path(current, source, predecessor):

#####$ function is_route_possible applies balance ceiling and whole-point transfer constraints

def is_route_possible(user, goal_amount, node):
    """ Return True or False if path is viable """

    return goal_amount <= balance_capacity(user, node)

#####$ function optimize (end) returns optimal path with involved programs, transfer amounts, vendor urls, and ratios.


Transaction History

Upon update, deletion, transfer, and commitment to optimized transfers, users can view their entire transaction history on their Koi profile.

Activity Table

Transfers Table


Koi History

Still here? Walk through the progress of Koi development with us!

Week 1

enter image description here

enter image description here

Week 2

enter image description here

Week 3 enter image description here

enter image description here

Support StackEdit

About

Koi utilizes Bellman-Ford Algorithm to maximize ratio for connecting reward programs and determine transfer strategy for users. User can edit program balances within profile on the webapp, simulate transfers, and view transaction history.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published