def sourced_properties(cache: any) -> tuple:
    if not(cache is None):
        return cache

    sourced_data = request.get_json()
    if 'property_list' in sourced_data:
        property_list = sourced_data['property_list']
    else:
        return jsonify({'status': 'failure', 'message': 'property_list is required'}), 500

    if 'postcode' in sourced_data:
        postcode = sourced_data['postcode']
    else:
        return jsonify({'status': 'failure', 'message': 'postcode is required'}), 500

    if 'radius' in sourced_data:
        radius = int(sourced_data['radius'])

        if 'results' in sourced_data:
            results = int(sourced_data['results'])

            return EndPoints().sourced_properties(property_list=property_list, postcode=postcode,
                                                  radius=radius, results=results)

        return EndPoints().sourced_properties(property_list=property_list, postcode=postcode,
                                              radius=radius)

    return EndPoints().sourced_properties(property_list=property_list, postcode=postcode)
def sold_prices(cache: any) -> tuple:
    """
        given postcode, property_type, max_age
    :return: sold prices
    """
    if not(cache is None):
        return cache

    sold_prices_data: dict = request.get_json()
    if 'postcode' in sold_prices_data:
        postcode: str = sold_prices_data['postcode']
    else:
        return jsonify({'status': 'failure', 'message': 'postcode is required'}), 500

    if 'property_type' in sold_prices_data:
        property_type: str = sold_prices_data['property_type']
    else:
        return jsonify({'status': 'failure', 'message': 'property_type is required'}), 500

    if 'max_age' in sold_prices_data:
        max_age: int = int(sold_prices_data['max_age'])
    else:
        return jsonify({'status': 'failure', 'message': 'max_age is required'}), 500

    return EndPoints().sold_prices(postcode=postcode, property_type=property_type, max_age=max_age)
Пример #3
0
def stamp_duty(cache: any) -> tuple:
    if not (cache is None):
        return cache
    stamp_data: dict = request.get_json()
    if 'value' in stamp_data and not (stamp_data['value'] == ""):
        value: int = int(stamp_data['value'])
    else:
        return jsonify({
            'status': 'failure',
            'message': 'value is required'
        }), 500
    if 'country' in stamp_data and not (stamp_data['country'] == ""):
        country: str = stamp_data['country']
    else:
        return jsonify({
            'status': 'failure',
            'message': 'country is required'
        }), 500

    if 'additional' in stamp_data and not (stamp_data['additional'] == ""):
        additional: int = int(stamp_data['additional'])
    else:
        return jsonify({
            'status': 'failure',
            'message': 'additional is required'
        }), 500

    return EndPoints().stamp_duty(value=value,
                                  country=country,
                                  additional=additional)
Пример #4
0
def listed_buildings(cache: any) -> tuple:
    if not (cache is None):
        return cache

    listed_data: dict = request.get_json()
    if 'postcode' in listed_data and not (listed_data['postcode'] == ""):
        postcode: str = listed_data['postcode']
    else:
        return jsonify({
            'status': 'failure',
            'message': 'postcode is required'
        }), 500

    if 'grade' in listed_data and not (listed_data['grade'] == ""):
        grade: str = listed_data['grade']
    else:
        return jsonify({
            'status': 'failure',
            'message': 'grade is required'
        }), 500

    if 'listed_after' in listed_data and not (listed_data['listed_after']
                                              == ""):
        listed_after: int = int(listed_data['listed_after'])
    else:
        return jsonify({
            'status': 'failure',
            'message': 'listed_after is required'
        }), 500

    return EndPoints().listed_buildings(postcode=postcode,
                                        grade=grade,
                                        listed_after=listed_after)
