From d20a7050118d970e341ee939db5d3dc321f287fb Mon Sep 17 00:00:00 2001 From: Tobias O Date: Wed, 12 Nov 2025 22:01:34 +1300 Subject: [PATCH] [Feature] Add per-package pathway prediction (#195) ## Major Changes - Introduces a new view for per-package predictions Co-authored-by: jebus Reviewed-on: https://git.envipath.com/enviPath/enviPy/pulls/195 Co-authored-by: Tobias O Co-committed-by: Tobias O --- epdb/urls.py | 5 +++++ epdb/views.py | 16 ++++++++++++++++ templates/actions/collections/pathway.html | 11 +++++++---- templates/predict_pathway.html | 8 +++++++- 4 files changed, 35 insertions(+), 5 deletions(-) diff --git a/epdb/urls.py b/epdb/urls.py index 151cfb51..a91fa2d6 100644 --- a/epdb/urls.py +++ b/epdb/urls.py @@ -142,6 +142,11 @@ urlpatterns = [ v.package_pathway, name="package pathway detail", ), + re_path( + rf"^package/(?P{UUID})/predict$", + v.package_predict_pathway, + name="package predict pathway", + ), # Pathway Nodes re_path( rf"^package/(?P{UUID})/pathway/(?P{UUID})/node$", diff --git a/epdb/views.py b/epdb/views.py index 784287ca..c2929418 100644 --- a/epdb/views.py +++ b/epdb/views.py @@ -374,6 +374,22 @@ def predict_pathway(request): return render(request, "predict_pathway.html", context) +@package_permission_required() +def package_predict_pathway(request, package_uuid): + """Package-specific predict pathway view.""" + if request.method != "GET": + return HttpResponseNotAllowed(["GET"]) + + current_user = _anonymous_or_real(request) + current_package = PackageManager.get_package_by_id(current_user, package_uuid) + + context = get_base_context(request) + context["title"] = f"enviPath - {current_package.name} - Predict Pathway" + context["meta"]["current_package"] = current_package + + return render(request, "predict_pathway.html", context) + + def packages(request): current_user = _anonymous_or_real(request) diff --git a/templates/actions/collections/pathway.html b/templates/actions/collections/pathway.html index fce48c86..0bc89a06 100644 --- a/templates/actions/collections/pathway.html +++ b/templates/actions/collections/pathway.html @@ -1,6 +1,9 @@ {% if meta.can_edit %} -
  • - - New Pathway -
  • +
  • + + New Pathway +
  • {% endif %} diff --git a/templates/predict_pathway.html b/templates/predict_pathway.html index cdf8cdb1..1f19cfe7 100644 --- a/templates/predict_pathway.html +++ b/templates/predict_pathway.html @@ -2,7 +2,13 @@ {% load static %} {% block content %}
    -

    Predict a Pathway

    +

    + Predict a Pathway + + in {{ meta.current_package.name|safe }} + +