import json


def get_city_from_string(ctx: str):
    """
    Parses the city out of the JSON contained in the given string.

    :param ctx: a string containing JSON.
    :return: (city id, city name) tuple or (None, None) if not found.
    """
    js = json.loads(ctx)
    for j in js["data"]:
        if "iglu:com.dbip/location/jsonschema/1-0-0" == j["schema"]:
            if "city" in j["data"]:
                city_id = j["data"]["city"]["geoname_id"]
                city_name = j["data"]["city"]["names"]["en"]
                return str(city_id), city_name
    return None, None