rasa
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# version: "3.1" | |
# stories: | |
# - story: stop form + continue | |
# steps: | |
# - intent: request_restaurant | |
# - action: restaurant_form | |
# - active_loop: restaurant_form | |
# - intent: stop | |
# - action: utter_ask_continue | |
# - intent: affirm | |
# - action: restaurant_form | |
# - active_loop: null | |
# - action: utter_submit | |
# - action: action_submit # Explicitly invoking the submit action | |
# - story: stop form + stop | |
# steps: | |
# - intent: request_restaurant | |
# - action: restaurant_form | |
# - active_loop: restaurant_form | |
# - intent: stop | |
# - action: utter_ask_continue | |
# - intent: deny | |
# - action: action_deactivate_loop | |
# - active_loop: null |
Author
ehzawad
commented
Aug 29, 2023
class ResetNamzariStatusInitials(Action):
"""action_reset_NamzariStatusInitials"""
def name(self) -> Text:
"""Unique identifier of the action"""
return "action_reset_NamzariStatusInitials"
async def run(
self,
dispatcher: CollectingDispatcher,
tracker: Tracker,
domain: Dict[Text, Any],
) -> List[Dict]:
print(tracker.latest_message['intent'].get('name'))
print(tracker.latest_message['intent']['confidence'])
"""Executes the action"""
print("Reset Namzari_Status_Form related info.")
return[
SlotSet("ApplicationNumber", None),
SlotSet("ApplicationNumber_confirm", None),
SlotSet("APtext", None),
SlotSet("DivisionName", None),
SlotSet("Incomplete_Story", True),
]
class Action_NamzariStatusResponse(Action):
"""action__NamzariStatus_Response"""
def name(self) -> Text:
"""Unique identifier of the action"""
return "action__NamzariStatus_Response"
async def run(
self,
dispatcher: CollectingDispatcher,
tracker: Tracker,
domain: Dict[Text, Any],
) -> List[Dict]:
"""Executes the action"""
#aid=['6920352']
found = tracker.get_slot("Found")
division_name = tracker.get_slot("DivisionName")
aid = tracker.get_slot("ApplicationNumber")
division='3'
# "description": "1 = Barisal; 2 = Chittagong; 3 = Dhaka; 4 = Khulna; 5 = Rajshahi; 6 = Rangpur; 7 = Sylhet; 8 = mymensingh;",
if(division_name=='Dhaka'):
division='3'
if(division_name=='Barisal'):
division='1'
if(division_name=='Chittagong'):
division='2'
if(division_name=='Khulna'):
division='4'
if(division_name=='Rajshahi'):
division='5'
if(division_name=='Rangpur'):
division='6'
if(division_name=='Sylhet'):
division='7'
if(division_name=='Mymensingh'):
division='8'
res="আপনার আবেদনটি উপজেলা ভূমি অফিসে জমা হয়েছে।"
try:
url = "https://trapi7.land.gov.bd/api/getToken"
payload = {'username': 'gplex_land','password': ')#lr.i#@#land#','clientid': 'gplex'}
headers = {
'content-type': "application/x-www-form-urlencoded",
'cache-control': "no-cache"
}
response = requests.request("POST", url, data=payload, headers=headers)
jdata = json.loads(response.text)
print(jdata)
url = "https://api.land.gov.bd/api/get-application-state"
payload={'division_id': str(division),'application_id': str(aid)}
print("PAYLOAD")
print(payload)
headers = {
'apiauthorization': "bearer "+jdata['token'],
'cache-control': "no-cache",
'content-type': "application/x-www-form-urlencoded"
}
response = requests.request("POST", url, data=payload, headers=headers)
jdata = json.loads(response.text)
print(jdata)
except:
print("Error: API Exception.")
finally:
res="আপনার আবেদনটি উপজেলা ভূমি অফিসে জমা হয়েছে।"
res="আপনার আবেদনটি উপজেলা ভূমি অফিসে জমা হয়েছে।"
if(jdata['response']=='success'):
found = True
if(jdata['data']['application_current_status']=='শুনানির জন্য আদেশ'):
numeric_words
date=re.findall(r'\(.*?\)', jdata['data']['to_be_done'])
dst=' '
if(len(date)>0):
ds=date[0][1:-1]
dsa=ds.split('/')
for x in dsa:
for k, v in numeric_words.items():
if(x==k):
dst=dst+' , '+str(v)
res="আপনার আবেদনটির শুনানির দিন "+str(dst)+" তারিখে ধার্য করা হয়েছে।"
print(res)
if(jdata['data']['application_current_status']=='খতিয়ান প্রস্তুত'):
res="আপনার আবেদনের খতিয়ানটি প্রস্তুত হয়ে গেছে, নামজারি পোর্টালে গিয়ে এক হাজার একশো টাকা ডিসিআর ফি পরিশোধ করে খতিয়ান সংগ্রহ করুন"
if(jdata['data']['application_current_status']=='আবেদন নামঞ্জুর হিসাবে গন্য'):
res="আপনার আবেদনটি নামঞ্জুর হিসাবে গন্য করা হয়েছে।"
dispatcher.utter_message(text = res)
# if found:
# dispatcher.utter_message(text = res)
# else:
# dispatcher.utter_message(text = "এই আবেদন সংক্রান্ত কোন তথ্য আমাদের ডাটাবেইজ এ পাওয়া যায় নাই। তাই আপনার কলটি একজন এজেন্টের কাছে ট্রান্সফার করা হচ্ছে, একটু অপেক্ষা করুন।")
return [
SlotSet("DivisionName", None),
SlotSet("ApplicationNumber", None),
SlotSet("ApplicationNumber_confirm", None),
SlotSet("Incomplete_Story", False),
SlotSet("Found", False),
]
return [
SlotSet("DivisionName", None),
SlotSet("ApplicationNumber", None),
SlotSet("ApplicationNumber_confirm", None),
SlotSet("Incomplete_Story", False),
SlotSet("Found", False),
]
return[
SlotSet("ApplicationNumber", None),
SlotSet("ApplicationNumber_confirm", None),
SlotSet("APtext", None),
SlotSet("DivisionName", None),
SlotSet("Incomplete_Story", True),
]
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment