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


Metadata

Release files for nuqui 0.1.5

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.5
File Size Uploaded Provenance Actions
nuqui-0.1.5.tar.gz 36.7 kB Without provenance Details for nuqui-0.1.5.tar.gz

Built distributions (wheels)

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

Total release size: 89.7 kB

Release files / nuqui-0.1.5.tar.gz

Download URL nuqui-0.1.5.tar.gz
Size 36.7 kB
Tags Source
SHA-256 checksum
How to use checksums
a0b1af6ea866185fec125ed77d1450e2a26514f61223c5a67cda4c1c2d0ac64f
BLAKE2b-256 checksum
How to use checksums
9f33e5ef3071315a326ca557c4f66b399d40bae9a7979bcc0aa8ba61dc49c0fe
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

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

Download URL nuqui-0.1.5-py3.4.egg
Size 27.5 kB
Tags Egg
SHA-256 checksum
How to use checksums
c8357caeb9158e5a0753d70bd410d42bfe156cb6684e2650f294a9f052fdfd34
BLAKE2b-256 checksum
How to use checksums
17faabbb03ae076270d8b4fcea26e93271a50fd768270bc608263d1bf2b8d33b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

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

Download URL nuqui-0.1.5-py3-none-any.whl
Size 25.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
15cfa3851da7961bc15b046aea393f64ff3aaeebfe063036cb90b372617fa3c5
BLAKE2b-256 checksum
How to use checksums
52f7039e87e76ef260ac76960fd9cf8ebe59b6790dc163d9a5f53d737523971f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Security for nuqui 0.1.5

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

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