Git Product home page Git Product logo

sherpa-kb's Introduction

SHERPA Knowledge Base

Knowledge Base (KB) is used for managing Questions, Answers and dealing with submitted Pending Questions suggested by the end-users. Application has three main roles, which are:

  • Administrator - system administrators that are allowed to manage user accounts + anything else that lesser roles can do
  • Master Expert - a role that is dealing with final review and assignment of Published state to both Questions and Answers. Experts are also dealing with reviewing Pending Questions and either marking those as Completed, which would also create a new Question, marking them as Cancelled, which would be the end game for the Pending Question flow, or changing the state back to Pending, which should be considered as sending it back to the Language Expert. Users with this role are also able to see the statistics for Questions and Answers, how many have been translated to certain language and how many Question-Answer pairs are harvested by the Chatterbot by using an API. A Master Expert can choose to open a Language Expert view for any of the languages, thus temporarily emulating an expert for any of the languages.
  • Language Expert - is generally dealing with Questions and Answers by working with corresponding translations to their language. They are also the ones that would be initially responsible for dealing with Pending Questions, either changing the working, adding texts in English and sending for review by Master Expert, or deleting the unnecessary ones.

KB has an API that is mostly responsible for exposing Question and Answer data for the Chatterbot. In addition to that, there also are endpoints for submitting new Pending Questions, tracking user activity on the Chatterbot Helper UI, mostly storing the questions submitted to the Chatterbot and answers received, and storing user ratings for the answers they get. The data is stored in the database without being exposed anywhere and would later be used to analyse the correctness of answers and how useful are those considered by the end-users.

Requirements

Please note that this might not be the most current information and codebase files could prove to be the most reliable source of current state of affairs. These are the versions that are currently being used for development and production environments:

  • PHP version 7.3 (7.4 should also work just fine)
  • Laravel version 8
  • Node.js version 14 (used in development for building static assets)
  • MySQL version 8 (5.7+ should also be just fine)
  • Apache web server (Nginx is also suitable, please check Laravel documentation for configuration)

Installation

Please read the Laravel Documentation for information about server requirements and getting the framework running.

Please check the composer.json for Laravel version requirement. The version being used might not be the latest available release of the framework.

Copy .env.example file to .env and fill in all the necessary configurations. Environment should be configured for production with initial portion of configurations declaring that and disabling debugging. This could be used as a basis:

APP_NAME="SHERPA Knowledge Base"
APP_ENV=production
APP_KEY=<SOME-UNIQUE-KEY>
APP_DEBUG=false
APP_URL=https://<SOME_ADDRESS>

In addition to that you will need to configure the database connection, mailer, and reCAPTCHA. Other configurations should be suitable and redis is not being used, at least for now. You could change the configuration yourself and use redis for cache and session storage.

Make sure that the database has been configured properly before running database migrations. Go to the application home catalog and run these commands in order to set up the application (make sure you use the code from production branch outside of development):

composer install --no-dev
php artisan key:generate
php artisan migrate
php artisan db:seed

This should get the packages installed, generate new secret key and update the .env file, run all the database migrations and create all the required tables, fill the database with data presets (categories, roles and some other data).

It might also be a good idea to configure caching to improve performance. Please note that caches would need to be reset after updates!

Once that is done, you would need to create an account and assign it an administrator role. After that all the user management could be done through the user management UI. That would include creating new user account and assigning roles. This command should get the job done (please replace the arguments with correct values):

php artisan auth:create-admin {name} {email} {password}

Log in to the application and create any additional accounts that are needed. One additional step would be setting up a scheduler according to the documentation. Scheduled jobs will be used for sending daily and weekly notification emails to Language Experts.

Configuring live-updates

Live-updates are achieved with use of Laravel Echo using Pusher as a service provider. Any Pusher-js compatible implementation should be suitable as well.

The easiest way would be to just create a Pusher Channels account and use a suitable plan. After that, there would also be a need to change the .env file and provide all the required configuration data.

Development

Follow the installation instructions without adding the --no-dev to composer command. Make sure that Node.js runtime with NPM package manager is present and run npm install. You will be able to run all the commands that are outlined in package.json file as soon as the dependencies are installed. The ones that make most sense are npm run watch and npm run prod. The first one will watch for changes and rebuild static assets during development and the second one will create a production build.

Development is done on any branch except for production, which is a special branch that has stable code ready for use in the live environment. This branch should also include the latest build of static assets (styles, scripts and possibly some others).

Docker

Laravel Sail is used for running in development. Please use docker-compose.yml file in the root of the directory. Please note that internal access to containers to be used in the .env file are:

  • mysql
  • redis
  • mailhog

CACHE_DRIVER and SESSION_DRIVER should be set to redis.

ACKNOWLEDGEMENT

Supported by Erasmus+ funding programme.

LICENSE

Creative Commons License
This work is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License.

sherpa-kb's People

Contributors

dependabot[bot] avatar pjotrsavitski avatar

Watchers

 avatar  avatar  avatar

sherpa-kb's Issues

Non-English question without an answer

In case an answer to non-English question is empty then additionally to offer to send to expert, ask if user would like to ask same question in English.

Use Sail instead of Laradock

It would be wise to migrate to Laravel Sail from currently used Laradock. Laradock is more powerful and provides a lot of configuration options and containers, though we're only using just a few ones and we can now easily migrate from PHP 7.3 to 7.4 without any issues.
Having a smaller and a lot more simple docker-compose.yml should be a serious plus.

Send notification to language expert

Language experts should be notified about Pending Questions that need to be handled. Notification will be sent daily, if new submissions exist. It might make sense to only consider the items that have been added during that same day.

One more weekly notification could also be sent that would notify an expert that there are a number of items that need to be dealt with.

Language expert allowed to edit translated Questions and Answers

Language expert should be allowed to make changes to Questions and Answers that have translated status. This would allow the data to be used before all the translations are added, while also allowing others to add translations.

It should be editable by everyone, including language experts for languages that already have translations.

Review process will still be as it is, requiring all the translations to be provided before being allowed to set status to published.

Deletion of questions and answers

Both CSE and MSE can delete PendingQuestion at any time with any status.

MSE can delete any Question or Answer with any status. CSE can delete any Question and Answer with status of inTranslation and Translated.

Dialogs should warn about possible consequences of that action.

Implement automatic token refresh functionality

CSRF token can become outdated if SPA part of the application is used for a longer duration of time.

Implement token refresh mechanics with token being refreshed every half an hour or so. Endpoint should check current token being valid (POST) and make sure that user is authenticated. New token should also be stored in the csrf_token meta value, although it is not really being used right now.

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.