Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add patrol start time to get_patrol_events #350

Merged
merged 38 commits into from
Dec 4, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
38 commits
Select commit Hold shift + click to select a range
0290ab0
flag io tests
atmorling Nov 28, 2024
ea33cf4
Merge remote-tracking branch 'upstream/master' into test_overhaul
atmorling Nov 28, 2024
d1f6fd1
tentative workflow rework
atmorling Nov 28, 2024
71228f3
slightly less tentative
atmorling Nov 28, 2024
f84f629
no need to be doing er io in base tests
atmorling Nov 28, 2024
fc97056
proximity doesn't need to do er io
atmorling Nov 28, 2024
94f7098
fix filename typo
atmorling Nov 28, 2024
55eff95
forgot to remove skip
atmorling Nov 28, 2024
b873b5d
param was lost in merge
atmorling Nov 28, 2024
d2571f4
needs a string wrapper
atmorling Nov 28, 2024
4a40663
remove caching just to see what happens
atmorling Nov 29, 2024
a09b6fd
fail a test to verify workflow
atmorling Nov 29, 2024
bdd3dd7
forgot to add mark
atmorling Nov 29, 2024
de5a02c
can revert test failure I think
atmorling Nov 29, 2024
ba74bba
fix syntax
atmorling Nov 29, 2024
028100d
inherit secrets
atmorling Nov 29, 2024
a1a6372
re-add env caching
atmorling Nov 29, 2024
deb357c
is this even required
atmorling Nov 29, 2024
d0604ec
-e
atmorling Nov 29, 2024
78d3d48
is pip the problem
atmorling Nov 29, 2024
8ea30eb
revert- we need mamba for gdal
atmorling Nov 29, 2024
74d014a
schedule io tests
atmorling Dec 2, 2024
1ae5718
rework os level tests
atmorling Dec 2, 2024
896e66e
typo
atmorling Dec 2, 2024
3505ffe
this isn't a var anymore
atmorling Dec 2, 2024
a7e9dcd
should cover io utils
atmorling Dec 3, 2024
796ef6b
add ee tools
atmorling Dec 3, 2024
5c9cf91
seasons requires gee io
atmorling Dec 3, 2024
30316f3
remove skips
atmorling Dec 3, 2024
7ff8906
now it's a seperate ci, let's just run io all the time
atmorling Dec 3, 2024
2c2397d
give daily test a more descriptive name
atmorling Dec 3, 2024
664a48e
Merge branch 'master' into test_overhaul
atmorling Dec 3, 2024
36b9384
update to daily
atmorling Dec 3, 2024
e72146f
Merge branch 'master' into test_overhaul
atmorling Dec 3, 2024
140fa74
conftest update
atmorling Dec 3, 2024
59a9c9a
add patrol_start_time to get_patrol_events
atmorling Dec 3, 2024
ecc19e4
add test for get_patrol_observations_with_patrol_filter
atmorling Dec 3, 2024
0a5f4e2
Merge branch 'master' into am/patrol_start_time
atmorling Dec 4, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions ecoscope/io/earthranger.py
Original file line number Diff line number Diff line change
Expand Up @@ -743,6 +743,7 @@ def get_patrol_events(
for event in segment.get("events", []):
event["patrol_id"] = row.get("id")
event["patrol_segment_id"] = segment.get("id")
event["patrol_start_time"] = (segment.get("time_range") or {}).get("start_time")
events.append(event)
events_df = pd.DataFrame(events)
if events_df.empty:
Expand Down
17 changes: 17 additions & 0 deletions tests/test_earthranger_io.py
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,7 @@ def test_get_patrol_events(er_io):
assert "geometry" in events
assert "patrol_id" in events
assert "patrol_segment_id" in events
assert "patrol_start_time" in events
assert "time" in events


Expand Down Expand Up @@ -339,3 +340,19 @@ def test_existing_token_expired(er_io):

with pytest.raises(ERClientException, match="Authorization token is invalid or expired."):
ecoscope.io.EarthRangerIO(service_root=er_io.service_root, token_url=er_io.token_url, token=token)


def test_get_patrol_observations_with_patrol_filter(er_io):
observations = er_io.get_patrol_observations_with_patrol_filter(
since=pd.Timestamp("2017-01-01").isoformat(),
until=pd.Timestamp("2017-04-01").isoformat(),
patrol_type_value="ecoscope_patrol",
status=["done"],
include_patrol_details=True,
)

assert not observations.empty
assert "patrol_id" in observations.columns
assert "patrol_title" in observations.columns
assert "patrol_start_time" in observations.columns
pd.testing.assert_series_equal(observations["patrol_id"], observations["groupby_col"], check_names=False)
Loading