-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Co-authored-by: sash-enka <[email protected]> Co-authored-by: Vincent Wijaya <[email protected]> Co-authored-by: sash-enka <[email protected]> Co-authored-by: Adam Ye <[email protected]> Co-authored-by: Adam Ye <[email protected]> Co-authored-by: rdev0010 <[email protected]> Co-authored-by: Zahin Shahriar Bin Khair <[email protected]> Co-authored-by: rdev0010 <[email protected]> Co-authored-by: ell-cam <[email protected]> Co-authored-by: gfra12 <[email protected]> Co-authored-by: Rutvik Dave <[email protected]> Co-authored-by: vincent-wijaya <[email protected]>
- Loading branch information
1 parent
0f35e36
commit f9147c2
Showing
66 changed files
with
13,791 additions
and
19,847 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 |
---|---|---|
@@ -0,0 +1,68 @@ | ||
|
||
name: CI/CD | ||
|
||
# Controls when the workflow will run | ||
on: | ||
# Triggers the workflow on push or pull request events for the main branch | ||
push: | ||
branches: [main] | ||
|
||
# Allows you to run this workflow manually from the Actions tab | ||
workflow_dispatch: | ||
|
||
jobs: | ||
backend-deploy: | ||
# The type of runner that the job will run on | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it | ||
- uses: actions/checkout@v3 | ||
|
||
# Deploy to Heroku | ||
- uses: akhileshns/[email protected] | ||
with: | ||
heroku_api_key: ${{secrets.HEROKU_API_KEY}} | ||
heroku_app_name: ${{secrets.HEROKU_APP_NAME}} | ||
heroku_email: ${{secrets.HEROKU_EMAIL}} | ||
appdir: "src/backend" | ||
env: | ||
DATABASE_HOST: ${{secrets.DATABASE_HOST}} | ||
DATABASE_NAME: ${{secrets.DATABASE_NAME}} | ||
DATABASE_PASSWORD: ${{secrets.DATABASE_PASSWORD}} | ||
DATABASE_PORT: ${{secrets.DATABASE_PORT}} | ||
DATABASE_USER: ${{secrets.DATABASE_USER}} | ||
|
||
frontend-build: | ||
# The type of runner that the job will run on | ||
runs-on: ubuntu-latest | ||
|
||
defaults: | ||
run: | ||
working-directory: src/frontend/Finding-Neno | ||
|
||
steps: | ||
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it | ||
- uses: actions/checkout@v3 | ||
|
||
- name: Setup Node | ||
uses: actions/setup-node@v3 | ||
with: | ||
node-version: 18.x | ||
cache: npm | ||
cache-dependency-path: '**/package-lock.json' | ||
|
||
- name: Setup EAS | ||
uses: expo/expo-github-action@v8 | ||
with: | ||
eas-version: 3.17.1 | ||
token: ${{ secrets.EXPO_TOKEN }} | ||
|
||
- name: Install dependencies | ||
run: npm install | ||
|
||
# Build the preview of the app | ||
- name: Build preview application | ||
run: | | ||
eas secret:create --name GOOGLE_MAPS_API_KEY --value ${{ secrets.GOOGLE_MAPS_API_KEY }} --type string --force --non-interactive | ||
eas build --profile preview --platform android --clear-cache --non-interactive |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
web: gunicorn api.main:app |
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,59 @@ | ||
# import requests | ||
|
||
# def get_suburb(location_latitude, location_longitude): | ||
# try: | ||
# api_url = f"https://nominatim.openstreetmap.org/reverse?lat={location_latitude}&lon={location_longitude}&format=geocodejson" | ||
|
||
# response = requests.get(api_url) | ||
|
||
# result = response.json() | ||
# print(result) | ||
# suburb = f"{result['address']['suburb']}, {result['address']['state']}" | ||
# return suburb | ||
|
||
# except requests.exceptions.RequestException as e: | ||
# print('Error fetching data:', e) | ||
|
||
# # Example usage | ||
# location_latitude = 123.456 # Replace with your latitude | ||
# location_longitude = 78.910 # Replace with your longitude | ||
# suburb = get_suburb(location_latitude, location_longitude) | ||
# print('Suburb:', suburb) | ||
|
||
from geopy.geocoders import Nominatim | ||
|
||
def get_suburb(latitude: float, longitude: float) -> str: | ||
""" | ||
Returns the suburb of the given latitude and longitude. left indicates the suburb (or city), right indicates the state. | ||
""" | ||
geolocator = Nominatim(user_agent="Finding_Neno") | ||
coordinates = f"{latitude}, {longitude}" | ||
address = geolocator.reverse(coordinates, addressdetails=True) | ||
|
||
if address is not None: | ||
address = address.raw["address"] | ||
left, right = None, None | ||
|
||
if "suburb" in address: | ||
left = address["suburb"] | ||
else: | ||
if "city" in address: | ||
left = address["city"] | ||
|
||
if "state" in address: | ||
right = address["state"] | ||
|
||
if right is not None: | ||
if left is not None: | ||
return f"{left}, {right}" | ||
else: | ||
return right | ||
else: | ||
if left is not None: | ||
return left | ||
|
||
else: | ||
print("Location not found") | ||
|
||
return "Location not available" | ||
|
Oops, something went wrong.