proso_models package

Submodules

proso_models.admin module

class proso_models.admin.AnswerAdmin(model, admin_site)[source]

Bases: django.contrib.admin.options.ModelAdmin

asked_ago(a)[source]
is_correct(a)[source]
list_display = ('user', 'item_asked', 'item_answered', 'is_correct', 'asked_ago')
media
proso_models.admin.pretty_date(time=False)[source]

Get a datetime object or a int() Epoch timestamp and return a pretty string like ‘an hour ago’, ‘Yesterday’, ‘3 months ago’, ‘just now’, etc

proso_models.json_enrich module

proso_models.json_enrich.answers_in_practice_set(request, json_list, nested)[source]
proso_models.json_enrich.avg_prediction(request, json_list, nested)[source]
proso_models.json_enrich.item2object(request, json_list, nested)[source]
proso_models.json_enrich.number_of_answers(request, json_list, nested)[source]
proso_models.json_enrich.number_of_correct_answers(request, json_list, nested)[source]
proso_models.json_enrich.prediction(request, json_list, nested)[source]

proso_models.models module

class proso_models.models.Answer(id, user, session, item, item_asked, item_answered, time, response_time, guess, config, context, metainfo, type, lang, practice_set)[source]

Bases: django.db.models.base.Model

exception DoesNotExist

Bases: django.core.exceptions.ObjectDoesNotExist

exception Answer.MultipleObjectsReturned

Bases: django.core.exceptions.MultipleObjectsReturned

Answer.answerexperimentsetup_set

Accessor to the related objects manager on the reverse side of a many-to-one relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

parent.children is a ReverseManyToOneDescriptor instance.

Most of the implementation is delegated to a dynamically defined manager class built by create_forward_many_to_many_manager() defined below.

Answer.audit_set

Accessor to the related objects manager on the reverse side of a many-to-one relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

parent.children is a ReverseManyToOneDescriptor instance.

Most of the implementation is delegated to a dynamically defined manager class built by create_forward_many_to_many_manager() defined below.

Answer.config

Accessor to the related object on the forward side of a many-to-one or one-to-one relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

child.parent is a ForwardManyToOneDescriptor instance.

Answer.context

Accessor to the related object on the forward side of a many-to-one or one-to-one relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

child.parent is a ForwardManyToOneDescriptor instance.

Answer.flashcardanswer

Accessor to the related object on the reverse side of a one-to-one relation.

In the example:

class Restaurant(Model):
    place = OneToOneField(Place, related_name='restaurant')

place.restaurant is a ReverseOneToOneDescriptor instance.

Answer.get_next_by_time(*moreargs, **morekwargs)
Answer.get_previous_by_time(*moreargs, **morekwargs)
Answer.item

Accessor to the related object on the forward side of a many-to-one or one-to-one relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

child.parent is a ForwardManyToOneDescriptor instance.

Answer.item_answered

Accessor to the related object on the forward side of a many-to-one or one-to-one relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

child.parent is a ForwardManyToOneDescriptor instance.

Answer.item_asked

Accessor to the related object on the forward side of a many-to-one or one-to-one relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

child.parent is a ForwardManyToOneDescriptor instance.

Answer.metainfo

Accessor to the related object on the forward side of a many-to-one or one-to-one relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

child.parent is a ForwardManyToOneDescriptor instance.

Answer.objects = <proso_models.models.AnswerManager object>
Answer.practice_set

Accessor to the related object on the forward side of a many-to-one or one-to-one relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

child.parent is a ForwardManyToOneDescriptor instance.

Answer.session

Accessor to the related object on the forward side of a many-to-one or one-to-one relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

child.parent is a ForwardManyToOneDescriptor instance.

Answer.taskanswer

Accessor to the related object on the reverse side of a one-to-one relation.

In the example:

class Restaurant(Model):
    place = OneToOneField(Place, related_name='restaurant')

place.restaurant is a ReverseOneToOneDescriptor instance.

Answer.to_json(nested=False)[source]
Answer.user

Accessor to the related object on the forward side of a many-to-one or one-to-one relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

child.parent is a ForwardManyToOneDescriptor instance.

Answer.variable_set

Accessor to the related objects manager on the reverse side of a many-to-one relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

parent.children is a ReverseManyToOneDescriptor instance.

