Example #1
0
def cleanse_data_chunk(record_type, ids, file_pk, increment):
    """

    :param record_type: one of 'property' or 'taxlot'
    :param ids: list of primary key ids to process
    :param file_pk: import file primary key
    :param increment: currently unused, but needed because of the special method that appends this onto the function  # NOQA
    :return: None
    """

    # get the db objects based on the ids
    model = {'property': PropertyState, 'taxlot': TaxLotState}.get(record_type)

    qs = model.objects.filter(id__in=ids).iterator()

    import_file = ImportFile.objects.get(pk=file_pk)
    super_org = import_file.import_record.super_organization

    c = Cleansing(super_org.get_parent())
    c.cleanse(record_type, qs)
    c.save_to_cache(file_pk)
Example #2
0
def cleanse_data_chunk(ids, file_pk, increment):
    """

    :param ids: list of primary key ids to process
    :param file_pk: import file primary key
    :param increment: currently unused, but needed because of the special method that appends this onto the function  # NOQA
    :return: None
    """

    # get the db objects based on the ids
    qs = BuildingSnapshot.objects.filter(id__in=ids).iterator()

    c = Cleansing()
    c.cleanse(qs)
    c.save_to_cache(file_pk)