Skip to content

DBC22-1484: Added weather models and API endpoints #273

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

Merged
merged 3 commits into from
Feb 13, 2024

Conversation

bcgov-brwang
Copy link
Collaborator

DBC22-1484: Added weather models and API endpoints

Created API endpoint /api/weather/regional for retrieving areas regional current conditions and forecasts.

Local test URL:

http://localhost:8000/api/weather/regional

Please add the following variables in .env for accessing SAWSx API.

DRIVEBC_WEATHER_API_BASE_URL=https://sawsx-services-dev-api-gov-bc-ca.test.api.gov.bc.ca/api/v1/ec/cityforecast/
DRIVEBC_WEATHER_API_TOKEN_URL=https://dev.loginproxy.gov.bc.ca/auth/realms/apigw/protocol/openid-connect/token/
WEATHER_CLIENT_ID=
WEATHER_CLIENT_SECRET=
DRIVEBC_WEATHER_AREAS_API_BASE_URL=https://sawsx-services-dev-api-gov-bc-ca.test.api.gov.bc.ca/api/v1/ec/list/fcstareas

@ray-oxd
Copy link
Collaborator

ray-oxd commented Feb 7, 2024

I can't test this at the moment - getting {'error': 'Error obtaining access token: 400 Client Error: Bad Request for url: https://dev.loginproxy.gov.bc.ca/auth/realms/apigw/protocol/openid-connect/token/'}. Do we have a public/production endpoint I can access without VPN?

Also, can we store location as one pointfield instead of separate string columns? Storing it like this prevents any kind of spatial queries, and also further transformation is required before our FE can make use of it.

@bcgov-brwang
Copy link
Collaborator Author

bcgov-brwang commented Feb 7, 2024

I can't test this at the moment - getting {'error': 'Error obtaining access token: 400 Client Error: Bad Request for url: https://dev.loginproxy.gov.bc.ca/auth/realms/apigw/protocol/openid-connect/token/'}. Do we have a public/production endpoint I can access without VPN?

Also, can we store location as one pointfield instead of separate string columns? Storing it like this prevents any kind of spatial queries, and also further transformation is required before our FE can make use of it.

I tried this endpoint without connecting VPN and it works. Probably it was caused by the client id and client secret. This token endpoint comes from dev keycloak server, so we still have no endpoints from production yet.

I will look into if we can use pointfield as location storage. Thanks.

@ray-oxd
Copy link
Collaborator

ray-oxd commented Feb 8, 2024

Thanks @bcgov-brwang, ping one of the devs to message me on Slack when it's ready again.

I've copied the ID and secret, please remove/edit them out of your previous comment.

@bcgov-brwang
Copy link
Collaborator Author

Thanks @bcgov-brwang, ping one of the devs to message me on Slack when it's ready again.

I've copied the ID and secret, please remove/edit them out of your previous comment.

I've updated the model to use PointField for location, but I kept two columns location_latitude and location_longitude in the database. These columns won't be returned in the response, just make it easy to populate the location point and keep the tracking if any issues, because the original value returned from SAWSx api for latitude and longitude are something like this "51.65N" and "120.03W". Thanks.

@ray-oxd ray-oxd force-pushed the feature/DBC22-1484-2 branch from 7f06dac to 93767d3 Compare February 13, 2024 08:27
@fatbird fatbird merged commit c6493e8 into main Feb 13, 2024
@ray-oxd ray-oxd deleted the feature/DBC22-1484-2 branch February 14, 2024 05:29
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

Successfully merging this pull request may close these issues.

3 participants