forked from enviPath/enviPy
[Feature] Identify Missing Rules (#177)
Fixes #97 Co-authored-by: Tim Lorsbach <tim@lorsba.ch> Reviewed-on: enviPath/enviPy#177
This commit is contained in:
@ -1866,6 +1866,25 @@ def package_pathway(request, package_uuid, pathway_uuid):
|
||||
|
||||
return response
|
||||
|
||||
if (
|
||||
request.GET.get("identify-missing-rules", False) == "true"
|
||||
and request.GET.get("rule-package") is not None
|
||||
):
|
||||
from .tasks import dispatch_eager, identify_missing_rules
|
||||
|
||||
rule_package = PackageManager.get_package_by_url(
|
||||
current_user, request.GET.get("rule-package")
|
||||
)
|
||||
res = dispatch_eager(
|
||||
current_user, identify_missing_rules, [current_pathway.pk], rule_package.pk
|
||||
)
|
||||
|
||||
filename = f"{current_pathway.name.replace(' ', '_')}_{current_pathway.uuid}.csv"
|
||||
response = HttpResponse(res, content_type="text/csv")
|
||||
response["Content-Disposition"] = f'attachment; filename="{filename}"'
|
||||
|
||||
return response
|
||||
|
||||
# Pathway d3_json() relies on a lot of related objects (Nodes, Structures, Edges, Reaction, Rules, ...)
|
||||
# we will again fetch the current pathway identified by this url, but this time together with nearly all
|
||||
# related objects
|
||||
|
||||
Reference in New Issue
Block a user