Exemplo n.º 1
0
class Location(JsonObject):
    id = IntegerProperty()
    name = StringProperty()
    type = StringProperty()
    parent_id = IntegerProperty()
    latitude = StringProperty()
    longitude = StringProperty()
    code = StringProperty()
    groups = ListProperty()
    historical_groups = DictProperty()
Exemplo n.º 2
0
class Location(JsonObject):
    id = IntegerProperty()
    name = StringProperty()
    type = StringProperty()
    parent_id = IntegerProperty()
    latitude = StringProperty()
    longitude = StringProperty()
    code = StringProperty()
    groups = ListProperty()
    supervised_by = IntegerProperty()
    supply_points = ListProperty(item_type=SupplyPoint)
    is_active = BooleanProperty()
Exemplo n.º 3
0
class SupplyPoint(JsonObject):
    id = IntegerProperty()
    active = BooleanProperty()
    code = StringProperty()
    groups = ListProperty()
    last_reported = StringProperty()
    name = StringProperty()
    primary_reporter = IntegerProperty()
    supervised_by = IntegerProperty()
    supplied_by = IntegerProperty()
    type = StringProperty()
    location_id = IntegerProperty()
    products = ListProperty()
    incharges = ListProperty()
Exemplo n.º 4
0
class StockTransaction(JsonObject):
    beginning_balance = DecimalProperty()
    date = StringProperty()
    ending_balance = DecimalProperty()
    product = StringProperty()
    quantity = DecimalProperty()
    report_type = StringProperty()
    supply_point = IntegerProperty()
Exemplo n.º 5
0
class SumWhenTemplateSpec(JsonObject):
    type = StringProperty(required=True)
    expression = StringProperty(required=True)
    binds = ListProperty()
    then = IntegerProperty()

    def bind_count(self):
        return len(re.sub(r'[^?]', '', self.expression))
Exemplo n.º 6
0
class EWSUser(JsonObject):
    username = StringProperty()
    first_name = StringProperty()
    last_name = StringProperty()
    email = StringProperty()
    password = StringProperty()
    is_staff = BooleanProperty()
    is_active = BooleanProperty()
    is_superuser = BooleanProperty()
    last_login = StringProperty()
    date_joined = StringProperty()
    location = IntegerProperty()
    supply_point = IntegerProperty()
    sms_notifications = BooleanProperty()
    organization = StringProperty()
    groups = ListProperty(item_type=Group)
    contact = ObjectProperty(item_type=SMSUser)
Exemplo n.º 7
0
class ReportsForm(JsonObject):
    time = DateTimeProperty()
    completion_time = DateTimeProperty()
    start_time = DateTimeProperty()
    duration = IntegerProperty()
    submission_time = DateTimeProperty()
    xmlns = StringProperty()
    app_id = StringProperty()
    user_id = StringProperty()
    username = StringProperty()
Exemplo n.º 8
0
class SMSUser(JsonObject):
    id = IntegerProperty()
    name = StringProperty()
    role = StringProperty()
    is_active = StringProperty()
    supply_point = DecimalProperty()
    email = StringProperty()
    phone_numbers = ListProperty()
    backend = StringProperty()
    date_updated = StringProperty()
    language = StringProperty()
Exemplo n.º 9
0
class SMSUser(JsonObject):
    id = IntegerProperty()
    name = StringProperty()
    role = StringProperty()
    is_active = StringProperty()
    supply_point = ObjectProperty(item_type=SupplyPoint)
    email = StringProperty()
    phone_numbers = ListProperty()
    backend = StringProperty()
    family_name = StringProperty()
    to = StringProperty()
    language = StringProperty()
Exemplo n.º 10
0
class SumWhenColumn(_CaseExpressionColumn):
    type = TypeProperty("sum_when")
    else_ = IntegerProperty(default=0)
    _agg_column_type = SumWhen

    @classmethod
    def restricted_to_static(cls, domain):
        # The conditional expressions used here don't have sufficient safety checks,
        # so this column type is only available for static reports.  To release this,
        # we should require that conditions be expressed using a PreFilterValue type
        # syntax, as attempted in commit 02833e28b7aaf5e0a71741244841ad9910ffb1e5
        return True
