Example #1
0
def pearl_map():

    if request.method == "POST":
        print("\n------")
        print("POST request in pearl_map")
        print("------\n")

    init_zoom = 3
    init_lat = 11.252725743861603
    init_long = -0.005242086131886481
    data_name = "Global Parasite Distributions"
    pearl_sp = "abbreviata_bancrofti"
    prop_name = "Abbreviata bancrofti"
    obj_show = {
        "pearl_sp": pearl_sp,
        "prop_name": prop_name,
        "data_name": data_name,
        "init_zoom": init_zoom,
        "init_lat": init_lat,
        "init_long": init_long
    }
    ## Pull in PEARL metadata
    obj_meta = get_csv(csv_path="./static/csv/pearl_data_summary.csv")
    obj_sp = get_csv(csv_path="./static/csv/pearl_sp/ABBREVIATA_BANCROFTI.csv")
    return render_template("pearl_map.html",
                           obj_show=obj_show,
                           obj_meta=obj_meta,
                           obj_sp=obj_sp)
Example #2
0
def point_page(pedon_key):
    obj_list = get_csv()
    for row in obj_list:
        if row['pedon_key'] == pedon_key:
            return render_template("point_page.html", obj_row=row)

    abort(404)
Example #3
0
def temp_map():
    if request.method == "POST":
        print("\n------")
        print("POST request in temp_map")
        print("------\n")

    obj_list = get_csv()

    st_cali = get_state(state="California")
    st_arzn = get_state(state="Arizona")
    st_nvda = get_state(state="Nevada")

    init_lat = 36.23418283
    init_long = -116.8341902
    init_zoom = 6
    data_name = "Temperature Samples"
    show_points = "true"
    show_states = "true"
    show_popup = "true"
    obj_show = {
        "data_name": data_name,
        "init_zoom": init_zoom,
        "init_lat": init_lat,
        "init_long": init_long,
        "show_points": show_points,
        "show_states": show_states,
        "show_popup": show_popup,
    }
    return render_template("temp_map.html",
                           obj_list=obj_list,
                           obj_show=obj_show,
                           st_cali=st_cali)
Example #4
0
def pick_pearl_sp():
    if request.method == "POST":
        print("\n------")
        print("POST request in pick_pearl_sp")
        #print("request.form['query_string']: ", request.form['query_string'])
        print("------\n")

        if request.form['query_string']:
            try:
                req_raw = request.form['query_string']
                if req_raw == "abba":
                    print("It is abba time...")
                    init_zoom = 3
                    init_lat = 11.252725743861603
                    init_long = -0.005242086131886481
                    data_name = "Global Parasite Distributions"
                    pearl_sp = "abbreviata_bancrofti"
                    prop_name = "Abbreviata bancrofti"
                    obj_show = {
                        "pearl_sp": pearl_sp,
                        "prop_name": prop_name,
                        "data_name": data_name,
                        "init_zoom": init_zoom,
                        "init_lat": init_lat,
                        "init_long": init_long
                    }
                    ## Pull in PEARL metadata
                    obj_meta = get_csv(
                        csv_path="./static/csv/pearl_data_summary.csv")
                    obj_sp = get_csv(
                        csv_path=
                        "./static/csv/pearl_sp/ABBREVIATA_BANCROFTI.csv")
                    return render_template("pearl_map.html",
                                           obj_show=obj_show,
                                           obj_meta=obj_meta,
                                           obj_sp=obj_sp)

                else:
                    flash("Something went wrong with finding that species...")
                    return redirect(request.url)

            except:
                flash("Bad query - could not interpret.")
                return redirect(request.url)
