Skip to content

Toolkit for using spreadsheets to create and modify RapidPro flows

License

Notifications You must be signed in to change notification settings

IDEMSInternational/rapidpro-flow-toolkit

Repository files navigation

RapidPro Flow Toolkit

Toolkit for using spreadsheets to create and modify RapidPro flows.

Quickstart

pip install rpft
rpft --help

Command Line Interface (CLI)

The CLI supports the following subcommands:

  • create_flows: create RapidPro flows (in JSON format) from spreadsheets using content index
  • flows_to_sheets: convert RapidPro flows (in JSON format) into spreadsheets
  • convert: save input spreadsheets as JSON
  • save_data_sheets: save input spreadsheets as nested JSON using content index - an experimental feature that is likely to change.

Full details of the available options for each can be found via the help feature:

rpft <subcommand> --help

Examples

Below is a concrete example of a valid execution of the command line tool using create_flows to convert a set of spreadsheets into RapidPro flows. The line breaks are merely for improving readability; the command would also be valid on a single line.

cd tests/input/example1
PYTHONPATH=. rpft create_flows \
  --output flows.json \
  --datamodels=nestedmodel \
  --format=csv \
  csv_workbook

The following is an example of the flows_to_sheets operation, essentially the reverse of create_flows.

mkdir output
rpft flows_to_sheets tests/output/all_test_flows.json output --strip_uuids

Using the toolkit in other Python projects

  1. Add the package rpft as a dependency of your project e.g. in requirements.txt or pyproject.toml
  2. Import the create_flows function
  3. Call create_flows to convert spreadsheets to flows
from rpft.converters import create_flows

sources = ["workbook.xlsx", "csv_workbook"]
create_flows(
    sources, "flows.json", "csv", data_models="your_project.models"
)

It should be noted that this project is still considered beta software that may change significantly at any time.

RapidPro flow spreadsheet format

The expected contents of the input spreadsheets is documented separately:

Google Sheets integration

The toolkit can fetch spreadsheets from Google Sheets. See the setup instructions for details.

Development

For instructions on how to set up your development environment for developing the toolkit, see the development page.

About

Toolkit for using spreadsheets to create and modify RapidPro flows

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages