GlobalFishingWatch / gfwr

R package for accessing data from Global Fishing Watch APIs
https://globalfishingwatch.github.io/gfwr/
Apache License 2.0
58 stars 7 forks source link

Adjust Search Start and End Handling #92

Closed adeloera closed 1 year ago

adeloera commented 1 year ago

Hi! I am a huge fan of GFWR and have been working with it for the last several months. I have a few suggestions for things that would be helpful additions or modifications, though of course I recognize that these may be too big of asks. Apologies if it is inappropriate, but I think this is in the purview of the contribution guide.

Currently, I believe the start_date and end_date given to the get_events function are hard bounds: the function will return events which begin after 12:00am on the start date and end before midnight preceding the end date. I think it would be useful to have some way to extract all the events that had some time between the start and end date, regardless of whether the entire event occurred between those bounds. Currently, if I do a get_events calls from 2020-01-05 to 2020-01-10 I would not get any events which, say, began on 2020-01-04 but continued into the period or any events which began during the period and ended after. For my purposes this makes it difficult to loop over dates to extract events, since events are lost if they don't fit entire between date ranges. I can also imagine this being problematic for other stakeholders: if I want to see fishing effort on a certain day, it might be uninformative to show only those fishing events that began and ended in that same day. One fix to at least allow for looping over dates would be to return all events which began between the start and end date, though admittedly this would still miss some events that occurred partially during the time period.

Anyway, just wanted to flag this as a potential improvement to an already really great public good! Thank you!

tclavelle commented 1 year ago

@natemiller @rociojoo Slack thread describing the change in the APIs.

adeloera commented 1 year ago

Has the handling of the get_events function changed?

giselamo commented 1 year ago

@adeloera yes, it was implemented. For example if you search for the vessel id 8c7304226-6c71-edbe-0b63-c246734b3c01, loitering events from start-date=2020-05-07 and end-date=2020-06-04, you will get a loitering event with "start": "2020-05-06T21:57:30.000Z" and "end": "2020-05-09T06:59:25.000Z". Please let us know if you don't see it on your end.

adeloera commented 1 year ago

@giselamo I get the same result, thanks! If easy to implement it would be useful to be able to specify whether the function uses hard bounds or not. For example I am looping over several months trying to extract the fishing events. To make sure I get them all it would be great is the function returned every event that began in each month, even if it didn't end in it, but I also don't want to double count events that began in January and ended in February. So at least for that purpose it would be useful to specify a "hard" start bound and a "soft" end bound.

tclavelle commented 1 year ago

Closing for now, @giselamo as this is more of an API feature request rather than a specific gfwr issue.

giselamo commented 6 months ago

Added in our API and Data feedback board for planning https://feedback.globalfishingwatch.org/data-requests/p/filtering-event-dates