Exemple #1
0
class Fields(JsonObject):
    """ Fields model for issue"""
    status = ObjectProperty(Status)
    components = ListProperty(Component, default=None)
    labels = ListProperty(StringProperty, default=None)
    summary = StringProperty(default='')
    assignee = ObjectProperty(User)
    closed_sprints = ListProperty(Sprint, default=None, name='closedSprints')
    reporter = ObjectProperty(User)
    issue_type = ObjectProperty(IssueType)
    parent_ = DefaultProperty(default=None, name='parent')
    subtasks_ = DefaultProperty(default=None, name='subtasks')

    @property
    def parent(self):
        """ Getter for parent issue """
        if self.parent_:
            return Issue(self.parent_)
        return None

    @property
    def subtasks(self):
        """ Getter for subtasks """
        if self.subtasks_:
            return list(map(Issue, self.subtasks_))
        return None
Exemple #2
0
class QCLMMutationOutput(JsonObject):
    # List of mutations in the format "E42L"
    mutations = ListProperty(str, required=True)
    result_found = BooleanProperty(required=True)
    # List of primers for the given mutations, however
    # this is *ALWAYS only a single primer*!!!
    # We keep it as a list because frontend depends on it.
    primers = ListProperty(PrimerOutput)
Exemple #3
0
class _InvalidCredentialsErrors(JsonObject):
    email = ListProperty(StringProperty, required=True)
    password = ListProperty(StringProperty, required=True)
    message = StringProperty(required=True)

    def __eq__(self, other):
        # email and password lists should be sorted before comparing
        return sorted(self.email) == sorted(other.email) and sorted(self.password) == sorted(other.password) and \
               self.message == other.message
Exemple #4
0
class PASResult(JsonObject):
    fragment = StringProperty(required=True)
    start = IntegerProperty(required=True)
    end = IntegerProperty(required=True)
    length = IntegerProperty(required=True)
    overlap = StringProperty(required=False)
    overlap_Tm = FloatProperty(required=False)
    overlap_GC = FloatProperty(required=False)
    overlap_length = IntegerProperty(required=False)
    mutations = ListProperty(PASMutationFormatted, required=False)
    oligos = ListProperty(PASOligoOutput, required=True)
Exemple #5
0
class ByTypeWithTotal(JsonObject):
    by_type = ListProperty(TypedIndicator)
    totals = ObjectProperty(BasicIndicator)
    all_types = BooleanProperty(default=False)

    @property
    def enabled(self):
        return self.totals.enabled or self.all_types or len(self.enabled_types) > 0

    @property
    def enabled_types(self):
        return [type_ for type_ in self.by_type if type_.enabled]

    def types_by_date_range(self):
        types_list = sorted([
            TypeRange(type_.type, date_range) for type_ in self.enabled_types
            for date_range in type_.date_ranges
        ], key=lambda x: x.range_slug)

        return {
            range_slug: {type_.type for type_ in group}
            for range_slug, group in itertools.groupby(types_list, lambda x: x.range_slug)
        }

    def get_or_add_for_type(self, type_):
        try:
            return [by_type for by_type in self.by_type if by_type.type == type_][0]
        except IndexError:
            indicator = TypedIndicator(enabled=True, type=type_)
            self.by_type.append(
                indicator
            )
            return indicator
Exemple #6
0
class PASMutationSite(JsonObject):
    """ List of mutations at a given amino acid position """
    position = IntegerProperty(required=True)
    # List of mutation. Each mutation is a amino acid IUPAC code, or a DNA codon.
    mutations = ListProperty(PASMutation, required=True)
    # frequency = FloatProperty(required=True)

    def __gt__(self, other):
        if type(other) == int:
            return self.position > other
        return self.position > other.position

    def __lt__(self, other):
        if type(other) == int:
            return self.position < other
        return self.position < other.position

    def __eq__(self, other):
        if type(other) == int:
            return self.position == other
        return self.position == other.position

    # def __hash__(self):
    #     return hash(str(self.position))

    def get_mutations_str_list(self):
        return [mut.mutation for mut in self.mutations]
