Exemplo n.º 1
0
class FileTypeSummary(AzulJsonObject):
    format = StringProperty()
    fileSource = ListProperty()  # List could have string(s) and/or None
    count = IntegerProperty()
    totalSize = FloatProperty()
    matrixCellCount = FloatProperty()
    isIntermediate = BooleanProperty()
    contentDescription = ListProperty(
    )  # List could have string(s) and/or None

    @classmethod
    def for_bucket(cls, bucket: JSON) -> 'FileTypeSummary':
        self = cls()
        self.count = bucket['doc_count']
        self.totalSize = bucket['size_by_type']['value']
        self.matrixCellCount = bucket['matrix_cell_count_by_type']['value']
        self.format = bucket['key']
        return self

    @classmethod
    def for_aggregate(cls, aggregate_file: JSON) -> 'FileTypeSummary':
        self = cls()
        self.count = aggregate_file['count']
        self.fileSource = aggregate_file['file_source']
        self.totalSize = aggregate_file['size']
        self.matrixCellCount = aggregate_file['matrix_cell_count']
        self.format = aggregate_file['file_format']
        self.isIntermediate = aggregate_file['is_intermediate']
        self.contentDescription = aggregate_file['content_description']
        assert isinstance(self.format, str), type(str)
        assert self.format
        return self
Exemplo n.º 2
0
class ResumableIteratorState(JsonObject):
    doc_type = "ResumableIteratorState"
    _id = StringProperty()
    name = StringProperty()
    timestamp = DateTimeProperty()
    args = ListProperty()
    kwargs = DictProperty()
    retry = DictProperty()
    progress = DictProperty()
    complete = BooleanProperty(default=False)
Exemplo n.º 3
0
class ResumableIteratorState(JsonObject):
    doc_type = "ResumableIteratorState"
    _id = StringProperty()
    name = StringProperty()
    timestamp = DateTimeProperty()
    args = ListProperty()
    kwargs = DictProperty()
    retry = DictProperty()
    progress = DictProperty()
    complete = BooleanProperty(default=False)

    def is_resume(self):
        return bool(getattr(self, '_rev', None))
Exemplo n.º 4
0
    class SchedulerModuleInfo(JsonObject):
        # Set to True to enable setting the start date of any schedule instances
        # based on the visit scheduler info details below
        enabled = BooleanProperty(default=False)

        # The app that contains the visit scheduler form being referenced
        app_id = StringProperty()

        # The unique_id of the visit scheduler form in the above app
        form_unique_id = StringProperty()

        # The visit number from which to pull the start date for any schedule
        # instances; this should be the 0-based index in the FormSchedule.visits list
        visit_number = IntegerProperty()

        # VISIT_WINDOW_START - the start date used will be the first date in the window
        # VISIT_WINDOW_END - the start date used will be the last date in the window
        # VISIT_WINDOW_DUE_DATE - the start date used will be the due date of the visit
        window_position = StringProperty(choices=[
            VISIT_WINDOW_START, VISIT_WINDOW_END, VISIT_WINDOW_DUE_DATE
        ])
Exemplo n.º 5
0
class FormArchiveRebuild(CaseTransactionDetail):
    _type = CaseTransaction.TYPE_REBUILD_FORM_ARCHIVED
    form_id = StringProperty()
    archived = BooleanProperty()