CSV file

Hello Everyone, I am new to RASA. Is it possible to read time series data with rasa bot? I have time series data in csv file. How can i give csv file directly for rasa bot?

Welcome Sruthin,

Can you explain more about how you want the bot to use the time series data? Is the data required to respond to a user question?

Greg

Hello Greg, Thank you for your reply. I have a CSV file with two types of sensor readings along with timestamps. Sample view of the table represented below. Now I want to design a chatbot using rasa, which should be able to read sensor values. If the user asks, what is the temperature, the rasabot must see the latest value inside the temperature column and display the temperature. and i would like to give an optimal temperature range (for example 25 to 40 degrees). If chatbot observes any temperature value outside the optimal value, it must warn the user.

example conversation: User: hey bot, could you say what is the latest temperature Bot: The latest temperature is 42.2. Temperature is outside of limits, there might be a problem with the temperature sensor.

This is the example scenario for my use case. Does it possible to read the time series data with rasabot? Can you please explain how to connect rasabot with CSV fileCapture1

hey @Sruthin your csv file is going to be dynamic?? means it will going to change over the time so if the data is appending in same file then you can use pandas library in python and from that you can always fetch first row and show your data to user

Thank you buddy for reply Yes, it will be dynamic. Can i use panads library in rasa? If possible can send some link which explains using csv file in rasa.

Hello, You can do like the following.

import csv
    class ActionHelloWorld(Action):
        def name(self) -> Text:
            return "action_hello_world"

        def run(self, dispatcher: CollectingDispatcher,
                tracker: Tracker,
                domain: Dict[Text, Any]) -> List[Dict[Text, Any]]:
     #Get Input from user
      limit = tracker.latest_message['text'].
       
      with open('location for your csv //Test.csv', 'r') as file:
               reader = list(csv.reader(file))
        
        for row in reader[:limit]:
                print("In Row")
                dispatcher.utter_message(text=row[1])
            return [] 

It is not the same code but you will get the idea.

Yes, you can use Pandas library in rasa.

I hope this helps!!