Most of the implementation is delegated to a dynamically defined manager class built by create_forward_many_to_many_manager() defined below.

class proso_models.models.AnswerManager[source]

Bases: django.db.models.manager.Manager

answer_class(name)[source]
answers(answer_ids)[source]
correct_count(user)[source]
count(user)[source]
from_json(json_object, practice_context, practice_set, user_id, object_class=None)[source]
class proso_models.models.AnswerMeta(id, content, content_hash)[source]

Bases: django.db.models.base.Model

exception DoesNotExist

Bases: django.core.exceptions.ObjectDoesNotExist

exception AnswerMeta.MultipleObjectsReturned

Bases: django.core.exceptions.MultipleObjectsReturned

AnswerMeta.answer_set

Accessor to the related objects manager on the reverse side of a many-to-one relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

parent.children is a ReverseManyToOneDescriptor instance.

Most of the implementation is delegated to a dynamically defined manager class built by create_forward_many_to_many_manager() defined below.

AnswerMeta.objects = <proso_models.models.AnswerMetaManager object>
AnswerMeta.to_json(nested=False)[source]
class proso_models.models.AnswerMetaManager[source]

Bases: django.db.models.manager.Manager

from_content(content)[source]
class proso_models.models.Audit(id, user, item_primary, item_secondary, key, value, time, info, answer)[source]

Bases: django.db.models.base.Model

exception DoesNotExist

Bases: django.core.exceptions.ObjectDoesNotExist

exception Audit.MultipleObjectsReturned

Bases: django.core.exceptions.MultipleObjectsReturned

Audit.answer

Accessor to the related object on the forward side of a many-to-one or one-to-one relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

child.parent is a ForwardManyToOneDescriptor instance.

Audit.get_next_by_time(*moreargs, **morekwargs)
Audit.get_previous_by_time(*moreargs, **morekwargs)
Audit.info

Accessor to the related object on the forward side of a many-to-one or one-to-one relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

child.parent is a ForwardManyToOneDescriptor instance.

Audit.item_primary

Accessor to the related object on the forward side of a many-to-one or one-to-one relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

child.parent is a ForwardManyToOneDescriptor instance.

Audit.item_secondary

Accessor to the related object on the forward side of a many-to-one or one-to-one relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

child.parent is a ForwardManyToOneDescriptor instance.

Audit.objects = <django.db.models.manager.Manager object>
Audit.user

Accessor to the related object on the forward side of a many-to-one or one-to-one relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

child.parent is a ForwardManyToOneDescriptor instance.

class proso_models.models.DifficultyUpdates[source]

Bases: proso_models.models.EnvironmentItemUpdateDirection

class proso_models.models.EnvironmentInfo(id, status, revision, config, load_progress, updated, created)[source]

Bases: django.db.models.base.Model

exception DoesNotExist

Bases: django.core.exceptions.ObjectDoesNotExist

exception EnvironmentInfo.MultipleObjectsReturned

Bases: django.core.exceptions.MultipleObjectsReturned

EnvironmentInfo.STATUS = ((0, 'disabled'), (1, 'loading'), (2, 'enabled'), (3, 'active'))
EnvironmentInfo.STATUS_ACTIVE = 3
EnvironmentInfo.STATUS_DISABLED = 0
EnvironmentInfo.STATUS_ENABLED = 2
EnvironmentInfo.STATUS_LOADING = 1
EnvironmentInfo.audit_set

Accessor to the related objects manager on the reverse side of a many-to-one relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

parent.children is a ReverseManyToOneDescriptor instance.

Most of the implementation is delegated to a dynamically defined manager class built by create_forward_many_to_many_manager() defined below.

EnvironmentInfo.config

Accessor to the related object on the forward side of a many-to-one or one-to-one relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

child.parent is a ForwardManyToOneDescriptor instance.

EnvironmentInfo.get_next_by_created(*moreargs, **morekwargs)
EnvironmentInfo.get_next_by_updated(*moreargs, **morekwargs)
EnvironmentInfo.get_previous_by_created(*moreargs, **morekwargs)
EnvironmentInfo.get_previous_by_updated(*moreargs, **morekwargs)
EnvironmentInfo.get_status_display(*moreargs, **morekwargs)
EnvironmentInfo.objects = <django.db.models.manager.Manager object>
EnvironmentInfo.to_json(nested=False)[source]
EnvironmentInfo.variable_set

