diff --git a/citation_parser_ui.py b/citation_parser_ui.py index fd7ee849ec641de7bc1b849d52721dc4cb1d910b..453ead98cdb0543e35c58a3e0adfd734e34067bc 100644 --- a/citation_parser_ui.py +++ b/citation_parser_ui.py @@ -14,7 +14,8 @@ app = dash.Dash(__name__) # List of options when inputting data and generating the graph additional_options = ['Update Automatically','Smart Input'] -# Reads the contents of info_box.txt. They can later be displayed by pressing the corresponding button. +# Reads the contents of info_box.txt. +# They can later be displayed by pressing the corresponding button. f = open('info_box.txt', 'r') boxcontent = f.read() f.close() @@ -28,13 +29,14 @@ app.layout = html.Div([ # Layer 1: For all mandatory Inputs html.Div([ "Input: ", - # A simple box for inputting a string. Value is transmitted upon pressen return or clicking out of the box. + # A simple box for inputting a string. + # Value is transmitted upon pressing return or clicking out of the box. dcc.Input(id='input-string', value='', type='text',debounce=True), # Forward recursion. Values between 1 and 10 can be entered. dcc.Input(id='forward-depth',value='1',type='number',min='1',max='10'), # Backward recursion. Values between 1 and 10 can be entered. dcc.Input(id='backward-depth',value='1',type='number',min='1',max='10'), - # Upload box. Can be used via drag-and-drop or byclicking on it to open a file viewer. + # Upload box. Can be used via drag-and-drop or byclicking on it to open a file viewer. dcc.Upload( id="upload-data", children=html.Div( @@ -52,8 +54,10 @@ app.layout = html.Div([ ]), # Layer 2: For the checklist, Remove-/Start-Buttons and input-error-message html.Div([ - # All input DOIs are collected in this checklist. It is initialized to avoid error messages. - dcc.Checklist(id='input-checklist',options=[],labelStyle = dict(display='block'),value=[]), + # All input DOIs are collected in this checklist. + # It is initialized to avoid error messages. + dcc.Checklist(id='input-checklist',options=[], + labelStyle = dict(display='block'),value=[]), # Displays error message if 'Smart Input' is active. html.Div(id='input-err',style={'color':'red'}), # Clears the entire list. @@ -90,7 +94,8 @@ app.layout = html.Div([ State('input-checklist','value'), State('additional-options','value') ) -def update_input_checklist(input_value,btn1,btn2,filecontents,all_inputs,selected_inputs,additional_options): +def update_input_checklist(input_value,btn1,btn2,filecontents,all_inputs, + selected_inputs,additional_options): ''' Most important callback function. Updates the checklist that holds all inputs. State of the checklist as input is needed so that previews entries are readded. @@ -140,11 +145,12 @@ def update_input_checklist(input_value,btn1,btn2,filecontents,all_inputs,selecte # Attempts to call get_publication. If unsuccesful, # the DOI is not added and an error message is returned i = InputInterface() - pub = i.get_publication(input_value) + pub = i.get_pub_light(input_value) except Exception as err: return options,selected_inputs,'','{}'.format(err) # Creates a more readable string to display in the checklist - rep_str = pub.contributors[0] + ',' + pub.journal + ',' + pub.publication_date + rep_str = pub.contributors[0] + ',' + pub.journal + \ + ',' + pub.publication_date all_inputs.append({'label':rep_str, 'value':input_value}) # if 'Smart Input' is not selected, the input value is added as is, @@ -169,10 +175,11 @@ def update_input_checklist(input_value,btn1,btn2,filecontents,all_inputs,selecte if 'Smart Input' in additional_options: try: i = InputInterface() - pub = i.get_publication(input_value) + pub = i.get_pub_light(input_value) except Exception as err: return all_inputs,selected_inputs,'','{}'.format(err) - rep_str = pub.contributors[0] + ',' + pub.journal + ',' + pub.publication_date + rep_str = pub.contributors[0] + ',' + pub.journal + \ + ',' + pub.publication_date all_inputs.append({'label':rep_str, 'value':input_value}) else: all_inputs.append({'label':input_value,'value':input_value}) @@ -181,7 +188,6 @@ def update_input_checklist(input_value,btn1,btn2,filecontents,all_inputs,selecte # if this is not done, the input_checklist will be generated # with one element that contains an empty string if input_value == '': - app.layout['input-checklist'].options.clear() return list(),list(),'','' @app.callback( diff --git a/input/get/__pycache__/__init__.cpython-38.pyc b/input/get/__pycache__/__init__.cpython-38.pyc index 8f81f36aaccfa12fdee27996811a2c67cc19fff8..a1e24ad908499dfeb45afebf60601d0704dbbbcb 100644 Binary files a/input/get/__pycache__/__init__.cpython-38.pyc and b/input/get/__pycache__/__init__.cpython-38.pyc differ diff --git a/input/get/__pycache__/acs.cpython-38.pyc b/input/get/__pycache__/acs.cpython-38.pyc index 0f8c362e84d5ccbbdf32f8310eeafd1376ab1977..f3585b798ebbeab22676f00cc409ef48cd6b6019 100644 Binary files a/input/get/__pycache__/acs.cpython-38.pyc and b/input/get/__pycache__/acs.cpython-38.pyc differ diff --git a/input/get/__pycache__/journal_fetcher.cpython-38.pyc b/input/get/__pycache__/journal_fetcher.cpython-38.pyc index 894af00c5d09c44d55f9e5d9a60d05409a7620db..3be8ddceae79b7f027f194a2c4cec6c1fe9575a5 100644 Binary files a/input/get/__pycache__/journal_fetcher.cpython-38.pyc and b/input/get/__pycache__/journal_fetcher.cpython-38.pyc differ diff --git a/input/get/__pycache__/nature.cpython-38.pyc b/input/get/__pycache__/nature.cpython-38.pyc index 47affbf4e197c535229a9e2bbecf3988abfad115..6008e587da3dab81c3c79bb42345b63f0226ebbd 100644 Binary files a/input/get/__pycache__/nature.cpython-38.pyc and b/input/get/__pycache__/nature.cpython-38.pyc differ diff --git a/ui_programm_fragmente/README.md b/ui_programm_fragmente/README.md new file mode 100644 index 0000000000000000000000000000000000000000..d3a7e438ee56b341db5d7a1eabcb996e154f103f --- /dev/null +++ b/ui_programm_fragmente/README.md @@ -0,0 +1,38 @@ +# Projekt CiS-Biochemie 2021-22 UI + +# Benötigt: +- Dash +- Pandas +- beautifulsoup4 +- requests + +# 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. + + +# Ü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") + +- Drag and drop or click to select a file to upload: Mehrere DOI in einem txt-Dokument (genau ein DOI pro Zeile). + +- Recursion: die beiden noch unbeschrifteten Felder rechts neben Input sind für die Rekursionstiefen in beide Richtungen + +- 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) + +- 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: + Der Autor, Das Journal, Das Veröffentlichungsdatum. (muss vor Hinzufügen aktiviert worden sein) + +## Autoren +- Isabelle Siebels +- Sebastian David