diff --git a/authorname-disambiguation/requirements.txt b/authorname-disambiguation/requirements.txt new file mode 100755 index 0000000..e3dca0a --- /dev/null +++ b/authorname-disambiguation/requirements.txt @@ -0,0 +1 @@ +git+http://vxgit.intra.inist.fr:60000/dago/orcid-disambiguation.git#egg=disambiguator \ No newline at end of file diff --git a/authorname-disambiguation/swagger.json b/authorname-disambiguation/swagger.json new file mode 100755 index 0000000..336cac8 --- /dev/null +++ b/authorname-disambiguation/swagger.json @@ -0,0 +1,20 @@ +{ + "servers": [{ + "url": "{scheme}://{hostname}", + "variables": { + "scheme": { + "default": "https" + } + } + }], + "tags": [ + { + "name": "orcid_disambiguation", + "description": "Authorname disambiguation with orcid ", + "externalDocs": { + "description": "Plus de documentation", + "url": "https://gitbucket.inist.fr/tdm/web-services/tree/master/orcid-disambiguation" + } + } + ] +} \ No newline at end of file diff --git a/authorname-disambiguation/v1/disambiguate.ini b/authorname-disambiguation/v1/disambiguate.ini new file mode 100755 index 0000000..0e8a093 --- /dev/null +++ b/authorname-disambiguation/v1/disambiguate.ini @@ -0,0 +1,57 @@ +# OpenAPI Documentation - JSON format (dot notation) +post.responses.default.description = Return all objects with enrich fields +post.responses.default.content.application/json.schema.$ref = #/components/schemas/JSONStream +post.summary = Enrich one field of each Object with a Python function +post.requestBody.required = true +post.requestBody.content.application/json.schema.$ref = #/components/schemas/JSONStream +post.parameters.0.in = query +post.parameters.0.name = path +post.parameters.0.schema.type = string +post.parameters.0.description = The path in each object to enrich with an Python script +post.parameters.1.in = query +post.parameters.1.name = indent +post.parameters.1.schema.type = boolean +post.parameters.1.description = Indent or not the JSON Result + + +[use] +plugin = @ezs/local +plugin = @ezs/basics +plugin = @ezs/storage +plugin = @ezs/analytics + +[JSONParse] +separator = * + +[expand] +path = env('path', 'value') +size = 100 + +# in production mode, uncomment the following line +# cache = boost + +[debug] + +[expand/exec] +# command should be executable ! +command = ./v1/disambiguate.py + +[debug] +text = debug2 +; args = fix('--url') +; args = env('--url',"https://vicorhales1.intra.inist.fr:9200") +; args = fix('--index') +; args = env('--index','records-fromconditor') +; args = fix('--login') +; args = env('--login','elastic') +; args = fix('--password') +; args = env('--password','secret') +; args = fix('--size') +; args = env('--size','100') +; args = fix('--http_proxy') +; args = env('--http_proxy','') +; args = fix('--https_proxy') +; args = env('--https_proxy','') + +[dump] +indent = env('indent', false) diff --git a/authorname-disambiguation/v1/disambiguate.py b/authorname-disambiguation/v1/disambiguate.py new file mode 100755 index 0000000..a4a1248 --- /dev/null +++ b/authorname-disambiguation/v1/disambiguate.py @@ -0,0 +1,13 @@ +#!/usr/bin/python3 +import sys +import json +from disambiguator.disambiguate import Disambiguator + + +for line in sys.stdin: + data = json.loads(line) + d = Disambiguator(**data["value"]) + res = d.get_best_orcid_from_df() + data["value"] = res + sys.stdout.write(json.dumps(data)) + sys.stdout.write('\n') \ No newline at end of file