Accessor to the related objects manager on the reverse side of a many-to-one relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

parent.children is a ReverseManyToOneDescriptor instance.

Most of the implementation is delegated to a dynamically defined manager class built by create_forward_many_to_many_manager() defined below.

class proso_models.models.EnvironmentItemUpdateDirection(key, correct_increases=True, size=100)[source]

Bases: proso_common.models.IntegrityCheck

check()[source]
class proso_models.models.EnvironmentUserUpdateDirection(key, correct_increases=True, size=1000)[source]

Bases: proso_common.models.IntegrityCheck

check()[source]
class proso_models.models.ExclusiveEnvironmentUpdates(size=1000000)[source]

Bases: proso_common.models.IntegrityCheck

check()[source]
class proso_models.models.Item(id, item_type, active)[source]

Bases: django.db.models.base.Model, proso.django.models.ModelDiffMixin

exception DoesNotExist

Bases: django.core.exceptions.ObjectDoesNotExist

exception Item.MultipleObjectsReturned

Bases: django.core.exceptions.MultipleObjectsReturned

Item.child_relations

Accessor to the related objects manager on the reverse side of a many-to-one relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

parent.children is a ReverseManyToOneDescriptor instance.

Most of the implementation is delegated to a dynamically defined manager class built by create_forward_many_to_many_manager() defined below.

Item.children

Accessor to the related objects manager on the forward and reverse sides of a many-to-many relation.

In the example:

class Pizza(Model):
    toppings = ManyToManyField(Topping, related_name='pizzas')

pizza.toppings and topping.pizzas are ManyToManyDescriptor instances.

Most of the implementation is delegated to a dynamically defined manager class built by create_forward_many_to_many_manager() defined below.

Item.flashcard_categories

Accessor to the related objects manager on the reverse side of a many-to-one relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

parent.children is a ReverseManyToOneDescriptor instance.

Most of the implementation is delegated to a dynamically defined manager class built by create_forward_many_to_many_manager() defined below.

Item.flashcard_contexts

Accessor to the related objects manager on the reverse side of a many-to-one relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

parent.children is a ReverseManyToOneDescriptor instance.

Most of the implementation is delegated to a dynamically defined manager class built by create_forward_many_to_many_manager() defined below.

Item.flashcard_terms

Accessor to the related objects manager on the reverse side of a many-to-one relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

parent.children is a ReverseManyToOneDescriptor instance.

Most of the implementation is delegated to a dynamically defined manager class built by create_forward_many_to_many_manager() defined below.

Item.flashcards

Accessor to the related objects manager on the reverse side of a many-to-one relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

parent.children is a ReverseManyToOneDescriptor instance.

Most of the implementation is delegated to a dynamically defined manager class built by create_forward_many_to_many_manager() defined below.

Item.item_answered_answers

Accessor to the related objects manager on the reverse side of a many-to-one relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

parent.children is a ReverseManyToOneDescriptor instance.

Most of the implementation is delegated to a dynamically defined manager class built by create_forward_many_to_many_manager() defined below.

Item.item_answers

Accessor to the related objects manager on the reverse side of a many-to-one relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

parent.children is a ReverseManyToOneDescriptor instance.

Most of the implementation is delegated to a dynamically defined manager class built by create_forward_many_to_many_manager() defined below.

Item.item_asked_answers

Accessor to the related objects manager on the reverse side of a many-to-one relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

parent.children is a ReverseManyToOneDescriptor instance.

Most of the implementation is delegated to a dynamically defined manager class built by create_forward_many_to_many_manager() defined below.

Item.item_primary_audits

Accessor to the related objects manager on the reverse side of a many-to-one relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

parent.children is a ReverseManyToOneDescriptor instance.

Most of the implementation is delegated to a dynamically defined manager class built by create_forward_many_to_many_manager() defined below.

Item.item_primary_variables

Accessor to the related objects manager on the reverse side of a many-to-one relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

parent.children is a ReverseManyToOneDescriptor instance.

Most of the implementation is delegated to a dynamically defined manager class built by create_forward_many_to_many_manager() defined below.

Item.item_secondary_audits

Accessor to the related objects manager on the reverse side of a many-to-one relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

parent.children is a ReverseManyToOneDescriptor instance.

Most of the implementation is delegated to a dynamically defined manager class built by create_forward_many_to_many_manager() defined below.

Item.item_secondary_variables

Accessor to the related objects manager on the reverse side of a many-to-one relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

parent.children is a ReverseManyToOneDescriptor instance.

Most of the implementation is delegated to a dynamically defined manager class built by create_forward_many_to_many_manager() defined below.

Item.item_type

Accessor to the related object on the forward side of a many-to-one or one-to-one relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

child.parent is a ForwardManyToOneDescriptor instance.

Item.objects = <proso_models.models.ItemManager object>
Item.parent_relations

Accessor to the related objects manager on the reverse side of a many-to-one relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

parent.children is a ReverseManyToOneDescriptor instance.

Most of the implementation is delegated to a dynamically defined manager class built by create_forward_many_to_many_manager() defined below.

Item.parents

Accessor to the related objects manager on the forward and reverse sides of a many-to-many relation.

In the example:

class Pizza(Model):
    toppings = ManyToManyField(Topping, related_name='pizzas')

pizza.toppings and topping.pizzas are ManyToManyDescriptor instances.

Most of the implementation is delegated to a dynamically defined manager class built by create_forward_many_to_many_manager() defined below.

Item.task_contexts

Accessor to the related objects manager on the reverse side of a many-to-one relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

parent.children is a ReverseManyToOneDescriptor instance.

Most of the implementation is delegated to a dynamically defined manager class built by create_forward_many_to_many_manager() defined below.

Item.task_instances

Accessor to the related objects manager on the reverse side of a many-to-one relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

parent.children is a ReverseManyToOneDescriptor instance.

Most of the implementation is delegated to a dynamically defined manager class built by create_forward_many_to_many_manager() defined below.

Item.task_skills

Accessor to the related objects manager on the reverse side of a many-to-one relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

parent.children is a ReverseManyToOneDescriptor instance.

Most of the implementation is delegated to a dynamically defined manager class built by create_forward_many_to_many_manager() defined below.

Item.task_tasks

Accessor to the related objects manager on the reverse side of a many-to-one relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

parent.children is a ReverseManyToOneDescriptor instance.

Most of the implementation is delegated to a dynamically defined manager class built by create_forward_many_to_many_manager() defined below.

Item.to_json(nested=False)[source]
class proso_models.models.ItemManager[source]

Bases: django.db.models.manager.Manager

filter_all_reachable_leaves(identifier_filter, language)[source]

Get all leaves corresponding to the given filter:

  • the filter is a list of lists;
  • each of the inner list carries identifiers;
  • for each identifier, we find an item and all its reachable leaf items;
  • within the inner list we union the reachable items;
  • with the outer list we intersect the reachable items;
  • when an identifier starts with the prfix ‘-‘, we find its reachable leaf items and then complement them

Example:

    A
   / \
  B   C
 / \ / \
D   E   F

