Entity extraction Implementing checkboxes in forms

Hello there,

Regarding Rasa 2.0

I’m trying to build a bot that would collect symptoms experienced by users using a form and store them in a database. The prompt is:

  • text: “Which among these symptoms are you experiencing? If more than one, separate symptoms with a comma (e.g. loss of taste, sore throat)?”

How exactly will these slots be extracted? I thought about assigning the following roles in the Domain file under Slots so later on, I can also assign 1 column per symptom to the database.

symptoms:

- type: from_entity

  entity: symptoms

  role: symptom1

- type: from_entity

  entity: symptoms

  role: symptom2

- type: from_entity

  entity: symptoms

  role: symptom3

- type: from_entity

  entity: symptoms

  role: symptom4

- type: from_entity

  entity: symptoms

  role: symptom5

Hi @chiqui_hm,

You may be interested in a custom validation method. You could use from_text and process the list by separating on commas.

For incorporating checkboxes, it would depend on the channel you intend to deploy the bot. This would be handled using custom json payloads. To which platforms do you intend to share the bot?

Hi @kearnsw

Thanks for the suggestion. I’ll look into the custom validation method.

Will be sharing the bot via Slack so I can use Interactive components.

The Slack InputChannel extracts interactive responses into the message text field. Although, I don’t see checklist in the list of interactive components in the method below:


   @staticmethod
    def _get_interactive_response(action: Dict) -> Optional[Text]:
        """Parse the payload for the response value."""

        if action["type"] == "button":
            return action.get("value")
        elif action["type"] == "select":
            return action.get("selected_options", [{}])[0].get("value")
        elif action["type"] == "static_select":
            return action.get("selected_option", {}).get("value")
        elif action["type"] == "external_select":
            return action.get("selected_option", {}).get("value")
        elif action["type"] == "conversations_select":
            return action.get("selected_conversation")
        elif action["type"] == "users_select":
            return action.get("selected_user")
        elif action["type"] == "channels_select":
            return action.get("selected_channel")
        elif action["type"] == "overflow":
            return action.get("selected_option", {}).get("value")
        elif action["type"] == "datepicker":
            return action.get("selected_date")

Take a look at the text of the user message stored in the tracker:

tracker.latest_message['text'].

or through rasa run —debug

If it’s blank, you should raise an issue on GitHub. You can make the change in rasa.core.channels.slack and submit a pull request. Let us know if you need any other help!

These are the supported interactive response types:


supported = [
            "button",
            "select",
            "static_select",
            "external_select",
            "conversations_select",
            "users_select",
            "channels_select",
            "overflow",
            "datepicker",
        ]

Hopefully checklist falls under one of the select options.