Commit 593f3d06964b65e3ba0c9d577330bae2240ad08f
Merge remote-tracking branch 'remotes/origin/development'
# Conflicts: # docu/project_documentation.md
Showing
2 changed files
with
55 additions
and
0 deletions
docu/project_documentation.md
0 → 100755
1 | +# BHT-Chatbot Project | ||
2 | +The hole project is build by gradle and divided into a couple of subprojects (cf. [Subprojects section](#subprojects) ). | ||
3 | +Each module is loosely connected through a Java Message Service. The application is running on a Jboss Wildfly | ||
4 | +inside of a docker container. Another docker container is used for the Rasa backend. | ||
5 | + | ||
6 | +## Infrastructure | ||
7 | +- see [docker compose file](../docker/docker-compose.yml) | ||
8 | + | ||
9 | +The productive project is represented by a separate Git repository in absent of a continuous integration server. | ||
10 | +Pushing into this repository will automatically trigger a rebuild of the productive environment. | ||
11 | +- confer [post-receive](../scripts/post-receive) - Git hook for auto deploying the application | ||
12 | + | ||
13 | +### Subprojects | ||
14 | + | ||
15 | +#### MainBot | ||
16 | +- [Canteen Parser](canteenParser.md) - web crawler for collecting data of the beuth university canteen | ||
17 | +- Common - holding common classes used by all other subprojects | ||
18 | +- [Drools](drools.md) - Business Rules Management System used to generate the right answer | ||
19 | +- Global - global available services | ||
20 | +- [Scheduler] (scheduler.md) - Scheduling EJB, used to create and handle reminders. | ||
21 | + | ||
22 | +#### Natural Language Processing | ||
23 | +- [ApiAi](apiai.md) - simple RESTEasy client application calling googles Api.ai API | ||
24 | +- [Rasa](rasa.md) - simple RESTEasy client application calling the rasa backend rest API | ||
25 | + | ||
26 | +#### Messenger | ||
27 | +- [Facebook](facebook.md) - Facebook Messenger connector | ||
28 | +- [Telegram](telegram.md) - Telegram Messenger connector | ||
29 | + | ||
30 | +#### Text <-> Speech Processing | ||
31 | +- [Bing Speech](binspeechapi.md) - REST client for Microsofts Bing Speech API | ||
0 | \ No newline at end of file | 32 | \ No newline at end of file |
docu/scheduler.md
0 → 100644
1 | +#Scheduler | ||
2 | + | ||
3 | +##Concept | ||
4 | +The Scheduler service is used to give users the ability to create scheduled reminders. For example, a user of the BeuthBot might want to be informed of the canteen menu on a daily basis. For this he would send a message to the bot, asking it to send him the menu every morning at nine o clock. | ||
5 | +If Rasa identifies this message as an attempt to create such a reminder, it will extract a `createReminder`-intent, along with entities for `date`, `time`, `cycle` and `event`. | ||
6 | + | ||
7 | +##The reminder object | ||
8 | +The `date`-entity contains the given day on which this reminder should be sent. | ||
9 | +`time` contains the time at which the reminder should be sent. | ||
10 | +`cycle` contains a value defining the interval at which the reminder should be sent. This can either be `DAILY`, `WEEKLY`,`MONTHLY` or `ONCE` for reminders that should only be sent on one specific date. | ||
11 | +The `event-entity contains the object of which the user wishes to be reminded. Currently, only canteen-menu-reminders are supported, but this can expanded to any type of object (e.g. course-timetables), given the data-infrastructure. | ||
12 | + | ||
13 | +##Scheduler class | ||
14 | +The Scheduler-class is implemented as a singleton, using the `@Singleton`-annotation, along with a `@Startup`-annotation to make sure an instance of it is created during startup, without the need to be instantiated by another service. | ||
15 | + | ||
16 | +###Creating reminders | ||
17 | +A reminder is created via the `createReminder`-function, which requires a `TaskMessage` and `AppUser` as parameters. The `TaskMessage`-object is required to read out the entities mentioned above, which are used as parameters to create a new instance of a `Reminder`-object which is then stored in the reminders-array and inserted into the database. | ||
18 | +The `createReminder`-function returns the created reminder object which can then be further used by the Drools-service to create a response for the user. Should errors occur along the way, the function returns null, giving Drools the opportunity to tell the user that creation of the reminder has failed. This functionality could be expanded to explain to the user what exactly went wrong. | ||
19 | + | ||
20 | +###Sending reminders | ||
21 | +To send users the reminders they have asked for, the Scheduler-class makes use of the EJB-annotation `@Schedule`, which is set to fire once every minute, searching the database for Reminder-objects whose `date` and `time` settings match the timestamp at which the function has fired, and if so, forwards this information to Drools, where the appropriate messages can be created and relayed to the users. | ||
22 | + | ||
23 | +###Deleting reminders | ||
24 | +If a user wishes to no longer be reminded of these events, he can ask the bot to stop sending him reminders, which will cause drools to fire the `delete reminder` rule, in turn causing the schedulerService to sift through all reminders associated with this user and removing them. | ||
0 | \ No newline at end of file | 25 | \ No newline at end of file |