/pco-export-data

Exports data from Planning Center Online

Primary LanguagePythonMIT LicenseMIT

PCO Group Member Exports Overview

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:

  1. Gets all active groups
  2. Gets the members for each group
  3. Gets the person data for each member
  4. Gets the geolocation of the person (using Google APIs)
  5. Performs a distance calculation for the members in the group
  6. Exports it all to a CSV

The CSV will include the following columns:

  • First Name PCO People
  • Last Name PCO People
  • Gender PCO People
  • Birthdate PCO People
  • City PCO People
  • State PCO People
  • Zip PCO People
  • Location Long Google Maps
  • Location Lat Google Maps
  • Distance to Group
  • Marital Status PCO People
  • Membership PCO People
  • Status PCO People
  • Person Record Updated PCO People
  • Person Record Created PCO People
  • Joined Group At PCO People
  • Role PCO People
  • Group PCO People
  • Group Location PCO People
  • Group Long PCO People
  • Group Lat PCO People

Setup

Install Libraries

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.

Setup Configuration

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.

Using the Script

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.

Postman Scripts

You will find the Postman file in the folder \postman for each PCO and Google API call. Learn more about Postman.

About

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!

Contributing

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!