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

add : get_score(lat, lon) #79

Merged
merged 27 commits into from
Jun 24, 2024
Merged

add : get_score(lat, lon) #79

merged 27 commits into from
Jun 24, 2024

Conversation

GHCamille
Copy link
Collaborator

Add function to get the fwi score for a specific lat lon.

Camille Modeste and others added 24 commits October 20, 2023 17:51
use environment variables for connection
improve readability and handle empty buckets
- restructure task
- add retrieved_date option
lint & remove `pip install -r requirements.txt` step.
add localstack guidelines
@Acruve15
Copy link
Collaborator

Hey @GHCamille 👋🏼

I have an additional question. How is this function expected to be used? Will @MateoLostanlen add the pyro-risk repo to the app backend directly? Or something else (using the API for example)

Thx 😃

Co-authored-by: Alexis Cruveiller <33450491+Acruve15@users.noreply.github.com>
@GHCamille
Copy link
Collaborator Author

I'm not sure how @MateoLostanlen wants to use it ! @MateoLostanlen any ideas ?

@MateoLostanlen
Copy link
Member

Hello @Acruve15 @GHCamille, Hi, there,

Sorry for the late reply, ideally the less you install on the pi the better. Especially since installing a whole repo for one request doesn't seem very adapted. The best thing would be to deploy a small api that the pi can easily call. Is that feasible for you?
Do you need help ?

@MateoLostanlen
Copy link
Member

MateoLostanlen commented Jun 6, 2024

smothing like this :

import requests

def get_risk_score(lat, lon):
    url = "https://example.com/risk_score"
    params = {
        'lat': lat,
        'lon': lon
    }
    
    try:
        response = requests.get(url, params=params)
        response.raise_for_status()  # Check if the request failed
        data = response.json()  # Assume the API returns a JSON response
        return data['risk_score']  # Assume the risk score is under the 'risk_score' key
    except requests.exceptions.RequestException as e:
        print(f"An error occurred: {e}")
        return None

@Acruve15 Acruve15 merged commit c75299d into master Jun 24, 2024
2 of 10 checks passed
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