Exemple #7
0
class PASOligoOutput(JsonObject):
    sequence = StringProperty(required=True)
    mix_ratio = FloatProperty(required=True)
    mutations = ListProperty(required=False)
    reds = ListProperty(required=False)
    blues = ListProperty(required=False)

    def make_reverse_complement(self):
        # TODO test this
        self.sequence = reverse_complement(self.sequence)
        # -3 because when we do reverse complement we reverse the order of indexes
        #    -> what was start of codon will be end of codon in the reverse complement
        # thus we are moving from the end to start of codon in reversed sequence by subtracting 3
        def reindexer(ind): return abs(len(self.sequence) - ind - 3)
        self.reds = sorted(list(map(reindexer, self.reds)))
        self.blues = sorted(list(map(reindexer, self.blues)))
Exemple #8
0
class TaxJarBreakdown(JsonObject):
    taxable_amount = TaxJarFloatProperty()
    tax_collectable = TaxJarFloatProperty()
    combined_tax_rate = TaxJarFloatProperty()
    state_taxable_amount = TaxJarFloatProperty()
    state_tax_rate = TaxJarFloatProperty()
    state_tax_collectable = TaxJarFloatProperty()
    county_taxable_amount = TaxJarFloatProperty()
    county_tax_rate = TaxJarFloatProperty()
    county_tax_collectable = TaxJarFloatProperty()
    city_taxable_amount = TaxJarFloatProperty()
    city_tax_rate = TaxJarFloatProperty()
    city_tax_collectable = TaxJarFloatProperty()
    special_district_taxable_amount = TaxJarFloatProperty()
    special_tax_rate = TaxJarFloatProperty()
    special_district_tax_collectable = TaxJarFloatProperty()
    country_taxable_amount = TaxJarFloatProperty()
    country_tax_rate = TaxJarFloatProperty()
    country_tax_collectable = TaxJarFloatProperty()
    gst_taxable_amount = TaxJarFloatProperty()
    gst_tax_rate = TaxJarFloatProperty()
    gst = TaxJarFloatProperty()
    pst_taxable_amount = TaxJarFloatProperty()
    pst_tax_rate = TaxJarFloatProperty()
    pst = TaxJarFloatProperty()
    qst_taxable_amount = TaxJarFloatProperty()
    qst_tax_rate = TaxJarFloatProperty()
    qst = TaxJarFloatProperty()

    shipping = ObjectProperty(TaxJarShipping)

    line_items = ListProperty(TaxJarBreakdownLineItem)
Exemple #9
0
class PrimerOutput(JsonObject):
    sequence = StringProperty(required=True)
    start = IntegerProperty(required=True)
    length = IntegerProperty(required=True)
    temperature = FloatProperty(required=True)
    gc_content = FloatProperty(required=True)
    degenerate_codons = ListProperty(str, required=True)
    overlap_with_following = BooleanProperty(default=False, required=False)
Exemple #10
0
class PullRequest(JsonObject):
    id_ = IntegerProperty(name='id')
    version = IntegerProperty()
    title = StringProperty()
    description = StringProperty()
    state = StringProperty()
    open_ = BooleanProperty(name="open")
    closed = BooleanProperty()
    createdDate = EpochProperty()
    updatedDate = EpochProperty()
    fromRef = ObjectProperty(Ref)
    toRef = ObjectProperty(Ref)
    locked = BooleanProperty()
    author = ObjectProperty(PullRequestUser)
    reviewers = ListProperty(PullRequestUser, default=[])
    participants = ListProperty(PullRequestUser, default=[])
    properties = ObjectProperty(PullRequestProperties)
Exemple #11
0
class ProtectedSaleOrder(JsonObject):
    ownId = StringProperty(required=True)
    amount = ObjectProperty(Amount, exclude_if_none=True)
    items = ListProperty(Item, required=True)
    customer = ObjectProperty(Customer, required=True)
    checkoutPreferences = ObjectProperty(CheckoutPreferences,
                                         exclude_if_none=True,
                                         default=None)
