From 1bdf549c65f5045dfbf9be04695400875718ae82 Mon Sep 17 00:00:00 2001 From: devora Date: Mon, 10 Aug 2020 17:23:32 +0300 Subject: [PATCH 1/6] some small bug fixes --- backend/application.py | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/backend/application.py b/backend/application.py index 83f37016c..4f5d9b570 100644 --- a/backend/application.py +++ b/backend/application.py @@ -238,7 +238,7 @@ def wikify_region(pid): flag = int(request.form["flag"]) if action == "wikify_region": if not project.current_file: - raise web_exception.WikifyWithoutDataFileException( + raise web_exceptions.WikifyWithoutDataFileException( "Upload data file before wikifying a region") sheet = project.current_file.current_sheet @@ -257,7 +257,8 @@ def wikify_region(pid): else: data['problemCells'] = False - return data, 200 + return data, 200 + return {}, 404 @app.route('/api/yaml/', methods=['POST']) @@ -284,7 +285,7 @@ def upload_yaml(pid): response['yamlRegions'] = highlight_region(sheet, yf, project) else: response['yamlRegions'] = None - raise web_exception.YAMLEvaluatedWithoutDataFileException( + raise web_exceptions.YAMLEvaluatedWithoutDataFileException( "Upload data file before applying YAML.") return response, 200 @@ -303,7 +304,7 @@ def get_cell_statement(pid, col, row): sheet = project.current_file.current_sheet yaml_file = sheet.yaml_file if not yaml_file: - raise web_exception.CellResolutionWithoutYAMLFileException( + raise web_exceptions.CellResolutionWithoutYAMLFileException( "Upload YAML file before resolving cell.") data = get_cell(sheet, yaml_file, project, col, row) return data, 200 @@ -320,7 +321,7 @@ def downloader(pid, filetype): sheet = project.current_file.current_sheet yaml_file = sheet.yaml_file if not yaml_file: # the frontend disables this, this is just another layer of checking - raise web_exception.CellResolutionWithoutYAMLFileException( + raise web_exceptions.CellResolutionWithoutYAMLFileException( "Cannot download report without uploading YAML file first") response = download(sheet, yaml_file, project, filetype, project.name) return response, 200 @@ -357,7 +358,7 @@ def rename_project(pid): } ptitle = request.form["ptitle"] project = get_project(pid) - project.title = ptitle + project.name = ptitle project.modify() data['projects'] = get_project_details() return data, 200 From befa6c10fdcc4a68d7d891559e58aa39b6acbc39 Mon Sep 17 00:00:00 2001 From: devora Date: Mon, 10 Aug 2020 17:23:52 +0300 Subject: [PATCH 2/6] full set of the basic tests --- .vscode/launch.json | 21 + backend/tests/basic_test.py | 271 ++- .../aid/consolidated-wikifier.csv | 77 + .../tests/files_for_tests/aid/dataset.xlsx | Bin 0 -> 10860 bytes .../tests/files_for_tests/aid/download.tsv | 40 + .../files_for_tests/aid/kgtk_item_defs.tsv | 103 ++ .../files_for_tests/aid/kgtk_properties.tsv | 174 ++ .../tests/files_for_tests/aid/results.json | 1615 +++++++++++++++++ backend/tests/files_for_tests/aid/test.yaml | 20 + 9 files changed, 2272 insertions(+), 49 deletions(-) create mode 100644 backend/tests/files_for_tests/aid/consolidated-wikifier.csv create mode 100644 backend/tests/files_for_tests/aid/dataset.xlsx create mode 100644 backend/tests/files_for_tests/aid/download.tsv create mode 100644 backend/tests/files_for_tests/aid/kgtk_item_defs.tsv create mode 100644 backend/tests/files_for_tests/aid/kgtk_properties.tsv create mode 100644 backend/tests/files_for_tests/aid/results.json create mode 100644 backend/tests/files_for_tests/aid/test.yaml diff --git a/.vscode/launch.json b/.vscode/launch.json index bba810853..6ff9c657a 100644 --- a/.vscode/launch.json +++ b/.vscode/launch.json @@ -37,5 +37,26 @@ ], "cwd": "${workspaceFolder}/backend", }, + { + "name": "Tests", + "type": "python", + "request": "launch", + "module": "pytest", + "args": [ + "backend\\tests", + "-s", + "-v" + ], + "cwd": "${workspaceFolder}", + }, + { + "name": "Python: Current File (Integrated Terminal)", + "type": "python", + "request": "launch", + "program": "${file}", + "console": "integratedTerminal", + "cwd": "${fileDirname}", + "env": {"PYTHONPATH": "${workspaceRoot}"} + }, ] } \ No newline at end of file diff --git a/backend/tests/basic_test.py b/backend/tests/basic_test.py index bb3b23209..73bf816a0 100644 --- a/backend/tests/basic_test.py +++ b/backend/tests/basic_test.py @@ -3,37 +3,76 @@ import tempfile import pytest -# To import app_config we need to add the backend directory into sys.path +# To import application we need to add the backend directory into sys.path import sys BACKEND_DIR = os.path.abspath(os.path.dirname(os.path.dirname(__file__))) if BACKEND_DIR not in sys.path: sys.path.append(BACKEND_DIR) +from flask_migrate import upgrade + from application import app +files_dir=os.path.join(os.path.dirname(__file__), "files_for_tests", "aid") + + pid=None +results_dict={} + +with open(os.path.join(files_dir, "results.json"), 'r', encoding="utf-8") as f: + expected_results_dict=json.load(f) + +def recurse_lists_and_dicts(input1, input2): + if isinstance(input1, dict): + assert input1.keys()==input2.keys() + for key in input1: + recurse_lists_and_dicts(input1[key], input2[key]) + + elif isinstance(input1, list): + assert len(input1)==len(input2) + for index, item in enumerate(input1): + recurse_lists_and_dicts(input1[index], input2[index]) + + assert input1==input2 + +def compare_jsons(data, expected_key): + expected_data=expected_results_dict[expected_key] + assert data.keys()==expected_data.keys() + for key in data: + try: + assert data[key]==expected_data[key] + except AssertionError as e: + recurse_lists_and_dicts(data[key], expected_data[key]) + raise e -@pytest.fixture -def client(): + + +@pytest.fixture(scope="module") +def client(request): + def fin(): + os.close(db_fd) + os.unlink(name) app.config['TESTING']=True - db_fd, app.config['DATABASE'] = tempfile.mkstemp() + db_fd, name = tempfile.mkstemp() + app.config['SQLALCHEMY_DATABASE_URI']='sqlite:///' +name + request.addfinalizer(fin) + with app.app_context(): + upgrade(directory=os.path.join(BACKEND_DIR, 'migrations')) with app.test_client() as client: - #with app.app_context(): yield client - os.close(db_fd) - os.unlink(app.config['DATABASE']) -def test_get_projects_list(client): + +def test_0_get_projects_list(client): #GET /api/projects response=client.get('/api/projects') data = response.data.decode("utf-8") data = json.loads(data) assert response.status_code==200 -def test_add_project(client): +def test_01_add_project(client): #POST /api/project response=client.post('/api/project', data=dict( @@ -43,65 +82,199 @@ def test_add_project(client): data = response.data.decode("utf-8") data = json.loads(data) global pid - pid=data['pid'] + pid=str(data['pid']) assert response.status_code==201 -def test_add_data_file(client): - print(pid) - #POST /api/data/ - pass +def test_02_get_project_files(client): + url= '/api/project/{pid}'.format(pid=pid) + response=client.get(url) + data = response.data.decode("utf-8") + data = json.loads(data) + assert data == { + 'name': 'Unit test', + 'tableData': None, + 'yamlData': None, + 'wikifierData': None + } -def test_add_properties_file(client): - #POST /api/project//properties - pass +def test_03_add_data_file(client): + url = '/api/data/{pid}'.format(pid=pid) + filename=os.path.join(files_dir, "dataset.xlsx") + with open(filename, 'rb') as f: + response=client.post(url, + data=dict( + file=f + ) + ) -def test_add_wikifier_file(client): - #POST '/api/wikifier/' - pass + data = response.data.decode("utf-8") + data = json.loads(data) + results_dict['add_data_file']=data + compare_jsons(data, 'add_data_file') -def test_change_sheet(client): - #GET /api/data// - pass +def test_04_add_properties_file(client): + url = '/api/project/{pid}/properties'.format(pid=pid) + filename=os.path.join(files_dir, "kgtk_properties.tsv") + with open(filename, 'rb') as f: + response=client.post(url, + data=dict( + file=f + ) + ) -def test_add_yaml_file(client): - #POST '/api/yaml/' - pass + data = response.data.decode("utf-8") + data = json.loads(data) + results_dict['add_properties_file']=data + compare_jsons(data, 'add_properties_file') -def test_get_project_files(client): - #GET /api/project/ - pass +def test_05_add_wikifier_file(client): + url='/api/wikifier/{pid}'.format(pid=pid) + filename=os.path.join(files_dir, "consolidated-wikifier.csv") + with open(filename, 'rb') as f: + response=client.post(url, + data=dict( + file=f + ) + ) -def test_wikify_region(client): - #POST '/api/wikifier_service/' - pass + data = response.data.decode("utf-8") + data = json.loads(data) + results_dict['add_wikifier_file']=data + compare_jsons(data, 'add_wikifier_file') -def test_change_project_name(client): - #PUT '/api/project/' - pass -def test_change_sparql_endpoint(client): - #PUT '/api/project//sparql' - pass +def test_06_add_items_file(client): + #POST /api/project/{pid}/items + url='/api/project/{pid}/items'.format(pid=pid) + filename=os.path.join(files_dir, "kgtk_item_defs.tsv") + with open(filename, 'rb') as f: + response=client.post(url, + data=dict( + file=f + ) + ) -def test_delete_project(client): - #this test must be sequentially last (do not run pytest in parallel) - #DELETE '/api/project/' - url_str="/api/project/"+str(pid) - response=client.delete(url_str) data = response.data.decode("utf-8") data = json.loads(data) + results_dict['add_items']=data + compare_jsons(data, 'add_items') +def test_08_add_yaml_file(client): + url='/api/yaml/{pid}'.format(pid=pid) + filename=os.path.join(files_dir, "test.yaml") + with open(filename, 'r') as f: + response=client.post(url, + data=dict( + yaml=f.read() + ) + ) -''' + data = response.data.decode("utf-8") + data = json.loads(data) + results_dict['add_yaml']=data + + #some of the results are sent back as unordered lists and need to be compared separately + set_keys=[] + for key in data["yamlRegions"]: + if "list" in data["yamlRegions"][key]: + set_keys.append(key) + test1=set(data["yamlRegions"][key]["list"]) + test2=set(expected_results_dict["add_yaml"]["yamlRegions"][key]["list"]) + assert test1==test2 + for key in set_keys: + data["yamlRegions"].pop(key) + expected_results_dict["add_yaml"]["yamlRegions"].pop(key) + + compare_jsons(data, 'add_yaml') + +def test_09_get_cell(client): + #GET '/api/data/{pid}/cell//' + url='/api/data/{pid}/cell/{col}/{row}'.format(pid=pid, col="G", row=4) + response=client.get(url) + data = response.data.decode("utf-8") + data = json.loads(data) + results_dict['get_cell']=data + compare_jsons(data, 'get_cell') + +def test_10_get_node(client): + #GET /api/qnode/ + url='/api/qnode/{qid}'.format(qid="Q21203") + response=client.get(url) + data = response.data.decode("utf-8") + data = json.loads(data) + assert data['label']=='Aruba' + url='/api/qnode/{qid}'.format(qid="P17") + response=client.get(url) + data2 = response.data.decode("utf-8") + data2 = json.loads(data2) + assert data2['label']=='country' + +def test_11_get_download(client): + #GET '/api/project/{pid}/download/' + url='/api/project/{pid}/download/{filetype}'.format(pid=pid, filetype="tsv") + response=client.get(url) + data = response.data.decode("utf-8") + data = json.loads(data) + data=data["data"] + with open(os.path.join(files_dir, "download.tsv"), 'w') as f: + f.write(data) + +def test_12_change_sheet(client): + #GET /api/data/{pid}/ + url='/api/data/{pid}/{sheet_name}'.format(pid=pid,sheet_name="Sheet4") + response=client.get(url) + data = response.data.decode("utf-8") + data = json.loads(data) + results_dict['change_sheet']=data + compare_jsons(data, 'change_sheet') +def test_12_wikify_region(client): + #POST '/api/wikifier_service/{pid}' + url='/api/wikifier_service/{pid}'.format(pid=pid) + response=client.post(url, + data=dict( + action="wikify_region", + region="I3:I8", + context="wikifier test", + flag="0" + ) + ) + data = response.data.decode("utf-8") + data = json.loads(data) + results_dict['wikify_region']=data + compare_jsons(data, 'wikify_region') -POST /api/project//items -GET /api/qnode/ +def test_13_change_project_name(client): + url='/api/project/{pid}'.format(pid=pid) + ptitle="Unit test renamed" + response=client.put(url, + data=dict( + ptitle=ptitle + )) + data = response.data.decode("utf-8") + data = json.loads(data) + assert data['projects'][0]['ptitle']==ptitle -GET '/api/data//cell//' -GET '/api/project//download/' +def test_14_change_sparql_endpoint(client): + from t2wml.settings import t2wml_settings + #PUT '/api/project/{pid}/sparql' + url='/api/project/{pid}/sparql'.format(pid=pid) + endpoint='https://query.wikidata.org/bigdata/namespace/wdq/sparql' + response=client.put(url, + data=dict( + endpoint=endpoint + )) + assert t2wml_settings['wikidata_provider'].sparql_endpoint==endpoint + +def test_99_delete_project(client): + #this test must be sequentially last (do not run pytest in parallel) + #DELETE '/api/project/{pid}' + url_str="/api/project/"+str(pid) + response=client.delete(url_str) + data = response.data.decode("utf-8") + data = json.loads(data) + assert data["projects"]==[] -''' \ No newline at end of file diff --git a/backend/tests/files_for_tests/aid/consolidated-wikifier.csv b/backend/tests/files_for_tests/aid/consolidated-wikifier.csv new file mode 100644 index 000000000..c00bc5cb9 --- /dev/null +++ b/backend/tests/files_for_tests/aid/consolidated-wikifier.csv @@ -0,0 +1,77 @@ +column,row,value,context,item +,,Aruba,,Q21203 +,,Afghanistan,,Q889 +,,Angola,,Q916 +,,Europe & Central Asia,,Q232 +,,Ecuador,,Q736 +,,Organisation of Eastern Caribbean States,,Q392770 +,,Ivory Coast,,Q1008 +,,Palestinian National Authority,,Q219060 +,,UN,property,Paid-security-002 +,,INGO,property,Paid-security-003 +,,LNGO/NRCS,property,Paid-security-004 +,,ICRC,property,Paid-security-005 +,,IFRC,property,Paid-security-006 +,,Other,property,Paid-security-007 +,,Nationals killed,property,Paid-security-008 +,,Nationals wounded,property,Paid-security-009 +,,Nationals kidnapped,property,Paid-security-010 +,,Total nationals,property,Paid-security-011 +,,Internationals killed,property,Paid-security-012 +,,Internationals wounded,property,Paid-security-013 +,,Internationals kidnapped,property,Paid-security-014 +,,Total internationals,property,Paid-security-015 +,,Total killed,property,Paid-security-016 +,,Total wounded,property,Paid-security-017 +,,Total kidnapped,property,Paid-security-018 +,,Total affected,property,Paid-security-019 +,,Gender Male,property,Paid-security-020 +,,Gender Female,property,Paid-security-021 +,,Gender Unknown,property,Paid-security-022 +,,Means of attack,property,Paid-security-023 +,,Attack context,property,Paid-security-024 +,,Location,property,Paid-security-025 +,,Actor type,property,Paid-security-026 +,,Actor name,property,Paid-security-027 +,,Details,property,Paid-security-028 +,,Verified,property,Paid-security-029 +,,Source,property,Paid-security-030 +,,UN,variable,Qaid-security-002 +,,INGO,variable,Qaid-security-003 +,,LNGO/NRCS,variable,Qaid-security-004 +,,ICRC,variable,Qaid-security-005 +,,IFRC,variable,Qaid-security-006 +,,Other,variable,Qaid-security-007 +,,Nationals killed,variable,Qaid-security-008 +,,Nationals wounded,variable,Qaid-security-009 +,,Nationals kidnapped,variable,Qaid-security-010 +,,Total nationals,variable,Qaid-security-011 +,,Internationals killed,variable,Qaid-security-012 +,,Internationals wounded,variable,Qaid-security-013 +,,Internationals kidnapped,variable,Qaid-security-014 +,,Total internationals,variable,Qaid-security-015 +,,Total killed,variable,Qaid-security-016 +,,Total wounded,variable,Qaid-security-017 +,,Total kidnapped,variable,Qaid-security-018 +,,Total affected,variable,Qaid-security-019 +,,Gender Male,variable,Qaid-security-020 +,,Gender Female,variable,Qaid-security-021 +,,Gender Unknown,variable,Qaid-security-022 +,,Means of attack,variable,Qaid-security-023 +,,Attack context,variable,Qaid-security-024 +,,Location,variable,Qaid-security-025 +,,Actor type,variable,Qaid-security-026 +,,Actor name,variable,Qaid-security-027 +,,Details,variable,Qaid-security-028 +,,Verified,variable,Qaid-security-029 +,,Source,variable,Qaid-security-030 +,,person,unit,Qaid-security-U002 +1.0,,22,main subject,aid-security-22 +1.0,,47,main subject,aid-security-47 +1.0,,73,main subject,aid-security-73 +1.0,,103,main subject,aid-security-103 +1.0,,475,main subject,aid-security-475 +1.0,,782,main subject,aid-security-782 +1.0,,793,main subject,aid-security-793 +1.0,,942,main subject,aid-security-942 +1.0,,964,main subject,aid-security-964 \ No newline at end of file diff --git a/backend/tests/files_for_tests/aid/dataset.xlsx b/backend/tests/files_for_tests/aid/dataset.xlsx new file mode 100644 index 0000000000000000000000000000000000000000..1e18d444758ba4811de72e9f54a909cd35d0272b GIT binary patch literal 10860 zcmeHN^;;W>)`p@j?i7dMZpB@SI}~?pcXx`GqQ%`UxND(Mic_RmDQ;hOuk3E` zet*He^TW(DN#65J&YbtSssbE5E({_JG7Jn1B@8y<*HsHx7#KnX7#JKFl72@jAN_PAKG& zg!e-&(lC)EV3s-xEx0+4*d(hMJw$A|NR9aJ&fnP_W9V?uk}1NvgGsu3FA~*Yr_uRb zy+bAMTriQ6p(OPJUA`6;cWdTi!Kv-}+m}{?%+gA@$3^|+VXsX$;P}2~-Yn5?F7l;| zYoWYC;@`V)1n!Uq7G~?AaS)00DYCEtRqP%+Xd+G2EHGAjK7GVxgtudqR%Fyxegcnp zpd(ln6ILko5D#M3%@wTPteB)E&1m9onWL0g$Fof?qdyTfkzO789ou!m)CBw=*fMX z!O8t|K@Jy@Yk0Gwi^ESS{hprSU{wD?&PFYEz)z^fDMGo20wt$07-;Xp#`@d&f28~` zX5ydzdPS0w3WOas>_qlHeE4c%H33sX!9!fOol?{Pt=t!k#@Iq?;?-_C5=>2^U^tn8 zPXGJSl~tkGgJH_cP40?lY+OM=lSgG(`mM7Y5+f}*?X`2oMn9JO!o|X6ri{E7y?bXo z$^!0Wj)sanh_R&Ao^I7K93_`;cidV@;3U(K$oU>77bjw-`yntAgNlBeDU zET$FjqlrfFD}JBN#2a=ov-(`+J8VyRaYLk~Va;z-W0ngRpz<=dulI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+t6Lhv-+}ubUKqK>HB? zJzM+NUd6BAzYcN#fWp9py!ajb|BQ5hmGkRJ?+-~`sQ-S5{}}N7D&^M^z#mfPG5=P| z?*oBfrTp3^{6oqmG&z7)Ex$Gme--d+q4S3THP{#R%EXZQs5pWy#=t*QzLP#gJeO$`NR5E}gx=zhEVKZe%} AWdHyG literal 0 HcmV?d00001 diff --git a/backend/tests/files_for_tests/aid/download.tsv b/backend/tests/files_for_tests/aid/download.tsv new file mode 100644 index 000000000..9413ea750 --- /dev/null +++ b/backend/tests/files_for_tests/aid/download.tsv @@ -0,0 +1,40 @@ +id node1 label node2 node2;kgtk:data_type node2;kgtk:number node2;kgtk:low_tolerance node2;kgtk:high_tolerance node2;kgtk:units_node node2;kgtk:date_and_time node2;kgtk:precision node2;kgtk:calendar node2;kgtk:truth node2;kgtk:symbol node2;kgtk:latitude node2;kgtk:longitude node2;kgtk:globe node2;kgtk:text node2;kgtk:language +.;F3 22 Paid-security-002 quantity 2 Qaid-security-U002 + .;F3 P585 date_and_times "1997-09-24T00:00:00" 11 Q1985727 +.;F4 47 Paid-security-002 quantity 0 Qaid-security-U002 + .;F4 P585 date_and_times "1998-06-25T00:00:00" 11 Q1985727 + .;F4 P17 string "Q21203" +.;F5 73 Paid-security-002 quantity 0 Qaid-security-U002 + .;F5 P585 date_and_times "1999-04-01T00:00:00" 11 Q1985727 +.;F6 103 Paid-security-002 quantity 0 Qaid-security-U002 + .;F6 P585 date_and_times "2000-02-01T00:00:00" 11 Q1985727 +.;F7 475 Paid-security-002 quantity 0 Qaid-security-U002 + .;F7 P585 date_and_times "2006-09-20T00:00:00" 11 Q1985727 +.;F8 782 Paid-security-002 quantity 0 Qaid-security-U002 + .;F8 P585 date_and_times "2008-01-01T00:00:00" 11 Q1985727 +.;G3 22 Paid-security-003 quantity 0 Qaid-security-U002 + .;G3 P585 date_and_times "1997-09-24T00:00:00" 11 Q1985727 +.;G4 47 Paid-security-003 quantity 0 Qaid-security-U002 + .;G4 P585 date_and_times "1998-06-25T00:00:00" 11 Q1985727 + .;G4 P17 string "Q21203" +.;G5 73 Paid-security-003 quantity 1 Qaid-security-U002 + .;G5 P585 date_and_times "1999-04-01T00:00:00" 11 Q1985727 +.;G6 103 Paid-security-003 quantity 2 Qaid-security-U002 + .;G6 P585 date_and_times "2000-02-01T00:00:00" 11 Q1985727 +.;G7 475 Paid-security-003 quantity 0 Qaid-security-U002 + .;G7 P585 date_and_times "2006-09-20T00:00:00" 11 Q1985727 +.;G8 782 Paid-security-003 quantity 0 Qaid-security-U002 + .;G8 P585 date_and_times "2008-01-01T00:00:00" 11 Q1985727 +.;H3 22 Paid-security-004 quantity 0 Qaid-security-U002 + .;H3 P585 date_and_times "1997-09-24T00:00:00" 11 Q1985727 +.;H4 47 Paid-security-004 quantity 0 Qaid-security-U002 + .;H4 P585 date_and_times "1998-06-25T00:00:00" 11 Q1985727 + .;H4 P17 string "Q21203" +.;H5 73 Paid-security-004 quantity 0 Qaid-security-U002 + .;H5 P585 date_and_times "1999-04-01T00:00:00" 11 Q1985727 +.;H6 103 Paid-security-004 quantity 0 Qaid-security-U002 + .;H6 P585 date_and_times "2000-02-01T00:00:00" 11 Q1985727 +.;H7 475 Paid-security-004 quantity 0 Qaid-security-U002 + .;H7 P585 date_and_times "2006-09-20T00:00:00" 11 Q1985727 +.;H8 782 Paid-security-004 quantity 3 Qaid-security-U002 + .;H8 P585 date_and_times "2008-01-01T00:00:00" 11 Q1985727 diff --git a/backend/tests/files_for_tests/aid/kgtk_item_defs.tsv b/backend/tests/files_for_tests/aid/kgtk_item_defs.tsv new file mode 100644 index 000000000..1ef44f093 --- /dev/null +++ b/backend/tests/files_for_tests/aid/kgtk_item_defs.tsv @@ -0,0 +1,103 @@ +id node1 label node2 + aid-security-22 label Incident ID 22 + aid-security-22 description incident related to aid worker security + aid-security-22 P31 Q35120 + aid-security-47 label Incident ID 47 + aid-security-47 description incident related to aid worker security + aid-security-47 P31 Q35120 + aid-security-73 label Incident ID 73 + aid-security-73 description incident related to aid worker security + aid-security-73 P31 Q35120 + aid-security-103 label Incident ID 103 + aid-security-103 description incident related to aid worker security + aid-security-103 P31 Q35120 + aid-security-475 label Incident ID 475 + aid-security-475 description incident related to aid worker security + aid-security-475 P31 Q35120 + aid-security-782 label Incident ID 782 + aid-security-782 description incident related to aid worker security + aid-security-782 P31 Q35120 + aid-security-793 label Incident ID 793 + aid-security-793 description incident related to aid worker security + aid-security-793 P31 Q35120 + aid-security-942 label Incident ID 942 + aid-security-942 description incident related to aid worker security + aid-security-942 P31 Q35120 + aid-security-964 label Incident ID 964 + aid-security-964 description incident related to aid worker security + aid-security-964 P31 Q35120 + aid-security-1069 label Incident ID 1069 + aid-security-1069 description incident related to aid worker security + aid-security-1069 P31 Q35120 + aid-security-1060 label Incident ID 1060 + aid-security-1060 description incident related to aid worker security + aid-security-1060 P31 Q35120 + aid-security-1102 label Incident ID 1102 + aid-security-1102 description incident related to aid worker security + aid-security-1102 P31 Q35120 + aid-security-1281 label Incident ID 1281 + aid-security-1281 description incident related to aid worker security + aid-security-1281 P31 Q35120 + aid-security-1479 label Incident ID 1479 + aid-security-1479 description incident related to aid worker security + aid-security-1479 P31 Q35120 + aid-security-1713 label Incident ID 1713 + aid-security-1713 description incident related to aid worker security + aid-security-1713 P31 Q35120 + aid-security-1689 label Incident ID 1689 + aid-security-1689 description incident related to aid worker security + aid-security-1689 P31 Q35120 + aid-security-1931 label Incident ID 1931 + aid-security-1931 description incident related to aid worker security + aid-security-1931 P31 Q35120 + aid-security-1924 label Incident ID 1924 + aid-security-1924 description incident related to aid worker security + aid-security-1924 P31 Q35120 + aid-security-1923 label Incident ID 1923 + aid-security-1923 description incident related to aid worker security + aid-security-1923 P31 Q35120 + aid-security-1934 label Incident ID 1934 + aid-security-1934 description incident related to aid worker security + aid-security-1934 P31 Q35120 + aid-security-2143 label Incident ID 2143 + aid-security-2143 description incident related to aid worker security + aid-security-2143 P31 Q35120 + aid-security-2135 label Incident ID 2135 + aid-security-2135 description incident related to aid worker security + aid-security-2135 P31 Q35120 + aid-security-2692 label Incident ID 2692 + aid-security-2692 description incident related to aid worker security + aid-security-2692 P31 Q35120 + aid-security-2623 label Incident ID 2623 + aid-security-2623 description incident related to aid worker security + aid-security-2623 P31 Q35120 + aid-security-2641 label Incident ID 2641 + aid-security-2641 description incident related to aid worker security + aid-security-2641 P31 Q35120 + aid-security-2952 label Incident ID 2952 + aid-security-2952 description incident related to aid worker security + aid-security-2952 P31 Q35120 + aid-security-2916 label Incident ID 2916 + aid-security-2916 description incident related to aid worker security + aid-security-2916 P31 Q35120 + aid-security-3006 label Incident ID 3006 + aid-security-3006 description incident related to aid worker security + aid-security-3006 P31 Q35120 + aid-security-2895 label Incident ID 2895 + aid-security-2895 description incident related to aid worker security + aid-security-2895 P31 Q35120 + aid-security-2896 label Incident ID 2896 + aid-security-2896 description incident related to aid worker security + aid-security-2896 P31 Q35120 + aid-security-2768 label Incident ID 2768 + aid-security-2768 description incident related to aid worker security + aid-security-2768 P31 Q35120 + aid-security-2897 label Incident ID 2897 + aid-security-2897 description incident related to aid worker security + aid-security-2897 P31 Q35120 + aid-security-2911 label Incident ID 2911 + aid-security-2911 description incident related to aid worker security + aid-security-2911 P31 Q35120 + aid-security-2997 label Incident ID 2997 + aid-security-2997 description incident related to aid worker security + aid-security-2997 P31 Q35120 diff --git a/backend/tests/files_for_tests/aid/kgtk_properties.tsv b/backend/tests/files_for_tests/aid/kgtk_properties.tsv new file mode 100644 index 000000000..68b7d39c7 --- /dev/null +++ b/backend/tests/files_for_tests/aid/kgtk_properties.tsv @@ -0,0 +1,174 @@ +node1 label node2 id +P2006020001 label column index P2006020001-label-1 +P2006020001 data_type Quantity P2006020001-data_type-1 +P2006020001 description Column number that corresponds to a variable P2006020001-description-1 +P2006020002 label qualifier P2006020002-label-1 +P2006020002 description Qualifiers used to describe a variable. E.g., FertilizerType, Source, etc. P2006020002-description-1 +P2006020002 data_type WikibaseProperty P2006020002-data_type-1 +P2006020003 label variable measured P2006020003-label-1 +P2006020003 data_type WikibaseItem P2006020003-data_type-1 +P2006020003 description Variables that are measured in a Dataset P2006020003-description-1 +P2006020004 label dataset P2006020004-label-1 +P2006020004 data_type WikibaseItem P2006020004-data_type-1 +P2006020004 description Id of the dataset this variable is included in P2006020004-description-1 +P2006020005 label mapping file P2006020005-label-1 +P2006020005 data_type String P2006020005-data_type-1 +P2006020006 label keywords P2006020006-label-1 +P2006020006 description Keywords describing the dataset. Multiple entries are delimited by commas P2006020006-description-1 +P2006020006 data_type String P2006020006-data-type-1 +P2006020007 label version P2006020007-label-1 +P2006020007 description Version number of the Dataset. Semantic versioning in the form of X.Y.Z is preferred (where X indicates a major version, Y a minor version and Z indicates a patch or bug fixes) P2006020007-description-1 +P2006020007 data_type String P2006020007-data-type-1 +P2006020008 label date created P2006020008-label-1 +P2006020008 description Creation date of the Dataset in ISO 8601 format (YYYY-MM-DD) P2006020008-description-1 +P2006020008 data_type String P2006020008-data-type-1 +P2006020009 label included in data catalog P2006020009-label-1 +P2006020009 description Catalog where the Dataset is included P2006020009-description-1 +P2006020009 data_type String P2006020009-data-type-1 +P2006180001 label geospatial granularity P2006180001-label-1 +P2006180001 description Administrative area (admin 1, admin 2 or admin 3) the variable or dataset corresponds to P2006180001-description-1 +P2006180001 data_type String P2006180001-data-type-1 +P2006190001 label located in the first-level administrative country subdivision P2006190001-label-1 +P2006190001 description The item is located in the first-level administrative country subdivision. A first-level adminstrative country subdivision is located within itself P2006190001-description-1 +P2006190001 data_type WikibaseItem P2006190001-data-type-1 +P2006190002 label located in the second-level administrative country subdivision P2006190002-label-1 +P2006190002 description The item is located in the second-level administrative country subdivision. A second-level adminstrative country subdivision is located within itself P2006190002-description-1 +P2006190002 data_type WikibaseItem P2006190002-data-type-1 +P2006190003 label located in the third-level administrative country subdivision P2006190003-label-1 +P2006190003 description The item is located in the third-level administrative country subdivision. A third-level adminstrative country subdivision is located within itself P2006190003-description-1 +P2006190003 data_type WikibaseItem P2006190003-data-type-1 +P248 label stated in P248-label-1 +P1687 label corresponds to property P1687-label-1 +P1687 data_type WikibaseProperty P1687-data_type-1 +P1476 label title P1476-label-1 +P1476 data_type String P1476-data_type-1 +P2699 label String P2699-label-1 +P2699 data_type String P2699-data_type-1 +P1813 data_type String P1813-data-type-1 +P170 label creator P170-label-1 +P170 data_type WikibaseItem P170-data-type-1 +P767 label contributor P767-label-1 +P767 data_type WikibaseItem P767-data-type-1 +P2860 label cites work P2860-label-1 +P2860 data_type String P2860-data-type-1 +P275 label copyright license P275-label-1 +P275 data_type String P275-data-type-1 +P356 label doi P356-label-1 +P356 data_type String P356-data-type-1 +P921 label main subject P921-label-1 +P921 data_type WikibaseItem P921-data-type-1 +P625 label coordinate location P625-label-1 +P625 data_type GlobeCoordinate P625-data-type-1 +P3896 label geoshape P3896-label-1 +P3896 data_type String P3896-data-type-1 +P17 label country P17-label-1 +P17 data_type String P17-data-type-1 +P276 label location P276-label-1 +P276 data_type String P276-data-type-1 +P580 label start time P580-label-1 +P580 data_type Time P580-data-type-1 +P582 label end time P582-label-1 +P582 data_type Time P582-data-type-1 +P6339 label data interval P6339-label-1 +P6339 data_type WikibaseItem P6339-data-type-1 +P856 label official website P856-label-1 +P856 data_type String P856-data-type-1 +P6269 label api endpoint P6269-label-1 +P6269 data_type String P6269-data-type-1 +P527 label has part P527-label-1 +P527 data_type String P527-data-type-1 +P1813 label short name P1813-label-1 +P1813 data_type String P1813-data-type-1 +P921 label main subject P921-label-1 +P921 data_type WikibaseItem P921-data-type-1 +P1880 label unit of measure P1880-label-1 +P1880 data_type String P1880-data-type-1 +P1114 label count P1114-label-1 +P1114 data_type Quantity P1114-data-type-1 +Paid-security-002 data_type Quantity Paid-security-002-data_type +Paid-security-002 P31 Q18616576 Paid-security-002-P31 +Paid-security-002 label "UN" Paid-security-002-label +Paid-security-003 data_type Quantity Paid-security-003-data_type +Paid-security-003 P31 Q18616576 Paid-security-003-P31 +Paid-security-003 label "INGO" Paid-security-003-label +Paid-security-004 data_type Quantity Paid-security-004-data_type +Paid-security-004 P31 Q18616576 Paid-security-004-P31 +Paid-security-004 label "LNGO/NRCS" Paid-security-004-label +Paid-security-005 data_type Quantity Paid-security-005-data_type +Paid-security-005 P31 Q18616576 Paid-security-005-P31 +Paid-security-005 label "ICRC" Paid-security-005-label +Paid-security-006 data_type Quantity Paid-security-006-data_type +Paid-security-006 P31 Q18616576 Paid-security-006-P31 +Paid-security-006 label "IFRC" Paid-security-006-label +Paid-security-007 data_type Quantity Paid-security-007-data_type +Paid-security-007 P31 Q18616576 Paid-security-007-P31 +Paid-security-007 label "Other" Paid-security-007-label +Paid-security-008 data_type Quantity Paid-security-008-data_type +Paid-security-008 P31 Q18616576 Paid-security-008-P31 +Paid-security-008 label "Nationals killed" Paid-security-008-label +Paid-security-009 data_type Quantity Paid-security-009-data_type +Paid-security-009 P31 Q18616576 Paid-security-009-P31 +Paid-security-009 label "Nationals wounded" Paid-security-009-label +Paid-security-010 data_type Quantity Paid-security-010-data_type +Paid-security-010 P31 Q18616576 Paid-security-010-P31 +Paid-security-010 label "Nationals kidnapped" Paid-security-010-label +Paid-security-011 data_type Quantity Paid-security-011-data_type +Paid-security-011 P31 Q18616576 Paid-security-011-P31 +Paid-security-011 label "Total nationals" Paid-security-011-label +Paid-security-012 data_type Quantity Paid-security-012-data_type +Paid-security-012 P31 Q18616576 Paid-security-012-P31 +Paid-security-012 label "Internationals killed" Paid-security-012-label +Paid-security-013 data_type Quantity Paid-security-013-data_type +Paid-security-013 P31 Q18616576 Paid-security-013-P31 +Paid-security-013 label "Internationals wounded" Paid-security-013-label +Paid-security-014 data_type Quantity Paid-security-014-data_type +Paid-security-014 P31 Q18616576 Paid-security-014-P31 +Paid-security-014 label "Internationals kidnapped" Paid-security-014-label +Paid-security-015 data_type Quantity Paid-security-015-data_type +Paid-security-015 P31 Q18616576 Paid-security-015-P31 +Paid-security-015 label "Total internationals" Paid-security-015-label +Paid-security-016 data_type Quantity Paid-security-016-data_type +Paid-security-016 P31 Q18616576 Paid-security-016-P31 +Paid-security-016 label "Total killed" Paid-security-016-label +Paid-security-017 data_type Quantity Paid-security-017-data_type +Paid-security-017 P31 Q18616576 Paid-security-017-P31 +Paid-security-017 label "Total wounded" Paid-security-017-label +Paid-security-018 data_type Quantity Paid-security-018-data_type +Paid-security-018 P31 Q18616576 Paid-security-018-P31 +Paid-security-018 label "Total kidnapped" Paid-security-018-label +Paid-security-019 data_type Quantity Paid-security-019-data_type +Paid-security-019 P31 Q18616576 Paid-security-019-P31 +Paid-security-019 label "Total affected" Paid-security-019-label +Paid-security-020 data_type Quantity Paid-security-020-data_type +Paid-security-020 P31 Q18616576 Paid-security-020-P31 +Paid-security-020 label "Gender Male" Paid-security-020-label +Paid-security-021 data_type Quantity Paid-security-021-data_type +Paid-security-021 P31 Q18616576 Paid-security-021-P31 +Paid-security-021 label "Gender Female" Paid-security-021-label +Paid-security-022 data_type Quantity Paid-security-022-data_type +Paid-security-022 P31 Q18616576 Paid-security-022-P31 +Paid-security-022 label "Gender Unknown" Paid-security-022-label +Paid-security-023 data_type Quantity Paid-security-023-data_type +Paid-security-023 P31 Q18616576 Paid-security-023-P31 +Paid-security-023 label "Means of attack" Paid-security-023-label +Paid-security-024 data_type Quantity Paid-security-024-data_type +Paid-security-024 P31 Q18616576 Paid-security-024-P31 +Paid-security-024 label "Attack context" Paid-security-024-label +Paid-security-025 data_type Quantity Paid-security-025-data_type +Paid-security-025 P31 Q18616576 Paid-security-025-P31 +Paid-security-025 label "Location" Paid-security-025-label +Paid-security-026 data_type Quantity Paid-security-026-data_type +Paid-security-026 P31 Q18616576 Paid-security-026-P31 +Paid-security-026 label "Actor type" Paid-security-026-label +Paid-security-027 data_type Quantity Paid-security-027-data_type +Paid-security-027 P31 Q18616576 Paid-security-027-P31 +Paid-security-027 label "Actor name" Paid-security-027-label +Paid-security-028 data_type Quantity Paid-security-028-data_type +Paid-security-028 P31 Q18616576 Paid-security-028-P31 +Paid-security-028 label "Details" Paid-security-028-label +Paid-security-029 data_type Quantity Paid-security-029-data_type +Paid-security-029 P31 Q18616576 Paid-security-029-P31 +Paid-security-029 label "Verified" Paid-security-029-label +Paid-security-030 data_type Quantity Paid-security-030-data_type +Paid-security-030 P31 Q18616576 Paid-security-030-P31 +Paid-security-030 label "Source" Paid-security-030-label diff --git a/backend/tests/files_for_tests/aid/results.json b/backend/tests/files_for_tests/aid/results.json new file mode 100644 index 000000000..bd9f92dc7 --- /dev/null +++ b/backend/tests/files_for_tests/aid/results.json @@ -0,0 +1,1615 @@ +{ + "add_data_file": { + "tableData": { + "filename": "dataset.xlsx", + "isCSV": false, + "sheetNames": [ + "Sheet3", + "Sheet4" + ], + "currSheetName": "Sheet3", + "sheetData": { + "columnDefs": [ + { + "headerName": "", + "field": "^", + "pinned": "left" + }, + { + "headerName": "A", + "field": "A" + }, + { + "headerName": "B", + "field": "B" + }, + { + "headerName": "C", + "field": "C" + }, + { + "headerName": "D", + "field": "D" + }, + { + "headerName": "E", + "field": "E" + }, + { + "headerName": "F", + "field": "F" + }, + { + "headerName": "G", + "field": "G" + }, + { + "headerName": "H", + "field": "H" + }, + { + "headerName": "I", + "field": "I" + } + ], + "rowData": [ + { + "index": 1, + "A": "", + "B": "", + "C": "", + "D": "", + "E": "unit:", + "F": "person", + "G": "person", + "H": "person", + "I": "", + "^": "1" + }, + { + "index": 2, + "A": "", + "B": "Incident ID", + "C": "Year", + "D": "Month", + "E": "Day", + "F": "UN", + "G": "INGO", + "H": "LNGO/NRCS", + "I": "Country", + "^": "2" + }, + { + "index": 3, + "A": "", + "B": 22, + "C": 1997, + "D": 9, + "E": 24, + "F": 2, + "G": 0, + "H": 0, + "I": "Ethiopia", + "^": "3" + }, + { + "index": 4, + "A": "", + "B": 47, + "C": 1998, + "D": 6, + "E": 25, + "F": 0, + "G": 0, + "H": 0, + "I": "Aruba", + "^": "4" + }, + { + "index": 5, + "A": "", + "B": 73, + "C": 1999, + "D": 4, + "E": "", + "F": 0, + "G": 1, + "H": 0, + "I": "Afghanistant", + "^": "5" + }, + { + "index": 6, + "A": "", + "B": 103, + "C": 2000, + "D": 2, + "E": "", + "F": 0, + "G": 2, + "H": 0, + "I": "Ethiopia", + "^": "6" + }, + { + "index": 7, + "A": "", + "B": 475, + "C": 2006, + "D": 9, + "E": 20, + "F": 0, + "G": 0, + "H": 0, + "I": "Ethiopia", + "^": "7" + }, + { + "index": 8, + "A": "", + "B": 782, + "C": 2008, + "D": "", + "E": "", + "F": 0, + "G": 0, + "H": 3, + "I": "Ethiopia", + "^": "8" + } + ] + } + }, + "wikifierData": { + "qnodes": {}, + "rowData": [] + }, + "yamlData": null, + "error": null + }, + "add_properties_file": { + "added": [ + "P2006020001", + "P2006020002", + "P2006020003", + "P2006020004", + "P2006020005", + "P2006020006", + "P2006020007", + "P2006020008", + "P2006020009", + "P2006180001", + "P2006190001", + "P2006190002", + "P2006190003", + "P1687", + "P1476", + "P2699", + "P1813", + "P170", + "P767", + "P2860", + "P275", + "P356", + "P921", + "P625", + "P3896", + "P17", + "P276", + "P580", + "P582", + "P6339", + "P856", + "P6269", + "P527", + "P1880", + "P1114", + "Paid-security-002", + "Paid-security-003", + "Paid-security-004", + "Paid-security-005", + "Paid-security-006", + "Paid-security-007", + "Paid-security-008", + "Paid-security-009", + "Paid-security-010", + "Paid-security-011", + "Paid-security-012", + "Paid-security-013", + "Paid-security-014", + "Paid-security-015", + "Paid-security-016", + "Paid-security-017", + "Paid-security-018", + "Paid-security-019", + "Paid-security-020", + "Paid-security-021", + "Paid-security-022", + "Paid-security-023", + "Paid-security-024", + "Paid-security-025", + "Paid-security-026", + "Paid-security-027", + "Paid-security-028", + "Paid-security-029", + "Paid-security-030" + ], + "present": [], + "failed": [] + }, + "add_wikifier_file": { + "error": null, + "qnodes": { + "B3": { + "main subject": { + "item": "aid-security-22" + } + }, + "B4": { + "main subject": { + "item": "aid-security-47" + } + }, + "B5": { + "main subject": { + "item": "aid-security-73" + } + }, + "B6": { + "main subject": { + "item": "aid-security-103" + } + }, + "B7": { + "main subject": { + "item": "aid-security-475" + } + }, + "B8": { + "main subject": { + "item": "aid-security-782" + } + }, + "F1": { + "unit": { + "item": "Qaid-security-U002" + } + }, + "F2": { + "property": { + "item": "Paid-security-002" + } + }, + "G1": { + "unit": { + "item": "Qaid-security-U002" + } + }, + "G2": { + "property": { + "item": "Paid-security-003" + } + }, + "H1": { + "unit": { + "item": "Qaid-security-U002" + } + }, + "H2": { + "property": { + "item": "Paid-security-004" + } + }, + "I4": { + "": { + "item": "Q21203", + "label": "Aruba", + "desc": "island country in the Caribbean, part of the Kingdom of the Netherlands" + } + } + }, + "rowData": [ + { + "context": "main subject", + "col": "B", + "row": "3", + "value": 22, + "item": "aid-security-22" + }, + { + "context": "main subject", + "col": "B", + "row": "4", + "value": 47, + "item": "aid-security-47" + }, + { + "context": "main subject", + "col": "B", + "row": "5", + "value": 73, + "item": "aid-security-73" + }, + { + "context": "main subject", + "col": "B", + "row": "6", + "value": 103, + "item": "aid-security-103" + }, + { + "context": "main subject", + "col": "B", + "row": "7", + "value": 475, + "item": "aid-security-475" + }, + { + "context": "main subject", + "col": "B", + "row": "8", + "value": 782, + "item": "aid-security-782" + }, + { + "context": "unit", + "col": "F", + "row": "1", + "value": "person", + "item": "Qaid-security-U002" + }, + { + "context": "property", + "col": "F", + "row": "2", + "value": "UN", + "item": "Paid-security-002" + }, + { + "context": "unit", + "col": "G", + "row": "1", + "value": "person", + "item": "Qaid-security-U002" + }, + { + "context": "property", + "col": "G", + "row": "2", + "value": "INGO", + "item": "Paid-security-003" + }, + { + "context": "unit", + "col": "H", + "row": "1", + "value": "person", + "item": "Qaid-security-U002" + }, + { + "context": "property", + "col": "H", + "row": "2", + "value": "LNGO/NRCS", + "item": "Paid-security-004" + }, + { + "context": "", + "col": "I", + "row": "4", + "value": "Aruba", + "item": "Q21203", + "label": "Aruba", + "desc": "island country in the Caribbean, part of the Kingdom of the Netherlands" + } + ] + }, + "add_items": { + "qnodes": { + "B3": { + "main subject": { + "item": "aid-security-22", + "label": "Incident ID 22", + "desc": "incident related to aid worker security" + } + }, + "B4": { + "main subject": { + "item": "aid-security-47", + "label": "Incident ID 47", + "desc": "incident related to aid worker security" + } + }, + "B5": { + "main subject": { + "item": "aid-security-73", + "label": "Incident ID 73", + "desc": "incident related to aid worker security" + } + }, + "B6": { + "main subject": { + "item": "aid-security-103", + "label": "Incident ID 103", + "desc": "incident related to aid worker security" + } + }, + "B7": { + "main subject": { + "item": "aid-security-475", + "label": "Incident ID 475", + "desc": "incident related to aid worker security" + } + }, + "B8": { + "main subject": { + "item": "aid-security-782", + "label": "Incident ID 782", + "desc": "incident related to aid worker security" + } + }, + "F1": { + "unit": { + "item": "Qaid-security-U002" + } + }, + "F2": { + "property": { + "item": "Paid-security-002" + } + }, + "G1": { + "unit": { + "item": "Qaid-security-U002" + } + }, + "G2": { + "property": { + "item": "Paid-security-003" + } + }, + "H1": { + "unit": { + "item": "Qaid-security-U002" + } + }, + "H2": { + "property": { + "item": "Paid-security-004" + } + }, + "I4": { + "": { + "item": "Q21203", + "label": "Aruba", + "desc": "island country in the Caribbean, part of the Kingdom of the Netherlands" + } + } + }, + "rowData": [ + { + "context": "main subject", + "col": "B", + "row": "3", + "value": 22, + "item": "aid-security-22", + "label": "Incident ID 22", + "desc": "incident related to aid worker security" + }, + { + "context": "main subject", + "col": "B", + "row": "4", + "value": 47, + "item": "aid-security-47", + "label": "Incident ID 47", + "desc": "incident related to aid worker security" + }, + { + "context": "main subject", + "col": "B", + "row": "5", + "value": 73, + "item": "aid-security-73", + "label": "Incident ID 73", + "desc": "incident related to aid worker security" + }, + { + "context": "main subject", + "col": "B", + "row": "6", + "value": 103, + "item": "aid-security-103", + "label": "Incident ID 103", + "desc": "incident related to aid worker security" + }, + { + "context": "main subject", + "col": "B", + "row": "7", + "value": 475, + "item": "aid-security-475", + "label": "Incident ID 475", + "desc": "incident related to aid worker security" + }, + { + "context": "main subject", + "col": "B", + "row": "8", + "value": 782, + "item": "aid-security-782", + "label": "Incident ID 782", + "desc": "incident related to aid worker security" + }, + { + "context": "unit", + "col": "F", + "row": "1", + "value": "person", + "item": "Qaid-security-U002" + }, + { + "context": "property", + "col": "F", + "row": "2", + "value": "UN", + "item": "Paid-security-002" + }, + { + "context": "unit", + "col": "G", + "row": "1", + "value": "person", + "item": "Qaid-security-U002" + }, + { + "context": "property", + "col": "G", + "row": "2", + "value": "INGO", + "item": "Paid-security-003" + }, + { + "context": "unit", + "col": "H", + "row": "1", + "value": "person", + "item": "Qaid-security-U002" + }, + { + "context": "property", + "col": "H", + "row": "2", + "value": "LNGO/NRCS", + "item": "Paid-security-004" + }, + { + "context": "", + "col": "I", + "row": "4", + "value": "Aruba", + "item": "Q21203", + "label": "Aruba", + "desc": "island country in the Caribbean, part of the Kingdom of the Netherlands" + } + ] + }, + "add_yaml": { + "error": null, + "yamlRegions": { + "dataRegion": { + "color": "hsl(150, 50%, 90%)", + "list": [ + "H7", + "F6", + "G8", + "F3", + "G4", + "H8", + "F7", + "F5", + "H3", + "G6", + "H4", + "G3", + "H6", + "G7", + "F4", + "H5", + "F8", + "G5" + ] + }, + "item": { + "color": "hsl(200, 50%, 90%)", + "list": [ + "B4", + "B3", + "B6", + "B7", + "B8", + "B5" + ] + }, + "qualifierRegion": { + "color": "hsl(250, 50%, 90%)", + "list": [ + "I4" + ] + }, + "referenceRegion": { + "color": "yellow", + "list": [] + }, + "error": { + "F3": { + "qualifier": { + "1": { + "value": "Failed to resolve" + } + } + }, + "F5": { + "qualifier": { + "1": { + "value": "Failed to resolve" + } + } + }, + "F6": { + "qualifier": { + "1": { + "value": "Failed to resolve" + } + } + }, + "F7": { + "qualifier": { + "1": { + "value": "Failed to resolve" + } + } + }, + "F8": { + "qualifier": { + "1": { + "value": "Failed to resolve" + } + } + }, + "G3": { + "qualifier": { + "1": { + "value": "Failed to resolve" + } + } + }, + "G5": { + "qualifier": { + "1": { + "value": "Failed to resolve" + } + } + }, + "G6": { + "qualifier": { + "1": { + "value": "Failed to resolve" + } + } + }, + "G7": { + "qualifier": { + "1": { + "value": "Failed to resolve" + } + } + }, + "G8": { + "qualifier": { + "1": { + "value": "Failed to resolve" + } + } + }, + "H3": { + "qualifier": { + "1": { + "value": "Failed to resolve" + } + } + }, + "H5": { + "qualifier": { + "1": { + "value": "Failed to resolve" + } + } + }, + "H6": { + "qualifier": { + "1": { + "value": "Failed to resolve" + } + } + }, + "H7": { + "qualifier": { + "1": { + "value": "Failed to resolve" + } + } + }, + "H8": { + "qualifier": { + "1": { + "value": "Failed to resolve" + } + } + } + }, + "dangerCells": { + "color": "#FF8000", + "list": [ + "F3", + "F5", + "F6", + "F7", + "F8", + "G3", + "G5", + "G6", + "G7", + "G8", + "H3", + "H5", + "H6", + "H7", + "H8" + ] + }, + "errorCells": { + "color": "#FF3333", + "list": [] + }, + "cellStatements": { + "F3": { + "property": "Paid-security-002", + "value": 2, + "item": 22, + "unit": "Qaid-security-U002", + "qualifier": [ + { + "property": "P585", + "value": "1997-09-24T00:00:00", + "calendar": "Q1985727", + "precision": 11, + "time_zone": 0, + "format": "%Y-%m-%d" + } + ], + "cell": "B3" + }, + "F4": { + "property": "Paid-security-002", + "value": 0, + "item": 47, + "unit": "Qaid-security-U002", + "qualifier": [ + { + "property": "P585", + "value": "1998-06-25T00:00:00", + "calendar": "Q1985727", + "precision": 11, + "time_zone": 0, + "format": "%Y-%m-%d" + }, + { + "property": "P17", + "value": "Q21203", + "cell": "I4" + } + ], + "cell": "B4" + }, + "F5": { + "property": "Paid-security-002", + "value": 0, + "item": 73, + "unit": "Qaid-security-U002", + "qualifier": [ + { + "property": "P585", + "value": "1999-04-01T00:00:00", + "calendar": "Q1985727", + "precision": 11, + "time_zone": 0, + "format": "%Y-%m-%d" + } + ], + "cell": "B5" + }, + "F6": { + "property": "Paid-security-002", + "value": 0, + "item": 103, + "unit": "Qaid-security-U002", + "qualifier": [ + { + "property": "P585", + "value": "2000-02-01T00:00:00", + "calendar": "Q1985727", + "precision": 11, + "time_zone": 0, + "format": "%Y-%m-%d" + } + ], + "cell": "B6" + }, + "F7": { + "property": "Paid-security-002", + "value": 0, + "item": 475, + "unit": "Qaid-security-U002", + "qualifier": [ + { + "property": "P585", + "value": "2006-09-20T00:00:00", + "calendar": "Q1985727", + "precision": 11, + "time_zone": 0, + "format": "%Y-%m-%d" + } + ], + "cell": "B7" + }, + "F8": { + "property": "Paid-security-002", + "value": 0, + "item": 782, + "unit": "Qaid-security-U002", + "qualifier": [ + { + "property": "P585", + "value": "2008-01-01T00:00:00", + "calendar": "Q1985727", + "precision": 11, + "time_zone": 0, + "format": "%Y-%m-%d" + } + ], + "cell": "B8" + }, + "G3": { + "property": "Paid-security-003", + "value": 0, + "item": 22, + "unit": "Qaid-security-U002", + "qualifier": [ + { + "property": "P585", + "value": "1997-09-24T00:00:00", + "calendar": "Q1985727", + "precision": 11, + "time_zone": 0, + "format": "%Y-%m-%d" + } + ], + "cell": "B3" + }, + "G4": { + "property": "Paid-security-003", + "value": 0, + "item": 47, + "unit": "Qaid-security-U002", + "qualifier": [ + { + "property": "P585", + "value": "1998-06-25T00:00:00", + "calendar": "Q1985727", + "precision": 11, + "time_zone": 0, + "format": "%Y-%m-%d" + }, + { + "property": "P17", + "value": "Q21203", + "cell": "I4" + } + ], + "cell": "B4" + }, + "G5": { + "property": "Paid-security-003", + "value": 1, + "item": 73, + "unit": "Qaid-security-U002", + "qualifier": [ + { + "property": "P585", + "value": "1999-04-01T00:00:00", + "calendar": "Q1985727", + "precision": 11, + "time_zone": 0, + "format": "%Y-%m-%d" + } + ], + "cell": "B5" + }, + "G6": { + "property": "Paid-security-003", + "value": 2, + "item": 103, + "unit": "Qaid-security-U002", + "qualifier": [ + { + "property": "P585", + "value": "2000-02-01T00:00:00", + "calendar": "Q1985727", + "precision": 11, + "time_zone": 0, + "format": "%Y-%m-%d" + } + ], + "cell": "B6" + }, + "G7": { + "property": "Paid-security-003", + "value": 0, + "item": 475, + "unit": "Qaid-security-U002", + "qualifier": [ + { + "property": "P585", + "value": "2006-09-20T00:00:00", + "calendar": "Q1985727", + "precision": 11, + "time_zone": 0, + "format": "%Y-%m-%d" + } + ], + "cell": "B7" + }, + "G8": { + "property": "Paid-security-003", + "value": 0, + "item": 782, + "unit": "Qaid-security-U002", + "qualifier": [ + { + "property": "P585", + "value": "2008-01-01T00:00:00", + "calendar": "Q1985727", + "precision": 11, + "time_zone": 0, + "format": "%Y-%m-%d" + } + ], + "cell": "B8" + }, + "H3": { + "property": "Paid-security-004", + "value": 0, + "item": 22, + "unit": "Qaid-security-U002", + "qualifier": [ + { + "property": "P585", + "value": "1997-09-24T00:00:00", + "calendar": "Q1985727", + "precision": 11, + "time_zone": 0, + "format": "%Y-%m-%d" + } + ], + "cell": "B3" + }, + "H4": { + "property": "Paid-security-004", + "value": 0, + "item": 47, + "unit": "Qaid-security-U002", + "qualifier": [ + { + "property": "P585", + "value": "1998-06-25T00:00:00", + "calendar": "Q1985727", + "precision": 11, + "time_zone": 0, + "format": "%Y-%m-%d" + }, + { + "property": "P17", + "value": "Q21203", + "cell": "I4" + } + ], + "cell": "B4" + }, + "H5": { + "property": "Paid-security-004", + "value": 0, + "item": 73, + "unit": "Qaid-security-U002", + "qualifier": [ + { + "property": "P585", + "value": "1999-04-01T00:00:00", + "calendar": "Q1985727", + "precision": 11, + "time_zone": 0, + "format": "%Y-%m-%d" + } + ], + "cell": "B5" + }, + "H6": { + "property": "Paid-security-004", + "value": 0, + "item": 103, + "unit": "Qaid-security-U002", + "qualifier": [ + { + "property": "P585", + "value": "2000-02-01T00:00:00", + "calendar": "Q1985727", + "precision": 11, + "time_zone": 0, + "format": "%Y-%m-%d" + } + ], + "cell": "B6" + }, + "H7": { + "property": "Paid-security-004", + "value": 0, + "item": 475, + "unit": "Qaid-security-U002", + "qualifier": [ + { + "property": "P585", + "value": "2006-09-20T00:00:00", + "calendar": "Q1985727", + "precision": 11, + "time_zone": 0, + "format": "%Y-%m-%d" + } + ], + "cell": "B7" + }, + "H8": { + "property": "Paid-security-004", + "value": 3, + "item": 782, + "unit": "Qaid-security-U002", + "qualifier": [ + { + "property": "P585", + "value": "2008-01-01T00:00:00", + "calendar": "Q1985727", + "precision": 11, + "time_zone": 0, + "format": "%Y-%m-%d" + } + ], + "cell": "B8" + } + } + } + }, + "get_cell": { + "statement": { + "property": "Paid-security-003", + "value": 0, + "item": 47, + "unit": "Qaid-security-U002", + "qualifier": [ + { + "property": "P585", + "value": "1998-06-25T00:00:00", + "calendar": "Q1985727", + "precision": 11, + "time_zone": 0, + "format": "%Y-%m-%d" + }, + { + "property": "P17", + "value": "Q21203", + "cell": "I4" + } + ], + "cell": "B4" + }, + "internalErrors": null, + "error": null + }, + "change_sheet": { + "tableData": { + "filename": "dataset.xlsx", + "isCSV": false, + "sheetNames": [ + "Sheet3", + "Sheet4" + ], + "currSheetName": "Sheet4", + "sheetData": { + "columnDefs": [ + { + "headerName": "", + "field": "^", + "pinned": "left" + }, + { + "headerName": "A", + "field": "A" + }, + { + "headerName": "B", + "field": "B" + }, + { + "headerName": "C", + "field": "C" + }, + { + "headerName": "D", + "field": "D" + }, + { + "headerName": "E", + "field": "E" + }, + { + "headerName": "F", + "field": "F" + }, + { + "headerName": "G", + "field": "G" + }, + { + "headerName": "H", + "field": "H" + }, + { + "headerName": "I", + "field": "I" + }, + { + "headerName": "J", + "field": "J" + }, + { + "headerName": "K", + "field": "K" + }, + { + "headerName": "L", + "field": "L" + }, + { + "headerName": "M", + "field": "M" + }, + { + "headerName": "N", + "field": "N" + } + ], + "rowData": [ + { + "index": 1, + "A": "", + "B": "", + "C": "", + "D": "", + "E": "unit:", + "F": "person", + "G": "person", + "H": "person", + "I": "", + "J": "", + "K": "", + "L": "", + "M": "", + "N": "", + "^": "1" + }, + { + "index": 2, + "A": "", + "B": "Incident ID", + "C": "Year", + "D": "Month", + "E": "Day", + "F": "UN", + "G": "INGO", + "H": "LNGO/NRCS", + "I": "Country", + "J": "", + "K": "", + "L": "", + "M": "", + "N": "", + "^": "2" + }, + { + "index": 3, + "A": "", + "B": 22, + "C": "bad date", + "D": 9, + "E": 24, + "F": 2, + "G": 0, + "H": 0, + "I": "Ethiopia", + "J": "", + "K": "", + "L": "", + "M": "", + "N": 4, + "^": "3" + }, + { + "index": 4, + "A": "", + "B": "bad item", + "C": 1998, + "D": 6, + "E": 25, + "F": 0, + "G": 0, + "H": 0, + "I": "Aruba", + "J": "", + "K": "", + "L": "", + "M": "", + "N": "", + "^": "4" + }, + { + "index": 5, + "A": "", + "B": 73, + "C": 1999, + "D": 4, + "E": "", + "F": "bad value", + "G": 1, + "H": 0, + "I": "Afghanistant", + "J": "", + "K": "", + "L": "", + "M": "", + "N": "", + "^": "5" + }, + { + "index": 6, + "A": "", + "B": 103, + "C": 2000, + "D": 2, + "E": "", + "F": "", + "G": "", + "H": "", + "I": "Ethiopia", + "J": "", + "K": "", + "L": "", + "M": "", + "N": "", + "^": "6" + }, + { + "index": 7, + "A": "", + "B": 475, + "C": 2006, + "D": 9, + "E": 20, + "F": 0, + "G": 0, + "H": 0, + "I": "bad qualifier", + "J": "", + "K": "", + "L": "", + "M": "", + "N": "", + "^": "7" + }, + { + "index": 8, + "A": "", + "B": 782, + "C": 2008, + "D": "", + "E": "", + "F": 0, + "G": 0, + "H": 3, + "I": "Ethiopia", + "J": "", + "K": "", + "L": "", + "M": "", + "N": "", + "^": "8" + } + ] + } + }, + "wikifierData": { + "qnodes": { + "B3": { + "main subject": { + "item": "aid-security-22", + "label": "Incident ID 22", + "desc": "incident related to aid worker security" + } + }, + "B5": { + "main subject": { + "item": "aid-security-73", + "label": "Incident ID 73", + "desc": "incident related to aid worker security" + } + }, + "B6": { + "main subject": { + "item": "aid-security-103", + "label": "Incident ID 103", + "desc": "incident related to aid worker security" + } + }, + "B7": { + "main subject": { + "item": "aid-security-475", + "label": "Incident ID 475", + "desc": "incident related to aid worker security" + } + }, + "B8": { + "main subject": { + "item": "aid-security-782", + "label": "Incident ID 782", + "desc": "incident related to aid worker security" + } + }, + "F1": { + "unit": { + "item": "Qaid-security-U002" + } + }, + "F2": { + "property": { + "item": "Paid-security-002" + } + }, + "G1": { + "unit": { + "item": "Qaid-security-U002" + } + }, + "G2": { + "property": { + "item": "Paid-security-003" + } + }, + "H1": { + "unit": { + "item": "Qaid-security-U002" + } + }, + "H2": { + "property": { + "item": "Paid-security-004" + } + }, + "I4": { + "": { + "item": "Q21203", + "label": "Aruba", + "desc": "island country in the Caribbean, part of the Kingdom of the Netherlands" + } + } + }, + "rowData": [ + { + "context": "main subject", + "col": "B", + "row": "3", + "value": 22, + "item": "aid-security-22", + "label": "Incident ID 22", + "desc": "incident related to aid worker security" + }, + { + "context": "main subject", + "col": "B", + "row": "5", + "value": 73, + "item": "aid-security-73", + "label": "Incident ID 73", + "desc": "incident related to aid worker security" + }, + { + "context": "main subject", + "col": "B", + "row": "6", + "value": 103, + "item": "aid-security-103", + "label": "Incident ID 103", + "desc": "incident related to aid worker security" + }, + { + "context": "main subject", + "col": "B", + "row": "7", + "value": 475, + "item": "aid-security-475", + "label": "Incident ID 475", + "desc": "incident related to aid worker security" + }, + { + "context": "main subject", + "col": "B", + "row": "8", + "value": 782, + "item": "aid-security-782", + "label": "Incident ID 782", + "desc": "incident related to aid worker security" + }, + { + "context": "unit", + "col": "F", + "row": "1", + "value": "person", + "item": "Qaid-security-U002" + }, + { + "context": "property", + "col": "F", + "row": "2", + "value": "UN", + "item": "Paid-security-002" + }, + { + "context": "unit", + "col": "G", + "row": "1", + "value": "person", + "item": "Qaid-security-U002" + }, + { + "context": "property", + "col": "G", + "row": "2", + "value": "INGO", + "item": "Paid-security-003" + }, + { + "context": "unit", + "col": "H", + "row": "1", + "value": "person", + "item": "Qaid-security-U002" + }, + { + "context": "property", + "col": "H", + "row": "2", + "value": "LNGO/NRCS", + "item": "Paid-security-004" + }, + { + "context": "", + "col": "I", + "row": "4", + "value": "Aruba", + "item": "Q21203", + "label": "Aruba", + "desc": "island country in the Caribbean, part of the Kingdom of the Netherlands" + } + ] + }, + "yamlData": null, + "error": null + }, + "wikify_region": { + "qnodes": { + "I3": { + "wikifier test": { + "item": "Q115", + "label": "Ethiopia", + "desc": "country in East Africa" + } + }, + "I4": { + "wikifier test": { + "item": "Q21203", + "label": "Aruba", + "desc": "island country in the Caribbean, part of the Kingdom of the Netherlands" + } + }, + "I6": { + "wikifier test": { + "item": "Q115", + "label": "Ethiopia", + "desc": "country in East Africa" + } + }, + "I7": { + "wikifier test": { + "item": "Q82770", + "label": "Bad Dürrheim", + "desc": "municipality in Germany" + } + }, + "I8": { + "wikifier test": { + "item": "Q115", + "label": "Ethiopia", + "desc": "country in East Africa" + } + } + }, + "rowData": [ + { + "context": "wikifier test", + "col": "I", + "row": "3", + "value": "Ethiopia", + "item": "Q115", + "label": "Ethiopia", + "desc": "country in East Africa" + }, + { + "context": "wikifier test", + "col": "I", + "row": "4", + "value": "Aruba", + "item": "Q21203", + "label": "Aruba", + "desc": "island country in the Caribbean, part of the Kingdom of the Netherlands" + }, + { + "context": "wikifier test", + "col": "I", + "row": "6", + "value": "Ethiopia", + "item": "Q115", + "label": "Ethiopia", + "desc": "country in East Africa" + }, + { + "context": "wikifier test", + "col": "I", + "row": "7", + "value": "bad qualifier", + "item": "Q82770", + "label": "Bad Dürrheim", + "desc": "municipality in Germany" + }, + { + "context": "wikifier test", + "col": "I", + "row": "8", + "value": "Ethiopia", + "item": "Q115", + "label": "Ethiopia", + "desc": "country in East Africa" + } + ], + "problemCells": { + "errorCode": 400, + "errorTitle": "Failed to wikify some cellsr", + "errorDescription": "Failed to wikify: I5" + } + } +} \ No newline at end of file diff --git a/backend/tests/files_for_tests/aid/test.yaml b/backend/tests/files_for_tests/aid/test.yaml new file mode 100644 index 000000000..7ee747635 --- /dev/null +++ b/backend/tests/files_for_tests/aid/test.yaml @@ -0,0 +1,20 @@ +statementMapping: + region: + - left: F + right: H + top: 3 + bottom: 8 + template: + item: =value[B, $row, "main subject"] + property: =item[$col, 2, "property"] + value: =value[$col, $row] + unit: =item[$col,1,"unit"] + qualifier: + - property: P585 # point in time + value: '=concat(value[C:E,$row],"-")' + calendar: Q1985727 + precision: day + time_zone: 0 + format: "%Y-%m-%d" + - property: P17 # country + value: =item[I,$row] From fbfa3438c7071575298c9cc3dfdbf97f244e401a Mon Sep 17 00:00:00 2001 From: devora Date: Mon, 10 Aug 2020 17:33:34 +0300 Subject: [PATCH 3/6] do not compare filepaths when running tests --- backend/tests/basic_test.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/backend/tests/basic_test.py b/backend/tests/basic_test.py index 73bf816a0..393258230 100644 --- a/backend/tests/basic_test.py +++ b/backend/tests/basic_test.py @@ -110,6 +110,8 @@ def test_03_add_data_file(client): data = response.data.decode("utf-8") data = json.loads(data) results_dict['add_data_file']=data + data['tableData'].pop('filename') + expected_results_dict['add_data_file']['tableData'].pop('filename') compare_jsons(data, 'add_data_file') def test_04_add_properties_file(client): @@ -226,6 +228,8 @@ def test_12_change_sheet(client): data = response.data.decode("utf-8") data = json.loads(data) results_dict['change_sheet']=data + data['tableData'].pop('filename') + expected_results_dict['change_sheet']['tableData'].pop('filename') compare_jsons(data, 'change_sheet') def test_12_wikify_region(client): From f7468f03d956c96d883e88ef147e46ef3cecade0 Mon Sep 17 00:00:00 2001 From: devora Date: Mon, 10 Aug 2020 17:36:16 +0300 Subject: [PATCH 4/6] get rid of the travis running --- .travis.yml => .travis.yml.old | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename .travis.yml => .travis.yml.old (100%) diff --git a/.travis.yml b/.travis.yml.old similarity index 100% rename from .travis.yml rename to .travis.yml.old From 298f14833b06356f74a24a99610eca1b2ead785f Mon Sep 17 00:00:00 2001 From: devora Date: Tue, 11 Aug 2020 11:23:02 +0300 Subject: [PATCH 5/6] clean up the tests a bit, to make adding new tests in the future easier --- backend/tests/basic_test.py | 479 ++++++++++++++++++------------------ 1 file changed, 243 insertions(+), 236 deletions(-) diff --git a/backend/tests/basic_test.py b/backend/tests/basic_test.py index 393258230..6c6d82983 100644 --- a/backend/tests/basic_test.py +++ b/backend/tests/basic_test.py @@ -10,44 +10,9 @@ sys.path.append(BACKEND_DIR) from flask_migrate import upgrade - from application import app -files_dir=os.path.join(os.path.dirname(__file__), "files_for_tests", "aid") - - -pid=None -results_dict={} - -with open(os.path.join(files_dir, "results.json"), 'r', encoding="utf-8") as f: - expected_results_dict=json.load(f) - -def recurse_lists_and_dicts(input1, input2): - if isinstance(input1, dict): - assert input1.keys()==input2.keys() - for key in input1: - recurse_lists_and_dicts(input1[key], input2[key]) - - elif isinstance(input1, list): - assert len(input1)==len(input2) - for index, item in enumerate(input1): - recurse_lists_and_dicts(input1[index], input2[index]) - - assert input1==input2 - -def compare_jsons(data, expected_key): - expected_data=expected_results_dict[expected_key] - assert data.keys()==expected_data.keys() - for key in data: - try: - assert data[key]==expected_data[key] - except AssertionError as e: - recurse_lists_and_dicts(data[key], expected_data[key]) - raise e - - - -@pytest.fixture(scope="module") +@pytest.fixture(scope="class") def client(request): def fin(): os.close(db_fd) @@ -63,222 +28,264 @@ def fin(): yield client +pid=None #we need to use a global pid for some reason... self.pid does not work. +class BaseClass: + files_dir="" + results_dict={} #used if we need to overwrite the existing results when something changes + expected_results_path="" -def test_0_get_projects_list(client): - #GET /api/projects - response=client.get('/api/projects') - data = response.data.decode("utf-8") - data = json.loads(data) - assert response.status_code==200 - -def test_01_add_project(client): - #POST /api/project - response=client.post('/api/project', - data=dict( - ptitle="Unit test" - ) - ) - data = response.data.decode("utf-8") - data = json.loads(data) - global pid - pid=str(data['pid']) - assert response.status_code==201 - -def test_02_get_project_files(client): - url= '/api/project/{pid}'.format(pid=pid) - response=client.get(url) - data = response.data.decode("utf-8") - data = json.loads(data) - assert data == { - 'name': 'Unit test', - 'tableData': None, - 'yamlData': None, - 'wikifierData': None - } - -def test_03_add_data_file(client): - url = '/api/data/{pid}'.format(pid=pid) - filename=os.path.join(files_dir, "dataset.xlsx") - with open(filename, 'rb') as f: - response=client.post(url, + @property + def expected_results_dict(self): + try: + return self.e_results_dict + except AttributeError: + with open(self.expected_results_path, 'r', encoding="utf-8") as f: + expected_results_dict=json.load(f) + self.e_results_dict=expected_results_dict + return self.e_results_dict + + def recurse_lists_and_dicts(self, input1, input2): + if isinstance(input1, dict): + assert input1.keys()==input2.keys() + for key in input1: + self.recurse_lists_and_dicts(input1[key], input2[key]) + + elif isinstance(input1, list): + assert len(input1)==len(input2) + for index, item in enumerate(input1): + self.recurse_lists_and_dicts(input1[index], input2[index]) + + assert input1==input2 + + def compare_jsons(self, data, expected_key): + expected_data=self.expected_results_dict[expected_key] + assert data.keys()==expected_data.keys() + for key in data: + try: + assert data[key]==expected_data[key] + except AssertionError as e: + self.recurse_lists_and_dicts(data[key], expected_data[key]) + + +class TestBasicWorkflow(BaseClass): + files_dir=os.path.join(os.path.dirname(__file__), "files_for_tests", "aid") + expected_results_path=os.path.join(files_dir, "results.json") + + def test_0_get_projects_list(self, client): + #GET /api/projects + response=client.get('/api/projects') + data = response.data.decode("utf-8") + data = json.loads(data) + assert response.status_code==200 + + def test_01_add_project(self, client): + #POST /api/project + response=client.post('/api/project', data=dict( - file=f + ptitle="Unit test" ) ) - - data = response.data.decode("utf-8") - data = json.loads(data) - results_dict['add_data_file']=data - data['tableData'].pop('filename') - expected_results_dict['add_data_file']['tableData'].pop('filename') - compare_jsons(data, 'add_data_file') - -def test_04_add_properties_file(client): - url = '/api/project/{pid}/properties'.format(pid=pid) - filename=os.path.join(files_dir, "kgtk_properties.tsv") - with open(filename, 'rb') as f: - response=client.post(url, - data=dict( - file=f + data = response.data.decode("utf-8") + data = json.loads(data) + global pid + pid=str(data['pid']) + assert response.status_code==201 + + def test_02_get_project_files(self, client): + url= '/api/project/{pid}'.format(pid=pid) + response=client.get(url) + data = response.data.decode("utf-8") + data = json.loads(data) + assert data == { + 'name': 'Unit test', + 'tableData': None, + 'yamlData': None, + 'wikifierData': None + } + + def test_03_add_data_file(self, client): + url = '/api/data/{pid}'.format(pid=pid) + filename=os.path.join(self.files_dir, "dataset.xlsx") + with open(filename, 'rb') as f: + response=client.post(url, + data=dict( + file=f + ) ) - ) - data = response.data.decode("utf-8") - data = json.loads(data) - results_dict['add_properties_file']=data - compare_jsons(data, 'add_properties_file') - -def test_05_add_wikifier_file(client): - url='/api/wikifier/{pid}'.format(pid=pid) - filename=os.path.join(files_dir, "consolidated-wikifier.csv") - with open(filename, 'rb') as f: - response=client.post(url, - data=dict( - file=f + data = response.data.decode("utf-8") + data = json.loads(data) + self.results_dict['add_data_file']=data + data['tableData'].pop('filename') + self.expected_results_dict['add_data_file']['tableData'].pop('filename') + self.compare_jsons(data, 'add_data_file') + + def test_04_add_properties_file(self, client): + url = '/api/project/{pid}/properties'.format(pid=pid) + filename=os.path.join(self.files_dir, "kgtk_properties.tsv") + with open(filename, 'rb') as f: + response=client.post(url, + data=dict( + file=f + ) ) - ) - - data = response.data.decode("utf-8") - data = json.loads(data) - results_dict['add_wikifier_file']=data - compare_jsons(data, 'add_wikifier_file') - -def test_06_add_items_file(client): - #POST /api/project/{pid}/items - url='/api/project/{pid}/items'.format(pid=pid) - filename=os.path.join(files_dir, "kgtk_item_defs.tsv") - with open(filename, 'rb') as f: - response=client.post(url, - data=dict( - file=f + data = response.data.decode("utf-8") + data = json.loads(data) + self.results_dict['add_properties_file']=data + self.compare_jsons(data, 'add_properties_file') + + def test_05_add_wikifier_file(self, client): + url='/api/wikifier/{pid}'.format(pid=pid) + filename=os.path.join(self.files_dir, "consolidated-wikifier.csv") + with open(filename, 'rb') as f: + response=client.post(url, + data=dict( + file=f + ) ) - ) - - data = response.data.decode("utf-8") - data = json.loads(data) - results_dict['add_items']=data - compare_jsons(data, 'add_items') -def test_08_add_yaml_file(client): - url='/api/yaml/{pid}'.format(pid=pid) - filename=os.path.join(files_dir, "test.yaml") - with open(filename, 'r') as f: - response=client.post(url, - data=dict( - yaml=f.read() + data = response.data.decode("utf-8") + data = json.loads(data) + self.results_dict['add_wikifier_file']=data + self.compare_jsons(data, 'add_wikifier_file') + + + def test_06_add_items_file(self, client): + #POST /api/project/{pid}/items + url='/api/project/{pid}/items'.format(pid=pid) + filename=os.path.join(self.files_dir, "kgtk_item_defs.tsv") + with open(filename, 'rb') as f: + response=client.post(url, + data=dict( + file=f + ) ) - ) - data = response.data.decode("utf-8") - data = json.loads(data) - results_dict['add_yaml']=data - - #some of the results are sent back as unordered lists and need to be compared separately - set_keys=[] - for key in data["yamlRegions"]: - if "list" in data["yamlRegions"][key]: - set_keys.append(key) - test1=set(data["yamlRegions"][key]["list"]) - test2=set(expected_results_dict["add_yaml"]["yamlRegions"][key]["list"]) - assert test1==test2 - for key in set_keys: - data["yamlRegions"].pop(key) - expected_results_dict["add_yaml"]["yamlRegions"].pop(key) - - compare_jsons(data, 'add_yaml') - -def test_09_get_cell(client): - #GET '/api/data/{pid}/cell//' - url='/api/data/{pid}/cell/{col}/{row}'.format(pid=pid, col="G", row=4) - response=client.get(url) - data = response.data.decode("utf-8") - data = json.loads(data) - results_dict['get_cell']=data - compare_jsons(data, 'get_cell') - -def test_10_get_node(client): - #GET /api/qnode/ - url='/api/qnode/{qid}'.format(qid="Q21203") - response=client.get(url) - data = response.data.decode("utf-8") - data = json.loads(data) - assert data['label']=='Aruba' - url='/api/qnode/{qid}'.format(qid="P17") - response=client.get(url) - data2 = response.data.decode("utf-8") - data2 = json.loads(data2) - assert data2['label']=='country' - -def test_11_get_download(client): - #GET '/api/project/{pid}/download/' - url='/api/project/{pid}/download/{filetype}'.format(pid=pid, filetype="tsv") - response=client.get(url) - data = response.data.decode("utf-8") - data = json.loads(data) - data=data["data"] - with open(os.path.join(files_dir, "download.tsv"), 'w') as f: - f.write(data) - -def test_12_change_sheet(client): - #GET /api/data/{pid}/ - url='/api/data/{pid}/{sheet_name}'.format(pid=pid,sheet_name="Sheet4") - response=client.get(url) - data = response.data.decode("utf-8") - data = json.loads(data) - results_dict['change_sheet']=data - data['tableData'].pop('filename') - expected_results_dict['change_sheet']['tableData'].pop('filename') - compare_jsons(data, 'change_sheet') - -def test_12_wikify_region(client): - #POST '/api/wikifier_service/{pid}' - url='/api/wikifier_service/{pid}'.format(pid=pid) - response=client.post(url, - data=dict( - action="wikify_region", - region="I3:I8", - context="wikifier test", - flag="0" + data = response.data.decode("utf-8") + data = json.loads(data) + self.results_dict['add_items']=data + self.compare_jsons(data, 'add_items') + + def test_08_add_yaml_file(self, client): + url='/api/yaml/{pid}'.format(pid=pid) + filename=os.path.join(self.files_dir, "test.yaml") + with open(filename, 'r') as f: + response=client.post(url, + data=dict( + yaml=f.read() + ) ) - ) - data = response.data.decode("utf-8") - data = json.loads(data) - results_dict['wikify_region']=data - compare_jsons(data, 'wikify_region') + data = response.data.decode("utf-8") + data = json.loads(data) + self.results_dict['add_yaml']=data + + #some of the results are sent back as unordered lists and need to be compared separately + set_keys=[] + for key in data["yamlRegions"]: + if "list" in data["yamlRegions"][key]: + set_keys.append(key) + test1=set(data["yamlRegions"][key]["list"]) + test2=set(self.expected_results_dict["add_yaml"]["yamlRegions"][key]["list"]) + assert test1==test2 + for key in set_keys: + data["yamlRegions"].pop(key) + self.expected_results_dict["add_yaml"]["yamlRegions"].pop(key) + + self.compare_jsons(data, 'add_yaml') + + def test_09_get_cell(self, client): + #GET '/api/data/{pid}/cell//' + url='/api/data/{pid}/cell/{col}/{row}'.format(pid=pid, col="G", row=4) + response=client.get(url) + data = response.data.decode("utf-8") + data = json.loads(data) + self.results_dict['get_cell']=data + self.compare_jsons(data, 'get_cell') + + def test_10_get_node(self, client): + #GET /api/qnode/ + url='/api/qnode/{qid}'.format(qid="Q21203") + response=client.get(url) + data = response.data.decode("utf-8") + data = json.loads(data) + assert data['label']=='Aruba' + url='/api/qnode/{qid}'.format(qid="P17") + response=client.get(url) + data2 = response.data.decode("utf-8") + data2 = json.loads(data2) + assert data2['label']=='country' + + def test_11_get_download(self, client): + #GET '/api/project/{pid}/download/' + url='/api/project/{pid}/download/{filetype}'.format(pid=pid, filetype="tsv") + response=client.get(url) + data = response.data.decode("utf-8") + data = json.loads(data) + data=data["data"] + with open(os.path.join(self.files_dir, "download.tsv"), 'w') as f: + f.write(data) + + def test_12_change_sheet(self, client): + #GET /api/data/{pid}/ + url='/api/data/{pid}/{sheet_name}'.format(pid=pid,sheet_name="Sheet4") + response=client.get(url) + data = response.data.decode("utf-8") + data = json.loads(data) + self.results_dict['change_sheet']=data + data['tableData'].pop('filename') + self.expected_results_dict['change_sheet']['tableData'].pop('filename') + self.compare_jsons(data, 'change_sheet') + + def test_12_wikify_region(self, client): + #POST '/api/wikifier_service/{pid}' + url='/api/wikifier_service/{pid}'.format(pid=pid) + response=client.post(url, + data=dict( + action="wikify_region", + region="I3:I8", + context="wikifier test", + flag="0" + ) + ) -def test_13_change_project_name(client): - url='/api/project/{pid}'.format(pid=pid) - ptitle="Unit test renamed" - response=client.put(url, - data=dict( - ptitle=ptitle - )) - data = response.data.decode("utf-8") - data = json.loads(data) - assert data['projects'][0]['ptitle']==ptitle - -def test_14_change_sparql_endpoint(client): - from t2wml.settings import t2wml_settings - #PUT '/api/project/{pid}/sparql' - url='/api/project/{pid}/sparql'.format(pid=pid) - endpoint='https://query.wikidata.org/bigdata/namespace/wdq/sparql' - response=client.put(url, - data=dict( - endpoint=endpoint - )) - assert t2wml_settings['wikidata_provider'].sparql_endpoint==endpoint - -def test_99_delete_project(client): - #this test must be sequentially last (do not run pytest in parallel) - #DELETE '/api/project/{pid}' - url_str="/api/project/"+str(pid) - response=client.delete(url_str) - data = response.data.decode("utf-8") - data = json.loads(data) - assert data["projects"]==[] + data = response.data.decode("utf-8") + data = json.loads(data) + self.results_dict['wikify_region']=data + self.compare_jsons(data, 'wikify_region') + + def test_13_change_project_name(self, client): + url='/api/project/{pid}'.format(pid=pid) + ptitle="Unit test renamed" + response=client.put(url, + data=dict( + ptitle=ptitle + )) + data = response.data.decode("utf-8") + data = json.loads(data) + assert data['projects'][0]['ptitle']==ptitle + + def test_14_change_sparql_endpoint(self, client): + from t2wml.settings import t2wml_settings + #PUT '/api/project/{pid}/sparql' + url='/api/project/{pid}/sparql'.format(pid=pid) + endpoint='https://query.wikidata.org/bigdata/namespace/wdq/sparql' + response=client.put(url, + data=dict( + endpoint=endpoint + )) + assert t2wml_settings['wikidata_provider'].sparql_endpoint==endpoint + + def test_99_delete_project(self, client): + #this test must be sequentially last (do not run pytest in parallel) + #DELETE '/api/project/{pid}' + url_str="/api/project/{pid}".format(pid=pid) + response=client.delete(url_str) + data = response.data.decode("utf-8") + data = json.loads(data) + assert data["projects"]==[] From 20689187db3e2b8b3a8ae2c44cadd5efca3a7366 Mon Sep 17 00:00:00 2001 From: devora Date: Tue, 11 Aug 2020 12:07:43 +0300 Subject: [PATCH 6/6] by now there are multiple launch configs for backend --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 12b71735f..200701819 100644 --- a/README.md +++ b/README.md @@ -85,7 +85,7 @@ The project has preconfigured settings file for Visual Studio Code. Before start On Macs and Linux machines, copy `.vscode/settings.linux.json` to `.vscode/settings.json` . On Windows, copy `.vscode/settings.windows.json` to `.vscode/settings.json` Start Visual Studio Code and open it in the t2wml-root/t2wml directory. -You can run the backend with F5 (choose the Backend launch configuration - the only one there). To run the Frontend, choose Terminal | Run Task | npm: start - frontend . +You can run the backend with F5 (choose the "Backend" launch configuration). To run the Frontend, choose Terminal | Run Task | npm: start - frontend . ## Usage with GUI