diff --git a/README.md b/README.md index d3a7e438ee56b341db5d7a1eabcb996e154f103f..e364b603b3cf39094aa5d8ec69004cd0d4686475 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -# Projekt CiS-Biochemie 2021-22 UI +# Projekt CiS-Biochemie 2021-22 # Benötigt: - Dash @@ -8,31 +8,40 @@ # Starten des Programms: -Ausführen von citation_parser_ui.py und einfügen des entstandenen Liks in einen Browser. -Danach müsste sich die Benutzeroberfläche im Browser öffnen. +Um das Programm nutzen zu können muss zuerst \grqq citation\_parser\_ui.py\grqq \, ausgeführt werden und der entstandene Lik in einen Browser eingefügt werden. Danach öffnet sich die Benutzeroberfläche im Browser. # Übersicht der Benutzeroberfläche: - Show Info: Durch wiederholtes klicken kann das Fenster ein und aus geblendet werden. -- Input: Die Eingabe erfolgt in Form eines DOI ("Digital Object Identifier") +- Input: Die Eingabe erfolgt in Form eines DOI ("Digital Object Identifier") oder Hyperlink -- Drag and drop or click to select a file to upload: Mehrere DOI in einem txt-Dokument (genau ein DOI pro Zeile). +- Drag and drop or click to select a file to upload: Mehrere DOI oder Hyperlinks in einem .txt-Dokument (genau ein Link pro Zeile). -- Recursion: die beiden noch unbeschrifteten Felder rechts neben Input sind für die Rekursionstiefen in beide Richtungen +- Reference Depth: die Tiefe der Artikel welche von der Eingabe zitiert werden. + +- Cited-by Depth: die Tiefe derjenigen welche de Eingegebenen Artikel Zitieren. - Clear All: alle Eingaben werden gelöscht - Clear Selected: alle markierten Eingaben werden gelöscht -- Generate Graph: generiert den zugehörigen Graphen (generiert momentan nur einen string) +- Generate Graph: generiert den zugehörigen Graphen - Update Automatically: automatische Aktualisierung des Graphen bei jeder neuen Eingabe -- Smart Input: direkte Überprüfung der Eingabe auf Richtigkeit zudem wird nicht mehr der DOI angezeigt sondern: +- Smart Input: direkte Überprüfung der Eingabe auf Richtigkeit zudem wird nicht mehr der DOI oder Hyperlink angezeigt sondern: Der Autor, Das Journal, Das Veröffentlichungsdatum. (muss vor Hinzufügen aktiviert worden sein) ## Autoren - Isabelle Siebels - Sebastian David +- Florian Jochens +- Julius Schenk +- Samuel Ockenden +- Alina Molkentin +- Donna Löding +- Malte Schokolowski +- Katja Ehlers +- Merle Stahl diff --git a/citation_parser_main.py b/citation_parser_main.py index 45e0321ce56703512330b7748cffde1b9748a515..16932f389392754bef4f563ff904ee28b1f2ec03 100644 --- a/citation_parser_main.py +++ b/citation_parser_main.py @@ -15,8 +15,8 @@ import plotly.express as px import dash_bootstrap_components as dbc # pip install dash-bootstrap-components - -app = dash.Dash(__name__, external_stylesheets=[dbc.themes.SPACELAB]) #SPACELAB https://bootswatch.com/default/ for more themes) +#SPACELAB is added as a style by https://bootswatch.com/default/ +app = dash.Dash(__name__, external_stylesheets=[dbc.themes.SPACELAB]) # List of options when inputting data and generating the graph additional_options = ['Update Automatically','Smart Input'] @@ -72,22 +72,14 @@ html.Div(children=[ #Drag and drop or click to select a file to upload ["Drag and drop"]), style={ -<<<<<<< HEAD:citation_parser_main.py - "width": "400px", -======= "width": "360px", ->>>>>>> main:citation_parser_ui.py "height": "60px", "lineHeight": "60px", "borderWidth": "1px", "borderStyle": "dashed", "borderRadius": "5px", "textAlign": "center", -<<<<<<< HEAD:citation_parser_main.py - "margin": "10px", -======= "margin": "10px" ->>>>>>> main:citation_parser_ui.py }),size="lg", color="primary", type="border", fullscreen=True,), ]), @@ -113,28 +105,17 @@ html.Div(children=[ dcc.Checklist(id='additional-options', options=[{'label':k,'value':k} for k in additional_options], value=[],labelStyle = dict(display= 'block')) -<<<<<<< HEAD:citation_parser_main.py - ]), -======= ],style={'margin-top': "50px"}), ->>>>>>> main:citation_parser_ui.py ], style={'padding': 10, 'flex': 0.8}), html.Div(children=[ # Layer 5: For the Graph and corresponding error messages dbc.Spinner(html.Div([ -<<<<<<< HEAD:citation_parser_main.py - html.Div(id='generate-graph-error',style={'color':'red'}), - html.Iframe( - src="assets/index.html", - style={"height": "650px", "width": "100%"}, -======= html.Div(id='generate-graph-error',style={'color':'red', 'position': "absolute", 'margin-top': "650px"}), html.Iframe( src="assets/index.html", style={"height": "650px", "width": "1000px"}, ->>>>>>> main:citation_parser_ui.py ), ]),size="lg", color="primary", type="border", fullscreen=True,), ], style={'padding': 10, 'flex': 1.2}) @@ -184,7 +165,11 @@ def update_input_checklist(input_value,btn1,btn2,filecontents,all_inputs, # if clear-all-button was pressed: if 'clear-all-button' in changed_id: - os.remove('assets/json_text.json') + # the try/except is needed so that clear-all may be used even if there is no json-file + try: + os.remove('assets/json_text.json') + except: + pass return list(),list(),'','' # if clear-selected-button was pressed: @@ -263,7 +248,7 @@ def update_input_checklist(input_value,btn1,btn2,filecontents,all_inputs, ) def toggle_collapse(n, is_open): ''' - This callback shows and hides the (first) info-box by, checking how# often + This callback shows and hides the (first) info-box by, checking how often the button has been pressed. The text was loaded at the top. :param n_clicks: number of times show-info has been clicked. 'type n_clicks: int @@ -301,22 +286,17 @@ def generate_output(n_clicks,all_inputs,forward_depth,backward_depth,additional_ changed_id = [p['prop_id'] for p in callback_context.triggered][0] if n_clicks is None: raise PreventUpdate - # This branch is entered when 'Generate Graph' is pushed or 'Update Automatically' is selected - # and the checklist or recursion depths are changed. elif 'Update Automatically' in additional_options \ or 'start-button' in changed_id: input_links = [x['value'] for x in all_inputs] - # Processing only returns a potential error message. The data for the graph is simply saved - # in the specified file. errors = Processing(input_links,int(forward_depth),int(backward_depth),'assets/json_text.json') if errors: - # This construct is needed because dash removes white spaces and newlines when concatinating - # strings with '\n'.join(...) or similar methods. message = ['The following inputs are invalid and were not used:'] for error in errors: message.append(html.Br()) message.append(error) message = html.P(message) + #message = [html.P(error) for error in errors] return message if __name__ == '__main__':