Medical bot do not recognize action

why when ı run my action the server did not recognize the actions and my code like that :

eqxu-aw4f is for hospitals

np3k-uatv is for nursing homes

9wzi-peqs is for home health agencies

ENDPOINTS = { “base”: “https://data.medicare.gov/resource/{}.json”,

"eqxu-aw4f": {
    "city_query": "?city={}",
    "zip_code_query": "?zip_code={}",
    "id_query": "?provider_id={}"
},
"np3k-uatv": {
    "city_query": "?provider_city={}",
    "zip_code_query": "?provider_zip_code={}",
    "id_query": "?federal_provider_number={}"
},
"9wzi-peqs": {
    "city_query": "?city={}",
    "zip_code_query": "?zip={}",
    "id_query": "?provider_number={}"
}

}

 FACILITY_TYPES = {
"hospital":
    {
        "name": "hospital",
        "resource": "eqxu-aw4f"
    },
"nursing_home":
    {
        "name": "nursing home",
        "resource": "np3k-uatv"
    },
"home_health":
    {
        "name": "home health agency",
        "resource": "9wzi-peqs"
    }

}

 def _create_path(base: Text, resource: Text,
             query: Text, values: Text) -> Text:
"""Creates a path to find provider using the endpoints."""

if isinstance(values, list):
    return (base + query).format(
        resource, ', '.join('"{0}"'.format(w) for w in values))
else:
    return (base + query).format(resource, values)


 def _find_facilities(location: Text, resource: Text) -> List[Dict]:
"""Returns json of facilities matching the search criteria."""

if str.isdigit(location):
    full_path = _create_path(ENDPOINTS["base"], resource,
                             ENDPOINTS[resource]["zip_code_query"],
                             location)
else:
    full_path = _create_path(ENDPOINTS["base"], resource,
                             ENDPOINTS[resource]["city_query"],
                             location.upper())

results = requests.get(full_path).json()
return results


def _resolve_name(facility_types, resource) ->Text:
for key , value in facility_types.items():
    if value.get("resource") == resource:
        return value.get("name",key)
return ""

       
             class FindFacilityTypes(Action):

              """This action class allows to display buttons for each facility type

        for the user to chose from to fill the facility_type entity slot."""

def name(self) -> Text:
    """Unique identifier of the action"""

    return "find_facility_types"

def run(self,
        dispatcher: CollectingDispatcher,
        tracker: Tracker,
        domain: Dict[Text, Any]) -> List:

    buttons = []
    for t in FACILITY_TYPES:
        facility_type = FACILITY_TYPES[t]
        payload = "/inform{\"facility_type\": \"" + facility_type.get(
            "resource") + "\"}"

        buttons.append(
            {"title": "{}".format(facility_type.get("name").title()),
             "payload": payload})

    # TODO: update rasa core version for configurable `button_type`
    dispatcher.utter_button_template("utter_greet", buttons, tracker)
    return []


       

    class FindHealthCareAddress(Action):
"""This action class retrieves the address of the user's
healthcare facility choice to display it to the user."""

def name(self) -> Text:
    """Unique identifier of the action"""

    return "find_healthcare_address"

def run(self,
        dispatcher: CollectingDispatcher,
        tracker: Tracker,
        domain: Dict[Text, Any]) -> List[Dict]:

    facility_type = tracker.get_slot("facility_type")
    healthcare_id = tracker.get_slot("facility_id")
    full_path = _create_path(ENDPOINTS["base"], facility_type,
                             ENDPOINTS[facility_type]["id_query"],
                             healthcare_id)
    results = requests.get(full_path).json()
    if results:
        selected = results[0]
        if facility_type == FACILITY_TYPES["hospital"]["resource"]:
            address = "{}, {}, {} {}".format(selected["address"].title(),
                                             selected["city"].title(),
                                             selected["state"].upper(),
                                             selected["zip_code"].title())
        elif facility_type == FACILITY_TYPES["nursing_home"]["resource"]:
            address = "{}, {}, {} {}".format(selected["provider_address"].title(),
                                             selected["provider_city"].title(),
                                             selected["provider_state"].upper(),
                                             selected["provider_zip_code"].title())
        else:
            address = "{}, {}, {} {}".format(selected["address"].title(),
                                             selected["city"].title(),
                                             selected["state"].upper(),
                                             selected["zip"].title())

        return [SlotSet("facility_address", address)]
    else:
        print("No address found. Most likely this action was executed "
              "before the user choose a healthcare facility from the "
              "provided list. "
              "If this is a common problem in your dialogue flow,"
              "using a form instead for this action might be appropriate.")

        return [SlotSet("facility_address", "not found")]

