Skip to content

Action Network: add more useful functions#74

Merged
scwikla merged 7 commits intomainfrom
action_network_additions
Jun 17, 2025
Merged

Action Network: add more useful functions#74
scwikla merged 7 commits intomainfrom
action_network_additions

Conversation

@KeshSridhar
Copy link
Copy Markdown
Contributor

Checklist for this pull request:

  • I have added docstrings to my additions if needed
  • I have added the module to docs/index.rst if it is completely new

Description:

Adding reusable functions for the Action Network API. Functions include:

  • extract_action_network_id: parses through a person record's Action Network identifiers and grabs just the Action Network ID

  • create_people_dataframe: Returns a pandas dataframe given an iterable of Action Network people from the Action Network people API endpoint

  • paginate_endpoint: Pagination helper for Action Network API endpoints

  • fetch_related_people: Given a resource dict (i.e. a submission or signup), fetches all related people records

…ople_dataframe, paginate_endpoint, and fetch_related_people
Copy link
Copy Markdown
Contributor

@scwikla scwikla left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

going to look at this more closely today. off the bat, we will need to add tests in addition to any code changes. stac-utils a little harder core

@KeshSridhar
Copy link
Copy Markdown
Contributor Author

going to look at this more closely today. off the bat, we will need to add tests in addition to any code changes. stac-utils a little harder core

Added some really basic unit tests for core functionality, for each function. Let me know if you want more coverage here

@codecov
Copy link
Copy Markdown

codecov bot commented Jun 11, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 95.67%. Comparing base (4990da8) to head (e39303c).
Report is 9 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main      #74      +/-   ##
==========================================
+ Coverage   95.48%   95.67%   +0.19%     
==========================================
  Files          25       25              
  Lines        1062     1109      +47     
  Branches      122      131       +9     
==========================================
+ Hits         1014     1061      +47     
  Misses         36       36              
  Partials       12       12              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@scwikla
Copy link
Copy Markdown
Contributor

scwikla commented Jun 16, 2025

if it's alright, would you mind looking @DarrFranco ? just because these are utils would like better engineering eyes in case i don't see something

return pd.DataFrame(rows)

def paginate_endpoint(
self, base_endpoint: str, embedded_key: str, max_pages: int = None, **kwargs
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think if we know payloads/responses are consistent these look fine

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

They should be. Person fields from: https://actionnetwork.org/docs/v2/people/

full_endpoint = f"{base_endpoint}?page={page}"
data = self.get(full_endpoint, **kwargs)

embedded = data.get("_embedded", {})
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same for this, I think if we always have these specific things we look for (ie: '_embedded") it should be fine

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For all endpoints that return some sort of collection of items (forms, submissions, events, etc), they should always have a "_embedded" field, from what I can see from the documentation: https://actionnetwork.org/docs/v2

Copy link
Copy Markdown
Contributor

@scwikla scwikla left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok see the dennis comments have been addressed - will approve but let engineering merge @KeshSridhar

@scwikla scwikla merged commit aedb646 into main Jun 17, 2025
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants