def format_display_json(title_json): LOGGER.debug("STARTED: format_display_json") proprietors = _format_proprietors(title_json['data']['proprietors']) title_data = title_json['data'] address_lines = address_utils.get_address_lines(title_data['address']) indexPolygon = _get_property_address_index_polygon(title_json['geometry_data']) title = { 'number': title_json['title_number'], 'last_changed': title_data.get('last_application_timestamp', 'No data'), 'address_lines': address_lines, 'proprietors': proprietors, 'tenure': title_data.get('tenure', 'No data'), 'indexPolygon': indexPolygon, 'is_caution_title': title_utils.is_caution_title(title_data), 'edition_date': title_data.get('edition_date'), 'class_of_title': title_data.get('class_of_title'), 'districts': title_data.get('districts') } if 'lenders' in title_data: title['lenders'] = _format_proprietors(title_data['lenders']) if 'ppi_data' in title_data: title['ppi_data'] = _format_ppi_data(title_data) LOGGER.debug("formatted title{0}".format(title)) LOGGER.debug("ENDED: format_display_json") return title
def format_display_json(title_json): proprietors = _format_proprietors(title_json['data']['proprietors']) title_data = title_json['data'] address_lines = address_utils.get_address_lines(title_data['address']) indexPolygon = _get_property_address_index_polygon(title_json['geometry_data']) title = { 'number': title_json['title_number'], 'last_changed': title_data.get('last_application_timestamp', 'No data'), 'address_lines': address_lines, 'proprietors': proprietors, 'tenure': title_data.get('tenure', 'No data'), 'indexPolygon': indexPolygon, 'is_caution_title': title_utils.is_caution_title(title_data), 'edition_date': title_data.get('edition_date'), 'class_of_title': title_data.get('class_of_title'), } if 'lenders' in title_data: title['lenders'] = _format_proprietors(title_data['lenders']) if 'ppi_data' in title_data: title['ppi_data'] = _format_ppi_data(title_data) return title
def _get_proprietor_addresses(proprietor): addresses = proprietor.get('addresses') or [] return [{"lines": address_utils.get_address_lines(address)} for address in addresses]