Skip to main content
# NuQui extension
This is a little module to make chatbots able to ask questions. There is already a prototype that uses the NuQui module [you find it here](https://github.com/nuqui-chatbot/nuqui-nombot). It has over 200 Questions about food in German. You can easily change the sqlite database to add more questions or adapt them to your needs. (it will never ask the same questions twice).

The question will be related to the food that the user ate. If there are no meal entry it will ask a random question.

### Installation
The installation is quite easy. It is a pypi module so you can just install it via pip.
```
pip install nuqui
```

If you want to install it form source code you just have to clone the, move into the root directory and then run the following command:
```
pip install -r requirements.txt
python setup.py install
```

### Usage
Nuqui is quite easy to use and has just a few methods to invoke in your program.

First you need to import nuqui in the file you need it
```
import nuqui
```
#### USer Management
After the import we need to make a new user in the nuqui module so we have to call
```
nuqui.create_user(<user_id>, <name>)
```
If your bot or program has the possibility to delete a user you have can also delete the user in the nuqui module by calling
```
nuqui.delete_user(<user_id>)
```
This will delete the user and everyhting related to him.

#### add meals
Then we need to add a meal to the user. That is also pretty simple to do. Just call
```
nuqui.add_meal(<user_id>, <food_String>, <total_calories>)
```
The 'food_string' needs to have a certain format. Just use ingredents of the meal and then concatenate them together with a comma seperation. e.g. "wasser,apfel,salz". The total calories are an int that represents the total calories of the whole meal.

#### Get a Question
Now as you have some restriction in the database you can ask for a question. With
```
nuqui.get_predefined_question_dict_with_random_answers(<user_id>)
```
you get a question dictionary (JSON) with the following structure:
```
{
"question": questionstring,
"answer": an array with 4 answer options,
"value": the points you get for this question
}
```
Let your user answer with 4 options (!A, !B, !C, !D)

#### Evaluate your answer
Because you dont know what the right answer you need e evaluation.
```
nuqui.evaluat(<answer>, <user_id>)
```
This function need an answer (A sting that contains either !A, !B, !C or !D) and the user id. It will return you a Dictornary (JSON) in the following structur:

```
{
"success": boolean,
"right_answer": right_answer,
"achieved_points": points the question was worth,
"total_points": the total points of the user
}
```

### run tests
You can also test the module by running the tests in the tests folder. They are all based on the standart unit test python framework.
To run the tests just type
```
python tests/test_basic.py
```

### Future work
* delete question form the user after a certain time
* make the database more persistent


Release files for nuqui 0.1.6

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for nuqui 0.1.6
File Size Uploaded
nuqui-0.1.6.tar.gz 36.8 kB Details

Built distributions (wheels)

Table of built distributions (wheels) for nuqui 0.1.6
File Interpreter ABI Platform
nuqui-0.1.6-py3.4.egg Legacy Egg format - - Details
nuqui-0.1.6-py3-none-any.whl Python 3 none any Details

Total release size: 89.8 kB

Release files / nuqui-0.1.6.tar.gz

Download URL nuqui-0.1.6.tar.gz
Size 36.8 kB
Tags Source
SHA-256 checksum
How to use checksums
7452ce59e164e1945e7cadb838b2dc5c3739d5035a2b0fd9bdbd24b1e25f49cd
BLAKE2b-256 checksum
How to use checksums
643f887155063cda96a63a8f6f530a62b5d8e18b6eb3434f43a3150edd828f19
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Release files / nuqui-0.1.6-py3.4.egg

Download URL nuqui-0.1.6-py3.4.egg
Size 27.6 kB
Tags Egg
SHA-256 checksum
How to use checksums
72597f426ee2a3a55aa2d93683343202e2a1f48a23a7c795f468e70c50f0631e
BLAKE2b-256 checksum
How to use checksums
1962820f899a5435860961dfcdcdb8b96c49e34af622f3082b4af1c3fa1d4ef8
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Release files / nuqui-0.1.6-py3-none-any.whl

Download URL nuqui-0.1.6-py3-none-any.whl
Size 25.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
2e6d9a326be5e8bcc516b0c063d8f7e64d34bcda29a1437b7c963075b48d9371
BLAKE2b-256 checksum
How to use checksums
ebc06a98625f467448c159260cfe9e58ba737d561adf42f6c9c5aabe7a0c1ba3
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Release history Release notifications | RSS feed

This release

0.1.6 This release

3 release files

0.1.5

3 release files

0.1.4

3 release files

0.1.2

2 release files

0.1.1

3 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page