class FacilityForm(FormAction): “”“Custom form action to fill all slots required to find specific type of healthcare facilities in a certain city or zip code.”""

def name(self) -> Text:
    """Unique identifier of the form"""

    return "facility_form"

@staticmethod
def required_slots(tracker: Tracker) -> List[Text]:
    """A list of required slots that the form has to fill"""

    return ["facility_type", "location"]

def slot_mappings(self) -> Dict[Text, Any]:
    return {"facility_type": self.from_entity(entity="facility_type",
                                              intent=["inform",
                                                      "search_provider"]),
            "location": self.from_entity(entity="location",
                                         intent=["inform",
                                                 "search_provider"])}

def submit(self,
           dispatcher: CollectingDispatcher,
           tracker: Tracker,
           domain: Dict[Text, Any]
           ) -> List[Dict]:
    """Once required slots are filled, print buttons for found facilities"""

    location = tracker.get_slot('location')
    facility_type = tracker.get_slot('facility_type')

    results = _find_facilities(location, facility_type)
    button_name = _resolve_name(FACILITY_TYPES, facility_type)
    if len(results) == 0:
        dispatcher.utter_message(
            "Sorry, we could not find a {} in {}.".format(button_name,
                                                          location.title()))
        return []

    buttons = []
    # limit number of results to 3 for clear presentation purposes
    for r in results[:3]:
        if facility_type == FACILITY_TYPES["hospital"]["resource"]:
            facility_id = r.get("provider_id")
            name = r["hospital_name"]
        elif facility_type == FACILITY_TYPES["nursing_home"]["resource"]:
            facility_id = r["federal_provider_number"]
            name = r["provider_name"]
        else:
            facility_id = r["provider_number"]
            name = r["provider_name"]

        payload = "/inform{\"facility_id\":\"" + facility_id + "\"}"
        buttons.append(
            {"title": "{}".format(name.title()), "payload": payload})

    if len(buttons) == 1:
        message = "Here is a {} near you:".format(button_name)
    else:
        if button_name == "home health agency":
            button_name = "home health agencie"
        message = "Here are {} {}s near you:".format(len(buttons),
                                                     button_name)

    # TODO: update rasa core version for configurable `button_type`
    dispatcher.utter_button_message(message, buttons)

    return []

class ActionChitchat(Action): “”“Returns the chitchat utterance dependent on the intent”""

def name(self) -> Text:
    """Unique identifier of the action"""

    return "action_chitchat"

def run(self,
        dispatcher: CollectingDispatcher,
        tracker: Tracker,
        domain: Dict[Text, Any]) -> List:

    intent = tracker.latest_message['intent'].get('name')

    # retrieve the correct chitchat utterance dependent on the intent
    if intent in ['ask_builder', 'ask_weather', 'ask_howdoing',
                  'ask_howold', 'ask_languagesbot', 'ask_restaurant',
                  'ask_time', 'ask_wherefrom', 'ask_whoami',
                  'handleinsult', 'telljoke', 'ask_whatismyname']:
        dispatcher.utter_template('utter_' + intent, tracker)

    return []

sorry, it is impossible to look through what you posted. Could you please format it. Also please clarify what error do you experience

i have modify but the class would not be move ı wish the be clear for you so my code is similar to demo medical bot I only change the api call correspond to recent up date but when I tape “rasa run action” it the action in server but I do not see the name of my actions as form action and so on how can solve that issue and also when I tape "rasa run actions -vv " the same think ??? it does not recognize all my actions why ::::::::::?

could you post here the exact error you see in cmdline?

      in my terminal that what I saw when write " rasa run actions "
 2019-08-15 13:23:59 INFO     rasa_sdk.endpoint  - Starting action endpoint 
