opensrp/opensrp-client-chw-anc

Send information to RapidPro pushing a mother through a flow based on ANC registration

Closed this issue · 2 comments

When a mother is registered for ANC:

  • The form values sent would have to the mother's base-entity-id and phone_number and head of family's base-entity and phone number and start the flow ANC Registration- Flow ID: 02fb73e6-3319-4349-90e3-e73b7aa673dd
  • The form would also have to send the following form values: edd, lmp, gest_age

@msschroeder what kind of link are we looking to have? we already have this link within the OpenSRP application

The following payload is posted to the flow

    "flow": "anc_registration_flow_uuid",
    "contacts": ["rapidpro_contact_uuid"],
    "extra": {"edd": "edd", 
              "lmp": "lmp", 
              "gest_age": "gest_age",
              "family_head_base_entity_id": "family_head",
              "family_head_phone_number": "familyHeadPhoneNumber"
             }
}

The primary_caregivers number is not passed since this can be obtained from the contact's rapidpro variable (@contact.urn.tel)

The family_head_base_entity_id is always passed, but the phone number is only passed if this individual has their own unique rapidpro contact. The reason I didn't pass the phone number is because this number is possibly shared with the primary_caregiver. So you'd inadvertently be triggering the secondary flow against the wrong individual.
The family_head_base_entity_id also technically doesn't need to be passed because we can retrieve it from the contacts head_household field.

To use the variables in the extra field within the rapidpro flows use the @trigger variable. For example to reference lmp, use @trigger.params.lmp. You'd need to manually specify the specific field name.

Nifi Flow