The goal for this project is to easily export members of all active groups from Planning Center Online (PCO) so that we may perform some analysis and reporting on the data.
This python script:
- Gets all active groups
- Gets the members for each group
- Gets the person data for each member
- Gets the geolocation of the person (using Google APIs)
- Performs a distance calculation for the members in the group
- Exports it all to a CSV
The CSV will include the following columns:
- First Name
- Last Name
- Gender
- Birthdate
- City
- State
- Zip
- Location Long
- Location Lat
- Distance to Group
- Marital Status
- Membership
- Status
- Person Record Updated
- Person Record Created
- Joined Group At
- Role
- Group
- Group Location
- Group Long
- Group Lat
Before we begin, you'll need Python installed, obviously ;)
Install the following libraries:
pip install requests
pip install geopy
Learn more about requests and geopy.
You have to create your own config.py
file to store your API keys. Don't worry, this file is not included in the repo. Copy and paste the following into your config file:
API_USERNAME = 'specify your user name'
API_PASSWORD = 'specify your password'
GOOGLE_APIKEY = 'specify your Google API key'
Optionally, you can also specify the unit distance used in the calculations (default is miles, available options listed here):
UNIT = 'km'
Learn how to obtain a Google API Key.
NOTE The config.py file is ignored by git.
Simply run the exportGroupMembers.py
python exportGroupMembers.py
As it runs, it'll share each group name and member name in the console, along with each API call being made, just for reference.
This script will export the contents to groupsExport.csv
. This file is not included in the git repo.
You will find the Postman file in the folder \postman
for each PCO and Google API call. Learn more about Postman.
This repo, like much on github came from a need. My name is David Lozzi, I volunteer at my church and recently we moved to PCO from CCB. After we settled into PCO, we wanted to learn more about our Groups and the span and reach of them, along with a way to analyze the data to identify areas for improvement, i.e. new locations, better times, etc.
I greatly welcome any contributions and improvements!
I adore those who want to support the community. Please do contribute! Simply fork from this repo, do your thing, and submit a pull request!