def development_gdv(cache: any) -> tuple:
    if not(cache is None):
        return cache

    development_gdv_data = request.get_json()
    if 'postcode' in development_gdv_data:
        postcode = development_gdv_data['postcode']
    else:
        return jsonify({'status': 'failure', 'message': 'postcode is required'}), 500

    if 'flat_2' in development_gdv_data:
        flat_2 = development_gdv_data['flat_2']
    else:
        return jsonify({'status': 'failure', 'message': 'flat_2 is required'}), 500

    if 'flat_1' in development_gdv_data:
        flat_1 = development_gdv_data['flat_1']
    else:
        return jsonify({'status': 'failure', 'message': 'flat_1 is required'}), 500

    if 'finish_quality' in development_gdv_data:
        finish_quality = development_gdv_data['finish_quality']
    else:
        return jsonify({'status': 'failure', 'message': 'finish_quality is required'}), 500

    return EndPoints().development_gdv(postcode=postcode, flat_2=flat_2, flat_1=flat_1)
def valuation_sale(cache: any) -> tuple:
    """
     post-body:        postcode, internal_area, property_type, construction_date, bedrooms,
                       bathrooms, finish_quality, outdoor_space, off_street_parking
    :return:
    """
    if not(cache is None):
        return cache
    valuation_data: dict = request.get_json()
    if 'postcode' in valuation_data:
        postcode: str = valuation_data['postcode']
    else:
        return jsonify({'status': 'failure', 'message': 'postcode is required'}), 500

    if 'internal_area' in valuation_data:
        internal_area: int = int(valuation_data['internal_area'])
    else:
        return jsonify({'status': 'failure', 'message': 'internal_area is required'}), 500

    if 'property_type' in valuation_data:
        property_type: str = valuation_data['property_type']
    else:
        return jsonify({'status': 'failure', 'message': 'property_type is required'}), 500

    if 'construction_date' in valuation_data:
        construction_date: str = valuation_data['construction_date']
    else:
        return jsonify({'status': 'failure', 'message': 'construction_date is required'}), 500

    if 'bedrooms' in valuation_data:
        bedrooms: int = int(valuation_data['bedrooms'])
    else:
        return jsonify({'status': 'failure', 'message': 'bedrooms is required'}), 500

    if 'bathrooms' in valuation_data:
        bathrooms: int = int(valuation_data['bathrooms'])
    else:
        return jsonify({'status': 'failure', 'message': 'bathrooms is required'}), 500

    if 'finish_quality' in valuation_data:
        finish_quality: str = valuation_data['finish_quality']
    else:
        return jsonify({'status': 'failure', 'message': 'finish_quality is required'}), 500

    if 'outdoor_space' in valuation_data:
        outdoor_space: str = valuation_data['outdoor_space']
    else:
        return jsonify({'status': 'failure', 'message': 'outdoor_space is required'}), 500

    if 'off_street_parking' in valuation_data:
        off_street_parking: str = valuation_data['off_street_parking']
    else:
        return jsonify({'status': 'failure', 'message': 'off_street_parking is required'}), 500

    return EndPoints().valuation_sale(postcode=postcode, internal_area=internal_area, property_type=property_type,
                                      construction_date=construction_date, bedrooms=bedrooms, bathrooms=bathrooms,
                                      finish_quality=finish_quality, outdoor_space=outdoor_space,
                                      off_street_parking=off_street_parking)
def property_info(cache: any) -> tuple:
    if not(cache is None):
        return cache
    property_info_data = request.get_json()
    if 'property_id' in property_info_data:
        property_id = property_info_data['property_id']
    else:
        return jsonify({'status': 'failure', 'message': 'property_id is required'}), 500

    return EndPoints().property_info(property_id=property_id)
def postcode_stats(cache: any) -> tuple:
    if not(cache is None):
        return cache

    postcode_stats_data = request.get_json()
    if 'region' in postcode_stats_data:
        region = postcode_stats_data['region']
    else:
        return jsonify({'status': 'failure', 'message': 'region is required'}), 500

    return EndPoints().postcode_key_stats(region=region)
