Giter Site home page Giter Site logo

qa-module's Introduction

How to use

Pretty easy. Import get_next_question from methods. Pass a unique user_id, lang (currently only "de" or "en"). You can expect to get an object returned which has the following attributes: text which is the basic text and answers which is a dictionary, mapping the answer to the next question id. The following attributes are optional, but always there and set to false (so you can do if question.attribute): comment which is a longer explanation or multi which would be a multi answer question.

In the end, return the new question id alongside the other variables. For the multi questions, pick the last answer/question id you get. If the returned value is False, you have reached the end.

get_user_score returns a score dict, mapping the category to the score. If a category isn't in there, the user has no score in it. All categories are contact, symptoms, medication, illnesses, respiratorySymptoms

Development

make sure that you initialized the submodule, then you need to run npm ci from inside the covapp directory to install the dependencies. Then run npm start which copies the rest of the modules. Once its running, abort it. From there, run tsc covapp/src/global/questions.ts which generates the .js file from that ts one. Ignore the one error popping up and telling you that --jsx is not set. Now you can use node question_object_to_json.js to generate the q_a.json `

qa-module's People

Contributors

poolitzer avatar

Stargazers

 avatar

Watchers

James Cloos avatar Rico avatar

qa-module's Issues

Multiple question answer value is not a valid question id

{'_lang': 'en', 'id': 'X0', 'text': 'Which of the following symptoms have you had in the past 24 hours? (multiple selection possible)', 'comment': 'The question relates to acute or exacerbated symptoms and excludes chronic complaints or seasonal or allergic complaints. If you have a chronic illness, compare your current symptoms with your previous problems to answer the question.\n\nIf you don\'t have any of the symptoms, don\'t select an entry and continue by choosing the "Next" button.', 'free': False, 'answers': {'Feeling tired or weak': 'S4', 'Body aches': 'S5', 'Diarrhea': 'S8', 'Headache': 'SA', 'Loss of taste and/or smell': 'SC'}, 'multi': True}

Answer (for example): 'Diarrhea': 'S8'

current_question = "S8"
response = get_next_question(sender_id, "en", current_question)
if response is False:
    raise Exception("why?")

Exception is raised.

What do the values of multiple-answer question mean, if they are not legit ids?

KeyError

Issue with transition from C0 to CZ in methods:

{'_lang': 'en', 'id': 'C0', 'text': 'Have you had close contact with a confirmed case?', 'comment': 'Close contact with a confirmed case means:\nFace-to-face contact for longer than 15 minutes\nDirect, physical contact (touching, shaking hands, kissing)\nBeing within 1.5 meters of the person for more than 15 minutes\nContact with or exchange of body fluids\nLiving in the same apartment\n\nChoose "No" if you have worn adequate protective measures (mask, smock) on contact.', 'free': False, 'answers': {'Yes': 'CZ', 'No': 'S0'}, 'multi': False}

{'_lang': 'en', 'id': 'CZ', 'text': 'What day was the last contact?', 'comment': False, 'free': True, 'answers': 'S0', 'multi': False}

Traceback (most recent call last):
File "/home/dewald/rasa_env/lib/python3.6/site-packages/sanic/app.py", line 976, in handle_request
response = await response
File "app.py", line 136, in handle_message
handle_fb_message(data)
File "app.py", line 169, in handle_fb_message
conversation_handler(sender_id)
File "app.py", line 521, in conversation_handler
medical_assessment(sender_id)
File "app.py", line 931, in medical_assessment
response = get_next_question(sender_id, "en", current_question)
File "/home/dewald/projects/humanbios/fb/modules/qa_module/methods.py", line 71, in get_next_question
if old_question.score[next_question_id] > 0:
KeyError: 'C0'

Changes to high level interface

  • Allow passing translated object (dict) to high level method
  • Allow accessing full english version of questions object to make translations

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.