Exemplo n.º 11
0
class Report(CaseReportMixin, JsonObject):
    month = IntegerProperty(required=True)
    year = IntegerProperty(required=True)
    block = StringProperty(required=True)

    def __init__(self, *args, **kwargs):
        super(Report, self).__init__(*args, **kwargs)
        self._extra_row_objects = []

    _data_provider = None

    @property
    def data_provider(self):
        return self._data_provider

    @property
    def datespan(self):
        return DateSpan.from_month(self.month, self.year, inclusive=True)

    def set_extra_row_objects(self, row_objects):
        self._extra_row_objects = row_objects
Exemplo n.º 12
0
class ILSUser(JsonObject):
    username = StringProperty()
    first_name = StringProperty()
    last_name = StringProperty()
    email = StringProperty()
    password = StringProperty()
    is_staff = BooleanProperty(default=False)
    is_active = BooleanProperty()
    is_superuser = BooleanProperty(default=False)
    last_login = StringProperty()
    date_joined = StringProperty()
    location = DecimalProperty()
    supply_point = IntegerProperty()
Exemplo n.º 13
0
class ExpandedColumn(ReportColumn):
    type = TypeProperty('expanded')
    field = StringProperty(required=True)
    max_expansion = IntegerProperty(default=DEFAULT_MAXIMUM_EXPANSION)

    @classmethod
    def wrap(cls, obj):
        # lazy migrations for legacy data.
        # todo: remove once all reports are on new format
        _add_column_id_if_missing(obj)
        return super(ExpandedColumn, cls).wrap(obj)

    def get_sql_column_config(self, data_source_config, lang):
        return get_expanded_column_config(data_source_config, self, lang)
Exemplo n.º 14
0
class ExpandedColumn(ReportColumn):
    type = TypeProperty('expanded')
    field = StringProperty(required=True)
    max_expansion = IntegerProperty(default=DEFAULT_MAXIMUM_EXPANSION)

    @classmethod
    def wrap(cls, obj):
        # lazy migrations for legacy data.
        # todo: remove once all reports are on new format
        _add_column_id_if_missing(obj)
        return super(ExpandedColumn, cls).wrap(obj)

    def get_column_config(self, data_source_config, lang):
        return get_expanded_column_config(data_source_config, self, lang)

    def get_fields(self, data_source_config, lang):
        return [self.field] + [
            c.aggregation.name
            for c in self.get_column_config(data_source_config, lang).columns
        ]

    def aggregations(self, data_source_config, lang):
        return [
            c.aggregation
            for c in self.get_column_config(data_source_config, lang).columns
        ]

    def get_es_data(self,
                    row,
                    data_source_config,
                    lang,
                    from_aggregation=True):
        sub_columns = self.get_column_config(data_source_config, lang).columns
        ret = {}

        if not from_aggregation:
            for counter, sub_col in enumerate(sub_columns):
                ui_col = self.column_id + "-" + str(counter)
                if row[self.column_id] == sub_col.expand_value:
                    ret[ui_col] = 1
                else:
                    ret[ui_col] = 0
        else:
            for sub_col in sub_columns:
                ret[sub_col.ui_alias] = sub_col.get_es_data(row)
        return ret
Exemplo n.º 15
0
class Groups(JsonObject):
    location_id = IntegerProperty()
    groups = DictProperty()
Exemplo n.º 16
0
class LocationDrilldownFilterSpec(FilterSpec):
    type = TypeProperty('location_drilldown')
    include_descendants = BooleanProperty(default=False)
    # default to some random high number '99'
    max_drilldown_levels = IntegerProperty(default=99)
    ancestor_expression = DictProperty(default={}, required=False)
Exemplo n.º 17
0
class Group(JsonObject):
    id = IntegerProperty()
    name = StringProperty()
Exemplo n.º 18
0
class ProductStock(JsonObject):
    supply_point = IntegerProperty()
    quantity = FloatProperty()
    product = StringProperty()
    last_modified = StringProperty()
    auto_monthly_consumption = FloatProperty()
Exemplo n.º 19
0
class SumWhenColumn(_CaseExpressionColumn):
    type = TypeProperty("sum_when")
    else_ = IntegerProperty(default=0)
    _agg_column_type = SumWhen