Skip to content

Commit

Permalink
Get patrols and their observations in the same method (#199)
Browse files Browse the repository at this point in the history
  • Loading branch information
Yun-Wu authored Jul 17, 2024
1 parent 1f59817 commit 8d6d70a
Showing 1 changed file with 29 additions and 0 deletions.
29 changes: 29 additions & 0 deletions ecoscope/io/earthranger.py
Original file line number Diff line number Diff line change
Expand Up @@ -725,6 +725,35 @@ def get_patrol_segments(self):
self.get_objects_multithreaded(object=object, threads=self.tcp_limit, page_size=self.sub_page_size)
)

def get_patrol_observations_with_patrol_filter(
self, since=None, until=None, patrol_type=None, status=None, include_patrol_details=False, **kwargs
):
"""
Download observations for patrols with provided filters.
Parameters
----------
since:
lower date range
until:
upper date range
patrol_type:
Comma-separated list of type of patrol UUID
status
Comma-separated list of 'scheduled'/'active'/'overdue'/'done'/'cancelled'
include_patrol_details : bool, optional
Whether to merge patrol details into dataframe
kwargs
Additional parameters to pass to `get_subject_observations`.
Returns
-------
relocations : ecoscope.base.Relocations
"""

patrols_df = self.get_patrols(since=since, until=until, patrol_type=patrol_type, status=status, **kwargs)
return self.get_patrol_observations(patrols_df, include_patrol_details=include_patrol_details, **kwargs)

def get_patrol_observations(self, patrols_df, include_patrol_details=False, **kwargs):
"""
Download observations for provided `patrols_df`.
Expand Down

0 comments on commit 8d6d70a

Please sign in to comment.