def growth(cache: any) -> tuple:
    if not(cache is None):
        return cache

    growth_data = request.get_json()
    if 'postcode' in growth_data:
        postcode = growth_data['postcode']
    else:
        return jsonify({'status': 'failure', 'message': 'postcode is required'}), 500

    return EndPoints().growth(postcode=postcode)
def sold_prices_per_sqf(cache: any) -> tuple:

    if not(cache is None):
        return cache

    sold_prices_data = request.get_json()
    if 'postcode' in sold_prices_data:
        postcode = sold_prices_data['postcode']
    else:
        return jsonify({'status': 'failure', 'message': 'postcode is required'}), 500

    return EndPoints().sold_prices_per_sqf(postcode=postcode)
Пример #11
0
def internet_speed(cache: any) -> tuple:
    if not (cache is None):
        return cache
    internet_data: dict = request.get_json()
    if 'postcode' in internet_data and not (internet_data['postcode'] == ""):
        postcode: str = internet_data['postcode']
    else:
        return jsonify({
            'status': 'failure',
            'message': 'postcode is required'
        }), 500
    return EndPoints().internet_speed(postcode=postcode)
Пример #12
0
def flood_risk(cache: any) -> tuple:
    if not (cache is None):
        return cache
    flood_data: dict = request.get_json()
    if 'postcode' in flood_data and not (flood_data['postcode'] == ""):
        postcode: str = flood_data['postcode']
    else:
        return jsonify({
            'status': 'failure',
            'message': 'postcode is required'
        }), 500
    return EndPoints().flood_risk(postcode=postcode)
Пример #13
0
def aobn(cache: any) -> tuple:
    if not (cache is None):
        return cache
    aobn_data: dict = request.get_json()
    if 'postcode' in aobn_data and not (aobn_data['postcode'] == ""):
        postcode: str = aobn_data['postcode']
    else:
        return jsonify({
            'status': 'failure',
            'message': 'postcode is required'
        }), 500
    return EndPoints().aonb(postcode=postcode)
Пример #14
0
def national_park(cache: any) -> tuple:
    if not (cache is None):
        return cache
    national_park_data: dict = request.get_json()
    if 'postcode' in national_park_data and not (national_park_data['postcode']
                                                 == ""):
        postcode: str = national_park_data['postcode']
    else:
        return jsonify({
            'status': 'failure',
            'message': 'postcode is required'
        }), 500
    return EndPoints().national_park(postcode=postcode)
Пример #15
0
def green_belt(cache: any) -> tuple:
    if not (cache is None):
        return cache
    green_belt_data: dict = request.get_json()
    if 'postcode' in green_belt_data and not (green_belt_data['postcode']
                                              == ""):
        postcode: str = green_belt_data['postcode']
    else:
        return jsonify({
            'status': 'failure',
            'message': 'postcode is required'
        }), 500
    return EndPoints().green_belt(postcode=postcode)
Пример #16
0
def council_tax(cache: any) -> tuple:
    if not (cache is None):
        return cache

    council_data: dict = request.get_json()
    if 'postcode' in council_data and not (council_data['postcode'] == ""):
        postcode: str = council_data['postcode']
    else:
        return jsonify({
            'status': 'failure',
            'message': 'postcode is required'
        }), 500
    return EndPoints().council_tax(postcode=postcode)
Пример #17
0
def title_info(cache: any) -> tuple:
    if not (cache is None):
        return cache
    title_data: dict = request.get_json()
    if 'title' in title_data and not (title_data['title'] == ""):
        title: str = title_data['title']
    else:
        return jsonify({
            'status': 'failure',
            'message': 'title is required'
        }), 500

    return EndPoints().title_info(title=title)
