davidclarance / rabm

The `rabm` package provides an interface to the Africa Bird Atlas data.
https://davidclarance.github.io/rabm/
3 stars 1 forks source link

Safe pulls: Implement pull by year instead off one shot #7

Open davidclarance opened 5 years ago

davidclarance commented 5 years ago

There's a suggestion to have defaults as the entire date range. Implementing this in the current functions will increase server utilization by a lot. This isn't healthy for the server and the package. Therefore we need to break requests by year instead of pull it all at once and then combine it inside the function.

bluehill commented 5 years ago

Internal data breaks are a good idea, but currently the extract_species function is within data call parameters: the most data intensive species call which is for all time available for cape turtle dove for south africa: this returns 150 000 records: so the function is still well within margin's of good etiquette (<250 000). Reproducible example: ctdove_raw_records <- extract_species(

species_ids = 316, start_date = '2007-01-01', end_date = '2019-09-01', region_type = 'country', region_id = 'southafrica'

)

Happy coding :)

davidclarance commented 5 years ago

Great point and thanks for the example. I think I'll still do it for three reasons:

I think the addition is simple, can be used across all the extract functions and provides a safety net.