Exemple #12
0
class Meter(JsonObject):
    """An Urjanet "Meter" object

    From Urjanet's documentation:
      | The Meter table organizes usage information into specific
      | "points" of service. Urjanet's definition of a meter is not
      | limited to physical meters. The meter table captures data
      | such as service types, tariffs, and usage periods.
    """

    # The primary key of the Meter object in the Urjanet database
    PK = IntegerProperty(required=True)

    # The tariff assigned to the meter.
    # Note: this is drawn from text in a PDF, and is not guaranteed
    # to have a consistent format (that is, tariff's on separate meters
    # cannot reliably be compared in a direct fashion)
    Tariff = StringProperty()

    # The service type of the meter (e.g. electric, natural_gas)
    ServiceType = StringProperty()

    # The "Point of Delivery" identifier for the meter. Interpretation
    # of this field varies for different utilities. For Pacific Gas &
    # Electric, this corresponds to a service ID.
    PODid = StringProperty()

    # The meter number for the meter. Interpretation of this field varies
    # for different utilities.
    MeterNumber = StringProperty()

    # The start/end dates for the Meter object. These fields are a little
    # difficult to interpret. Roughly speaking, they define, respectively, the
    # earliest and latest date for which usage/charge information is available
    # for the meter on a given statement. While this is usually set correctly,
    # there are times where individual charge/usage date ranges do not fully
    # interect with their parent meter.
    IntervalStart = DateProperty()
    IntervalEnd = DateProperty()

    # The charges associated with this meter
    charges = ListProperty(Charge)

    # The usage values associated with this meter
    usages = ListProperty(Usage)
Exemple #13
0
class _ModuleMetadata(JsonObject):
    unique_id = StringProperty()
    name = DictProperty()
    short_comment = StringProperty()
    module_type = StringProperty()
    is_surveys = BooleanProperty()
    module_filter = StringProperty()
    forms = ListProperty(_FormMetadata)
    changes = ObjectProperty(_ModuleDiff)
Exemple #14
0
class _FormMetadata(JsonObject):
    unique_id = StringProperty()
    name = DictProperty()
    short_comment = StringProperty()
    action_type = StringProperty()
    form_filter = StringProperty()
    questions = ListProperty(_FormMetadataQuestion)
    error = DictProperty()
    changes = ObjectProperty(_FormDiff)
Exemple #15
0
class SSMInput(JsonObject):
    sequences = ObjectProperty(SSMSequences, required=True)
    config = ObjectProperty(SSMConfig, required=True)
    mutations = ListProperty(str, required=True)
    degenerate_codon = StringProperty(required=True, default="NNS")

    def parse_mutations(self, goi_offset):
        return [
            parse_codon_mutation(mutation, goi_offset)
            for mutation in self.mutations
        ]
Exemple #16
0
class TaxJarCustomer(JsonObject):
    customer_id = StringProperty()
    exemption_type = StringProperty()
    name = StringProperty()
    country = StringProperty()
    state = StringProperty()
    zip = StringProperty()
    city = StringProperty()
    street = StringProperty()

    exempt_regions = ListProperty(TaxJarExemptRegion)
Exemple #17
0
class QCLMInput(JsonObject):
    sequences = ObjectProperty(QCLMSequences, required=True)
    config = ObjectProperty(QCLMConfig, required=True)
    mutations = ListProperty(str, required=True)

    def parse_mutations(self, goi_offset: int) -> List[MutationSite]:
        """
        Parses the user input in the format "E32W E32L E49K" and produces multi-amino
        mutations in the format of "E32WL E49K"
        """
        codon_muts = [parse_codon_mutation(mutation, goi_offset) for mutation in self.mutations]
        return create_multi_amino_mutations(codon_muts)
Exemple #18
0
class PASInput(JsonObject):
    # Sequences for the synthesized gene.
    # Expressed as ATGC or amino acid sequence.
    sequences = ObjectProperty(PASSequences, required=True)
    # Is the gene sequence a DNA (ATGC) sequence?
    is_dna_sequence = BooleanProperty(required=True)
    # Input parameters
    config = ObjectProperty(PASConfig, required=True)
    # List of mutations by position in the gene
    mutations = ListProperty(PASMutationFormattedInput, required=False)
    # Are mutations given as codons?
    is_mutations_as_codons = BooleanProperty(required=True)
Exemple #19
0
class SSMOutput(JsonObject):
    input_data = ObjectProperty(SSMInput, required=True)
    results = ListProperty(SSMMutationOutput, required=True)
    full_sequence = StringProperty(required=True)
    goi_offset = IntegerProperty(required=True)
    new_sequence_start = IntegerProperty(required=True)

    forward_flanking_primer_temperature = FloatProperty(required=True)
    reverse_flanking_primer_temperature = FloatProperty(required=True)
    min_three_end_temperature = FloatProperty()
    max_three_end_temperature = FloatProperty()
    min_overlap_temperature = FloatProperty()
    max_overlap_temperature = FloatProperty()
Exemple #20
0
class GridiumBillingPeriod(JsonObject):
    """A gridium billing period synthesized from Urjanet data."""

    # The start date of the billing period
    start = DateProperty()

    # The end date of the billing period
    end = DateProperty()

    # The statement date of the billing period
    statement = DateProperty()

    # The tariff associated with this period
    tariff = StringProperty()

    # A list of URLs pointing to the source documents for this billing period (e.g. PDF bills)
    source_urls = ListProperty(StringProperty)

    # The total charge for this period
    total_charge = DecimalProperty()

    # The peak demand for this period
    peak_demand = DecimalProperty()

    # The total usage for this period
    total_usage = DecimalProperty()

    # The list of charges for this period
    line_items = ListProperty(Charge)

    # The service id (SAID) associated with this billing period
    service_id = StringProperty()

    # The utility account id (account number) associated with this billing period
    utility_account_id = StringProperty()

    # The utility associated with this billing period, may also be a third party provider
    utility = StringProperty()
Exemple #21
0
class PASConfig(JsonObject):

    min_oligo_size = IntegerProperty(default=40)
    max_oligo_size = IntegerProperty(default=90)
    opt_oligo_size = IntegerProperty(default=56)

    min_overlap_tm = FloatProperty(default=50)
    max_overlap_tm = FloatProperty(default=65)
    opt_overlap_tm = IntegerProperty(default=56)  # this optimal temperature is for NEB like temperature calculator

    min_overlap_length = IntegerProperty(default=15)
    max_overlap_length = IntegerProperty(default=25)
    opt_overlap_length = IntegerProperty(default=21)

    min_gc_content = FloatProperty(default=40)
    max_gc_content = FloatProperty(default=60)

    use_degeneracy_codon = BooleanProperty(default=False)

    organism = StringProperty(default="e-coli")
    avoided_motifs = ListProperty(str)
    codon_usage_frequency_threshold = FloatProperty(default=0.1)

    # The allowed range for melting temperatures of fragment overlaps, in deg C
    temp_range_size = FloatProperty(default=5)

    # Temperature calculator configuration
    temperature_config = ObjectProperty(TemperatureConfig,
                                        default=create_default_pas_temperature_config())

    # Weights used for non_optimality calculation.
    temp_weight = FloatProperty(default=1)
    gc_content_weight = FloatProperty(default=1)
    length_weight = FloatProperty(default=1)
    hairpin_homodimer_weight = FloatProperty(default=2)

    # "Safe" temperature difference between a hairpin or homodimer formation and the reaction temperature
    safe_temp_difference = FloatProperty(default=10)

    # Step for iteration over possible melting temperature thresholds, in deg C
    temp_threshold_step = FloatProperty(default=1)
class TaxJarOrder(JsonObject):
    user_id = IntegerProperty()

    transaction_id = StringProperty()
    transaction_date = StringProperty()
    from_country = StringProperty()
    from_zip = StringProperty()
    from_state = StringProperty()
    from_city = StringProperty()
    from_street = StringProperty()
    to_country = StringProperty()
    to_zip = StringProperty()
    to_state = StringProperty()
    to_city = StringProperty()
    to_street = StringProperty()

    amount = TaxJarFloatProperty()
    shipping = TaxJarFloatProperty()
    sales_tax = TaxJarFloatProperty()

    line_items = ListProperty(TaxJarLineItem)
Exemple #23
0
class PASMutationFormattedInput(JsonObject):
    mutants = ListProperty(required=True)
    position = IntegerProperty(required=True)
    # TODO this should be also list if we have list of mutants
    frequency = FloatProperty(required=True)