[[A], [C]] ----> [D, F]
[[B], [C]] ----> [E]
[[B], [-C]] ---> [D]
[[A], [-D], [-F]] ---> [E]
[[-C]] ---> []
Args::
identifier_filter (list): list of lists of identifiers (some of them
can start with the prefix ‘-‘)
language (str): language used for further filtering (some objects
for different languages share the same item
Returns:list of item ids
Return type:list
filter_all_reachable_leaves_many(identifier_filters, language)[source]

Provides the same functionality as .. py:method:: ItemManager.filter_all_reachable_leaves(), but for more filters in the same time.

Parameters:
  • identifier_filters – list of identifier filters
  • language (str) – language used for further filtering (some objects for different languages share the same item
Returns:

list of list of item ids

Return type:

list

get_all_available_leaves()[source]

Get all available leaves.

get_all_leaves(item_ids, language=None)[source]

Get all leaves reachable from the given set of items. Leaves having inactive relations to other items are omitted.

Parameters:
  • item_ids (list) – items which are taken as roots for the reachability
  • language (str) – if specified, filter out items which are not available in the given language
Returns:

leaf items which are reachable from the given set of items

Return type:

set

get_children_counts(active=True)[source]
get_children_graph(item_ids=None, language=None)[source]

Get a subgraph of items reachable from the given set of items through the ‘child’ relation.

Parameters:
  • item_ids (list) – items which are taken as roots for the reachability
  • language (str) – if specified, filter out items which are not available in the given language
Returns:

item id -> list of items (child items), root items are referenced by None key

Return type:

dict

get_item_type_id_from_identifier(identifier, item_types=None)[source]

Get an ID of item type for the given identifier. Identifier is a string of the following form:

<model_prefix>/<model_identifier>

where <model_prefix> is any suffix of database table of the given model which uniquely specifies the table, and <model_identifier> is identifier of the object.

Parameters:
  • identifier (str) – item identifier
  • item_types (dict) – ID -> item type JSON
Returns:

ID of the corresponding item type

Return type:

int

get_leaves(item_ids, language=None)[source]

Get mapping of items to their reachable leaves. Leaves having inactive relations to other items are omitted.

Parameters:
  • item_ids (list) – items which are taken as roots for the reachability
  • language (str) – if specified, filter out items which are not available in the given language
Returns:

item id -> list of items (reachable leaves)

Return type:

dict

get_parents_graph(item_ids, language=None)[source]

Get a subgraph of items reachable from the given set of items through the ‘parent’ relation.

Parameters:
  • item_ids (list) – items which are taken as roots for the reachability
  • language (str) – if specified, filter out items which are not available in the given language
Returns:

item id -> list of items (parent items), root items are referenced by None key

Return type:

dict

get_reachable_children(item_ids, language=None)[source]
get_reachable_parents(item_ids, language=None)[source]
get_reference_fields(exclude_models=None)[source]

Get all Django model fields which reference the Item model.

item_id_to_json(item_id)[source]
override_children_subgraph(children_subgraph, invisible_edges=None)[source]

Get all items with outcoming edges from the given subgraph, drop all their child relations, and then add children according to the given subgraph.

Parameters:
  • children_subgraph (dict) – item id -> list of chidlren (item ids)
  • invisible_edges (list|set) – set of (from, to) tuples specifying invisible edges
override_parent_subgraph(parent_subgraph, invisible_edges=None)[source]

Get all items with outcoming edges from the given subgraph, drop all their parent relations, and then add parents according to the given subgraph.

Parameters:
  • parent_subgraph (dict) – item id -> list of parents(item ids)
  • invisible_edges (list|set) – set of (from, to) tuples specifying invisible edges
predict_for_overview(environment, user_id, items)[source]
translate_identifiers(identifiers, language)[source]

Translate a list of identifiers to item ids. Identifier is a string of the following form:

<model_prefix>/<model_identifier>

where <model_prefix> is any suffix of database table of the given model which uniquely specifies the table, and <model_identifier> is identifier of the object.

Parameters:
  • identifiers (list[str]) – list of identifiers
  • language (str) – language used for further filtering (some objects for different languages share the same item
Returns:

identifier -> item id

Return type:

dict

translate_item_ids(item_ids, language, is_nested=None)[source]

Translate a list of item ids to JSON objects which reference them.

Parameters:
  • item_ids (list[int]) – item ids
  • language (str) – language used for further filtering (some objects for different languages share the same item)
  • is_nested (function) – mapping from item ids to booleans, where the boolean value indicates whether the item is nested
Returns:

item id -> JSON object

Return type:

dict

class proso_models.models.ItemRelation(id, parent, child, visible, active)[source]

Bases: django.db.models.base.Model, proso.django.models.ModelDiffMixin

exception DoesNotExist

Bases: django.core.exceptions.ObjectDoesNotExist

exception ItemRelation.MultipleObjectsReturned

Bases: django.core.exceptions.MultipleObjectsReturned

ItemRelation.child

Accessor to the related object on the forward side of a many-to-one or one-to-one relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

child.parent is a ForwardManyToOneDescriptor instance.

ItemRelation.objects = <django.db.models.manager.Manager object>
ItemRelation.parent

Accessor to the related object on the forward side of a many-to-one or one-to-one relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

child.parent is a ForwardManyToOneDescriptor instance.

class proso_models.models.ItemType(id, model, table, foreign_key, language, valid)[source]

Bases: django.db.models.base.Model

exception DoesNotExist

Bases: django.core.exceptions.ObjectDoesNotExist

exception ItemType.MultipleObjectsReturned

Bases: django.core.exceptions.MultipleObjectsReturned

ItemType.item_set

Accessor to the related objects manager on the reverse side of a many-to-one relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

parent.children is a ReverseManyToOneDescriptor instance.

Most of the implementation is delegated to a dynamically defined manager class built by create_forward_many_to_many_manager() defined below.

ItemType.objects = <proso_models.models.ItemTypeManager object>
ItemType.to_json(nested=False)[source]
class proso_models.models.ItemTypeManager[source]

Bases: django.db.models.manager.Manager

find_object_types(with_answers=True)[source]
get_all_item_type_ids()[source]
get_all_types()[source]
get_model(item_type_id)[source]
class proso_models.models.LonelyItems[source]

Bases: proso_common.models.IntegrityCheck

check()[source]
class proso_models.models.PracticeContext(id, content, content_hash)[source]

Bases: django.db.models.base.Model

exception DoesNotExist

Bases: django.core.exceptions.ObjectDoesNotExist

exception PracticeContext.MultipleObjectsReturned

Bases: django.core.exceptions.MultipleObjectsReturned

PracticeContext.answer_set

Accessor to the related objects manager on the reverse side of a many-to-one relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

parent.children is a ReverseManyToOneDescriptor instance.

Most of the implementation is delegated to a dynamically defined manager class built by create_forward_many_to_many_manager() defined below.

PracticeContext.objects = <proso_models.models.PracticeContextManager object>
PracticeContext.to_json(nested=False)[source]
class proso_models.models.PracticeContextManager[source]

Bases: django.db.models.manager.Manager

from_content(content)[source]
class proso_models.models.PracticeSet(id, finished)[source]

Bases: django.db.models.base.Model

exception DoesNotExist

Bases: django.core.exceptions.ObjectDoesNotExist

exception PracticeSet.MultipleObjectsReturned

Bases: django.core.exceptions.MultipleObjectsReturned

PracticeSet.answer_set

Accessor to the related objects manager on the reverse side of a many-to-one relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

parent.children is a ReverseManyToOneDescriptor instance.

Most of the implementation is delegated to a dynamically defined manager class built by create_forward_many_to_many_manager() defined below.

PracticeSet.objects = <django.db.models.manager.Manager object>
PracticeSet.to_json(nested=False)[source]
class proso_models.models.PriorSkillUpdates[source]

Bases: proso_models.models.EnvironmentItemUpdateDirection

class proso_models.models.Variable(id, user, item_primary, item_secondary, permanent, key, value, audit, updated, info, answer)[source]

Bases: django.db.models.base.Model

exception DoesNotExist

Bases: django.core.exceptions.ObjectDoesNotExist

exception Variable.MultipleObjectsReturned

Bases: django.core.exceptions.MultipleObjectsReturned

Variable.answer

Accessor to the related object on the forward side of a many-to-one or one-to-one relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

child.parent is a ForwardManyToOneDescriptor instance.

Variable.get_next_by_updated(*moreargs, **morekwargs)
Variable.get_previous_by_updated(*moreargs, **morekwargs)
Variable.info

Accessor to the related object on the forward side of a many-to-one or one-to-one relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

child.parent is a ForwardManyToOneDescriptor instance.

Variable.item_primary

Accessor to the related object on the forward side of a many-to-one or one-to-one relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

child.parent is a ForwardManyToOneDescriptor instance.

Variable.item_secondary

Accessor to the related object on the forward side of a many-to-one or one-to-one relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

child.parent is a ForwardManyToOneDescriptor instance.

Variable.objects = <django.db.models.manager.Manager object>
Variable.user

Accessor to the related object on the forward side of a many-to-one or one-to-one relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

child.parent is a ForwardManyToOneDescriptor instance.

proso_models.models.activity_of_environment_relation(sender, instance, **kwargs)[source]
proso_models.models.custom_filter_for_filters(identifier_filter)[source]
proso_models.models.drop_environment_relation(sender, instance, **kwargs)[source]
proso_models.models.get_active_environment_info()[source]
proso_models.models.get_content_hash(content)[source]
proso_models.models.get_environment()[source]
proso_models.models.get_environment_write_hooks()[source]
proso_models.models.get_filter(request)[source]
proso_models.models.get_item_selector()[source]
proso_models.models.get_mastery_trashold()[source]
proso_models.models.get_option_selector(item_selector, options_number=None)[source]
proso_models.models.get_options_number()[source]
proso_models.models.get_predictive_model(environment_info=None)[source]
proso_models.models.get_time_for_knowledge_overview(request=None)[source]
proso_models.models.handle_response_time_bug(sender, instance, **kwargs)[source]
proso_models.models.identifier_filter_canonical(identifier_filter)[source]
proso_models.models.identifier_filter_eq(a, b)[source]
proso_models.models.init_config(sender, instance, **kwargs)[source]
proso_models.models.init_content_hash(instance)[source]
proso_models.models.init_content_hash_answer_meta(sender, instance, **kwargs)[source]
proso_models.models.init_content_hash_practice_context(sender, instance, **kwargs)[source]
proso_models.models.init_environment_relation(sender, instance, **kwargs)[source]
proso_models.models.init_session(sender, instance, **kwargs)[source]
proso_models.models.learning_curve(length, context=None, users=None, user_length=None, number_of_users=1000)[source]
proso_models.models.log_audit(sender, instance, **kwargs)[source]
proso_models.models.recommend_users(register_time_interval, number_of_answers_interval, success_rate_interval, variable_name, variable_interval, limit)[source]
proso_models.models.relation_activity(sender, instance, **kwargs)[source]
proso_models.models.update_predictive_model(sender, instance, **kwargs)[source]

proso_models.urls module

proso_models.views module

proso_models.views.answer(request)[source]

Save the answer.

GET parameters:
html:
turn on the HTML version of the API

BODY json in following format: {

“answer”: #answer, – for one answer “answers”: [#answer, #answer, #answer ...] – for multiple answers

}

answer = {

“answer_class”: str, – class of answer to save (e.g., flashcard_answer) “response_time”: int, – response time in milliseconds “meta”: “str” – optional information “time_gap”: int – waiting time in frontend in seconds ... – other fields depending on aswer type

(see from_json method of Django model class)

}

proso_models.views.answers(request)[source]
proso_models.views.audit(request, key)[source]
proso_models.views.learning_curve(request)[source]

Shows a learning curve based on the randomized testing.

GET parameters:
length:
length of the learning curve
context:
JSON representing the practice context
all_users:
if present stop filtering users based on the minimal number of testing answers (=length)
proso_models.views.practice(request)[source]

Return the given number of questions to practice adaptively. In case of POST request, try to save the answer(s).

GET parameters:
filter:
list of lists of identifiers (may be prefixed by minus sign to mark complement)
language:
language (str) of items
avoid:
list of item ids to avoid
limit:
number of returned questions (default 10, maximum 100)
time:
time in format ‘%Y-%m-%d_%H:%M:%S’ used for practicing
user:
identifier for the practicing user (only for stuff users)
stats:
turn on the enrichment of the objects by some statistics
html:
turn on the HTML version of the API
BODY:
see answer resource
proso_models.views.practice_image(request)[source]
proso_models.views.read(request, key)[source]
proso_models.views.recommend_users(request)[source]

Recommend users for further analysis.

GET parameters:
register_min:
minimal date of user’s registration (‘%Y-%m-%d’)
register_max:
maximal date of user’s registration (‘%Y-%m-%d’)
number_of_answers_min:
minimal number of user’s answers
number_of_answers_max:
maximal number of user’s answers
success_min:
minimal user’s success rate
success_max:
maximal user’s success rate
variable_name:
name of the filtered parameter
variable_min:
minimal value of the parameter of the model
variable_max:
maximal value of parameter of the model
limit:
number of returned questions (default 10, maximum 100)
proso_models.views.show_more(request, object_class, should_cache=True)[source]
proso_models.views.show_one(request, object_class, id)[source]
proso_models.views.status(request)[source]
proso_models.views.to_practice(request)[source]
proso_models.views.to_practice_counts(request)[source]

Get number of items available to practice.

filters: – use this or body
json as in BODY
language:
language of the items
BODY

json in following format: {

“#identifier”: [] – custom identifier (str) and filter ...

}

proso_models.views.user_stats(request)[source]

Get user statistics for selected groups of items

time:
time in format ‘%Y-%m-%d_%H:%M:%S’ used for practicing
user:
identifier of the user (only for stuff users)
username:
username of user (only for users with public profile)
filters: – use this or body
json as in BODY
mastered:
use model to compute number of mastered items - can be slowed
language:
language of the items
BODY

json in following format: {

“#identifier”: [] – custom identifier (str) and filter ...

}

Module contents