metaxy / churchtools-memberlist

Generate membership directory and other reports via ChurchTools API

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Reporting via Churchtools API

Python script to create documents via Churchtools API.

  • Member list
  • Prayer list
  • Checkin form
  • Attendance report

Initial Setup

  • Copy .env.sample to .env, and adjust to your setup.

  • Copy template.sample.odt to template.odt and adjust to your preferences (Use LibreOffice to modify the template).

  • Install Python 3

  • Create a virtual env for this project, and activate the venv. More information

  • Install Python dependencies:

    • pip install -r requirements.txt
  • Rename template_prayerlist_example.odt to template_prayerlist.odt

Install on ubuntu

apt install python3 python3-full python3-dotenv
python3 -m venv ~/.local --system-site-packages
~/.local/bin/pip install -r requirements.txt

Usage

Any of the below commands will create odt output files. Use LibreOffice to preview or postprocess them, or generate a PDF of it.

You can also use the command line to generate a PDF: libreoffice --convert-to pdf --outdir . input.odt

Member list

Creates a membership directory.

./create-memberlist.py \
    --filter-group <group_id> \
    [--template template_memberlist.odt] \
    [--output memberlist.odt]
./create-memberlist.py \
    --filter-status <status_id> \
    [--template template_memberlist.odt] \
    [--output memberlist.odt]

The --filter-group and --filter-status param is used to filter by a certain group/status.

Prayer list

Creates a prayer list (similiar to membership directory, but different layout). Can be filtered to include only part of the members using --surname-from and surname-to arguments.

./create-prayerlist.py \
    [--surname-from <letter>] \
    [--surname-to <letter>] \
    [--template template_prayerlist.odt] \
    [--output prayerlist.odt]

Checkin form

Create a checkin form. This assumes you have two groups: Members and regular visitors. The regular visitors group can be filtered to include only certain roles from that group.

./create-checkinform.py \
    --group-members <group_id> \
    --group-regularvisitors <group_id> \
    --role-id-regularvisitors <role_id> \
    [--template template_checkinform.odt] \
    [--output checkinform.odt]

Attendance report

Generate an attendance report.

./create-attendancereport.py \
    --group-members <group_id> \
    --group-regular-visitors <group_id> \
    --role-id-regularvisitors <role_id> \
    --group-visitors <group_id> \
    --role-id-visitors <role_id> \
    --date YYYY-MM-DD \
    [--template template_attendancereport.odt] \
    [--output attendancereport.odt]

Getting a login token

Find your ChurchTools API documentation / playground here: <mychurch>.church.tools/api

To retrieve a login token, first find your user ID using the GET /persons API.

Then use the GET /persons/{id}/logintoken API to get your login token.

About

Generate membership directory and other reports via ChurchTools API

License:MIT License


Languages

Language:Python 100.0%