server...
 2019-08-15 13:24:04 INFO     rasa_sdk.endpoint  - Action endpoint is up 
   and running. on   ('0.0.0.0', 5055)

no name of my actions ??

            but when I run the demo my terminal identify the actions 

     python3 -m rasa_core_sdk.endpoint --actions actions
       2019-08-15 13:31:49 INFO     __main__  - Starting action endpoint server...
       2019-08-15 13:31:49 INFO     rasa_core_sdk.executor 

        - Registered function for   'find_facility_types'.
       2019-08-15 13:31:49 INFO     rasa_core_sdk.executor  

      - Registered function for           'find_healthcare_address'.

     2019-08-15 13:31:49 INFO     rasa_core_sdk.executor  - 
     Registered function for 'action_chitchat'.

      2019-08-15 13:31:49 INFO     rasa_core_sdk.executor  
     - Registered function for 'facility_form'.


      2019-08-15 13:31:54 INFO     __main__  
     - Action endpoint is up and running. on ('0.0.0.0', 5055)

SORRY BUT I TRİED TO KEEP IT MORE CLEAR

what is the name of the file where your custom actions are? If you just use rasa run actions it should be actions.py: Actions

yes my file name actions.py

ok, but what is the log when you talk to the bot?

sorry I could not understand what you mean but when I use rasa shell the first things must display the buttons but I see nothings the msg that display for the bot continu run action s…

sorry, I don’t understand what you mean. Could you please rephrase

could you please run rasa shell --debug and post the whole output of it

Your input -> hey

  2019-08-15 15:46:48 DEBUG   
       rasa.core.agent  - Created a new lock for conversation 'default'

 2019-08-15 15:46:48 DEBUG  
        rasa.core.tracker_store  - Creating a new tracker for id 'default'.

 2019-08-15 15:46:49 DEBUG    
   rasa.core.processor 
   - Received user message 
    'hey' with intent '{'name': 'greet', 'confidence': 0.9710147380828857}'      and entities '[]'

     2019-08-15 15:46:49 DEBUG 
asa.core.processor  - Logged UserUtterance - tracker now has 2 events

    2019-08-15 15:46:49 DEBUG  

     rasa.core.policies.memoization 

 - Current tracker state
    [None, None, None, {}, {'intent_greet': 1.0, 'prev_action_listen': 1.0}]

    2019-08-15 15:46:49 DEBUG   

     rasa.core.policies.memoization  - There is a memorised next action '9'

   2019-08-15 15:46:49 DEBUG  
            rasa.core.policies.form_policy  - There is no active form

      2019-08-15 15:46:49 DEBUG   

      rasa.core.policies.ensemble  

     - Predicted next action using policy_0_MemoizationPolicy

      2019-08-15 15:46:49 DEBUG   

       rasa.core.processor  - 
             Predicted next action 'find_facility_types' with confidence 1.00.


           2019-08-15 15:46:49 DEBUG  
      rasa.core.actions.action  -

     Calling action endpoint to run action 'find_facility_types'.

        2019-08-15 15:46:49 ERROR  

    rasa.core.processor  

   - Encountered an exception while running action 'find_facility_types'. 

          Bot will continue, but the actions events are lost.

     Make sure to fix the exception in your custom code.

    2019-08-15 15:46:49 DEBUG  

       rasa.core.processor  - Failed to execute custom action.

in action server

         "No registered Action found for name '{}'.".format(action_name)

           Exception: No registered Action found for name 'facility_form'.

it refers to that line in my actions :slightly_smiling_face:

       message = "Here are {} {}s near you:".format(len(buttons,button_name)  

why I could not see the buttons ???

I am the same problem, was a solution ever provided?

2020-02-21 17:07:32 DEBUG rasa_sdk.executor - Received request to run ‘findfacilitytypes’

2020-02-21 17:07:32 ERROR rasa_sdk.endpoint - No registered action found for name ‘findfacilitytypes’.

2020-02-21 17:07:32 ERROR rasa.core.processor - Encountered an exception while running action ‘findfacilitytypes’. Bot will continue, but the actions events are lost. Please check the logs of your action server for more information.

2020-02-21 17:07:32 DEBUG rasa.core.processor - Failed to execute custom action.