onadata.libs.utils package

Submodules

onadata.libs.utils.api_export_tools module

onadata.libs.utils.async_status module

onadata.libs.utils.audit module

onadata.libs.utils.backup_tools module

onadata.libs.utils.briefcase_client module

onadata.libs.utils.cache_tools module

onadata.libs.utils.chart_tools module

onadata.libs.utils.common_tags module

onadata.libs.utils.common_tools module

onadata.libs.utils.country_field module

onadata.libs.utils.csv_builder module

onadata.libs.utils.csv_import module

onadata.libs.utils.csv_reader module

class onadata.libs.utils.csv_reader.CsvReader(path)

Bases: object

Typical usage:

csv_reader = CsvReader(path)
for d in csv_reader.iter_dicts():
Variable.objects.create(**d)
close()
iter_dicts()
next()

A CsvReader object is iterable (since we have defined __iter__ and next methods. Each iteration of this object returns a row of data.

open(path)

onadata.libs.utils.decorators module

onadata.libs.utils.dict_tools module

onadata.libs.utils.dict_tools.csv_dict_to_nested_dict(a)
onadata.libs.utils.dict_tools.get_values_matching_key(doc, key)
onadata.libs.utils.dict_tools.list_to_dict(items, value)
onadata.libs.utils.dict_tools.merge_list_of_dicts(list_of_dicts)
onadata.libs.utils.dict_tools.remove_indices_from_dict(obj)

onadata.libs.utils.export_builder module

onadata.libs.utils.export_tools module

onadata.libs.utils.google module

onadata.libs.utils.gravatar module

onadata.libs.utils.gravatar.email_md5(user)
onadata.libs.utils.gravatar.gravatar_exists(user)

onadata.libs.utils.image_tools module

onadata.libs.utils.log module

onadata.libs.utils.logger_tools module

onadata.libs.utils.middleware module

onadata.libs.utils.model_tools module

onadata.libs.utils.model_tools.generate_uuid_for_form()
onadata.libs.utils.model_tools.get_columns_with_hxl(survey_elements)

Returns a dictionary whose keys are xform field names and values are instance::hxl values set on the xform :param include_hxl - boolean value :param survey_elements - survey elements of an xform return dictionary or None

onadata.libs.utils.model_tools.queryset_iterator(queryset, chunksize=100)

‘’ Iterate over a Django Queryset.

This method loads a maximum of chunksize (default: 100) rows in its memory at the same time while django normally would load all rows in its memory. Using the iterator() method only causes it to not preload all the classes.

onadata.libs.utils.model_tools.set_uuid(obj)

Only give an object a new UUID if it does not have one.

onadata.libs.utils.mongo module

onadata.libs.utils.numeric module

onadata.libs.utils.osm module

onadata.libs.utils.profiler module

onadata.libs.utils.project_utils module

onadata.libs.utils.qrcode module

onadata.libs.utils.quick_converter module

onadata.libs.utils.string module

onadata.libs.utils.string.str2bool(v)

onadata.libs.utils.timing module

onadata.libs.utils.user_auth module

onadata.libs.utils.viewer_tools module

Module contents