Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 7 additions & 6 deletions app.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
from toggle_bars import toggle_bars

import tempfile, os, shutil
import traceback

app = Flask(__name__)

Expand All @@ -27,7 +28,7 @@ def Sankey_Evaluate():

########## REPLACE THIS SECTION WITH OWN RUN CODE #################
#uses rdf types
accepted_types = {'Component'}
accepted_types = {'Component', 'ComponentDefinition'}

acceptable = rdf_type in accepted_types

Expand Down Expand Up @@ -63,13 +64,11 @@ def Sankey_Run():
#retrieve information about the poi
self_df, display_id, title, role, count = input_data(top_level_url, instance_url)

#print("Find role name")
#Find the role name in the ontology of the part of interest
role_link = find_role_name(role, plural = False)

#create data for the sankey diagram and format it correctly
df_sankey = sankey(url, top_level_url, title, instance_url)

sankey_title = "Parts Co-Located with "+ title + " (a "+role_link+")"

#create a temporary directory
Expand All @@ -90,7 +89,8 @@ def Sankey_Run():

return result
except Exception as e:
print(e)
print(e, flush=True)
print(traceback.format_exc(), flush=True)
abort(400)

#flask run --host=0.0.0.0
Expand All @@ -106,7 +106,7 @@ def Bar_Evaluate():

########## REPLACE THIS SECTION WITH OWN RUN CODE #################
#uses rdf types
accepted_types = {'Component'}
accepted_types = {'Component', 'ComponentDefinition'}

acceptable = rdf_type in accepted_types

Expand Down Expand Up @@ -180,5 +180,6 @@ def Bar_Run():

return toggle_display
except Exception as e:
print(e)
print(e, flush=True)
print(traceback.format_exc(), flush=True)
abort(400)
4 changes: 2 additions & 2 deletions input_data.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import json
import requests
from pandas.io.json import json_normalize
from pandas import json_normalize

def input_data(uri, instance):
"""
Expand All @@ -10,7 +10,7 @@ def input_data(uri, instance):
-------
import json
import requests
from pandas.io.json import json_normalize
from pandas import json_normalize
Input_Query.txt

Parameters
Expand Down
2 changes: 1 addition & 1 deletion most_used_bar.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import pandas as pd
import requests
import json
from pandas.io.json import json_normalize
from pandas import json_normalize
from uri_to_url import uri_to_url

def most_used_bar(uri, instance, display_id, title, role, count):
Expand Down
2 changes: 1 addition & 1 deletion most_used_by_type_bar.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import pandas as pd
import requests
import json
from pandas.io.json import json_normalize
from pandas import json_normalize
from uri_to_url import uri_to_url

def most_used_by_type_bar(uri, instance, display_id, title, role, count):
Expand Down
9 changes: 5 additions & 4 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
bs4==0.0.1
Flask==2.0.1
Flask==2.2.5
jsonschema==3.0.1
pandas==0.24.2
pandas==2.2.3
plotly==3.9.0
requests==2.21.0


Werkzeug==2.2.3
waitress
lxml
4 changes: 2 additions & 2 deletions sankey.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import requests
import json
import pandas as pd
from pandas.io.json import json_normalize
from pandas import json_normalize
from uri_to_url import uri_to_url

def sankey(url, uri, title, instance):
Expand All @@ -16,7 +16,7 @@ def sankey(url, uri, title, instance):
import requests
import json
import pandas as pd
from pandas.io.json import json_normalize
from pandas import json_normalize
Preceding_Percent_Query.txt


Expand Down