Exemple #24
0
class Installment(JsonObject):
    quantity = ListProperty(int, required=True)
    discount = IntegerProperty(exclude_if_none=True)
    addition = IntegerProperty(exclude_if_none=True)
Exemple #25
0
class _FormMetadataQuestion(FormQuestionResponse):
    form_id = StringProperty()
    load_properties = ListProperty(LoadSaveProperty)
    save_properties = ListProperty(LoadSaveProperty)
    changes = ObjectProperty(_QuestionDiff)
Exemple #26
0
class CheckoutPreferences(JsonObject):
    redirectUrls = ObjectProperty(RedirectUrls)
    installments = ListProperty(Installment, exclude_if_none=True)
Exemple #27
0
class PASOutput(JsonObject):
    input_data = ObjectProperty(PASInput, required=True)
    results = ListProperty(PASResult, required=False)
    message = StringProperty()
Exemple #28
0
class ByTypeHierarchyRecord(JsonObject):
    val = StringProperty()
    text = StringProperty()
    next = ListProperty(lambda: ByTypeHierarchyRecord, exclude_if_none=True)
Exemple #29
0
class CallCenterIndicatorConfig(JsonObject):
    forms_submitted = ObjectProperty(BasicIndicator)
    cases_total = ObjectProperty(ByTypeWithTotal)
    cases_active = ObjectProperty(ByTypeWithTotal)
    cases_opened = ObjectProperty(ByTypeWithTotal)
    cases_closed = ObjectProperty(ByTypeWithTotal)

    legacy_forms_submitted = BooleanProperty(False)
    legacy_cases_total = BooleanProperty(False)
    legacy_cases_active = BooleanProperty(False)

    custom_form = ListProperty(TypedIndicator)

    def includes_legacy(self):
        return (self.legacy_forms_submitted or self.legacy_cases_total
                or self.legacy_cases_active)

    @classmethod
    def default_config(cls, domain_name=None, include_legacy=True):
        def default_basic():
            return BasicIndicator(enabled=True,
                                  date_ranges=set(const.DATE_RANGES))

        def default_typed():
            return ByTypeWithTotal(totals=default_basic(), all_types=True)

        config = cls(
            forms_submitted=default_basic(),
            cases_total=default_typed(),
            cases_active=default_typed(),
            cases_opened=default_typed(),
            cases_closed=default_typed(),
        )

        config.legacy_forms_submitted = include_legacy
        config.legacy_cases_total = include_legacy
        config.legacy_cases_active = include_legacy

        for slug in const.PER_DOMAIN_FORM_INDICATORS.get(domain_name, {}):
            for range in const.DATE_RANGES:
                config.custom_form.append(
                    TypedIndicator(type=slug, date_range=range))

        return config

    def set_indicator(self, parsed_indicator):
        if parsed_indicator.is_legacy:
            indicator = getattr(self, parsed_indicator.category)
            setattr(self, 'legacy_{}'.format(parsed_indicator.category), True)
            if parsed_indicator.date_range:
                date_range = parsed_indicator.date_range
                if isinstance(indicator, ByTypeWithTotal):
                    indicator.totals.date_ranges.add(date_range)
                else:
                    indicator.date_ranges.add(date_range)
        elif parsed_indicator.category == const.CUSTOM_FORM:
            self.custom_form.append(
                TypedIndicator(enabled=True,
                               date_range=parsed_indicator.date_range,
                               type=parsed_indicator.type))
        elif parsed_indicator.category == const.FORMS_SUBMITTED:
            self.forms_submitted.enabled = True
            if parsed_indicator.date_range:
                self.forms_submitted.date_ranges.add(
                    parsed_indicator.date_range)
        else:
            indicator = getattr(self, parsed_indicator.category)
            if parsed_indicator.type:
                indicator = indicator.get_or_add_for_type(
                    parsed_indicator.type)
            else:
                indicator = indicator.totals

            indicator.enabled = True
            if parsed_indicator.date_range:
                indicator.date_ranges.add(parsed_indicator.date_range)
Exemple #30
0
class DomainConfiguration(JsonObject):
    geography_hierarchy = DictProperty()
    by_type_hierarchy = ListProperty(ByTypeHierarchyRecord)