Example #1
0
    def save(self, old_record, list_record, detail_record):
        if old_record is not None:
            return

        property_type = self.get_or_create_lookup('property_type',
                                                  list_record['property_type'],
                                                  list_record['property_type'])
        year_of_mortgage = self.get_or_create_lookup(
            'year_of_mortgage', list_record['year_of_mortgage'],
            list_record['year_of_mortgage'])
        newsitem_title = 'Foreclosure filed for property in the %s' % address_to_block(
            strip_unit(list_record['address']))
        attributes = {
            'original_principal': list_record['original_i'],
            'property_type': property_type.id,
            'year_of_mortgage': year_of_mortgage.id,
            'pin_number': list_record['pin_number'],
            'filing_date': list_record['filing_date'],
            'case_number': list_record['case_number'],
            'document_number': list_record['document_number'],
            'raw_address': list_record['address'],
        }
        self.create_newsitem(
            attributes,
            convert_to_block=True,
            title=newsitem_title,
            item_date=list_record['filing_date'],
            location_name=strip_unit(list_record['address']),
        )
Example #2
0
    def save(self, old_record, list_record, detail_record):
        if old_record is not None:
            return

        property_type = self.get_or_create_lookup('property_type', list_record['property_type'], list_record['property_type'])
        year_of_mortgage = self.get_or_create_lookup('year_of_mortgage', list_record['year_of_mortgage'], list_record['year_of_mortgage'])
        purchaser = self.get_or_create_lookup('purchaser', list_record['purchaser'], list_record['purchaser'])
        newsitem_title = 'Property on the %s sold at foreclosure auction' % address_to_block(strip_unit(list_record['address']))
        attributes = {
            'original_principal': list_record['original_i'],
            'property_type': property_type.id,
            'year_of_mortgage': year_of_mortgage.id,
            'pin_number': list_record['pin_number'],
            'case_number': list_record['case_number'],
            'document_number': list_record['document_number'],
            'filing_date': list_record['filing_date'],
            'raw_address': list_record['address'],
            'auction_price': list_record['auction_price'],
            'purchaser': purchaser.id,
        }
        self.create_newsitem(
            attributes,
            convert_to_block=True,
            title=newsitem_title,
            item_date=list_record['sale_date'],
            location_name=strip_unit(list_record['address']),
        )
Example #3
0
    def clean_list_record(self, record):
        record['application_date'] = parse_date(record['application_date'], '%m/%d/%Y')

        try:
            record['review_date'] = parse_date(record['review_date'], '%m/%d/%Y')
        except ValueError: # sometimes it's 'n/a'
            record['review_date'] = None

        record['address'] = strip_unit(clean_address(record['address']))
        if record['city'] not in self.city_names:
            raise SkipRecord('Skipping city %s' % record['city'])
        record['city'] = record['city'].title()
        return record
Example #4
0
    def clean_list_record(self, record):
        record['application_date'] = parse_date(record['application_date'], '%m/%d/%Y')

        try:
            record['review_date'] = parse_date(record['review_date'], '%m/%d/%Y')
        except ValueError: # sometimes it's 'n/a'
            record['review_date'] = None

        record['address'] = strip_unit(clean_address(record['address']))
        if record['city'] not in self.city_names:
            raise SkipRecord('Skipping city %s' % record['city'])
        record['city'] = record['city'].title()
        return record
Example #5
0
def clean_washington_address(add, city):
    add = add.replace(u'\xa0', ' ')
    add = re.sub(r',\s+%s,\s+WA.*$' % city, '', add)
    add = clean_address(add)
    return add, strip_unit(add).strip()
Example #6
0
def clean_washington_address(add, city):
    add = add.replace(u'\xa0', ' ')
    add = re.sub(r',\s+%s,\s+WA.*$' % city, '', add)
    add = clean_address(add)
    return add, strip_unit(add).strip()
Example #7
0
 def assertStripUnit(self, text, expected):
     self.assertEqual(strip_unit(text), expected)
Example #8
0
 def assertStripUnit(self, text, expected):
     self.assertEqual(strip_unit(text), expected)