Skip to content
This repository was archived by the owner on Feb 9, 2023. It is now read-only.
This repository was archived by the owner on Feb 9, 2023. It is now read-only.

discard junk data by refactoring the address creation function  #71

Open
@safebuffer

Description

@safebuffer

Address record creation should go through a proxy function i.e create_new_address and the city value should be checked whether it's inside affected areas or not

def create_address(processed_address=None,full_address=None,tweet=None):
    city = processed_address.get("city")
    allowed_cities = ["Gaziantep", "Malatya", "Batman", "Bingöl", "Elazığ", "Kilis", "Diyarbakır", "Mardin", "Siirt", "Şırnak", "Van", "Muş", "Bitlis", "Hakkari", "Adana", "Osmaniye","Hatay'"]

    if city in allowed_cities or city == None:
        return Address.objects.create(
            tweet_id=tweet.id,
            address=full_address,
            city=processed_address.get("city"),
            distinct=processed_address.get("distinct"),
            neighbourhood=processed_address.get("neighbourhood"),
            street=processed_address.get("street"),
            no=processed_address.get("no"),
            name_surname=processed_address.get("name_surname"),
            tel=processed_address.get("tel"),
        )

inside the ask_to_zekai function

        address = create_address(processed_address,full_address,tweet)
        if not address:
            return

this will cut down the number of API requests sent to the ty_geolocation_url endpoint

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions