def json_to_report(data):

    entity = data.get("entity")
    filters = data.get("filters", {})

    report = {
        "source": None,
        "targets": [],
        "column_filters": {},
        "where_filters": {}
    }

    #
    # Entity Mapping
    #

    if entity == "farmer":

        report["source"] = "agri_users"

        report["column_filters"] = {
            "agri_users": [
                "*"
            ]
        }

    #
    # District Filter
    #

    if "district" in filters:

        if "agri_user_address" not in report["targets"]:
            report["targets"].append(
                "agri_user_address"
            )

        if "agri_districts" not in report["targets"]:
            report["targets"].append(
                "agri_districts"
            )

        report["where_filters"][
            "agri_districts"
        ] = {
            "district_name": {
                "op": "=",
                "value": filters["district"]
            }
        }

    #
    # AWD Filter
    #

    if "awd_status" in filters:

        if "agri_crop_history" not in report["targets"]:
            report["targets"].append(
                "agri_crop_history"
            )

        report["where_filters"][
            "agri_crop_history"
        ] = {
            "awd_status": {
                "op": "=",
                "value": filters["awd_status"]
            }
        }

    #
    # Season Filter
    #

    if "season" in filters:

        if "agri_crop_user_rels" not in report["targets"]:
            report["targets"].append(
                "agri_crop_user_rels"
            )

        report["where_filters"][
            "agri_crop_user_rels"
        ] = {
            "season": {
                "op": "=",
                "value": int(filters["season"])
            }
        }

    #
    # Optional Limit
    #

    if "limit" in data:
        report["limit"] = data["limit"]

    return report

