Giter Club home page Giter Club logo

kobotoolbox / kpi Goto Github PK

View Code? Open in Web Editor NEW
122.0 30.0 166.0 55.11 MB

kpi is the (frontend) server for KoboToolbox. It includes an API for users to access data and manage their forms, question library, sharing settings, create reports, and export data.

Home Page: https://www.kobotoolbox.org

License: GNU Affero General Public License v3.0

Python 51.66% CSS 0.10% HTML 0.79% JavaScript 14.42% CoffeeScript 5.77% Shell 0.13% Dockerfile 0.10% Handlebars 0.01% SCSS 6.22% TypeScript 20.80%

kpi's Introduction

KPI

Python Build Status Python Coverage Status JavaScript Build Status

We're open for contributions!

Important notice when upgrading from any release older than 2.020.18

Prior to release 2.020.18, this project (KPI) and KoBoCAT both shared a common Postgres database. They now each have their own. If you are upgrading an existing single-database installation, you must follow these instructions to migrate the KPI tables to a new database and adjust your configuration appropriately.

If you do not want to upgrade at this time, please use the shared-database-obsolete branch instead.

Python Dependencies

Python dependencies are managed with pip-compile and pip-sync from the pip-tools package. The dependencies are listed in dependencies/pip/, with core requirements in dependencies/pip/requirements.in. You may use pip directly with one of the compiled dependencies/pip/*.txt files, but consider using instead the pip-sync. Do not add new dependencies directly to the compiled dependencies/pip/*.txt files; instead, update the relevant the source dependencies/pip/*.in file(s), and execute ./pip-compile.sh after any changes. You can pass arguments to pip-compile.sh with e.g. ./pip-compile.sh --upgrade-package=xlwt.

Downloading and compiling the translations

  • Pull the submodule into the locale directory with git submodule update.
  • Optionally configure transifex to pull the latest translations into the locale directory with tx pull --all
  • Run python manage.py compilemessages to create .mo files from the .po files.
  • To test out locales in the interface, double click "account actions" in the left navbar, use the dropdown to select a language, and refresh.

Searching

Results from the tags and api/v2/assets endpoints can be filtered by a Boolean query specified in the q parameter. For example: api/v2/assets?q=owner__username:meg AND name__icontains:quixotic would return assets whose owner has the username "meg" (case sensitive) and whose name contains "quixotic" anywhere (case insensitive). For more details about the syntax, see the documentation at the top of kpi/utils/query_parser/query_parser.py.

Admin reports

There are several types of data reports available to superusers.

  • Full list of users including their details provided during signup, number of deployed projects (XForm count), number of submissions, date joined, and last login: <kpi base url>/superuser_stats/user_report/. File being created is a CSV, so don't download immediately to wait for server to be finished writing to the file (it will download even if incomplete).
  • Monthly aggregate figures for number of forms, deployed projects, and submissions (from kobocat): <kc server domain>/<superuser username>/superuser_stats/

Django Admin Interface

As this is a Django project, you may find the admin panel at <kpi base url>/admin useful, e.g. to configure user accounts or log in as other users without knowing their passwords. You must use a superuser account to access the admin panel.

Icons

All project icons are kept in jsapp/svg-icons/. Adding new icon requires adding new svg file here and regenerating icons with npm run generate-icons. Filenames are used for icon font classnames, e.g. .k-icon-arrow-last for arrow-last.svg (please use kebab-case). You can see all available icons in Storybook by running npm run storybook.

Supported Browsers

See browsers list config

kpi's People

Contributors

arsea avatar avdata99 avatar bufke avatar dorey avatar duvld avatar gushil avatar jacquelinemorrissette avatar jamesrkiger avatar jeverling avatar jnm avatar joshuaberetta avatar ksamuel avatar lmntl avatar m4tx avatar magicznyleszek avatar mdestaubin avatar noliveleger avatar p2edwards avatar paulschreiber avatar pmusaraj avatar rhunwicks avatar russbiggs avatar ruthshryock avatar shadimh avatar shyamkumaryadav avatar srartese avatar tinok avatar wetbadger avatar yann-j avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

kpi's Issues

Asset API fails unceremoniously when not logged in

https://kf2.kbtdev.org/assets/ayJAkW7Tc8kXksViqNbmhH/

Traceback:
File "/home/ubuntu/.virtualenvs/kf/local/lib/python2.7/site-packages/django/core/handlers/base.py" in get_response
  111.                     response = wrapped_callback(request, *callback_args, **callback_kwargs)
File "/home/ubuntu/.virtualenvs/kf/local/lib/python2.7/site-packages/django/views/decorators/csrf.py" in wrapped_view
  57.         return view_func(*args, **kwargs)
File "/home/ubuntu/.virtualenvs/kf/local/lib/python2.7/site-packages/rest_framework/viewsets.py" in view
  85.             return self.dispatch(request, *args, **kwargs)
File "/home/ubuntu/.virtualenvs/kf/local/lib/python2.7/site-packages/rest_framework/views.py" in dispatch
  454.         self.response = self.finalize_response(request, response, *args, **kwargs)
File "./kpi/views.py" in finalize_response
  451.         if request.accepted_renderer.format == 'xls':
File "/home/ubuntu/.virtualenvs/kf/local/lib/python2.7/site-packages/rest_framework/request.py" in __getattribute__
  497.                 six.reraise(info[0], info[1], info[2].tb_next)

Exception Type: AttributeError at /assets/ayJAkW7Tc8kXksViqNbmhH/
Exception Value: 'Request' object has no attribute 'accepted_renderer'

/users/ returns full user list

When querying /users/

Would be nice to use this provide a dropdown and/or autocomplete of available users to grant new sharing permissions with.

when users are ___ it should return ___

  • not logged in ... empty list
  • logged in ... no random users (so i can't use it to see who everyone who's created an account). but show all users who the user would want to share an asset with. How do we decide this? Maybe based on existing links with other users through permissions.

form search and filter placeholders should be removed

The search field and radio buttons are not working to filter forms. Also the radio button "shared with me" shows as "shared with k c" somehow.

We should just disable / hide this for release prep / demo if it's not yet working.

image

dropdowns and input fields show at bottom of page

When creating or editing a dropdown or input field in the question settings (e.g. hint, default, skip logic condition dropdowns, appearance field dropdown), the elements are displayed at the bottom of the page (lower left, behind sidebar), and the view scrolls to these areas at the bottom of the page.

image

* change root URL default view

change it to a view that's consistent with the react views. we could potentially generate the html template from the react app (and commit it into the repository?)

separate asset list into 2

/#/forms view

  • show only forms

/#/blocks-and-questions view

  • Create and modify collections
  • remove sharing view from blocks-and-questions

* cloning feature

Done in a RESTful way in KPI.
Suggested-- POST to /assets/ with an attribute that's like "duplicate=a123uid"

in the process, verify that the user has permissions to view 'a123uid'

* default library queryset

the default qlib sidebar view should show a special queryset of assets since the space is very limited and it's no longer constrained to just the users own assets.

For now, i'm hard coding a "libraryDefaultSearch()" to "/assets/?tag=examples" but we'll want to adapt this in the future

Calculations break form builder

The formbuilder is currently not able to display calculate questions, and opening forms with calculations breaks the builder.

To reproduce import this form. Expected: Should show 4 questions, including the calculate formulas. Instead: Shows only 'this form is empty' plus two questions, without calculate formulas.

image

Model-level permissions are not automatically assigned to existing users

DevStaging
In [2]: User.objects.get(pk=-1).get_all_permissions()
Out[2]: 
{u'kpi.add_asset',
 u'kpi.add_collection',
 u'kpi.change_asset',
 u'kpi.change_collection',
 u'kpi.delete_asset',
 u'kpi.delete_collection',
 u'kpi.share_asset',
 u'kpi.share_collection',
 u'kpi.view_asset',
 u'kpi.view_collection',
 u'odk_logger.add_note',
 u'odk_logger.add_xform',
 u'odk_logger.change_note',
 u'odk_logger.change_xform',
 u'odk_logger.delete_note',
 u'odk_logger.delete_xform',
 u'odk_logger.view_xform'}
In [2]: User.objects.get(pk=-1).get_all_permissions()
Out[2]: 
{u'logger.add_note',
 u'logger.add_xform',
 u'logger.change_note',
 u'logger.change_xform',
 u'logger.delete_note',
 u'logger.delete_xform',
 u'logger.move_xform',
 u'logger.report_xform',
 u'logger.transfer_xform',
 u'logger.view_note',
 u'logger.view_xform'}

User should see confirmation/warning before deleting form

When deleting a form the user should always see a warning message - similar to deleting a question from the builder. Currently a form is just removed without confirmation, making accidental deletions of potentially complex forms possible.

Once we have a 'trash' folder available we might not need a confirmation, but until then we need it.

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.