Example #5
0
def index():
    if request.method == "POST":
        print("\n------")
        print("POST request in index")
        print("------\n")

        if request.form['optionsRadios']:
            try:
                req_raw = request.form['optionsRadios']
                if req_raw == "option-pearl":
                    return render_template("pick_pearl_sp.html")

                elif req_raw == "option-temp":
                    obj_list = get_csv()

                    st_cali = get_state(state="California")
                    st_arzn = get_state(state="Arizona")
                    st_nvda = get_state(state="Nevada")

                    init_lat = 36.23418283
                    init_long = -116.8341902
                    init_zoom = 6
                    data_name = "Temperature Samples"
                    show_points = "true"
                    show_states = "true"
                    show_popup = "true"
                    obj_show = {
                        "data_name": data_name,
                        "init_zoom": init_zoom,
                        "init_lat": init_lat,
                        "init_long": init_long,
                        "show_points": show_points,
                        "show_states": show_states,
                        "show_popup": show_popup,
                    }
                    return render_template("temp_map.html",
                                           obj_list=obj_list,
                                           obj_show=obj_show,
                                           st_cali=st_cali)

                elif req_raw == "option-abba":
                    init_zoom = 3
                    init_lat = 11.252725743861603
                    init_long = -0.005242086131886481
                    data_name = "Global Parasite Distributions"
                    pearl_sp = "abbreviata_bancrofti"
                    prop_name = "Abbreviata bancrofti"
                    sub_name = ""
                    obj_show = {
                        "pearl_sp": pearl_sp,
                        "prop_name": prop_name,
                        "sub_name": sub_name,
                        "data_name": data_name,
                        "init_zoom": init_zoom,
                        "init_lat": init_lat,
                        "init_long": init_long
                    }
                    ## Pull in PEARL metadata
                    obj_meta = get_csv(
                        csv_path="./static/csv/pearl_data_summary.csv")
                    obj_sp = get_csv(
                        csv_path=
                        "./static/csv/pearl_sp/ABBREVIATA_BANCROFTI.csv")
                    return render_template("pearl_map.html",
                                           obj_show=obj_show,
                                           obj_meta=obj_meta,
                                           obj_sp=obj_sp)

                elif req_raw == "option-aslo":
                    init_zoom = 3
                    init_lat = 11.252725743861603
                    init_long = -0.005242086131886481
                    data_name = "Global Parasite Distributions"
                    pearl_sp = "ascocotyle_longa"
                    prop_name = "Ascocotyle longa"
                    sub_name = ""
                    obj_show = {
                        "pearl_sp": pearl_sp,
                        "prop_name": prop_name,
                        "sub_name": sub_name,
                        "data_name": data_name,
                        "init_zoom": init_zoom,
                        "init_lat": init_lat,
                        "init_long": init_long
                    }
                    ## Pull in PEARL metadata
                    obj_meta = get_csv(
                        csv_path="./static/csv/pearl_data_summary.csv")
                    obj_sp = get_csv(
                        csv_path="./static/csv/pearl_sp/ASCOCOTYLE_LONGA.csv")
                    return render_template("pearl_map.html",
                                           obj_show=obj_show,
                                           obj_meta=obj_meta,
                                           obj_sp=obj_sp)

                elif req_raw == "option-ctca":
                    init_zoom = 3
                    init_lat = 11.252725743861603
                    init_long = -0.005242086131886481
                    data_name = "Global Parasite Distributions"
                    pearl_sp = "ctenocephalides_canis"
                    prop_name = "Ctenocephalides canis"
                    sub_name = "Common dog flea"
                    obj_show = {
                        "pearl_sp": pearl_sp,
                        "prop_name": prop_name,
                        "sub_name": sub_name,
                        "data_name": data_name,
                        "init_zoom": init_zoom,
                        "init_lat": init_lat,
                        "init_long": init_long
                    }
                    ## Pull in PEARL metadata
                    obj_meta = get_csv(
                        csv_path="./static/csv/pearl_data_summary.csv")
                    obj_sp = get_csv(
                        csv_path=
                        "./static/csv/pearl_sp/CTENOCEPHALIDES_CANIS.csv")
                    return render_template("pearl_map.html",
                                           obj_show=obj_show,
                                           obj_meta=obj_meta,
                                           obj_sp=obj_sp)

                elif req_raw == "option-zylu":
                    init_zoom = 3
                    init_lat = 11.252725743861603
                    init_long = -0.005242086131886481
                    data_name = "Global Parasite Distributions"
                    pearl_sp = "zygocotyle_lunata"
                    prop_name = "Zygocotyle lunata"
                    sub_name = ""
                    obj_show = {
                        "pearl_sp": pearl_sp,
                        "prop_name": prop_name,
                        "sub_name": sub_name,
                        "data_name": data_name,
                        "init_zoom": init_zoom,
                        "init_lat": init_lat,
                        "init_long": init_long
                    }
                    ## Pull in PEARL metadata
                    obj_meta = get_csv(
                        csv_path="./static/csv/pearl_data_summary.csv")
                    obj_sp = get_csv(
                        csv_path="./static/csv/pearl_sp/ZYGOCOTYLE_LUNATA.csv")
                    return render_template("pearl_map.html",
                                           obj_show=obj_show,
                                           obj_meta=obj_meta,
                                           obj_sp=obj_sp)

                else:
                    flash("Something went wrong with finding that data...")
                    return redirect(request.url)
            except:
                flash("Bad query - could not interpret.")
                return redirect(request.url)

    return render_template("index.html")