Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Creating a lookup table #49

Open
cetanu opened this issue Jul 3, 2023 · 1 comment
Open

Creating a lookup table #49

cetanu opened this issue Jul 3, 2023 · 1 comment

Comments

@cetanu
Copy link

cetanu commented Jul 3, 2023

Hey there,

Some background...
A while ago I created a lookup table manually using the data from the cloudping website.

The lookup table is used to determine which region is nearest to a particular region.

The table looks like this:

 ap-southeast-2:
    ap-southeast-2: '0'
    us-west-2: '1'
    us-west-1: '2'
    ap-southeast-1: '3'
    us-east-1: '4'
    us-east-2: '5'
    eu-west-1: '6'
    eu-west-2: '7'
    eu-central-1: '8'
ap-southeast-1:
    ap-southeast-1: '0'
    us-west-2: '1'
    eu-central-1: '2'
    eu-west-2: '3'
    us-west-1: '4'
    eu-west-1: '5'
    ap-southeast-2: '6'
    us-east-1: '7'
    us-east-2: '8'
eu-central-1:
    eu-central-1: '0'
    eu-west-2: '1'
    eu-west-1: '2'
    us-east-1: '3'
    us-east-2: '4'
    us-west-1: '5'
    us-west-2: '6'
    ap-southeast-2: '7'
    ap-southeast-1: '8'
    # and so on... and so forth...

and is used, in python for example, like this:

priority = table[source_region][destination_region]

I started out with only a few regions, but now I need to do many more. This is pretty tedious to do by hand.

I was about to build something that would scrape the website and calculate this data instead, however, I thought I'd bring this forward as an issue to see if:

  1. There is an easier way to do this that is closer to the data, and doesn't require html scraping
  2. This would be useful for anyone else

Thoughts?

@sigJoe
Copy link

sigJoe commented Jul 11, 2023

I agree this would be very useful. A minimal change to support it could be to modify the grid endpoint to support returning as JSON format rather than rendering the template, then process that as desired on the client side.

Edit: it was such a small change that I went ahead and made a PR: #50

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants