disbi.experiment_filter module

Functions for filtering the experiments based on conditions.

disbi.experiment_filter.combine_conditions(conditions, combinable_conditions)[source]

Apply combine_on_sep() to each value in a dictionary.

Parameters:conditions (dict) – Dictionary with a list of condition values.
Returns:dict – A dictionary with the same keys and lists of combined values.
disbi.experiment_filter.combine_on_sep(items, separator)[source]

Combine each item with each other item on a separator.

  • items (list) – A list or iterable that remembers order.
  • separator (str) – The SEPARATOR the items will be combined on.

list – A list with all the combined items as strings.

disbi.experiment_filter.get_experiments_by_condition(conditions, experiment_model)[source]

Return a set of experiments that match the conditions.

Parameters:conditions (dict) – A dictionary with conditions as keys and a list of values.
Returns:set – A set of experiments that match the conditions.
disbi.experiment_filter.get_requested_experiments(formset_list, experiment_model)[source]

Return all experiments that match the request from the form.

Parameters:formset_list (list) – Formsets containing POST data.
Returns:set – The union of the set of the directly requested experiments and those that matched the requested conditons.

Return a dictionary readily useable for filter kwargs.

Parameters:dic (dict) – The dictionary to be formatted.
Returns:dict – The same dictionary with the keys concatenated with ‘__in’