Skip to content

feature : ajout des fonctions pour l'ingestion API#13

Closed
alexpetit wants to merge 2 commits intodataforgoodfr:mainfrom
alexpetit:main
Closed

feature : ajout des fonctions pour l'ingestion API#13
alexpetit wants to merge 2 commits intodataforgoodfr:mainfrom
alexpetit:main

Conversation

@alexpetit
Copy link
Copy Markdown
Contributor

Ajout des fonctions pour requeter l'API et renommer au bon format. Fonctions non-intégrés dans observation.py pour le moment

Copy link
Copy Markdown
Collaborator

@cgoudet cgoudet left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sur le fond pas de problèmes.

Quelques commentaires sur le style.

D'ailleurs le pre-commit fail. Tu peux installer via uv run pre-commit install puis lancer uv run pre-commit run --all.

import polars as pl
import requests

###Test export from API
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Commentaire inutile

def fetch_biolit_api(per_page: int = 1000):
all_data = []
page = 1
print("Téléchargement des données depuis l'API Biolit...")
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Passer ca en logging. Pareil plus bas dans le code.


###Test export from API

def fetch_biolit_api(per_page: int = 1000):
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Peux tu ajouter le typage de l'output

return df


def adapt_api_to_parquet_schema(df):
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

typage des input/output

"espece": "nom_scientifique",
"common": "nom_commun",
})
.with_columns([
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

pas besoin de [] pour plusieurs éléments de with_columns

df_api = fetch_biolit_api()
if df_api.is_empty():
return df_api
print(adapt_api_to_parquet_schema(df_api).head())
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Dead code

…PI, ajout de test(limite aux 5 premieres pages pour le moment)
@alexpetit alexpetit closed this Mar 17, 2026
@alexpetit
Copy link
Copy Markdown
Contributor Author

J’ai créé une nouvelle branche avec les fixes pre-commit : #18

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.

2 participants