Пример #18
0
def planning(cache: any) -> tuple:
    if not (cache is None):
        return cache
    planning_data: dict = request.get_json()
    if 'postcode' in planning_data and not (planning_data['postcode'] == ""):
        postcode: str = planning_data['postcode']
    else:
        return jsonify({
            'status': 'failure',
            'message': 'postcode is required'
        }), 500

    if 'decision_rating' in planning_data and not (
            planning_data['decision_rating'] == ""):
        decision_rating: str = planning_data['decision_rating']
    else:
        return jsonify({
            'status': 'failure',
            'message': 'decision_rating is required'
        }), 500

    if 'category' in planning_data and not (planning_data['category'] == ""):
        category: str = planning_data['category']
    else:
        return jsonify({
            'status': 'failure',
            'message': 'category is required'
        }), 500

    if 'max_age_decision' in planning_data and not (
            planning_data['max_age_decision'] == ""):
        max_age_decision: int = int(planning_data['max_age_decision'])
    else:
        return jsonify({
            'status': 'failure',
            'message': 'max_age_decision is required'
        }), 500

    if 'results' in planning_data and not (planning_data['results'] == ""):
        results: int = int(planning_data['results'])
    else:
        return jsonify({
            'status': 'failure',
            'message': 'results is required'
        }), 500

    return EndPoints().planning(postcode=postcode,
                                decision_rating=decision_rating,
                                category=category,
                                max_age_decision=max_age_decision,
                                results=results)
def demographics(cache: any) -> tuple:
    if not (cache is None):
        return cache

    demo_data: dict = request.get_json()
    if 'postcode' in demo_data and not (demo_data['postcode'] == ""):
        postcode: str = demo_data['postcode']
    else:
        return jsonify({
            'status': 'failure',
            'message': 'postcode is required'
        }), 500

    return EndPoints().demographics(postcode=postcode)
def price_per_sqf(cache: any) -> tuple:
    """
        given postcode : return prices-per-sqf
    :return:
    """
    if not(cache is None):
        return cache

    prices_data: dict = request.get_json()
    if 'postcode' in prices_data:
        postcode: str = prices_data['postcode']
    else:
        return jsonify({'status': 'failure', 'message': 'postcode is required'}), 500

    return EndPoints().prices_per_sqf(postcode=postcode)
def prices(cache: any) -> tuple:
    if not(cache is None):
        return cache

    prices_data: dict = request.get_json()
    if 'postcode' in prices_data:
        postcode: str = prices_data['postcode']
    else:
        return jsonify({'status': 'failure', 'message': 'postcode is required'}), 500

    if 'bedrooms' in prices_data:
        bedrooms: int = int(prices_data['bedrooms'])
    else:
        return jsonify({'status': 'failure', 'message': 'postcode is required'}), 500

    return EndPoints().prices(postcode=postcode, bedrooms=bedrooms)
Пример #22
0
def build_cost(cache: any) -> tuple:
    if not (cache is None):
        return cache

    build_cost_data: dict = request.get_json()
    if 'postcode' in build_cost_data and not (build_cost_data['postcode']
                                              == ""):
        postcode: str = build_cost_data['postcode']
    else:
        return jsonify({
            'status': 'failure',
            'message': 'postcode is required'
        }), 500
    if 'property_type' in build_cost_data and not (
            build_cost_data['property_type'] == ""):
        property_type: str = build_cost_data['property_type']
    else:
        return jsonify({
            'status': 'failure',
            'message': 'property_type is required'
        }), 500

    if 'internal_area' in build_cost_data and not (
            build_cost_data['internal_area'] == ""):
        internal_area: int = int(build_cost_data['internal_area'])
    else:
        return jsonify({
            'status': 'failure',
            'message': 'internal_area is required'
        }), 500

    if 'finish_quality' in build_cost_data and not (
            build_cost_data['finish_quality'] == ""):
        finish_quality: str = build_cost_data['finish_quality']
    else:
        return jsonify({
            'status': 'failure',
            'message': 'finish_quality is required'
        }), 500
    return EndPoints().build_cost(postcode=postcode,
                                  property_type=property_type,
                                  internal_area=internal_area,
                                  finish_quality=finish_quality)