Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add basic RapidPro syncing. #522

Merged
merged 6 commits into from
Mar 20, 2019
Merged

Add basic RapidPro syncing. #522

merged 6 commits into from
Mar 20, 2019

Conversation

toolness
Copy link
Collaborator

@toolness toolness commented Mar 20, 2019

This adds basic syncing with RapidPro, so that our user statistics export can associate outcomes (represented by RapidPro Contact Groups) with users.

The syncing is performed via python manage.py syncrapidpro, which will need to be run on a regular basis. An optional --full-resync flag can be passed, which will take longer but guarantees more accurate syncing.

Limitations

  • This doesn't actually add anything to the user statistics CSV, that will need to be done in a future PR.

  • Right now this doesn't update Contact Group names if they change, since this would be unusual and the effect of showing a stale group name shouldn't be catastrophic (it's not like we're going to rename the "Tenant wants to file an HP action" group to "Tenant is totally happy with their situation"). We now deal with contact group renames in a decent way.

  • The syncing mechanism doesn't currently account for users who might have been in RapidPro before they were tenant app users. For example, if they used the rental history text bot to request their rental history and then signed up for the tenant app, their synced contact group information wouldn't be accurate until they did something in RapidPro to mark their user record as "modified", thereby forcing the initial sync of their info.

    We could probably fix this by, say, finding all users who have been created since the last time we synced, and explicitly doing a full sync of their information. Alternatively, we could just do a --full-resync on a regular but more infrequent basis, which also takes care of this.

  • The syncing attempts to remember when a user might have been added to a RapidPro Contact Group by storing the first time it saw a user be in a group. This won't necessarily be the date the user actually was associated with the group, but hopefully it will be useful in the future.

To do

  • Add tests.

@toolness toolness marked this pull request as ready for review March 20, 2019 11:02
@toolness toolness merged commit f434af8 into master Mar 20, 2019
@toolness toolness deleted the rapidpro branch March 20, 2019 11:03
@toolness toolness changed the title [WIP] Add basic RapidPro syncing. Add basic RapidPro syncing. Mar 20, 2019
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.

1 participant