Esempio n. 1
0
def case_diagnosis(institute_id, case_name):
    """Add or remove a diagnosis for a case."""

    institute_obj, case_obj = institute_and_case(store, institute_id,
                                                 case_name)
    user_obj = store.user(current_user.email)
    link = url_for(".case", institute_id=institute_id, case_name=case_name)
    level = "phenotype" if "phenotype" in request.form else "gene"
    omim_id = request.form["omim_term"].split("|")[0]

    if not "OMIM:" in omim_id:  # Could be an omim number provided by user
        omim_id = ":".join(["OMIM", omim_id])

    # Make sure omim term exists in database:
    omim_obj = store.disease_term(omim_id.strip())
    if not omim_obj:
        flash("Couldn't find any disease term with id: {}".format(omim_id),
              "warning")

    remove = True if request.args.get("remove") == "yes" else False
    store.diagnose(
        institute_obj,
        case_obj,
        user_obj,
        link,
        level=level,
        omim_id=omim_id,
        remove=remove,
    )
    return redirect(request.referrer)
Esempio n. 2
0
def case_diagnosis(institute_id, case_name):
    """Add or remove a diagnosis for a case."""
    institute_obj, case_obj = institute_and_case(store, institute_id,
                                                 case_name)
    user_obj = store.user(current_user.email)
    link = url_for(".case", institute_id=institute_id, case_name=case_name)

    omim_id = request.form["omim_term"].split("|")[0]
    omim_inds = request.form.getlist(
        "omim_inds")  # Individual-level phenotypes

    if not "OMIM:" in omim_id:  # Could be an omim number provided by user
        omim_id = ":".join(["OMIM", omim_id])

    # Make sure omim term exists in database:
    omim_obj = store.disease_term(omim_id.strip())
    if omim_obj is None:
        flash("Couldn't find any disease term with id: {}".format(omim_id),
              "warning")
        return redirect(request.referrer)

    remove = True if request.args.get("remove") == "yes" else False
    store.diagnose(institute_obj, case_obj, user_obj, link, omim_obj,
                   omim_inds, remove)
    return redirect("#".join([link, "omim_assign"]))
Esempio n. 3
0
def case_diagnosis(institute_id, case_name):
    """Add or remove a diagnosis for a case."""
    institute_obj, case_obj = institute_and_case(store, institute_id, case_name)
    user_obj = store.user(current_user.email)
    link = url_for('.case', institute_id=institute_id, case_name=case_name)
    level = 'phenotype' if 'phenotype' in request.form else 'gene'
    omim_id = request.form['omim_id']
    remove = True if request.args.get('remove') == 'yes' else False
    store.diagnose(institute_obj, case_obj, user_obj, link, level=level,
                   omim_id=omim_id, remove=remove)
    return redirect(request.referrer)
Esempio n. 4
0
def case_diagnosis(institute_id, case_name):
    """Add or remove a diagnosis for a case."""
    institute_obj, case_obj = institute_and_case(store, institute_id, case_name)
    user_obj = store.user(current_user.email)
    link = url_for('.case', institute_id=institute_id, case_name=case_name)
    level = 'phenotype' if 'phenotype' in request.form else 'gene'
    omim_id = request.form['omim_id']
    remove = True if request.args.get('remove') == 'yes' else False
    store.diagnose(institute_obj, case_obj, user_obj, link, level=level,
                   omim_id=omim_id, remove=remove)
    return redirect(request.referrer)
Esempio n. 5
0
def case_diagnosis(institute_id, case_name):
    """Add or remove a diagnosis for a case."""
    institute_obj, case_obj = institute_and_case(store, institute_id,
                                                 case_name)
    user_obj = store.user(current_user.email)
    link = url_for(".case", institute_id=institute_id, case_name=case_name)
    level = "phenotype" if "phenotype" in request.form else "gene"
    omim_id = request.form["omim_id"]
    remove = True if request.args.get("remove") == "yes" else False
    store.diagnose(
        institute_obj,
        case_obj,
        user_obj,
        link,
        level=level,
        omim_id=omim_id,
        remove=remove,
    )
    return redirect(request.referrer)