Example #1
0
    def save(self, old_record, list_record, detail_record):
        if old_record is not None:
            # Records never change, so we don't have to
            # worry about changing ones that already exist.
            self.logger.debug('Permit record already exists: %s' % old_record)
            return

        category = self.get_or_create_lookup('category', list_record['category_name'], list_record['BUILDING CLASS CATEGORY'])
        year_built = self.get_or_create_lookup('year_built', list_record['year_built'], list_record['year_built'])
        building_class = self.get_or_create_lookup('building_class', list_record['BUILDING CLASS AT TIME OF SALE'], list_record['BUILDING CLASS AT TIME OF SALE'])

        if list_record['sale_price'] == '0':
            title = '%s transferred ownership with no cash consideration' % list_record['clean_address_with_unit']
        else:
            title = '%s sold for $%s' % (list_record['clean_address_with_unit'], intcomma(list_record['sale_price']))

        attributes = {
            'clean_address': list_record['clean_address_with_unit'],
            'raw_address': list_record['ADDRESS'], # Save this for use in future scrapes.
            'sale_price': list_record['sale_price'],
            'category': category.id,
            'year_built': year_built.id,
            'building_class': building_class.id,
            'gross_square_feet': list_record['GROSS SQUARE FEET'],
            'total_units': list_record['TOTAL UNITS'],
        }
        self.create_newsitem(
            attributes,
            title=title,
            pub_date=list_record['SALE DATE'],
            item_date=list_record['SALE DATE'],
            location_name='%s, %s' % (list_record['clean_address'], list_record['borough']),
        )
Example #2
0
 def save(self, old_record, list_record, detail_record):
     if old_record is not None:
         return
     if list_record["Amount"] is None:
         title = "%s transferred ownership" % list_record["clean_address_with_unit"]
     else:
         title = "%s sold for $%s" % (list_record["clean_address_with_unit"], intcomma(list_record["Amount"]))
     attributes = {
         "doc_number": list_record["doc_number"],
         "sale_price": list_record["Amount"],
         "seller": list_record["Seller"],
         "buyer": list_record["Buyer"],
         "pin": list_record["PIN"],
         "date_executed": list_record["Executed"],
     }
     self.create_newsitem(
         attributes, title=title, item_date=list_record["Recorded"], location_name=list_record["clean_address"]
     )
Example #3
0
 def save(self, old_record, list_record, detail_record):
     if old_record is not None:
         return
     if list_record['Amount'] is None:
         title = '%s transferred ownership' % list_record['clean_address_with_unit']
     else:
         title = '%s sold for $%s' % (list_record['clean_address_with_unit'], intcomma(list_record['Amount']))
     attributes = {
         'doc_number': list_record['doc_number'],
         'sale_price': list_record['Amount'],
         'seller': list_record['Seller'],
         'buyer': list_record['Buyer'],
         'pin': list_record['PIN'],
         'date_executed': list_record['Executed'],
     }
     self.create_newsitem(
         attributes,
         title=title,
         item_date=list_record['Recorded'],
         location_name=list_record['clean_address'],
     )
    def save(self, old_record, list_record, detail_record):
        if old_record is not None:
            # Records never change, so we don't have to
            # worry about changing ones that already exist.
            self.logger.debug("Permit record already exists: %s" % old_record)
            return

        category = self.get_or_create_lookup(
            "category", list_record["category_name"], list_record["BUILDING CLASS CATEGORY"]
        )
        year_built = self.get_or_create_lookup("year_built", list_record["year_built"], list_record["year_built"])
        building_class = self.get_or_create_lookup(
            "building_class",
            list_record["BUILDING CLASS AT TIME OF SALE"],
            list_record["BUILDING CLASS AT TIME OF SALE"],
        )

        if list_record["sale_price"] == "0":
            title = "%s transferred ownership with no cash consideration" % list_record["clean_address_with_unit"]
        else:
            title = "%s sold for $%s" % (list_record["clean_address_with_unit"], intcomma(list_record["sale_price"]))

        attributes = {
            "clean_address": list_record["clean_address_with_unit"],
            "raw_address": list_record["ADDRESS"],  # Save this for use in future scrapes.
            "sale_price": list_record["sale_price"],
            "category": category.id,
            "year_built": year_built.id,
            "building_class": building_class.id,
            "gross_square_feet": list_record["GROSS SQUARE FEET"],
            "total_units": list_record["TOTAL UNITS"],
        }
        self.create_newsitem(
            attributes,
            title=title,
            pub_date=list_record["SALE DATE"],
            item_date=list_record["SALE DATE"],
            location_name="%s, %s" % (list_record["clean_address"], list_record["borough"]),
        )
Example #5
0
 def save(self, old_record, list_record, detail_record):
     if old_record is not None:
         return
     if list_record['Amount'] is None:
         title = '%s transferred ownership' % list_record[
             'clean_address_with_unit']
     else:
         title = '%s sold for $%s' % (
             list_record['clean_address_with_unit'],
             intcomma(list_record['Amount']))
     attributes = {
         'doc_number': list_record['doc_number'],
         'sale_price': list_record['Amount'],
         'seller': list_record['Seller'],
         'buyer': list_record['Buyer'],
         'pin': list_record['PIN'],
         'date_executed': list_record['Executed'],
     }
     self.create_newsitem(
         attributes,
         title=title,
         item_date=list_record['Recorded'],
         location_name=list_record['clean_address'],
     )