pyronear / pyro-api

Alert Management API for wildfire prevention, detection & monitoring. Built with FastAPI & PostgreSQL
Apache License 2.0
21 stars 9 forks source link

Add start_date, end_date & pagination parameters #324

Open RonanMorgan opened 4 months ago

RonanMorgan commented 4 months ago

In order to facilitate data science management I have refactored the endpoint "fetch_media" : I have added a start_date, an end_date to gather images during this time period and a pagination parameter in order to get images 10 by ten

=> still need to adapt pyro-client and to add test in the client part

codecov[bot] commented 4 months ago

Codecov Report

Attention: Patch coverage is 91.66667% with 2 lines in your changes are missing coverage. Please review.

Project coverage is 94.27%. Comparing base (767be30) to head (571e3c5).

Files Patch % Lines
src/app/api/endpoints/media.py 88.23% 2 Missing :warning:
Additional details and impacted files ```diff @@ Coverage Diff @@ ## main #324 +/- ## ========================================== - Coverage 94.54% 94.27% -0.27% ========================================== Files 63 66 +3 Lines 1594 1695 +101 ========================================== + Hits 1507 1598 +91 - Misses 87 97 +10 ``` | [Flag](https://app.codecov.io/gh/pyronear/pyro-api/pull/324/flags?src=pr&el=flags&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=pyronear) | Coverage Δ | | |---|---|---| | [client](https://app.codecov.io/gh/pyronear/pyro-api/pull/324/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=pyronear) | `90.58% <ø> (?)` | | | [unittests](https://app.codecov.io/gh/pyronear/pyro-api/pull/324/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=pyronear) | `94.47% <91.66%> (-0.07%)` | :arrow_down: | Flags with carried forward coverage won't be shown. [Click here](https://docs.codecov.io/docs/carryforward-flags?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=pyronear#carryforward-flags-in-the-pull-request-comment) to find out more.

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

RonanMorgan commented 4 months ago

some thoughts / questions : => this PR is useless, I should I have implemented the pagination code in the client part, not in the API part, no ? => Can I add the boto dependency in the client ? => instead of using fetch_media I should have used get_media_url => Mateo needs Alerts + URL

frgfm commented 2 months ago

I think the pagination idea is great for all the "fetch" routes, perhaps we should revisit this for all endpoints. Some rebasing is needed first though :sweat_smile:

RonanMorgan commented 2 months ago

Yes I will go back to this pagination after the end of the big refactor :) I think I will create a brand new PR