Skip to content

Instantly share code, notes, and snippets.

@markcerv
Last active June 9, 2021 04:34
Show Gist options
  • Save markcerv/914cc7e797e133c93e7ca4095057de88 to your computer and use it in GitHub Desktop.
Save markcerv/914cc7e797e133c93e7ca4095057de88 to your computer and use it in GitHub Desktop.
3 months of sample hotel data, 2 updates
I receive hotel room price updates a few times a week.
I am trying to determine 'best way' to do a few things.
Issue#1) Determine the changes that occur from one update to the next. I'd like to know
* Did price go up (or down)...and if so, by how much
* Is room now "closed" (price went from positive integer to 0)
* Is room now "open" (price went from 0 to a positive integer)
I'd like to know this by room type, and by day of month.
Issue#2) Determine best way to store these updates inside of a PostgreSQL database.
I was thinking each record could contain:
* YYYY-MM of the data in question
* JSON of the room types, days and values
* timestamp of when last update was received.
That way, given at least 2 records, I could always get the "latest" change (using whatever I determine in #1 above), or I could go "back" in time and compare any 2 timestamps for a certain YYYY-MM of data.
I've included before update/after update for 2 sets of data:
Set 1) a "mini" set of data (just one month, and only the first 5 days of the month) demo-hotel-mini-update1.csv and demo-hotel-mini-update1.csv. Used to quickly test out solutions for #1 and #2 above, without getting overwhelmed with too much data.
Set 2) a "more accurate" set of data (3 months worth, 30 and 31 days worth of data as appropriate by month).
Each of thet "sets" of data include mostly rooms that stay the same, with the occasional price increase/decrease/opening/closing of rooms.
Jun-21 1 2 3 4 5
1BR GV 400 400 450 450 450
1BR OV 500 500 500
2BR GV
2BR OV 800 800 800
Jun-21 1 2 3 4 5
1BR GV 400 400 450 450 450
1BR OV 400 500 600
2BR GV 700 700
2BR OV 800
Jun-21 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30
1BR GV 400 500 500 500 500 500 500 500 500 500 525 600 600 1BR GV
1BR OV 450 550 550 550 550 550 550 600 600 650 1BR OV
2BR GV 800 800 800 800 2BR GV
2BR OV 700 875 2BR OV
Jul-21 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31
1BR GV 675 775 775 700 700 775 775 750 750 750 700 700 700 700 700 700 675 650 650 650 650 650 650 650 650 650 650 600 600 600 600 1BR GV
1BR OV 850 775 775 850 850 800 800 800 775 775 775 775 775 775 750 700 700 700 700 700 700 700 700 700 700 650 650 650 650 1BR OV
2BR GV 900 2BR GV
2BR OV 925 925 925 925 925 2BR OV
Aug-21 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31
1BR GV 600 600 600 600 600 600 550 550 550 550 550 550 550 500 500 500 500 500 500 450 450 400 400 400 400 350 350 350 325 325 325 1BR GV
1BR OV 650 650 650 650 650 650 600 600 600 600 600 600 600 550 550 550 550 550 550 500 500 475 475 475 475 400 400 400 375 375 375 1BR OV
2BR GV 750 725 725 675 675 650 650 650 650 525 525 525 475 475 475 2BR GV
2BR OV 825 750 750 725 725 725 725 575 575 575 525 525 525 2BR OV
Jun-21 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30
1BR GV 400 500 500 500 500 500 500 500 500 500 525 600 600 1BR GV
1BR OV 450 550 550 550 550 550 550 600 600 650 1BR OV
2BR GV 800 800 800 800 800 800 2BR GV
2BR OV 700 875 2BR OV
Jul-21 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31
1BR GV 675 775 775 700 700 775 775 750 750 750 700 700 700 700 700 700 675 650 650 650 650 650 650 650 650 650 650 600 600 600 600 1BR GV
1BR OV 850 750 750 750 750 800 800 800 775 775 775 775 775 775 750 700 700 700 700 700 700 700 700 700 700 650 650 650 650 1BR OV
2BR GV 900 2BR GV
2BR OV 1000 1000 1000 950 950 2BR OV
Aug-21 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31
1BR GV 600 600 600 600 600 600 550 550 550 550 550 550 550 500 500 500 500 500 500 450 450 400 400 400 350 350 350 350 325 325 325 1BR GV
1BR OV 650 650 600 600 600 600 600 600 600 550 550 550 550 550 550 500 500 475 475 475 475 400 400 400 375 375 375 1BR OV
2BR GV 750 725 725 675 675 650 650 650 650 525 525 525 475 475 475 2BR GV
2BR OV 825 750 750 725 725 725 725 575 575 575 525 525 525 2BR OV
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment