-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
restructure backend to be standalone for deployment
- Loading branch information
1 parent
4b59c60
commit ff780fb
Showing
20 changed files
with
299 additions
and
226 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1 @@ | ||
CHROMEDRIVER_PATH=/opt/homebrew/bin/chromedriver # replace with path to your chromedriver install | ||
DATABASE_URL="postgresql://user:password@postgresserver/db" # replace with your DB credentials | ||
CHROMEDRIVER_PATH=/opt/homebrew/bin/chromedriver # replace with path to your chromedriver install |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
DATABASE_URL="postgresql://user:password@postgresserver/db" # replace with your DB credentials |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,116 @@ | ||
from enum import Enum | ||
|
||
class TableHeaders(Enum): | ||
BUILDING = 'Building' | ||
NEIGHBOURHOOD = 'Neighbourhood' | ||
ADDRESS = 'Address' | ||
CITY = 'City' | ||
LISTING = 'Listing' | ||
BED = 'Bed' | ||
BATH = 'Bath' | ||
SQFT = 'SqFt' | ||
PRICE = 'Price' | ||
UNIT_AMENITIES = 'Unit Amenities' | ||
BUILDING_AMENITIES = 'Building Amenities' | ||
PETS = 'Pets' | ||
LAT = 'Latitude' | ||
LON = 'Longitude' | ||
DATE = 'Date' | ||
|
||
class UnitAmenities(Enum): | ||
BALCONY = 'Balcony' | ||
IN_UNIT_LAUNDRY = 'In Unit Laundry' | ||
AIR_CONDITIONING = 'Air Conditioning' | ||
HIGH_CEILINGS = 'High Ceilings' | ||
FURNISHED = 'Furnished' | ||
HARDWOOD_FLOOR = 'Hardwood Floor' | ||
|
||
class BuildingAmenities(Enum): | ||
CONTROLLED_ACCESS = 'Controlled Access' | ||
FITNESS_CENTER = 'Fitness Center' | ||
SWIMMING_POOL = 'Swimming Pool' | ||
ROOF_DECK = 'Roof Deck' | ||
STORAGE = 'Storage' | ||
RESIDENTS_LOUNGE = 'Residents Lounge' | ||
OUTDOOR_SPACE = 'Outdoor Space' | ||
|
||
|
||
UnitAmenitiesDict = { | ||
UnitAmenities.BALCONY.value: 0, | ||
UnitAmenities.IN_UNIT_LAUNDRY.value: 0, | ||
UnitAmenities.AIR_CONDITIONING.value: 0, | ||
UnitAmenities.HIGH_CEILINGS.value: 0, | ||
UnitAmenities.FURNISHED.value: 0, | ||
UnitAmenities.HARDWOOD_FLOOR.value: 0 | ||
} | ||
|
||
BuildingAmenitiesDict = { | ||
BuildingAmenities.CONTROLLED_ACCESS.value: 0, | ||
BuildingAmenities.FITNESS_CENTER.value: 0, | ||
BuildingAmenities.SWIMMING_POOL.value: 0, | ||
BuildingAmenities.ROOF_DECK.value: 0, | ||
BuildingAmenities.STORAGE.value: 0, | ||
BuildingAmenities.RESIDENTS_LOUNGE.value: 0, | ||
BuildingAmenities.OUTDOOR_SPACE.value: 0 | ||
} | ||
|
||
locations = [ | ||
{ | ||
'location': 'Downtown Core', | ||
'bounding_box': { | ||
'southwest': {'lon': '-79.398', 'lat': '43.643'}, | ||
'northeast': {'lon': '-79.3762', 'lat': '43.66'} | ||
} | ||
}, | ||
{ | ||
'location': 'Midtown', | ||
'bounding_box': { | ||
'southwest': {'lon': '-79.4165', 'lat': '43.67'}, | ||
'northeast': {'lon': '-79.388', 'lat': '43.7'} | ||
} | ||
}, | ||
{ | ||
'location': 'West End', | ||
'bounding_box': { | ||
'southwest': {'lon': '-79.449', 'lat': '43.628'}, | ||
'northeast': {'lon': '-79.402', 'lat': '43.65'} | ||
} | ||
}, | ||
{ | ||
'location': 'East End', | ||
'bounding_box': { | ||
'southwest': {'lon': '-79.36', 'lat': '43.65'}, | ||
'northeast': {'lon': '-79.315', 'lat': '43.685'} | ||
} | ||
}, | ||
{ | ||
'location': 'North Toronto', | ||
'bounding_box': { | ||
'southwest': {'lon': '-79.425', 'lat': '43.7'}, | ||
'northeast': {'lon': '-79.383', 'lat': '43.73'} | ||
} | ||
}, | ||
{ | ||
'location': 'University Area', | ||
'bounding_box': { | ||
'southwest': {'lon': '-79.4042', 'lat': '43.6572'}, | ||
'northeast': {'lon': '-79.39', 'lat': '43.6675'} | ||
} | ||
}, | ||
{ | ||
'location': 'Scarborough', | ||
'bounding_box': { | ||
'southwest': {'lon': '-79.21498455469643', 'lat': '43.74522758306715'}, | ||
'northeast': {'lon': '-79.17281544530357', 'lat': '43.78977241693285'} | ||
} | ||
}, | ||
{ | ||
'location': 'Etobicoke', | ||
'bounding_box': { | ||
'southwest': {'lon': '-79.57890339741783', 'lat': '43.6379061704074'}, | ||
'northeast': {'lon': '-79.53609660258218', 'lat': '43.682093829592596'} | ||
} | ||
} | ||
] | ||
|
||
table_columns = [table_header.value for table_header in TableHeaders] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,9 @@ | ||
from backend.database import SessionLocal | ||
from database import SessionLocal | ||
|
||
|
||
def get_db(): | ||
db = SessionLocal() | ||
try: | ||
return db | ||
yield db | ||
finally: | ||
db.close() |
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
from pydantic import BaseModel | ||
from datetime import datetime | ||
|
||
class AddListing(BaseModel): | ||
building: str | ||
neighbourhood: str | ||
address: str | ||
city: str | ||
listing: str | ||
bed: int | ||
bath: float | ||
sqft: float | ||
price: float | ||
pets: float | ||
latitude: float | ||
longitude: float | ||
date: datetime | ||
controlled_access: bool | ||
fitness_center: bool | ||
outdoor_space: bool | ||
residents_lounge: bool | ||
roof_deck: bool | ||
storage: bool | ||
swimming_pool: bool | ||
air_conditioning: bool | ||
balcony: bool | ||
furnished: bool | ||
hardwood_floor: bool | ||
high_ceilings: bool | ||
in_unit_laundry: bool |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
annotated-types==0.6.0 | ||
anyio==4.2.0 | ||
click==8.1.7 | ||
fastapi==0.108.0 | ||
h11==0.14.0 | ||
httptools==0.6.1 | ||
idna==3.6 | ||
pydantic==2.5.3 | ||
pydantic_core==2.14.6 | ||
python-dotenv==1.0.0 | ||
PyYAML==6.0.1 | ||
sniffio==1.3.0 | ||
SQLAlchemy==2.0.25 | ||
starlette==0.32.0.post1 | ||
typing_extensions==4.9.0 | ||
uvicorn==0.25.0 | ||
uvloop==0.19.0 | ||
watchfiles==0.21.0 | ||
websockets==12.0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.